Posts Tagged ‘motors’

Motors Demo

25 October 2017


I don’t use motors much in my projects, but they are everywhere now on our very mechanical world. So I am always running into them, and had a bunch set aside mostly from tearing down old printers. I have been particularly interested in stepper motors, as I had read about them a long time ago, and they are used a lot in industry.

Stepper Motors

This isn’t going to be a huge technical article, but: Stepper motors are used for positioning in all sorts of equipment, computer printers just being one example. They are designed to be moved an exact rotational amount (by counting the step signals sent to the motor) and to hold that position while energized.

The ordinary stepper motor is driven by two overlapping signals, as mentioned in my recent post about SerDes design. Finding new data about how these motors are driven inspired me to take another shot at creating a working driver. My previous attempt, based on sine waves amplified by audio amps, had not been successful.

Design by Numbers

Here is a rear view of my project, with numbers added to match the discussion below:


  1. AC terminals and connectors. I like to run my projects off AC-powered supplies. I get them cheap from thrift stores. Usually they are “wall warts” or otherwise portable / external power supplies, and I remove the plastic cover and use the board inside. Sometimes I keep half the cover if it helps for mounting purposes.The funny thing about all modern power supplies is that the first thing they do is convert your AC power to DC. Then they step down the DC (about 120V in the US, about twice that in many other places) to the power supply voltage. Most of these modules provide good regulation, because that’s built into the controller electronics, and it helps protect people and equipment.
  2. I stacked the two power supplies I used. The top one runs my control electronics. Most of it is 5V, but I also have some 12V relays.
  3. I used a 9 volt 3-1/2 amp module to run the motors. These are a little hard to find, so when I run across one I grab it for later use. 5V supplies are ubiquitous, as they are used now for phone chargers (phones generally have 4V batteries). But other voltages and power levels can be more scarce.
  4. Next in line is a board that monitors the motor supply for voltage and current output. You can buy panel meters with these features built in, but I built my own, as it’s not too hard. It then feeds generic panel meters. The hardest part to get right on this board was the current shunt. I used a bunch of SMT (surface mount) resistors in parallel.
  5. The motor driver module was purchased online from China. This particular one had some problems, and I basically had to repair it before I could use it. That sometimes happens with cheap stuff from China. They had installed the wrong part to function as a 5V auxiliary supply. It was supposed to be a fixed-voltage part and an adjustable-voltage part was installed. So I had to lift the adjustment pin off the board and add some components to get my 5V output.One of the drivers was also poorly soldered, so I went over the solder joints and added more solder as needed.

    The board uses a part that has been around for a long time (LM298). It is designed to drive stepper motors. It has four logic-level inputs (plus enable) and four power outputs. It can work up to 48V. I had planned to add a second higher-voltage motor driver supply to the project, but all the motors worked fine with 9V, so I left it out.

    You have to feed the driver the correct signals, and I made two more boards to do that. One board provides the four steps needed to generate the “quadrature” drive pattern and a pulse-width-modulated (PWM) signal to vary the amount of drive. The other board converts these signals to those needed to feed to the driver board.

  6. Another board just gets all the connections right.
  7. I used a four-position rotary switch to select between four different motors. Only one is a stepper motor. The ordinary DC motors are very easy to power on; you just apply power. You can modify their speed somewhat by changing the drive voltage or using a PWM signal which essentially does the same thing. I used one driver IC on the driver board to power the DC motors. I paired up the four drivers to make two. I can run the load in forward, reverse or braking mode.
  8. Here are the front panel controls for stepper speed, PWM, and forward – brake – reverse.
  9. Cheap panel meters from China indicate the drive voltage and total current being used. They have a nice auto-ranging feature which makes them usable up to about 50 volts input. Their electronics run on 5 volts. These digital meters only have three decimal places, but that was enough for this application.

Closing Comments

The biggest problem with motors is having them stall out due to mechanical overload, which can ruin both the motor and the drive electronics. As these motors are running no-load, that’s not a problem. You can grab the motor shaft with your fingers if you want to, and see what mechanical loading does to the current draw. But for real use, the electronics should include overcurrent protection to turn the power off if the motor stalls. Many industrial motor drivers also monitor motor temperature, which is another way to tell that something is going wrong with your motor.

I am very happy that I was finally able to get my stepper motor to run (both forwards and reverse!) and at a variety of different speeds. It turns out steppers are a bit sensitive to what speed you drive them at. Try to go too fast and they just won’t run. Go too slow and they use too much power (though there are ways around this). Most steppers have an optimum speed, and in most applications, you will see them operated at a constant speed, or maybe two, high and low (like in a scanner).

The driver module was designed for robotics hobbyists. It’s a neat design, but not well-documented. I had to look up the datasheets for the various parts used to get details. This is par for the course in hobby electronics.