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.

Using a pic to switch a relay?

Status
Not open for further replies.

Sam Jelfs

New Member
Hi all, just a quick question, Im trying to switch a relay (G8P-1A2T from Omron - **broken link removed** ) from a pic (16f873a). The relay requires 77mA at 12v to switch, and I have both 5v and 12v on the board.

any suggestions on the best way to go about this? have been trying to use a BC109 transistor to amplify the signal from the pic, but not having much luck.

Any help greatfully recieved :)

Sam J
 
You forgot to attach a sketch of how you connected the transistor. Of course it should work if it is connected correctly.
 
What's wrong exactly? Did you check if the output goes high?
 

Attachments

  • img1b.png
    img1b.png
    1.6 KB · Views: 176
have attached a circuit diagram below - have tried various values of res/1
 

Attachments

  • circuit.PNG
    circuit.PNG
    12.6 KB · Views: 219
Your transistor was connected as an emitter-follower. Its max output voltage was the output voltage from the PIC (+5V) minus the 0.7V base-emitter voltage of the transistor. The 12V relay won't operate with only 4.3V on its coil.

With the transistor's emitter grounded and the coil of the relay at its collector then the coil gets about 11.8V so the relay works properly.

When the relay is turned off, the inductance of its coil creates a very high voltage that can destroy the transistor. The diode arrests the high voltage.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top