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.

3904 NPN transistor to drive a relay

Status
Not open for further replies.
The diode eliminates back EMF.
Maybe you connected the pins of the transistor backwards? Look at the datasheet for the transistor to see which pin is what.
 
Like I said, 10k is too high for the base resistor. This will give you about 430uA base drive, and the collector current is 79mA. Base current needs to be around 8mA, which is why I recommended 560Ω for the base resistor.
 
Last edited:
I would thank you all for your support.
Ron, As you said, I used two 1k resistors in parallel to make it 500 Ω. (I didn't have 560Ω resistor. The transisor (BC547) is connected properly. (I checked the datasheet)
The power supply is 6.7V DC
If you looked at the pdf, you will notice 4 dip switches, based on different combinations, the controller sends a signal to trigger the relay. after a while the relay doesn't get triggered. But when I power off and power back on with a gap of more than 5 seconds. everything works normally.

I suspect there is some charge buildup somewhere.
 
Could you have the resistor pac installed backwards (+5V on the wrong pin)? This could leave an input floating if a switch is open
 
Last edited:
Could you have the resistor pac installed backwards (+5V on the wrong pin)? This could leave an input floating if a switch is open

I checked. Resistor pack is wired properly.

I wired in another power supply. It is giving out 5.75v to 6v.

Wired that now. I started testing. Will update you in a little while
 
After continuously changing the dip switch configuration (on and off) for 7 min. I have the same problem.
 
The datasheet recommends 15pF caps for the crystal, and the PIC needs to be in HS mode.
 
The datasheet recommends 15pF caps for the crystal, and the PIC needs to be in HS mode.

You are correct. I also saw a note below saying, for vdd>4.5v, 30pf is recommended.

Will change from 33 pf to 30 pf.


Do you think I need to connect a capacitor across vdd and gnd?
 
Last edited:
Do you think I need to connect a capacitor across vdd and gnd?
Of course.
All electronic circuits need a supply bypass capacitor at the circuit.
Use a 0.1uf ceramic capacotor plus a 22uF electrolytic.
 
**broken link removed**The problem is the relay gets triggered for the first 7 min. Later on the controller hangs (I get no output). If I plug the relay out then the circuit works fine. (I connected an led instead of the relay which glows)

I think I need to get the triggering part of the relay correct. (circuit)


I am using the following circuit in the pic which I think is wrong:

**broken link removed**

I would also like to say that relay would be triggering 40Watt bulb (230VAC)
 
Last edited:
**broken link removed**The problem is the relay gets triggered for the first 7 min. Later on the controller hangs (I get no output). If I plug the relay out then the circuit works fine. (I connected an led instead of the relay which glows)

I think I need to get the triggering part of the relay correct. (circuit)


I am using the following circuit in the pic which I think is wrong:

**broken link removed**

I would also like to say that relay would be triggering 40Watt bulb (230VAC)
Are you sure you have the transistor connected correctly? The collector and emitter of BC547 are swapped relative to most transistors (e.g., 2N3904). This would give you low beta, which would still possibly drive an LED but not a relay.
Also - are you sure you have a 5V relay, and not a 12V (or other) one?
 
Also check the relay data sheet. Some DC relays require the correct polarization. (+ to + and - to -). Those have a partially magnetized armature and will only work reliably one way.
 
Last edited:
Can I use the same power supply for the controller as well as the relay?


Can someone send me a link showing a circuit where pic triggering a 5v relay
 
Last edited:
Are you sure you have the transistor connected correctly? The collector and emitter of BC547 are swapped relative to most transistors (e.g., 2N3904). This would give you low beta, which would still possibly drive an LED but not a relay.
Also - are you sure you have a 5V relay, and not a 12V (or other) one?

I am positive. I also interchanged the emitter and collector. The relay does not get triggered at all. SO I think I have the transistor wired properly.
 
Last edited:
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top