Maker Pro
Maker Pro

need help with simple 3v to 34v transistor relay/switch

sideburn

Jun 14, 2013
75
Joined
Jun 14, 2013
Messages
75
Hey guys,

It's been a long time since I was deep into analog type electronics and I need some help.

I've got a boost converter circuit that is taking a 3.6v input from a lipo battery and boosting it up to 34v. Next i've got a PIC chip that I will be programming to pulse one of the output pins at about 20 hz so i can make a bell ring (or you could think making a relay click on and off)

The goal here is to have a 3v battery make an actual bell ring.. think doorbell or 70's telephone ringer bell.

I've tested the step up converter and when I connect the 3v input to the step up converter and the 34v output to the bell coil, it has enough power to pull the hammer and make the bell ring. but i need to pulsate the output to make it ring like a telephone.

So now i need to get my low voltage output pin form the pic chip to trigger a transistor or something and complete the circuit from the 34v output to the bell so i can making it ring.

I guess what I'm looking for is an electronic relay basically.

I was thinking I could do this with maybe a 3904 transistor and maybe a diode?

My thoughts are that my pin out form the PIC chip (i think this is about 3v) would go to the base of the transistor, then connect the collector to ground, and the emitter to a diode and then to the other wire on the coil then have +34v going directly to the other wire on the coil?

Would this work or is there a better simpler way?
Can someone help me draw me up a simple schematic?

Thanks in advance for any help.

-Tavis
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
12,610
Joined
Nov 17, 2011
Messages
12,610
What type of boost converter do you use? If it's an IC with a shutdown pin, you could use that shutdown pin to tirn the boost converter on and of to the rhythm of your pic output. This will save power while the converter is not in use.

Your transistor solution is also viable as long as the current for the bell doesn't exceed 200mA. Use the transistor in common emitter configuration. Add a series resistor from the base of the transistor to the port pin of the pic to limit the current. Add a reverse diode across the bell to suppress the inductive spike at turn-off.

Note that the input current to the boost converter will be approx. 10 times the load current, which may drain your battery quite fast.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
You may find that connecting the diode across the bell coil will interfere with the bell's operation. It may be better to use a transistor (or better, a MOSFET - but you'll need one with a low Vgs threshold voltage, unless you make a gate driver circuit that runs from a higher voltage) with a higher collector-emitter (or drain-source) voltage rating, and a zener and diode in series across the bell coil. Try just the diode first and see whether it cramps the bell's style.

There might be other options that would work better - to give a louder noise with lower power consumption. It depends on the characteristics of the bell itself. That would require a lot of experimentation though, and what you suggest will do the job.
 

sideburn

Jun 14, 2013
75
Joined
Jun 14, 2013
Messages
75
Hey guys, I just got it working. You are probably going to laugh at my approach and I fried two 2222 NPN transistors in the process of trial and error.

I grabbed my drawer full of misc transistors and started with the 2222 since I know it's a basic switching transistor. The problem with it was there was a lot of leakage through the emitter and collector when I had no signal to the base.. I was reading 28v from my 34v output.

I'm still having trouble with emitter vs collector and which one to connect ground to (I think thats how I ended up frying them or it was 3v was too much to give to the base..)

right now the emitter is connected to ground and the collector goes to the negative input to the bell coil with the +34v going to the + side of the bell coil..

OK so the 2222 wasnt goign to work.. too much voltage passing through with nothing going to the base...

So then I tried a BC338 transistor and that worked.. I looked up the specs after and saw that it is a medium power transistor.. I guess thats why it worked.

Next i wanted to find out what the minimum amount of signal voltage I can give the base of the transistor. This is the kindof funny part since I suck at doing it right by reading specs and calculating resitor currents, I just put my left hand finger on the +3v from the batter and then touched the base with my right hand finger.. Nothing.. then I wet both of my fingers and tried again and it worked. Then i wet my fingers and touched my multimeter and got a reading of about 45K ohms so then I hooked a 45k ohm resistor to the base. now its working great. Next is to hook the base to my PIC output pin and write some software.

Is there any reason to put a diode between my bell and the emitter or collector and ground? I ended up putting a diode on the collector side anyway.. The emitter is going directly to ground.

Pic attached of the circuit for anyone interested.. The yellow wire is the 3v signal wire to the base of the transistor.. The transistor from left to right is CBE..
The white wire goes from the diod on the collector to the phone coil, Green wire from phone coil to +34v, then Green wire from ground to the emitter.
 

Attachments

  • IMG_8762.jpg
    IMG_8762.jpg
    95.4 KB · Views: 198
Last edited:

sideburn

Jun 14, 2013
75
Joined
Jun 14, 2013
Messages
75
What type of boost converter do you use? If it's an IC with a shutdown pin, you could use that shutdown pin to tirn the boost converter on and of to the rhythm of your pic output. This will save power while the converter is not in use.

Your transistor solution is also viable as long as the current for the bell doesn't exceed 200mA. Use the transistor in common emitter configuration. Add a series resistor from the base of the transistor to the port pin of the pic to limit the current. Add a reverse diode across the bell to suppress the inductive spike at turn-off.

Note that the input current to the boost converter will be approx. 10 times the load current, which may drain your battery quite fast.

Im not sure.. this is it: http://www.ebay.com/itm/130919580004?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649

My plan is to turn on the boost converter from the PIC when I need to ring the bell then turn it off when done.. But thats going to be another delima where I'm going to need a transistor again..
 

sideburn

Jun 14, 2013
75
Joined
Jun 14, 2013
Messages
75
You may find that connecting the diode across the bell coil will interfere with the bell's operation. It may be better to use a transistor (or better, a MOSFET - but you'll need one with a low Vgs threshold voltage, unless you make a gate driver circuit that runs from a higher voltage) with a higher collector-emitter (or drain-source) voltage rating, and a zener and diode in series across the bell coil. Try just the diode first and see whether it cramps the bell's style.

There might be other options that would work better - to give a louder noise with lower power consumption. It depends on the characteristics of the bell itself. That would require a lot of experimentation though, and what you suggest will do the job.

I thought about a FET too but I know nothing about them.. I'm not so great with electronics.. basically I used to take my toys about and turn them into things when I was a kid.. made some circuits with transistors and 555 timers etc etc.. I know just enough to get me in trouble.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
12,610
Joined
Nov 17, 2011
Messages
12,610

sideburn

Jun 14, 2013
75
Joined
Jun 14, 2013
Messages
75
No sign of a shutdown pin there.


add 1: it is current that passes through the transistor, not voltage.

Ah ok, I was just talking about the voltage I was reading off my multimeter.. I get a much lower reading with the other transistor.. Less than a volt I think.

add 2: put a 100kOhm resistor from base to emittter (emitter=GND) to turn off the transistor in the absence of a control signal from the µC.


OK, so basically a 100k resistor from the base to gnd.. Not sure why I need this exactly. would this be incase theres still some current coming off the PIC when the pin output goes low?
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
12,610
Joined
Nov 17, 2011
Messages
12,610
would this be incase theres still some current coming off the PIC when the pin output goes low?
No, a low output of the pic will turn off the transistor. From your post i gathered that you operated the transistor without the pic being connected or the pic being turned off. In that case any leackage may turn on the transistor.

I get a much lower reading with the other transistor.. Less than a volt I think.
If the transistor is fully turned on (it's called saturated), the voltage between collector and emitter should be well below 0.5V. If not, the collector current may be too much for the transistor (what current does the bell draw?) or the base current may be too low.
 

sideburn

Jun 14, 2013
75
Joined
Jun 14, 2013
Messages
75
No, a low output of the pic will turn off the transistor. From your post i gathered that you operated the transistor without the pic being connected or the pic being turned off. In that case any leackage may turn on the transistor.

You are correct, I have not begun to hook a PIC to it yet. I see, you said "in the absence of the µC. OK maybe not having the 100k resistor is what was causing the 2222 transistor to have current flowing though the Emitter/Collector. This BC338 is working fine as is without the resistor but I will try adding one and see if it removes all current flow.. I see there is a little.

If the transistor is fully turned on (it's called saturated), the voltage between collector and emitter should be well below 0.5V. If not, the collector current may be too much for the transistor (what current does the bell draw?) or the base current may be too low.

I don't know how much current the bell draws. A lot I assume. How would I go about finding out?

Also, should I have a diode on the collector side to the bell coil?
If I am using an NPN transistor, do I always want the emitter tied to GND?
That's confusing me, would this circuit work if I tied the collector to GND instead and connected the bell coil GND to the emitter?

I've always thought of a transistor as 3 of the same diodes so I am having trouble figuring out the difference between the collector and the emitter. I assume it has something to do with the direction the electrons flow.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
12,610
Joined
Nov 17, 2011
Messages
12,610
How would I go about finding out?

Well, measure it? Having a multimeter at hand (even a simple one) is always a good idea. Simple multimeters aren't expensive, you can find them for 10€+.

Also, should I have a diode on the collector side to the bell coil?
There are different ways to protect the transistor from the voltage spike when the coil of the bell is turned off. Personally I would put the diode parallel to the bell, cathode to +30V, anode to the transistor's collector. Thus the diode will be off when the transistor is on, but the diode will turn on as soon as the flyback voltage from the coil starts to rise. Thus the transistor is protected from that voltage.

If I am using an NPN transistor, do I always want the emitter tied to GND?
That depends on the circuit. In your case: yes.

That's confusing me, would this circuit work if I tied the collector to GND instead and connected the bell coil GND to the emitter?
It probably would work, but not very well. This is called reverse operation and the transistor's current gain will be diminished drastically.

I am having trouble figuring out the difference between the collector and the emitter
The datasheet tells you which pin has which fucntion. In the schematic the emitter is where the little arrow is.. For an NPN type transistor, emitter normally is on lower potential than collector, so Vce (Voltage from collector to emitter) is positive.


This is what your setup should look like:
attachment.php

L is the inductance of the bell, D is the protective diode. Use 1N4001 for example. 1N4148 could also work.
 

Attachments

  • Bell.gif
    Bell.gif
    4.3 KB · Views: 413
Last edited:

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
You can calculate the bell current by measuring its resistance with your multimeter. Use Ohm's Law: I = V / R. So if you measure 100 ohms, for example, and you're going to be feeding 34V into it, V=34 and R=100 so I=0.34 amps.

Make sure that your DC-DC converter is rated to supply that much current. Also remember that the current at the input of the converter (from your 3V battery) will be about 13 times higher than that current!

I think a better approach would be to charge a capacitor from your DC-DC converter and dump the charge into the bell at 50 ms intervals. But tell us more about your battery, and the DC-DC converter. (I tried looking on eBay; it said the auction had expired.) Also tell us the resistance of the bell, and any markings on it.

You should have a diode connected across the bell, with its cathode (the stripe end) to the positive side (the +34V supply rail). This is needed to protect the transistor. A 1N4001 will be suitable.

You will probably need a gruntier transistor than a BC338. I would use a Darlington rated at a few amps, such as a TIP120/121/122 or BD679.

The base connection should be: a 100k resistor from base to emitter (to keep the transistor OFF when nothing's driving it, as suggested by Harald), and a 10k resistor from the base to the output pin of the PIC.

Collector and emitter are NOT interchangeable. The emitter must be connected to GND.
 

sideburn

Jun 14, 2013
75
Joined
Jun 14, 2013
Messages
75
Thanks a lot for the help. This is great info.
I've got a multimeter and lots of components.

I'm just not so good and calculating things. I'll take some measurements tomorrow
And let you know what's I come up with and I'll get more details on the step up converter. I'm just glad I got it working already even without having things the way they should be.

It's 4am here so I've got to call it a night.
Thanks again.
 

sideburn

Jun 14, 2013
75
Joined
Jun 14, 2013
Messages
75
You can calculate the bell current by measuring its resistance with your multimeter. Use Ohm's Law: I = V / R. So if you measure 100 ohms, for example, and you're going to be feeding 34V into it, V=34 and R=100 so I=0.34 amps.

The resistance I measured between the coil is .974K so 1K roughly.
So 34v / 1000 = .034ams or 34 milliamps. Does this sound right? I'm surprized that heavy duty bell is only drawing 34 milliamps!?

Make sure that your DC-DC converter is rated to supply that much current. Also remember that the current at the input of the converter (from your 3V battery) will be about 13 times higher than that current!

I think a better approach would be to charge a capacitor from your DC-DC converter and dump the charge into the bell at 50 ms intervals. But tell us more about your battery, and the DC-DC converter. (I tried looking on eBay; it said the auction had expired.) Also tell us the resistance of the bell, and any markings on it.

Heres the specs on the booster: http://www.aliexpress.com/item/LM25...up-Converter-Adjustable-Charge/754722175.html

According to that it puts out 2.5 amps

You should have a diode connected across the bell, with its cathode (the stripe end) to the positive side (the +34V supply rail). This is needed to protect the transistor. A 1N4001 will be suitable.

You will probably need a gruntier transistor than a BC338. I would use a Darlington rated at a few amps, such as a TIP120/121/122 or BD679.

The base connection should be: a 100k resistor from base to emitter (to keep the transistor OFF when nothing's driving it, as suggested by Harald), and a 10k resistor from the base to the output pin of the PIC.

Collector and emitter are NOT interchangeable. The emitter must be connected to GND.


I've added the diode, and I noticed when I I had about 1 to 2 volts of leakage
between +34v and the collector. After adding the 100k resistor between the base and the emitter it elimated the leakage. Cool.

Not sure if I have any beefier transistors on hand at the moment but I'll order one.
In the meantime I've got tons of these so I'll keep using it for now and see how well it holds up.

I was using a 47k resistor on the base of the transistor but now I have changed that to 1k from your suggestions but wont that allow a lot more current to the base? Isn't that a bad thing?
 
Last edited:

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,505
Joined
Jan 21, 2010
Messages
25,505
Your calculations seem correct. 1K equates to 1mA per volt, so 34 volts means 34mA. Is that reasonable? Don't know.

Be careful where the ground lead you've shown is connected. Don't take it to the PIC circuit. Take it right back to the battery. That will help stop interference generated from the bell affecting your PIC.

It might also be useful to place a small capacitance (0.1uF 100V) across the bell in addition to the diode.

A larger capacitance (say 100uF 50V) between the +34V and ground, near the bell (i.e. not near the power supply) could also be of benefit.
 

sideburn

Jun 14, 2013
75
Joined
Jun 14, 2013
Messages
75
I spent the day on it and programmed the pic.. I got it to sound exactly like a telephone from the 70s ringing..... and then i think i fired the pic programmer.. dont ask me how but it wont program anything anymore.. why do i have to fry everything in order to make progress I do not know.. uhg..

I'm out of commission for a week or so..
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Yes, 34 mA sounds right. It does seem pretty low, but I think that bell is designed to operate from a pretty high voltage, such as ~100VAC as used in the telephone system.

The converter may be rated for 2.5A output, but you also have to consider how much current it will draw from the input supply. A converter that converts 3V to 34V with an efficiency of about 85% (which is not typical) will consume about 13 times as much current from the source as it delivers to the load. With a load current of 34 mA, this means the battery load current will be 450 mA while the transistor is ON.

I suggested a base resistor of 10k, not 1k. Yes, reducing it will increase the base voltage. That is important because you want to make sure the transistor is saturated. To do that, you have to provide a base current that's very much higher than the required collector current divided by the minimum current gain of the transistor. For a junction transistor like a BC338, that means the base current needs to be at least ~1 mA. The voltage drop across that resistor will be about 2.3V so ideally the resistor should be about 2.2k. If you use a Darlington transistor, which I recommend, a 10k resistor will be fine, because Darlington transistors have a much higher current gain.

A BC338 should be fine, since the bell current is only 34 mA. You NEED the diode across the bell though.

Steve's suggestion of a 100 uF capacitor from the bell positive to the transistor emitter is a good one, but I wouldn't connect a capacitor across the bell because it will increase the peak current. You could do it if you add a resistor (e.g. 1k) in series with the capacitor and put the series combination across the bell.
 

sideburn

Jun 14, 2013
75
Joined
Jun 14, 2013
Messages
75
the boost converter doesn't seem to be putting too much drain on the battery, at least when idle / bell not ringing. But in order to conserve the battery as much as possible, I want to control the power to it from one of the output pins on my PIC. should I use another transistor for this or is it ok to run the output pin directly to VCC on the boost converter?
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Right, the boost converter will not put much load on the battery when it's not loaded by the bell's 1k resistance. You have to test with the bell active. I estimated 450 mA load on the battery while the bell driver transistor is actually ON.

You want to switch the supply to the boost converter on and off? But it doesn't have a disable input. You would have to switch one of the power rails, using a MOSFET. Generally you switch the positive rail. The problem is your 3V supply rail; you need a special MOSFET that will saturate with only 3V gate-source bias, such as the AO3415 (http://www.digikey.com/product-detail/en/AO3415/785-1010-1-ND/1855952) which costs USD 0.48 and has an Rds(on) of about 50 milliohms at 3V Vgs.

The reason why the RDS(on) specification at 3V Vgs is important is that the MOSFET will dissipate power (i.e. get hot) while the DC-DC converter is drawing current. This dissipation is proportional to the RDS(on) resistance.

To calculate the power dissipation in the MOSFET, take the load current (assume 500 mA, that's 0.5 amps), square it (0.5 squared is 0.25) and multiply by Rds(on), which is 0.05 ohms (50 milliohms). The result is 12.5 mW which is so low that no heatsink will be needed; normally, power levels need to be over a few hundred milliwatts before you worry about heat.

You can also calculate the voltage dropped across the MOSFET using Ohm's Law, and the result is 25 mV, which is slightly less than 1% of the total voltage.

In any case, both of those calculations apply only when the bell is drawing current, which is only when it's ringing, and even then, only half the time, maybe less, depending on the waveform you use to drive the transistor that's in series with the bell.

You can drive the gate of the MOSFET from the microcontroller pin, through a reistor of, say, 33 ohms. That pin should also have a pullup resistor, so it doesn't float, and the MOSFET always sees a clear control voltage. Connect the MOSFET like this:

Break the 3V connection to the DC-DC converter, and connect the MOSFET across the break, with its source to the battery positive (which is also the microcontroller positive) and its drain to the DC-DC converter. Then connect the gate as I described, with a 33 ohm resistor from the gate to the microcontroller pin that drives it, and a pullup resistor (say 10k) from that microcontroller pin to the battery positive rail.

When your firmware starts up, it should set that pin as an output. Then when it drives that pin low, the DC-DC converter will power up, and when you drive that pin high, the DC-DC converter will shut down.

BTW the reason you can't just power the DC-DC converter from one of the PIC's I/O lines is that these are only rated to supply a few dozen milliamps of current. Your converter needs about 500 mA, maybe more. So you need to use a switching device. A MOSFET like that is the most efficient way to do it.
 

sideburn

Jun 14, 2013
75
Joined
Jun 14, 2013
Messages
75
ok thanks. Yeah I figured that would be the case.. That the i/o lines couldnt handle the current load. Before you replied I was looking at the specs for a ZXMP6A13F because I have a few of them lying around already.
 
Top