Measure the voltage on GPIO.4 when it's low. It MUST be a low voltage(below 1V), if not you will have problems just like this. My guess is that you have a short on the base resistor to the PNP or forgotten it completely.
Measure the voltage on GPIO.4 when it's low. It MUST be a low voltage(below 1V), if not you will have problems just like this. My guess is that you have a short on the base resistor to the PNP or forgotten it completely.
Success!
It was the resistor issue. I think this is the second time one of those damn things has screwed me up. I also had a 0 and a 1 reversed in part of my code which didn't show up until I got the resistor issue resolved.
So, now my question is this. I have a pre-programmed sound module which I know very little about and won't ever know anymore on. It runs on 3 to 4 volts and probably barely uses any amps at all. It is runs on 50 ma I'd be surprises. It drives a little 1.25" speaker.
I've been using just comman transistors and resistors on the breadboard in an effort to just turn the power on/off to the sound module. That problem now fixed thank God.
But, when I go to put this together for real I want to ensure I'm using suitable stuff that is over-engineered just enough to keep things working as future repair will be pretty much impossible.
So, is there a generic enough way to come up with a suitable transistor and resitor value to do this?
I had originally picked out a BCX5316CT-ND from Digikey as a transistor because it seemed to match the common through hole one I was using for testing. Resistor I was never quite sure on, but was thinking like 330 ohm.
Advice on this issue would be appreciated.
Thanks for enough questions and comments that I could troubleshoot this to a conclusion.
Bart
Last edited by bartman; - 2nd January 2006 at 18:52.
>> So, is there a generic enough way to come up with a suitable transistor and resitor value to do this?
How technical do you want to get?
Current in mA through the Collector divided by the gain of the Transistor (see Transistors Datasheet) should give you the current through the Base. Pick a suitable Resistor to fit (5v out from the PIC less 0.7v for the Transistors Emitter/Base junction divded by the previously calculated Base Current). Example 50mA Collector current with a Transistor gain of 150 should give you a Base current of around 333uA. 4.3v/333uA=12.9K Resistor... drop down to next lowest preferred value=12K.
Alternatively fit a 10K Resistor in the Base which should drive most decent small/medium Transistors on the planet.
Probably 10K will do!
But, here are the specs from the transistor I picked.
I'm not sure which of these figures is gain, but I think it is HFE@1c/VCE
min: 100
max 250
mA -150
V -2
In case not, we have VCE(sat)
Max V -.5
@IC (mA) -500
@IB (mA) -50
Also, PIC will be running on 3.7V same as sound board.
Bart
check this one out Bart at Digi-key
SMBT2907AINCT-ND $1.99(can) for 10
and resistors 311-10.0KFCT-ND $1.11 for 10
Okay, so looking at your suggestion it looks similar in specs to the one I listed. What is your reason for this one out of curiosity? I did notice your suggestion is a very small component and the one I listed was considerably bigger (I also picked that one so it would be a bit easier for me to work with).
But, I still want to know why one over the other when they are close.
I do have some SMD 10K resistors so I think I'm good there.
Thanks.
Bart
See this link.
Using Bipolar Transistors As Switches
http://www.rason.org/Projects/transwit/transwit.htm
Luciano
Bookmarks