2 Bit u Stepper using microcontroller Using Atmega

2 Bit u Stepper

This is the second stepper motor driver circuit I build. The first one had 4 linear current sources and got so hot it was barely usable. It had some cool leds though. When I was searching for a better schematic on the internet I couldn’t find any to my linking. I did find some commercial micro steppers but they were all prohibitively expensive and had lots of electronics on a circuit board. Time to design my own. The result is the picture on the right which is from the Millproject and on the top board are 4 stepper motor circuitss

2 Bit u Stepper

The main characteristics of this stepper are:
  • Controls a bipolar motor.
  • Uses the well known L298 (2Ampere) driver IC.
  • PWM to limit power consumption.
  • Microcontroller controlled, Easy to add more bits or other functions.
  • Uses 2-bit micro stepping.
  • Has step and direction inputs.

The hardware.

The microcontroller has 2 simple DA converters. One for each motor winding. Note that these DA converters are not linear. They are not supposed to be. To control a stepper motor with the smoothest speed, the input to the phases should be 2 sine waves with a 90 degree phase difference. The output of the DA converters goes into the input of a comparator. The comparator compares this reference voltage with the motor current. (Voltage over the 0.47 Ohm resistors). If the current reaches the limit a flip-flop is reset (7474), which turns of the L298 drivers. The 2 flip-flops are set at a steady rate by the microcontroller to turn the motor current back on. The width of the PWM pulses is determined by the self induction of the motor coils and the load of the motor.

The software.

At initialization the smallest interrupt routine I ever wrote is set up to trigger at a regular interval. This interrupt just generates a 1 instruction wide pulse to set the flip-flops and turn the motor current on. The main loop is almost as simple. It waits for a rising edge on the step input.

Dimmer

I made this project for Leo, a brother of mine. We had an old remote control of a video recorder laying around and he wanted some dimmers for all the lights in his house. I didn’t have much experience with programming microcontrollers at that time but I was willing to start something new. The basic hardware was built within 2 weeks of spare time and I got the software working in one or 2 months more. After I thought the project was finished the requirements changed a few times and I was stupid enough to accept those changes as an extra challenge. One change was an extra light switch to turn one light channel on so you wouldn’t have to search for the remote control in the dark if you come home late. And another was for the control of some motorized curtains.

Read more: 2 Bit u Stepper using microcontroller

Leave a Comment

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