Stepper Motor Controller with H-Bridge

A lot of precision controlled elements in the world are moved using stepper motors. Stepper motors are pretty complicated when compared to simple DC motors. This complexity is where their precision originates. And in order control something that is complex, you need a controller that is also complex: an H-bridge circuit board.

Stepper Motors

Stepper motors are very precise.Stepper motors have copper coils like DC motors do, but instead of being wrapped around a shaft, they are grouped into clusters around the shaft. Fitted to shaft is a gear with teeth. When each coil of copper is fed an electric current, it produces a magnetic charge that pulls the nearest teeth of the gear towards itself. If they are fed electricity in sequence, the shaft will rotate in a smooth motion. This requires a bit of computation to make sure they are switched on in order, at the right speed etc. This is where the H-bridge makes its entrance into this conversation.


An H-bridge is essential two pairs of transistors that are wired together. Transistors are essentially switches that are activated by a small charge which can be sent by an Arduino. When wired correctly, often in an H-bridge configuration, transistors can be used to reverse the direction of current in a circuit. As a result, they are often used to control DC motors giving them the ability to go both forwards and backward without rewiring. H-bridges can be made with 4 transistors and a breadboard, but it’s much more convenient to use a fully assembled H-bridge that is the size of Jolly Rancher. The model I used in this assignment was a Texas Instruments L293DNE.  The L293DNE (and most other models) have 4 logic pins, 4 ground pins, 4 pins to send voltage to the motor, 3 voltage in pins, and 1 pin for the motor’s power source. By sending charges to each of the different logic pins at different times, the 4 voltage-out pins are activated one by one, sending current to the two different copper coils in the stepper motor in either forwards or backward directions.

This image explains how the different combinations of current can move a stepper motor to 4 different positions.

Breadboard Prototype

Using this lab as a guide, we got to work on prototyping our circuit boards with breadboards. I managed to fry my Arduino Uno by wiring one of my Arduino’s pins to a live voltage pin. I switched to my Arduino 101, and found out after plenty of trial and error that it didn’t work with an Arduino 101.

My breadboard H-bridge circuit wired to an Arduino 101. This didn’t work.

I actually started over completely from scratch with a new breadboard and even new jumper wires to make sure there was no problem there.

This finally worked. Even though I started over from scratch, the real problem was actually the Arduino.

Final H-Bridge Circuit

After disassembling each part numerous times and reassembling over and over, I knew the entire wiring layout by heart. I used that knowledge to draw a quick sketch of what I wanted my final H-bridge circuit to look like.

My initial sketch of the H-board circuit. A couple of things are different in my final build, but for the most part it’s the same.

I wanted to make sure it was really clean-looking, so I chose to bend all my wires at 90 degrees. This was a great exercise to hone my soldering skills as well, which I only started doing last semester.

I used tape to keep the wires in place while I soldered.


The first jumper cables connected to the H-bridge.
I wanted to minimize the amount of wire crossing to the very least amount possible and to have all of the wires run in orthogonal paths.

The final result turned out better than I expected. I only had to use the solder sucker once to fix a wire meant of hole 6 in hole 7. Some of the solder is still visible.

I chose to have all of the wires connecting to logic pins run up and over, shown in blue, and all of the voltage out wires run down and over to avoid crossing paths.
The back looks pretty clean also.

Fortunately, unlike with the breadboard prototype, the H-bridge worked on the very first try.

The H-bridge circuit in action.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.