determining the right size transistor
NosePicker
Posts: 54
In this example I want to use the basic stamp to detect if a wire is off or on. The problem is when I say "on" means it will have 12v supplied to it.
I am assuming that I can use a transistor and connect as follows:
Base pin connects to the 12v wire.
Collector connects to the stamps vdd pin (+5v)
Emitter connects to a 220ohm resistor which connects to an input pin on the stamp.
It appears that when the 12v is on then the stamp pin is high and when the 12v is off the stamp pin is low.
I have two questions here.
1. Is this the right way to test for 12v being high or low?
2. If 1 is yes then what are the dangers of not using the "right size" transistor and how would you determine the right size?
I have the following transistors KSP2222A, 2N3904.
On the back of the box of transistors has the following ratings but I don't know what they means.
Maximum Ratings
Vcbo:· 60v
Vceo:· 40v
Vebo:· 6v
Ic:····· 200mA
It:····· 300MHz
Dissipation: 350mW
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thanks
NosePicker
Post Edited (NosePicker) : 7/26/2008 1:53:29 PM GMT
I am assuming that I can use a transistor and connect as follows:
Base pin connects to the 12v wire.
Collector connects to the stamps vdd pin (+5v)
Emitter connects to a 220ohm resistor which connects to an input pin on the stamp.
It appears that when the 12v is on then the stamp pin is high and when the 12v is off the stamp pin is low.
I have two questions here.
1. Is this the right way to test for 12v being high or low?
2. If 1 is yes then what are the dangers of not using the "right size" transistor and how would you determine the right size?
I have the following transistors KSP2222A, 2N3904.
On the back of the box of transistors has the following ratings but I don't know what they means.
Maximum Ratings
Vcbo:· 60v
Vceo:· 40v
Vebo:· 6v
Ic:····· 200mA
It:····· 300MHz
Dissipation: 350mW
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thanks
NosePicker
Post Edited (NosePicker) : 7/26/2008 1:53:29 PM GMT
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
Post Edited (erco) : 7/26/2008 3:07:03 PM GMT
12volts plus or minus will easily damage a BasicStamp I/O pin. Any negative voltage is quite dangerous. They are not suppose to get more than 5.5volts, but can manage an accidental 7 volts plus or 0.5 volts minus in a pinch.
You really need to comprehend some basics before you get too far into connecting wires. The Transistor ratings are maximum voltages across different pairs of the three basic wires. Their is also a polarity that is defined by the type -- either PNP or NPN.
Regarding your choice of 2n2222 or 2N3904 transitors for project, either will usually work fine with BasicStamps to boost output. But the 2n2222 can control more power. Use the internet to get good information as what you got on the back of a package seems wrong. Also, it is a bit silly to even buy a 2n3904 as the 2n2222 can control more power in similar situations.
Nearly all transistor will handle at least 40 volts in switching. The real design issues are how much current they can control and what are their high frequency properties. Since digital isn't really concerned with the high frequency issue, one begins to find that many, many different transistors can be used in the same context. It can be confusing to the beginner. The Europeans use their own part number and the Americans use others. Everyone tends to jump in and say this one will work fine, so don't worry about it.
If you really want to know in detail, the Navy has a series of manuals called NEETS that can be downloaded and studied for free [noparse][[/noparse]beware that there are web sites that will charge for these, but you should search further].
http://www.phy.davidson.edu/instrumentation/NEETS.htm This link may work. US Government manuals do not have copyrights and are free to all.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's sunny and warm here. It is always sunny and warm here.... (unless a typhoon blows through).
Tropically, G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan
Thanks for your help with the voltage divider but I am having trouble completely understanding the forumla so I can reuse this in the future so I will try to break it down and please correct me where I go wrong.
You stated the result would be:· (12*1/(1+4.7))
so obviously the 12 = the input voltage (IV) and the 4.7 is the size in k for the resistor being used from the (IV) to the pin so lets call the 4.7 resistor (IVRes)
that gives us (IV*1/(1+IVRes)).
Now my question is if I need to substitute the 1 k resisitor then is that represented by the first 1 or the second 1 or both in the forumla?
Lets call the ground resistor (GRes)
(IV*GRes)/(GRes+IVRes))
By the way that did seem to work, so long as the power was on with the 12v connect. But when I remove the power coming in from IV then it appears the pin on the stamp bounces high and low as if power is flickering above and below 1.4v. When I check it with my volt meter it does appear to be bouncing. Any ideas?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thanks
NosePicker
If the pin sees an "open", (in other words, the signal is 'floating' not pulled to ground OR to +12) then the pin sees an antenna, which will oscillate with any recieved RF signal, typically the 60Hz "line-noise".
If that's the case, you can fix this with a 10Kohm resistor attached between the pin and ground. This will give the pin a "soft ground", so it will read zero with no signal applied.
One other thing you can do is connect the pin to 12 volts using a 22 Kohm resistor. The PIC inside the BS2 has "clipping diodes" which will "clip" the signal to zero and +5 -- BUT, those diodes won't take a lot of current. The 22 Kohm resistor reduces the current enough to let the internal diodes do their job without being destroyed -- for a 12 Volt DC signal, anyway.
So, have a 10 Kohm resistor going to ground right next to the pin, and connect to +12 through a 22 Kohm resistor, and you've solved both problems.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thanks
NosePicker
Once I build that circuit I want to be able to connect and disconnect the wire from the positive side of the battery and have the stamp pin go high and low.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thanks
NosePicker
But yes, if you build that circuit (and keep the 12V battery ground tied to Vss) then you should be able to connect the battery + line and detect it's connected, or disconnect the battery + line and detect it's not connected.