Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC programing? light dimmer+ more, need HELP!!!

Status
Not open for further replies.

SkinnyBoy

New Member
alright, I'm looking to setup my turtle tank, so his basking light fades from off, to full brightness over a period of about 1/2 an hour... then, when the light reaches full brightness, I want the fluoro light in the tank to come on...

then, I want it to do the reverse... switch the fluoro light off, then dim the basking light over a period of half an hour...

now, I also need this to be triggered by an external source (namely a clock) so the first process starts at 6:30am, and then the second process starts at 6:30pm (I'm assuming an analog clock here, so the alarm goes off in the AM, and PM.. ya know the ones? lol)

anyway, AND help would be good...

thanx :)
 
I am currently working on a very similar project, utilising a PICaxe-08M, don't have time right now to go into detail, will post more later.

Your idea goes one step further than mine - mine only dims upwards, not downwards.
 
Silicon Chip had a circuit in the July 2005 magazine, that was to turn a light on by infrared remote control, but it also had a dimming feature, so at the press of a button, the light would automatically dim fully down, to off, at the press of a button on the remote control...

so, I need a similar thing that the PIC does in that circuit...

the circuit was based around a 16F628A-20P PIC (don't ask me, I know nothing about pics :p) and a BT137F triac... :)

I might go now... :p lol
 
i am not sure... but can't we do that with PWM ?? if we can ... then i see what the pic and the tricas does in a circuit like that...
 
ikalogic said:
i am not sure... but can't we do that with PWM ?? if we can ... then i see what the pic and the tricas does in a circuit like that...

It's not 'really' PWM, because you have to trigger the triac at a specific point after zero-crossing, whereas PWM is more a DC term, and doesn't matter where you switch.

So you first need to generate zero-crossing pulses, then execute a delay to reach the brightness you want, then turn the triac ON. The later you trigger the triac, the dimmer the light will be - obviously this must all happen in the time for one half cycle, and repeat every half cycle.

There are application notes at MicroChip for light dimmers, plus various examples out there on the Internet.
 
does anyone believe my application is actually possible? using a single pic, and two triacs?

actually.. I'm not even sure how the timer would work anymore... =\
 
SkinnyBoy said:
does anyone believe my application is actually possible? using a single pic, and two triacs?

actually.. I'm not even sure how the timer would work anymore... =\

Yes, it's perfectly viable!, a single PIC has plenty of capability to do it. Bear in mind, only ONE of the triacs is a dimmer, the other just switches a triac either ON or OFF. But for that matter, I've seen designs where a single PIC does multiple dimmer channels.
 
I'm also working on a PIC based dimming project, I've got the board and the components, just need time to assemble and do some programming... I'll post what I have when I get a chance (might be next week though). The board I have and will test soon is a triac based dimmer, but the new one I'm working on uses mosfet switching for reverse phase control.


One thing though I don't you can dim a fluorescent light using any of the normal methods- it wasn't clear if you are using fluorescent or incandescent.
 
ca178858 said:
One thing though I don't you can dim a fluorescent light using any of the normal methods- it wasn't clear if you are using fluorescent or incandescent.

the basking light is the one I wish to dim, which is a standard incandescent bulb (actually, its a 12volt halogen downlight, but the transformer is dimmable) I also want to switch a fluoro light on/off using a triac...

so, the halogen dims, the fluoro goes on/off.. :p lol
 
SkinnyBoy said:
I also want to switch a fluoro light on/off using a triac...

As the FL or compact FL involves AC main, you are better off using a relay to do the switching. Else you need to use an optical triac trigger to provide the isolation between low voltage PIC circuit and AC main.

You can use a common 0V for the incandescent light circuit and the PIC though.
 
eblc1388 said:
SkinnyBoy said:
I also want to switch a fluoro light on/off using a triac...

As the FL or compact FL involves AC main, you are better off using a relay to do the switching. Else you need to use an optical triac trigger to provide the isolation between low voltage PIC circuit and AC main.

You can use a common 0V for the incandescent light circuit and the PIC though.

I disagree! - you should be dimming in the mains side of the halogen transformer, so it requires an opto-isolator (unless you're planning running the PIC side live to the mains?). So you may as well use an opto-isolator and triac for the FL as well - use of a zero-crossing one would be a good idea, but NOT for the dimmer one!.
 
I was going to dim the mains side of the halogen transformer, yes... and the idea was to switch the fluoro with a triac as well...

unless, there's a better idea? hmm...
 
Nigel Goodwin said:
I disagree! - you should be dimming in the mains side of the halogen transformer, so it requires an opto-isolator (unless you're planning running the PIC side live to the mains?). So you may as well use an opto-isolator and triac for the FL as well - use of a zero-crossing one would be a good idea, but NOT for the dimmer one!.

Isn't he try to use PWM from the PIC to dim the incandscent light using 12V supply? I thought this is the way to go also getting supply for the PIC.

So 12V unregulated for the lamp and 5V reg for the PIC.

But everyone can have his idea of how things work.
 
eblc1388 said:
Nigel Goodwin said:
I disagree! - you should be dimming in the mains side of the halogen transformer, so it requires an opto-isolator (unless you're planning running the PIC side live to the mains?). So you may as well use an opto-isolator and triac for the FL as well - use of a zero-crossing one would be a good idea, but NOT for the dimmer one!.

Isn't he try to use PMW from the PIC to dim the incandscent light using 12V supply? I thought this is the way to go also getting supply for the PIC.

There had been no previous mention of it being a low voltage halogen lamp?, as you suggest by rectifying and smoothing the low voltage supply for the lamp you could use PWM and an FET (or transistor) to control it's brightness. By choosing a PIC with hardware PWM (like the 16F628) it would make the software part of the project considerably simpler!.

Obviously though, this limits you to a low voltage lamp, by phase dimming the mains supply you could use a mains voltage incandescent lamp instead.

Using a relay, or an opto-isolated triac, to switch the FL lamp is really a matter of personal choice, although the inductance of the FL will make the relay contacts spark as it turns OFF, the zero-crossing turn off of a triac will prevent this.
 
I'd rather adjust the primary to the transformer for the halogen so I CAN use a 240volts mains globe with the circuit instead...

also, I'd rather use a triac for the switching of the fluoro...

just so you know...

there was no mention of the fact that it was a 12volt halogen globe before, because I didn't want it specifically for this purpose...

anyhoo.... lol... I'm completely lost when it comes to PICs, so I'll just sit in the corner :p
 
Nigel Goodwin said:
There had been no previous mention of it being a low voltage halogen lamp?

skinnyBoy said:
... (actually, its a 12volt halogen downlight

Its time I should have my eyes tested. :shock:

Nigel Goodwin said:
...the low voltage supply for the lamp you could use PWM and an FET (or transistor) to control it's brightness. By choosing a PIC with hardware PWM (like the 16F628) it would make the software part of the project considerably simpler!.

And no phase angle to worry about.

As I already said, do as one please.
 
Skinny,

The Silicon chip circuit should work well for what you need. The source code for the PIC is available Here and should be modifiable to what you need. Depending on you programming abilities, you could modify the code to use the mains 50Hz to generate a timebase for your clock as it already generates an interrupt for the zero crossing detection.

If you do play around with the SC circuit then you should always unplug it before touching it. For people who haven't seen the circuit, the live(active/phase) from the mains is connected directly to Vdd on the PIC :shock:

Mike.
 
Pommie said:
Skinny,

The Silicon chip circuit should work well for what you need. The source code for the PIC is available Here and should be modifiable to what you need. Depending on you programming abilities, you could modify the code to use the mains 50Hz to generate a timebase for your clock as it already generates an interrupt for the zero crossing detection.

If you do play around with the SC circuit then you should always unplug it before touching it. For people who haven't seen the circuit, the live(active/phase) from the mains is connected directly to Vdd on the PIC :shock:

Mike.

I need MORE than what the kit does though... :p lol like switching a second triac hard on, when the dimming triac reaches full brightness...

hmm....

I need help... :( *sits in the corner*
 
Status
Not open for further replies.

Latest threads

Back
Top