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

Status
Not open for further replies.
The decoupling circuit is simply a non polarised cap across the supply rails of the processor.
Normally about .1uF

This is a picture of a PCB with a PIC16F648A and its decoupling capacitor.

**broken link removed**
 
It's no good adding capacitors three miles away, they need to be close to what's going on.

Are you sure your code is OK, that could make it lock up just as easily as the poor hardware.
 
So just to clarify, the circuit works fine until the relay switches the AC on?
Have you tried a different relay?

You problem is still not solved based on the info you've supplied, is there anything more you can tell us that might help.
Go into more depth about how the Dip switch triggers the relay...
 
So just to clarify, the circuit works fine until the relay switches the AC on?
Have you tried a different relay?

You problem is still not solved based on the info you've supplied, is there anything more you can tell us that might help.
Go into more depth about how the Dip switch triggers the relay...

There are 2 dip switches (1,2,) connected to 2 pins of the micro controller.

The relay is triggered when 1,2 are high. The relay will be on until 1,2 are made low (grounded)

when 1, 2 are high again relay gets triggered. This cycle repeats.

The application is liquid level controller. turning the motor on when the tank is empty and turing it back off when the tank is full.

Instead of dip switch I am using a magnetic float switch to make the controller pin high and low.

I built this earlier which worked fine with a solid state relay. But to cut down cost, I would like to use electromechanical relay.
 
Last edited:
I have 4 questions.
1. Can I use the same power supply for the pic mico controller as well as the relay shown in the attached picture?

I have read this else where on the web "opto isolators in relay drivers are generally used to electrically isolate the EMI/noise sensitive ciruit from the one succeptible to EM interference.So it is a better choice if the load connected to the relay is suspected of generating high noise spikes (usually inductive loads like valves). Do note that if u are using optoisolator , u have to take care that the power source used for the relay is also electrically isolated from the uC circuit . U may have to use a seperate secondary winding for the transformer and a completely different volatge power supply for the purpose for effective performance."

2. So, to have different voltage for relay and micro controller, Can I do voltage division and run the micro controller at 3.3V and power the relay with 5V from the same power supply?

3. Is it Okay to run PIC 16F54 at 3.3V? Since the data sheet says min of 2.0v and max of 5.5V.

4. Incase it is fine to power up the micro controller with 3.3V, then what would be the resistor size for the circuit shown below (in place of 470ohms from the controller)?

optocoupler-relay-jpg.23387
 
Last edited:
The first thing to do is power the micro via a battery.
Then remove the lamp and see if the relay works.
The use a small wattage lamp.
The problem is the lamp takes 6 times the current when starting (40 x 6 = 240watts) = 1 amp and this might be producing a spike that upsets the micro.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top