How to turn turn the 5V pin output signal into 9V and drive a motor?

Hi, i am fairly new electronics and am working on driving a DC motor with an H-Bridge. I planned on taking a 5V digital output from my arduino UNO and using it to switch a NPN transistor that would then allow 9V to flow through and go to the H-Bridge. The H-Bridge works great, however, it is only receiving the 5V from the arduino, despite that pin being connected to the base pin of the transistor. I don’t really understand how to set this resistor up. I though i had a good understanding of how to use resistors until this trumped me. Here’s a couple pictures.

The white wire is the 5V arduino signal. I have a simple test LED set up that needs to be powered and is already grounded. With only the 5V signal being activated on the base pin, the LED is on. The 9V power line (which is the red one) is not even plugged in. I didnt know that a transistor could work with something only on 2 of the 3 pins. In the other picture you can see that i plug in the 9V (red) to the other pin of the transistor and the LED brightness did not change. I tested with a voltmeter and the voltage did not change either.

So, my question is: what am i doing wrong? What do i need to do in order to turn this 5V signal into 9V power with a transistor. I would hate to have to order opto-isolators, as that would prevent me from learning whatever it is i am doing wrong.

Thanks in advance,
Carson.

IMG_0598.JPG

With an H-bridge you don't need another transistor. The H-bridge can be driven by 5V and powered by higher voltage.

You talk about a white wire. I don't see a white wire, but perhaps you mean what I see as gray.

You talk about "...this resistor..." without explaining WHICH resistor. There are two, presumably one for the base of the transistor and one for the LED.

If the collector of a transistor is unconnected then 5 volts applied to the base can appear at the emitter of the transistor (less about 0.65 volts for a diode drop). However, the current taking this path usually needs to be limited.

You did not tell us the part number of the transistor, so I can only guess at the connections for the emitter, the base, and the collector (which I cannot see). However, you cannot control 9 volts if you do not supply 9 volts. I can see that you are attempting to be cautious, but perhaps you are being overly cautious.

The pictures are not clear enough for me to determine the values of the resistors. I also cannot see if the negative side of the 9 volt battery is connected to the ground of the Arduino. A wiring diagram or schematic might help.

That's a lot of guesses for one post.

In any case, I don't know why you are controlling the power with this transistor if you already have an H bridge. The H bridge can do this if it can be controlled.

vaj4088: You talk about a white wire. I don't see a white wire, but perhaps you mean what I see as gray.

You talk about "...this resistor..." without explaining WHICH resistor. There are two, presumably one for the base of the transistor and one for the LED.

If the collector of a transistor is unconnected then 5 volts applied to the base can appear at the emitter of the transistor (less about 0.65 volts for a diode drop). However, the current taking this path usually needs to be limited.

You did not tell us the part number of the transistor, so I can only guess at the connections for the emitter, the base, and the collector (which I cannot see). However, you cannot control 9 volts if you do not supply 9 volts. I can see that you are attempting to be cautious, but perhaps you are being overly cautious.

The pictures are not clear enough for me to determine the values of the resistors. I also cannot see if the negative side of the 9 volt battery is connected to the ground of the Arduino. A wiring diagram or schematic might help.

That's a lot of guesses for one post.

In any case, I don't know why you are controlling the power with this transistor if you already have an H bridge. The H bridge can do this if it can be controlled.

First off, thank you for responding. Sorry that i was no specific enough for you to help me, next time i will do a better job asking questions.

As for the H-motor, forget about it. My real question has more to do with the fundamentals of transistors than of the H-Bridge and the motor.

Focusing solely on the LED circuit: The arduino is powered by the same 9V battery that powers the bread board. Ground is hooked up to negative. The resistors are both 1K ohm. White wire + shadow = gray wire The transistor is an NPN 2n3904

I would greatly appreciate if you would be able to tell me how to power the LED with 9V using the 5V arduino signal. With that understanding, i should be able to work with the motor and all that other stuff.

Thank you for the help.

“I would greatly appreciate if you would be able to tell me how to power the LED with 9V using the 5V arduino signal. With that understanding, i should be able to work with the motor and all that other stuff.”

In this example, VF is for a Red LED. For a White LED that’s different, approx. 4V.
[“ymmv”]

What Runaway Pancake said... mostly.

Vf should be the forward voltage of the LED, plus the transistor's Vc_sat which is quite low (probably about 0.2 volts).

The input is coming from an I/O pin of a 5 volt Arduino, so is slightly less than 5 volts and never above 5 volts.

This circuit goes on the low (ground) side of the H bridge. If you need something on the high (9 volt) side, it is going to get more interesting.

I hope that the 2N3904 can handle your unspecified motor current.

What I am seeing is a 2N3904 with 9V on the collector and the resistor and led from the emitter to GND. This is essentially an NPN in a "high side driver " configuration, which is not generally done. If this is the configuration you wanted you should be using a 2n3906 with the emitter to 9v and the collector driving the resistor and led. Since you have a 2n3904, you should disconnect the battery and rewire your circuit to SINK the led current instead of SOURCING it. In other words, connect the transistor emitter directly to ground. Connect the resistor directly to the 5V bus. Connect the led from the other end of the resistor to the collector of the transistor. Reconnect the battery and test again. If the led goes on and off under arduino control then you can connect your motor in place of the led & resistor. I would not advise trying to drive any motor with a 2n3904. You need a larger transistor. An H-bridge is more complicated. I believe someone else has already addressed that.