Wheel Robot |
An
Arduino Uno
controller board
and a stepper motor driver board are installed in the
robot. A 12V
battery supply is used for supplying power to the 2 stepper
motors: the driver board and the controller board. The 12V
battery
pack connects to the power jack of the Uno board, the on-board DC-DC
converter steps down and regulates the battery
voltage to a
5V output to supply power to all control and
driver logic
circuitry.
|
Part 2 - Controller and stepper motor drivers |
The
Arduino Uno microcontroller board
is used for this wheel robot control. The Uno is very easy to interface
and
to program. In addition, the stepper motor drivers are needed to
complete
this robot project. There are a few of the off-shelf stepper motor driver
boards and
other open sources products available. The two stepper
motors used in the robot are 12V unipolar. The left and right
motors are being driven independently. I have
made my own version of the stepper motor driver board. The motor driver
board supports dual stepper motor control. Arduino Uno board and stepper motor driver. For a quick test drive, the software will include only the very basic functions of moving forwards, backwards, and rotations. The Arduino programming uses C and provides a lot of open source codes and libraries for many applications that can be used in robotic projects. |
The
library
stepper.h comes with the Arduino C development software download that will be
used
for the test drive programming. The two motors of the robot need be driven independently but this library is not written for
dual
stepper motors. The problem can be fixed by adding two 2 to 1 multiplexer on the motor driver board
schematic. I can use the stepper.h library to simplify the
programming to control the two stepper
motors simutaneously. Because the left and right motors will be turning in opposite directions when the robot is moving in a straight line, the multiplexer will do the mirror wiring on the stepper motors' wire terminals instead. The circuit contains a quad 2 to 1 multiplexer (SN74LS157) and 2 TTL input high voltage and high current output driver (SN75472) for driving each stepper motor. The two-pin connector connects to a 12V battery supply. This 12V power also supplies to the Uno board using a DC plug. |
The Audrino C programming contains two functions, setup() and loop(). It does not have the main() function as the conventional way of C programming. Just for showing a quick test, the program listing only contains the basic movements. The two variables LmotorDIR and RmotorDIR are selecting the 74LS157 multiplexer A and B inputs to control the rotating direction of the left motor and right motor respectively. This selects the pulsing sequence to the stepper motor's winding terminals so the motor can turn in clockwise and counter-clockwise direction. // www.hteck.ca, Oct. 2011 // example code for testing the wheel robot basic movement // Program Arduino Uno board controlling the dual stepper // motors driver board. #include <Stepper.h> Stepper LRStepper(100, 11, 10, 9, 8); #define forward 1 #define reverse 0 #define motorON 0 #define motorOFF 1 #define LmotorDIR 5 #define LmotorEN 4 #define RmotorDIR 7 #define RmotorEN 6 void setup() { pinMode(LmotorDIR, OUTPUT); pinMode(LmotorEN, OUTPUT); pinMode(RmotorDIR, OUTPUT); pinMode(RmotorEN, OUTPUT); LRStepper.setSpeed(30); delay(10000); } void loop() { // move forward digitalWrite(LmotorDIR, forward); digitalWrite(RmotorDIR, forward); digitalWrite(LmotorEN, motorON); digitalWrite(RmotorEN, motorON); LRStepper.step(500); delay(1000); // move backward digitalWrite(LmotorDIR, reverse); digitalWrite(RmotorDIR, reverse); digitalWrite(LmotorEN, motorON); digitalWrite(RmotorEN, motorON); LRStepper.step(500); delay(1000); // rotating, both motors are ON // rotate right, digitalWrite(LmotorDIR, forward); digitalWrite(RmotorDIR, reverse); digitalWrite(LmotorEN, motorON); digitalWrite(RmotorEN, motorON); LRStepper.step(380); delay(1000); // rotate left digitalWrite(LmotorDIR, reverse); digitalWrite(RmotorDIR, forward); digitalWrite(LmotorEN, motorON); digitalWrite(RmotorEN, motorON); LRStepper.step(380); delay(1000); // turning, only one motor is ON // turn right digitalWrite(LmotorDIR, forward); digitalWrite(RmotorDIR, forward); digitalWrite(LmotorEN, motorON); digitalWrite(RmotorEN, motorON); LRStepper.setSpeed(30); LRStepper.step(50); digitalWrite(RmotorEN, motorOFF); LRStepper.step(190); delay(1000); // turn left digitalWrite(LmotorDIR, forward); digitalWrite(RmotorDIR, forward); digitalWrite(LmotorEN, motorON); digitalWrite(RmotorEN, motorON); LRStepper.step(50); digitalWrite(LmotorEN, motorOFF); LRStepper.step(190); delay(5000); } |
Menu | previous |