CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

PIC, relay and fluro light

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Markdem



Joined: 24 Jun 2005
Posts: 206

View user's profile Send private message Send e-mail

PIC, relay and fluro light
PostPosted: Wed Apr 18, 2007 10:48 pm     Reply with quote

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
Fabri



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

PostPosted: Thu Apr 19, 2007 12:29 am     Reply with quote

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
Markdem



Joined: 24 Jun 2005
Posts: 206

View user's profile Send private message Send e-mail

PostPosted: Thu Apr 19, 2007 3:34 am     Reply with quote

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
Fabri



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

PostPosted: Thu Apr 19, 2007 3:54 am     Reply with quote

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
Ttelmah
Guest







PostPosted: Thu Apr 19, 2007 4:21 am     Reply with quote

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
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Thu Apr 19, 2007 7:43 am     Reply with quote

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.
Markdem



Joined: 24 Jun 2005
Posts: 206

View user's profile Send private message Send e-mail

PostPosted: Fri Apr 27, 2007 12:07 am     Reply with quote

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 Confused

Thanks, Mark
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

PostPosted: Fri Apr 27, 2007 6:58 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group