Npn transistor circuit [Solved]

Ok so I am new to electronics and trying to figure out how to use an npn transistor to control a dc motor. I was looking through tutorials and pretty sure I did everything right but when I connect the battery to the leads it just runs at full rpm when in arduino code I just set it to 0 so that I would know if it worked. I have a resistor hooked up to base pin and pin 9 on arduino and emitter hooked to + rail and motor with collector hooked to - rail and motor(I htink) I flipped the transistor since the middle pin is base to see if it would make a difference and it didnt. I also thought if I had it the wrong way maybe it burnt it out so I just got another one and still no dice. I have a 9volt battery and 6volt motor, the transistor is 40v 600ma. Any help would be appreciated.

Motor goes between + rail and Collector.

Emitter goes to Arduino Ground and - rail.

I also thought if I had it the wrong way maybe it burnt it out

Swapping the collector and emitter of a transistor will not damage it. In fact it will still work as a transistor but with rubbish gain.
However get the base wrong and you can damage it if too much current flows.

Are you sure you are using NPN ? your connections sound like for as PNP and that would need "negative logic" so indeed with "0% PWM" you would be getting 100% output

Well it looks like I have everything wired correctly so I'm stumped why it wont work, would it just allow current through if there is no programming behind it? I just took a bunch of pics and one of the prog, It has a bunch commented out but I tried that as well and it didn't slow or speed it up so that I would know if 0 meant full speed it is NPN. Also I found this interesting I put my arduino from pin 9 to the base and didn't have it plugged into computer and it powered my arduino, should it do that? That would mean the 9volt was powering it and that doesnt sound good?

Check those power rails on your bread board. It looks like you have the ones that are broken at the middle where the red and black lines show a break. Use wires to jump these gaps.

I put my arduino from pin 9 to the base and didn't have it plugged into computer and it powered my arduino, should it do that?

It will do that and you shouldn't let it. It is called parasitic powering and can damage things.

Yea I have to jumper wires that connect the two sides of the rails, how would I stop the parasitic thing? Idk should my positive rail on arduino go anywhere or just the ground?

how would I stop the parasitic thing?

By never connecting a signal to an un powered chip. Just don't do it, there is no choice about it you don't do it or you find another hobby that is not electronics.

Okay I understand sorry just didn't know, on the development front I decided to get rid of the motor and just use an led on 3volt rail to simplify the circuit so maybe I could see the problem. When I wired it to the transistor and led it just stayed on but thats not really a surprise right? Because it is only messing with current, anyway I also just plugged it directly in pin 9 and ground and it started fading and coming on like it should. Idk if this tells anyone anything but i'll keep looking online. Thanks for the help so far I was actually supprised to see people reply.

OKAY! So after surfing the web for the past two days I finally got it too work, the problem was that I was connecting everything on the same rails so it would just bypass the transistor and power whatever it was I'm still not sure why it works but it does so I'm happy. I have one question though, so I am using an led as a diode to connect my collector to negative lead of motor to positive lead of motor on bread board and not really sure why that would work but when I put a jumper wire instead on led to replace it, it won't work and the on button flashes different brightness? If I use a jumper wire I would think that I am shorting it out but would think same thing using the diode, is it because if you short it out it would go either way or just back way and when you use a diode it will only let the flow travel the way you want or something? Also if this is the case is there a better way to not have to use a diode this way since if it fails the system would not be able to work, so instead just have the diode direct excess motor noise?

but when I put a jumper wire instead on led to replace it, it won't work and the on button flashes different brightness?

That is because you transistor is just shorting out the power supply.

The reason why an LED works is that it takes some voltage to turn it on so you are not putting a dead short across your supply. However, there is no mention of a series resistor with the LED you always need one otherwise you can burn out the LED or the thing driving it.
I am not too sure what your circuit is. Words will only take you so far with electronics you need to draw a schematic if you want to communicate what you have done to others.

I'm sorry I was looking at a different schematic that did what I said but I found another one and figured out how to do it when combining the two, it was SO easy! I am surprised that I over complicated the circuit that much it take like 3 wires haha thanks for your help!

tyscof:
Is there a way to close this topic, so it shows like solved or something?

Go to your original post, Click the "Modify" gadget (it's on the right), and then edit the Subject by adding [solved]

tyscof:
The + rail connects to collector
The motor goes between emitter and common ground

No, man, that's what you were doing before.
It should be as in the attached picture, but with the motor in place of fan.
(9V vs 12V, all these being equal, etc)

fan_NPN.JPG

Ok gotcha now I have it with the + to motor and the negative to collector and emitter connected to common ground.