Electronic – arduino – Switching 9V using a NPN transistor and an Arduino

arduinotransistorsvoltage

First of all, I'd like to say I'm not an Electrical engineer so please bear with me. I haven't got a sketch for what I'm trying to achieve but hopefully I can explain it ok.

I have an NPN transistor (2n2222 specifically) and am doing the following.

  • Connect 9V battery to transistor collector
  • Connect transistor base to Arduino PWM output pin (1k transistor in between)
  • Connect ground of 9V battery to Arduino ground
  • Write a for loop (i = 0-255) which increments by 1 every 100ms and do analogWrite(PWMOutputPin, i)

I then take a multimeter to measure the voltage between ground and the emitter leg and what I'm getting is values between 0-4.5 volts while the battery has about 7.68V in it by measuring it directly.

I thought the purpose of the transistor is to send the full voltage between the collector and emitter provided that there's sufficient voltage being sent to the base. Is this correct? Am I doing something wrong?

Best Answer

The circuit you describe is an emitter follower - the emitter voltage follows the base voltage and is always about 0.7 volts negative of the base. The transistor doesn't care where you think "ground" is, its operation only depends on the voltages between its pins.

If you ground the emitter, and put your load between the collector and the positive supply, you will be able to get very close to the supply voltage across the load when the Arduino output is high. You should have a resistor of 1K or so between the Arduino output pin and the transitor base, to limit base current and loading of the Arduino output pin.