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.

Feedback on schematic - relay control with PIC12F675

Status
Not open for further replies.

Yobortsa

Member
I am building a three channel relay board to power up/down my inverter, air compressor and 12V outlet panel via RS232 commands from a control panel.

It is working as drawn on a breadboard, I want some experts to look it over and provide feedback before I mill a circuit board and assemble it. A whole lot easier to change now than later!

Is it ok to drive 12V Bosch style automotive relays with a single PN100 transistor via 5V to the Base? Can a transistor switch 12V from a 5V base signal or are they intended strictly for current amplification at the same voltage level?

The relays have a coil rating of about 95ohms and draw approx 100mA and are rated to 40amps on the contacts.

Thanks,

David
 

Attachments

  • relay_board.png
    relay_board.png
    16.1 KB · Views: 2,055
With 5V at the base with a 2.2k resistor, you'll be able to push about 195mA through the relay. (The datasheet for a PN100 looks like it says the hFE is about 100). Assuming the relay operates on about 100mA, you should be fine. The power dissipation also shouldn't be a problem, the PN100 can handle up to ~625mW.
 
Last edited:
I am building a three channel relay board to power up/down my inverter, air compressor and 12V outlet panel via RS232 commands from a control panel.

It is working as drawn on a breadboard, I want some experts to look it over and provide feedback before I mill a circuit board and assemble it. A whole lot easier to change now than later!

Is it ok to drive 12V Bosch style automotive relays with a single PN100 transistor via 5V to the Base? Can a transistor switch 12V from a 5V base signal or are they intended strictly for current amplification at the same voltage level?

The relays have a coil rating of about 95ohms and draw approx 100mA and are rated to 40amps on the contacts.

Thanks,

David

hi,
The PN100 has only a gain of approx 10 at 100mA, so the 2k2 base resistors will not drive the PN100 hard enough to saturate.

I would suggest 2N2222, which has a much higher gain at 100mA, approx 150.

Also reduce the 2K2's to approx 470R.

Use a separate diode to feed the 7805 reg and increase the +5V rail caps.
 
The bottom relay won't work as GP3 is input only. Easy to fix, simply swap GP3 and GP4.

Mike.
 
I hate to be stupid, but where does it say that in the datasheet?

In Table 1-1 page 6. Also on the pin diagram there is only an in arrow - no out arrow.

Edit, On most pic chips the MCLR pin is input only.

Mike.
 
Last edited:
The PN100 has only a gain of approx 10 at 100mA, so the 2k2 base resistors will not drive the PN100 hard enough to saturate.

I would suggest 2N2222, which has a much higher gain at 100mA, approx 150.

Also reduce the 2K2's to approx 470R.

Use a separate diode to feed the 7805 reg and increase the +5V rail caps.

Thanks for you suggestions. I've attached a copy of the datasheet for the 2N2222A. How do you find out the gain at 100mA? How do you know what current needs to be fed to saturate a transistor?

I'm keen to understand the theory and how to make sense of these data sheets.

Thanks,

David
 

Attachments

  • PN2222A transistor.pdf
    153.1 KB · Views: 363
In Table 1-1 page 6. Also on the pin diagram there is only an in arrow - no out arrow.

Edit, On most pic chips the MCLR pin is input only.

Mike.

Well spotted! I'm sure that saved me many hours of stress and frustration..

Thankyou :)
 
Thanks for you suggestions. I've attached a copy of the datasheet for the 2N2222A. How do you find out the gain at 100mA? How do you know what current needs to be fed to saturate a transistor?

I'm keen to understand the theory and how to make sense of these data sheets.

Thanks,

David

Honestly Yob, I have no idea how he found the figure of 10 @ 100mA. I asked a few more fellow geeks on IRC and they also had no idea how he got 10, it should be around 100. Saturation current is the current at which the transistor acts as a short. If you have about 12V and 95 ohms, saturation current is 126.316mA, so if your hFE is 100, you need a minimum of 1.263 mA on the base of the transistor to put it in saturation.
 
Last edited:
Honestly Yob, I have no idea how he found the figure of 10 @ 100mA. I asked a few more fellow geeks on IRC and they also had no idea how he got 10, it should be around 100. Saturation current is the current at which the transistor acts as a short. If you have about 12V and 95 ohms, saturation current is 126.316mA, so if your hFE is 100, you need a minimum of 1.263 mA on the base of the transistor to put it in saturation.

The 5V pin feeding the transistor through a 2K2 resistor, according to my calculations, should put out 2.3mA. Even if you're not consuming 126.316mA into the Collector, say you're only using 50mA, is the transistor still saturated? ..or do you need to be using the current for the transistor to be saturated?

Can you test if the transistor is saturated by putting a Voltmeter between Collector and Emitter?

Thanks for your patience. I am learning!

David :)
 
The 5V pin feeding the transistor through a 2K2 resistor, according to my calculations, should put out 2.3mA. Even if you're not consuming 126.316mA into the Collector, say you're only using 50mA, is the transistor still saturated? ..or do you need to be using the current for the transistor to be saturated?

Can you test if the transistor is saturated by putting a Voltmeter between Collector and Emitter?

Thanks for your patience. I am learning!

David :)

Actually, the base current is going to be the base voltage, minus 0.7V (average, for a silicon transistor), then divided by the resistor on the base. So, 5V - 0.7V = 4.3V, 4.3V/2.2k Ohms = 1.955mA. So long as your base current times DC current gain (hFE) is greater than the supply voltage on the collector divided by the load resistance, you're in saturation.

You should be able to check for saturation by measuring the collector-emitter voltage. There will be a small voltage across the junctions, but not very much when you're in saturation, if my memory serves me correctly. On the datasheet for the PN100, it says the Vce(sat) is 0.4V at Ic = 200mA, so you'll measure a little under that.
 
Last edited:
I would upgrade your transistors, as they are the part most likely to fail. I would just start with GOOD transistors. Probably BC337-40 (40v, 0.5A or 1.0A, beta 400, low sat) still in the same package.

Also you SHOULD put safety resistors from the transistor bases to ground! At PIC bootup (and/or sleep or PIC latchup failures etc) the PIC pins are floating (very bad) so 3 extra resistors will keep the relays OFF at all times unless they get a +5v from the PIC pins. 10k is fine.

I would decouple the relay PSU and the PIC psu. A resistor between D1 and C2 of 10 ohms or 22 ohms, should do it. You should probably put a big cap on the relay power (ie after D1 to ground) of maybe 1000uF.

Depending on PCB space it might be worth adding RC snubbers to the relay contacts to increase relay life and keep spikes down overall since the relay contacts will probably be attached to ground or +12v at some point.
 
Thanks all for your much valued comments. I have updated the circuit diagram (see attached) - how is it looking now?

I'm not sure if I've placed the resistor between D1 and C2 in the correct spot - is this what you meant Mr RB?

I'm going to research the RC snubbers you speak of - are these a Resistor-Capacitor pair on each relay to reduce sparks/spikes at the contacts? Which side should they go - between relay contacts and +12V or between relay contacts and Gnd?

Thanks again,

David
 

Attachments

  • relay_board.png
    relay_board.png
    17.9 KB · Views: 1,072
Depending on PCB space it might be worth adding RC snubbers to the relay contacts to increase relay life and keep spikes down overall since the relay contacts will probably be attached to ground or +12v at some point.

I found this online:

Relay Snubber Circuit

Relay manufacturers data sheets give maximum contact ratings for resistive d.c. loads only and this rating is greatly reduced for either AC loads or highly inductive or capacitive loads. In order to achieve long life and high reliability when switching AC currents with inductive or capacitive loads some form of arc suppression or filtering is required across the relay contacts. This is achieved by connecting a RC Snubber network in parallel with the contacts. The voltage peak, which occurs at the instant the contacts open, will be safely short circuited by the RC network, thus suppressing any arc generated at the contact tips. For example.

**broken link removed**

Source: **broken link removed**

What values should one use for the resistors and capacitors to protect the relay contacts while driving approx 10A 12V air compressor, 10A-20A 12V inverter and DC outlet panel (one relay for each)?

I assume the resistor specifies the amount of charge time for the capacitor so it could be fairly high in value. The capacitor, I guess, the bigger the better?? Perhaps 470-1000uF electrolytic?

Thanks,

David
 
You need a 10 ohm resistor (not 10k) and it goes from the right side of D1 to the TOP of C2.
:)

I'm not sure about the best snubber values for your needs, i would just be in the same situation you are, needing to google it some more and work out the right values... ;)
 
You need a 10 ohm resistor (not 10k) and it goes from the right side of D1 to the TOP of C2.
:)

Thanks for the update - is this resistor stopping any spikes coming from the relays or other parts of the car?

Jason, well spotted - the symbol in Eagle doesn't have the Vdd and Vss pins marked!

Is anybody dissatisfied with this design? We must be getting close!

I am toying with the idea of swapping the MAX232 for an RF module and running wireless. Pros? Cons? See attached datasheet if interested. One negative is that the RF option would only allow one way communication (unless I use a MRF49XA from Microchip but I'd probably need more IO pins than the 12F675 has).

David :eek:
 

Attachments

  • relay_board.png
    relay_board.png
    18 KB · Views: 739
  • ST-RX04-ASK.pdf
    188.5 KB · Views: 590
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top