I have connected a 3906 PNP transistor base to a GPIO pin of ESP32 board. Collector is connected to 5v and emitter is connected to a buzzer. When I program the buzzer, it is permanently on. When I check it against a multimeter, the transistor turns on even when base current is 3.4v (when I though it turns on only if voltage is less than 0.7v).
To cross check the transistor and buzzer, I directly connect base to 5v and the transistor is turned off. Connecting to ground turns on. So, it works correctly when connected directly.
For those who would like to suggest a NPN transistor, I have tried using 3904 NPN transistor and everything works as expected. However the issue is that when programming, all the pins of ESP32 are high by default and the buzzer is ON until programming done.
Can someone tell me how to solve this issue? I need to use PNP transistor only. Thanks in advance.
Ideally, you would use a such a circuit (high side switch) :
For the reason that you have discovered that 3.3 volts is not enough to switch off a pnp transistor where the emitter is held at 5.0 volts. You have also to ensure that the 5 volts does not get to a 3.3volt arduino pin.
Does this exercise allow you to use an additional (npn) transistor ?
EDIT
If you have problems with a single NPN transistor (low side switch) use say a 1k base resistor and also a 10 k base pull down resistor to prevent the transistor turning on when the pins are input high state.
I have connected a 3906 PNP transistor base to a GPIO pin of ESP32 board. Collector is connected to 5v and emitter is connected to a buzzer. When I program the buzzer, it is permanently on. When I check it against a multimeter, the transistor turns on even when base current is 3.4v (when I though it turns on only if voltage is less than 0.7v).
Since the base is at -1.6V or lower w.r.t. emitter the transistor must always be on. You need a level
shifting circuit using an NPN device to shift up to 5V to drive the PNP as in the previous post.
MarkT:
Since the base is at -1.6V or lower w.r.t. emitter the transistor must always be on. You need a level
shifting circuit using an NPN device to shift up to 5V to drive the PNP as in the previous post.
Any supported or relevant circuit example? That would help make it much easier for me to understand. Thanks for your tip.
6v6gt:
Ideally, you would use a such a circuit (high side switch) :
For the reason that you have discovered that 3.3 volts is not enough to switch off a pnp transistor where the emitter is held at 5.0 volts. You have also to ensure that the 5 volts does not get to a 3.3volt arduino pin.
Does this exercise allow you to use an additional (npn) transistor ?
EDIT
If you have problems with a single NPN transistor (low side switch) use say a 1k base resistor and also a 10 k base pull down resistor to prevent the transistor turning on when the pins are input high state.
Thanks. I have tested this circuit. The problem is still the same. When I program the ESP32, it turns on the Buzzer. Similar results as using a single NPN transistor.
I will try using a single transistor with the said resistors and revert.
6v6gt:
Ideally, you would use a such a circuit (high side switch) :
If you have problems with a single NPN transistor (low side switch) use say a 1k base resistor and also a 10 k base pull down resistor to prevent the transistor turning on when the pins are input high state.
This is perfect. Thanks. It works as expected. I am implementing this very circuit with 1K and 10K resistor. Before I do that, need advice is there is any issues with this setup as with a minimal test, it seems to work without issues.
Yes. I have checked the pin required and it is connected to CS pin.
One question though. If I connect buzzer to positive and negative end to transistor collector, the problem seem to persist. (It buzzes while programming). This is the circuit I have used in all previous boards.
However, if I connect collected of transistor to 5v, emitter to buzzer, it works as expected and does not buzz while programming. If I program the buzzer to beep every second, it does so.
Since every circuit I have seen online, connects the buzzer positive to 5v and not like the way I have done now, is there a problem I should expect?
Attached circuit of what "works" (does not beep while programming) and what "does not work" (beeps while programming). Apart from the beep while programming, everything else works similarly.
This is odd. The one that is marked "Does Note Work" should be the one that works.
Check that you are using the NPN transistor 3904 and that you have not interchanges collector and emitter. The emitter has the arrow in the symbol. Check the data sheet for the pinout.
6v6gt:
This is odd. The one that is marked "Does Note Work" should be the one that works.
Check that you are using the NPN transistor 3904 and that you have not interchanges collector and emitter. The emitter has the arrow in the symbol. Check the data sheet for the pinout.
When I say "Does not work", it does not mean it does not buzz after programming. All I intend to say is that it beeps even while programming. After programming, it is normal and works as per the program written. If I write to beep once a second, it does so. The only issue is it is a continuous buzz while programming. In the second "Works" circuit, it does not buzz while programming and works as expected later. Pinout is correct as per the datasheet and since both works after programming, all is fine. Only issue is the continuous beep while the program is loaded.
Which ESP32 are you using ? On the board I have in front of me, there is no pin marked CS.
The symptoms you describe are if the pin is used for some dedicated purpose e.g. USB serial or flash memory. Try another GPIO pin.