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 16F54 Controller hangs while triggering a relay

Status
Not open for further replies.

kurrodu

New Member
Please find the circuit here:

The circuit works fine as long as there is no AC load on the relay.

Relay is 5v (sugarcube relay Make: Sunhold)

Load is 40 Watt Bulb.

But ones the load is connected, The controller hangs after a little while.

I am using the single power supply (5v) for the board and the relay.

Please find my circuit here: https://nirvana-corp.com/Circuit.pdf

Pardon me it is hand drawn.
 
Last edited:

kjennejohn

New Member
Right on about those bypass caps. Put at least a 0.1uF cap between the GND and Vcc pins, close to the chip.

Another thing that occurs to me is: What is the main power source for all this? If you are talking about a 12V battery to run the 40W bulb (not an unusual size for automotive use), the act of switching the bulb in and out rapidly may put enough spurious noise in the 5V line to screw with the 16C54. Try running the controller on an independent supply, like a 9V battery hooked just to the 5V regulator to see if that alleviates the problem. I don't think you'll want to stay with a 9V battery long, just long enough to troubleshoot power spikes from the lamp going on and off.

Good luck with your project.
 

kurrodu

New Member
Right on about those bypass caps. Put at least a 0.1uF cap between the GND and Vcc pins, close to the chip.

Another thing that occurs to me is: What is the main power source for all this? If you are talking about a 12V battery to run the 40W bulb (not an unusual size for automotive use), the act of switching the bulb in and out rapidly may put enough spurious noise in the 5V line to screw with the 16C54. Try running the controller on an independent supply, like a 9V battery hooked just to the 5V regulator to see if that alleviates the problem. I don't think you'll want to stay with a 9V battery long, just long enough to troubleshoot power spikes from the lamp going on and off.

Good luck with your project.

I am using a 240 VAC power supply for the bulb triggered by a 5v relay.

I tried using 2 different power supplies, one for the board and the other for the relay.

However, I would like to use only 1 power supply.
 

Arkham00

Member
Varistor

Try using a 280V varistor in parallel with the contact of the relay to reduce spark emi.

8958-450px-Varistor_S14K385_photo.jpg

 

kurrodu

New Member
That's a start, what about the rest - you've still given no idea of what your 5V supply is, and what decoupling that includes - a 0.22uF isn't going to drive a relay.
(5VDC and 500mA current) for power supply to the board.

Thank You for mentioning decoupling. I did not know what decoupling was until I read about it online. Could you draw a small sketch showing how I could integrate a decoupling circuit and size of the capacitors.
 
Last edited:

kurrodu

New Member
Try using a 280V varistor in parallel with the contact of the relay to reduce spark emi.

8962-450px-Varistor_S14K385_photo.jpg


is this to be connected in parallel to the input signal side or the load switching side of the relay? Could you also send me a link to a sample circuit showing the varistor connected across the relay.
 
Last edited:

kurrodu

New Member
That's a start, what about the rest - you've still given no idea of what your 5V supply is, and what decoupling that includes - a 0.22uF isn't going to drive a relay.

I used a 5v 1amp smps (pulled out from a phone charger) to power both the micro controller and the relay.

I have added a .22uF capacitor across vdd and vss to suppress spikes.

I need a sketch of decoupling circuit and capacitor sizes.
 
Last edited:

Nigel Goodwin

Super Moderator
Most Helpful Member
You need a decent size electrolytic across the supply to provide the surge for the relay (try 100uF or 220uF), but a phone charger may not be a very suitable supply?.
 

Arkham00

Member
is this to be connected in parallel to the input signal side or the load switching side of the relay? Could you also send me a link to a sample circuit showing the varistor connected across the relay.

The varistor should be installed on the "load side" of the relay and should be rated +10% or +20% respect the load supply voltage. The varistor may be used in parallel with the contact or in parallel with the load.

8966-dy05a_07.gif


Here are some links:
link1
link2
littlefuse varistors
 

kurrodu

New Member
You need a decent size electrolytic across the supply to provide the surge for the relay (try 100uF or 220uF), but a phone charger may not be a very suitable supply?.

I connected two 100uf in parallel across the supply. Did not help.
 
Last edited:

kurrodu

New Member
I tried adding 0.1uf capacitor across the vdd and vss pin of the micro controller.

2. I also added 200uf capacitor across the power supply. Still not resolved.
 
Last edited:
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top