2
\$\begingroup\$

My current project does involve some DC motors which I have to control the speed of. I'm will probably use the PWM pins of my arduino mini for this.

Currently I am building my first prototype of the setup so I can test the PWM. I have the motor connected to a 9V block battery, so my motor has enough power to run. The main control mechanism would be a NPN Transistor which would get its base from an optocoupler, since I want the arduino be isolated from the 9V circuit.

So this leads my to this setup:

[Circuit[1]

My problem with this setup is that my transistor is not working and I'm not exactly sure why. Just to specify the way this circuit is not working. When I am activating my optocoupler nothing is happening. So I tried to identify the problem. I cut the optocoupler in order to see if the transistor is the problem. Since it is somehow still not working I figured out that the transistor has to be the problem. But looking at the spreadsheet of the transistor it looked good so right now I'm at the point where I do not have any idea what the problem is.

The interesting thing about all this is that it all worked out when I tried it with an LED instead of the DC motor. Probably it is something simple I'm missing but I do not spot the mistake.

//EDIT So first of all thank you for all the answers. I know these are stupid mistakes, and I'm kinda hating myself for them, but still thank you for helping me with my first major project outside of high school physics.

With all the help I got to this circuit. Should it work now?

Circuit2.2

I also wanted to ask how I would calculate the different values for the resistors, sice we didn't had any resistor math in class yet.

\$\endgroup\$
8
  • \$\begingroup\$ The optocoupler in your schemtic is connected the other way around. The LED is an "input" and the output is the phototransistor. \$\endgroup\$
    – filo
    Commented May 22, 2017 at 16:06
  • \$\begingroup\$ fixed ty. I didn't noticed this. \$\endgroup\$
    – Ironlors
    Commented May 22, 2017 at 16:25
  • 2
    \$\begingroup\$ Looks like the collector and emitter on the transistor are switched around. The collector of an NPN needs to be V+. Also, the bottom circuit won't work because your base current has to be referenced to the transistor emitter, but V3 is not connected to the emitter at all. There is nowhere for the current to flow through the transistor with only one connection to V3. It's very important to put a current limiting resistor into the base connection, maybe 100 ohms to start. \$\endgroup\$ Commented May 22, 2017 at 16:26
  • 4
    \$\begingroup\$ This example does show why drawing a schematic in the orthodox orientation (horizontal rail lines, higher voltage at top and lower voltage at bottom) makes mistakes easier to spot. \$\endgroup\$
    – TonyM
    Commented May 22, 2017 at 16:32
  • \$\begingroup\$ A diode parallel to motor is very importaint if you want not to burn your NPN. Diode's direction should be - anode to NPN collector, cathode to battery (+). I am talking about the schematic below. The first one got so many errors, that you'd better delete it :) Of course you also need a resistor in series with the optocoupler's LED, and how other said - a resistor in series with NPN's base. A base-emitter parallel resistor is good to be placed too. Optocoupler's collector could go to battery (+). \$\endgroup\$ Commented May 22, 2017 at 18:54

1 Answer 1

0
\$\begingroup\$

You're asking your npn transistor to carry current from emitter to collector, which is opposite to how this transistor needs to work.

\$\endgroup\$
3
  • \$\begingroup\$ That true, but only one of the problems - the "9v block battery" is probably unsuitable for the motor, and the transistor current gain (even when installed the right way around) may not be sufficient. \$\endgroup\$ Commented May 23, 2017 at 3:58
  • \$\begingroup\$ @ChrisStratton The battery should be sufficient, since it is working perfectly when I'm directly connecting the wires, or just use a button instead of the transistor. \$\endgroup\$
    – Ironlors
    Commented May 23, 2017 at 11:00
  • \$\begingroup\$ No, it really will not be sufficient - it might work briefly, but it is a poor and extremely uneconomical choice. But your driver circuit is also poorly selected, as commented on the question itself. \$\endgroup\$ Commented May 24, 2017 at 0:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.