# Unipolar stepper motor and a MCU

I have been trying to steer unipolar stepper motor (5V, 0.7A) using microcontroller powered only by USB (5V or smthing like that). The motor clicking got louder but the motor doesn't move yet.

I tried to lower resistance of R1, R2, R3 and R4 and motor cliks got louder, but when I completely removed these resistors it again clicked more silently... Does anyone have any idea on how to make this motor turn as it should?

I used ohm meter to measure the internal resistance which was 5Ω and I am affraid to lower R5, R6, R7 and R8 any more as my external power supply isn't very strong plus I might damage transistors...

When I tested the motor all by itself with no microcontroller It did turn if approximately 0.3A current flow through the windings. Maybee my:

• transistor isn't fully opened
• current through the windings in motor is too low
• my external power supply can't handle it (this is not an option for me :S i have to make it work lol)

Schematic:

Closeup of the right part of the schematic:

EDIT: This is the circuit schematic after I consulting with you guys:

I hope this will do the trick.

• What model are the transistors T1-T4? Could you post a link to the datasheet? Feb 28, 2014 at 23:20
• Also mention the mcu you are using, best case it can provide about 20-30mA from I/O pins, so even if you are using a Darlington transistor the base resistor is way too low. Feb 28, 2014 at 23:23
• @Nick Alexeev Transistors are this ones: onsemi.com/pub_link/Collateral/BC546-D.PDF @ alexan_e I am using LPC3141 here is the datasheet: nxp.com/documents/data_sheet/LPC3141_43.pdf
– 71GA
Feb 28, 2014 at 23:30
• There are a few things I'm not clear about. You say the supply is from USB but your schematic shows a 12V supply. The motor rating is 5v/0.7A with coil resistance 5 Ohm. You place each coil in series with a 37 Ohm resistor so the voltage that reaches the motor is 5/(37+5)=1.42v is this just for testing purpose? Also the shown 12v supply rating is 0.31A but your motor current rating is more than double that. Mar 1, 2014 at 0:26
• @alexan_e USB supplies only microcontroller and is 5V. It can only be seen from the first image (top left corner). +12V is an external adapter capable of producing only 0.31A which is half as much as the motor needs. But in order not to fry my motor too I chose to settle for a lower current. This is a testing circuit correct. Really nice deduction btw.
– 71GA
Mar 1, 2014 at 21:29

Did you read the transistor rating of BC546 in the datasheet, Collector Current − Continuous IC 100 mA dc.

Your mcu specs mention an absolute max or 4mA as output current (you have already exceeded that with the base resistor you have used).

You need to select a more powerful transistor and a high gain Darlington would suit your needs, a device like TIP120

Your mcu is a 3.3v device and a Darlington transistor needs about 1.5v between base-emitter so a resistor of about (3.3v - 1.5v)/0.003A = 600 ohm should do or slightly higher to 620 Ohm

If you don't have a Darlington available you can use two discrete transistors in a Darlindton configuration to increase the current gain.

simulate this circuit – Schematic created using CircuitLab

Note that I've uses a 1A transistor for Q1.
You'll need four of these, one for each coil.

• @alexan_c That is not a Darlington, the collectors should be connected together for a Darlington. A MOSFET might be easier. Mar 1, 2014 at 15:30
• @71GA TIP121 is fine. So the mcu got damaged completely or just the specific pin or maybe one port? There is a lesson to be learned, always check the max current that a device can provide before trying to utilize the I/O pins. Another case that may damage the chip is when all pins are below the max current individually (which seems fine) but in total add to over the max rating for the port of the mcu supply, so make sure to check that parameter too in case you drive devices like seven segment displays. Mar 1, 2014 at 19:40
• @71GA I think the main cause was the I/O over current but I can't be sure of what got damaged. The purpose of the diodes is to protect the transistor, I don't see how they can help protect the MCU. Maybe in the future you should consider using a buffer like 74HC244 between the board and external circuit, at least when you are experimenting. Mar 1, 2014 at 20:30
• @71GA Yes, that will do, it feeds the base with about 2mA. In case the motor doesn't move you may need to lower the resistor values connected in series with the motor (R5/R6/R7/R8). Also note that these four resistors currently (37 Ohm) have to dissipate about 3W each so I hope they are not 1/4W type Mar 2, 2014 at 11:23
• Just to let readers know. This works! Thank you all who participated.
– 71GA
Mar 5, 2014 at 18:15