View previous topic :: View next topic |
Author |
Message |
Markdem
Joined: 24 Jun 2005 Posts: 206
|
PIC, relay and fluro light |
Posted: Wed Apr 18, 2007 10:48 pm |
|
|
Hi All, i am tring to turn on a fluro light for my aquarium with pic using a relay. I have got a MCP32016 driving a ULN2803 darlington array, which is then connected to the relay. I have a 1N4004 diode installed across the relay. When i was building my device, i was testing it with just a normal light bulb, but now i have connected my aquarium lights, it looks like the MCP32016 is locking up when it turns the relay on, eg as soon as the fluro arcs for the first time, the relay will turn off, and nothing else will happen untill i reset the system. The PIC still works ok, as i also have a lcd conected, and it will keep updating.
I am guessing this has somthing to do with inrush current, but the relays a 10A, and i am not too sure why it would be effecting the MCP32016 but not the PIC. Both are very close too each other on the board.
Should i have some resistors between the MCP32016 and the darlington array?
Anyone have any idea why this could be happening??
Thank you,
Mark |
|
![](templates/subSilver/images/spacer.gif) |
Fabri
Joined: 22 Aug 2005 Posts: 275
|
|
Posted: Thu Apr 19, 2007 12:29 am |
|
|
Hi,
I belive you have problem of noise especially during switch-on of your relay. I think your PIC stay in loop somewere till manual reset occured. Take a look in software loops and set timeout to escape in case of errors.
I had the same problem with I2C bus CCS software ad I solved it testing comunication software.
You have also to verify your hardware in first step and set protection of PIC as WDT and BOR.
Regards,
Fabri |
|
![](templates/subSilver/images/spacer.gif) |
Markdem
Joined: 24 Jun 2005 Posts: 206
|
|
Posted: Thu Apr 19, 2007 3:34 am |
|
|
thanks Fabri, but the PIC is not what is locking up, it is the MCP32016 port expander. I cant change code on it.
Is this going to be a problem with the power supply to the MCP, or is it just nosie around it??
Would adding a LC filter to the power supply help??
Thanks, Mark |
|
![](templates/subSilver/images/spacer.gif) |
Fabri
Joined: 22 Aug 2005 Posts: 275
|
|
Posted: Thu Apr 19, 2007 3:54 am |
|
|
Hi Mark,
post electric design of your application, or part of it, so I can verify the connections.
In my PIC application I use to refresh every 100 ms or more I/O situation so, in case of problem, I'll correct as soon as possible.
Regards,
Fabri |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Thu Apr 19, 2007 4:21 am |
|
|
The IN4004, is a very small diode, compared to the relay rating. It is also a relatively 'slow' device, in terms of trapping the spikes caused when energy is released in an inductor. How is this connected?. There are two possible connections. In one, the energy is dumped into the diode, and in the other, it is dumped into the supply rail. The former requires a much higher power rating from the diode, but the latter (of course), brings the risk of spikes being generated on the supply rail...
Now the load you have, itself has it's own switch that occurs after power is attached (as part of the 'starting' cycle). I suspect it is this that is resulting in the supply being spiked. Do you know what sort of ballast your lamp has?. If it has an electronic ballast, then this is effectively a switch mode supply, and can draw 'ludicrous' initial currents. Can you increase the reservoir capacitance, on the supply feeding the lamp itself?.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Thu Apr 19, 2007 7:43 am |
|
|
You say it works OK with an incandescent bulb but not with a florescent? This implies everything is OK on the PIC side of the relay. I would try a snubber of a 0.01uF cap rated for line voltage in series with a 1K 1/2W resistor across the relay contacts. Also try to keep the AC wiring away from the digital wiring. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
![](templates/subSilver/images/spacer.gif) |
Markdem
Joined: 24 Jun 2005 Posts: 206
|
|
Posted: Fri Apr 27, 2007 12:07 am |
|
|
Problem solved. Just in case anyone else runs into this one, make sure that the MCP32016 is bypassed with a .1uf cap.
Still not sure why the problem did not happen with anything but a flouro
Thanks, Mark |
|
![](templates/subSilver/images/spacer.gif) |
Douglas Kennedy
Joined: 07 Sep 2003 Posts: 755 Location: Florida
|
|
Posted: Fri Apr 27, 2007 6:58 am |
|
|
Solid state 120v relays are now priced in the range of mechanical relays and avoid the electrical noise and mechanical issues of relays...3v on drive and no load and back EMF no point corrosion or contact bounce as with a relay coil. |
|
![](templates/subSilver/images/spacer.gif) |
|