Motor Driver Using 555 Timer IC

Written by: admin@makezilla

Picture of Motor Driver Using 555 Timer IC555_Motor_Driver.jpg

I am living in a small town, 60 miles away from province capital city. It is impossible for me to get a motor driver to start a robot or RC project. Even if I wanted to build my own motor driver, it is hard to find the chips such as L298 Dual H-Bridge. What about online shop? In many cases, the shipping cost will be more expensive than the chip itself.

Thanks to Steve Hobley who finds a way using this popular tiny 555 Timer Chips to control a DC motor. His projects in Makezine can be read here. 555 Timer IC is easy to find on the market even in a small town where I live. Based on his project, I try to connect it to Arduino to control motors and this is what I used on my Android Controlled Arduino Bluetooth Panzer before I purchase Keyes L298N motor driver from dx.com with free shipping :)

I think it is easier for you to connect all the wires using the diagram above. If so, you can finish your wiring and jump to Arduino sketch section for testing. I will go on with my wiring photos.

Step 1: Ingridients

Picture of Ingridients

  • 2 pieces of 555 Timer Chip.
  • A mini breadboard.
  • A mini switch (optional).
  • A 7,4V or 9V battery.
  • An Arduino Uno R3
  • A small power rating DC Motor.
  • Some breadboard jumper cables.

Note : This project only works for standard 1.5V to 3V Tamiya DC Motor. Any higher power rating DC Motor will not move because 555 Timer IC has limited output power.

Step 2: Fabrication

Picture of FabricationIMG_20150312_093311.jpg

If you are not familiar with 555 Timer IC, here is the schematic of its internal components and pinouts.

Put two 555 Timer ICs (pin 1 on bottom left) in the middle of breadboard with a little space in between because we will plug many jumper wires here. I already have my mini switch on top left. At bottom left you see black spot, just ignore it. It was burnt on testing, so I mark it black :P And you see on the right side I have link the top and bottom VCC rails and Ground rails.

Step 3: Wiring The Chips

Picture of Wiring The ChipsIMG_20150312_103223.jpgIMG_20150312_103320.jpgIMG_20150312_144123.jpg

I will explain my photos with my wire colors, you can use whatever colors you like :)

Photo 1 : Blue wire connects pin 4 and pin 8. Do this for both chips.

Photo 2 : Green wire connects pin 2 and pin 6. Do this for both chips.

Photo 3 : White wire connect pin 5 of the first chip to pin 5 of the second chip.

Photo 4 : Another White wire connect pin 3 (output) of the first chip to pin 2 (trigger) of the second chip.

Step 4: Even More Wires

Picture of Even More WiresIMG_20150312_144858.jpgIMG_20150312_151027.jpg

We are getting more wires, so keep your eyes open :D As long as you follow the pins number, you won't get lost. My photos are only for references.

Photo 1 : Green wire connect pin 3 of first chip to motor terminal. Blue wire connect pin 3 of second chip to another terminal.

Photo 2 : Black wire connect pin 1 to Ground. Do this for both chips.

Photo 3 : Black wire connect pin 8 to VCC. Do this for both chips.

Step 5: Connecting Arduino and Battery

Picture of Connecting Arduino and BatteryIMG_20150312_151244.jpgIMG_20150312_151628.jpgIMG_20150312_151738.jpgIMG_20150312_152900.jpg

Photo 1 : Orange wire goes from First Chip pin 2 to Arduino pin ~3.

Photo 2 : White wire goes from First Chip pin 5 to Arduino pin 2.

Photo 3 : Red wire goes from Breadboard VCC Rail to Arduino VIN. Black wire goes from Breadboard Ground Rail to Arduino GND.

Photo 4 : White wire connects Breadboard VCC Rail to Switch terminal (I am out of red wires here).

Photo 5 : White wire connects another Switch terminal to Battery +. Black wire goes from Breadboard Ground Rail to Battery -.

Now we are done. ( ^_^ )

Step 6: Arduino Sketch

 

/*

* Chienline @2014 -==:: 3 Volts DC Motor Driver with Dual 555 Timer IC ::==- * Control Pin from 555 IC is needed to STOP the motor * Trigger Pin from 555 IC is needed to drive forward or backward * PWM on Trigger Pin is used to set the speed * Note : Forward and Backward is interchangeable via Motor connection. */

int controlPin = 2; // 555 pinout 5 int triggerPin = 3; // 555 pinout 2

// the setup routine runs once when you press reset:

void setup() { pinMode(controlPin, OUTPUT); pinMode(triggerPin, OUTPUT); }

// the loop routine runs over and over again forever: void loop() { // move FORWARD; digitalWrite(controlPin, HIGH); digitalWrite(triggerPin, HIGH); //full speed delay(3000); // PWM testing to control motor speed // analogWrite(triggerPin, 128+70); //minimum speed (128+70) // delay(3000);

// STOP; digitalWrite(controlPin, LOW); digitalWrite(triggerPin, HIGH); delay(3000);

// move BACKWARD; digitalWrite(controlPin, HIGH); digitalWrite(triggerPin, LOW); //full speed delay(3000);

// PWM testing to control motor speed

// analogWrite(triggerPin, 128-70); //minimum speed (128-70) // delay(3000);

// STOP; digitalWrite(controlPin, LOW); digitalWrite(triggerPin, HIGH); delay(3000);

}

Step 7: Testing

Picture of TestingIMG_20150312_153600.jpgIMG_20150312_153605.jpg

 

Put some tape on the rotor. I have clear tape only, so I cut a piece of paper forming "U" shape as in photo number 2. Put it as high as the rotor so that we know where it flaps. The direction is interchangeable in the code or on the motor terminals connection (those are pin 3 on the first chip and the second chip).

Step 8: Let's Go Further

Picture of Let's Go Further

 

Now let's make two of it to build Dual Motor Driver. I simplify it by using tiny wires from network cable. Connect it to my previous Bluetooth Panzer. Tadaaaa...

That is a video showing the panzer moves forward and backward.

 

 

 

 

Step 9: Furthest : Bluetooth, Controlled by Android Phone

Picture of Furthest : Bluetooth, Controlled by Android Phone

 

See my previous bluetooth panzer without camera. It is controlled by Android Phone. Four 555 Timer ICs drive its dual dc motors. Do not expect speed :D

Connect to the diagram above and upload this sketch:

 

/*
Chienline @ 2014 Controlling an Arduino car/tank using an Android phone over Bluetooth connection. Android Software : Arduino Bluetooth RC Car by Andi.Co [in PlayStore]. Some codes are changed from the Official codes to get it works with my DIY Motor Driver. */

char dataIn = 'S'; //Character/Data coming from the phone. S=Stop; int LCPin = 2; // 555 pinout 5 Left Motor int LTPin = 3; // 555 pinout 2 Left Motor int RCPin = 4; // 555 pinout 5 Right Motor int RTPin = 5; // 555 pinout 2 Right Motor

int pinfrontLights = 6; //Pin that activates the Front lights. int pinbackLights = 7; //Pin that activates the Back lights. char determinant; //Used in the check function, stores the character received from the phone. char det; //Used in the loop function, stores the character received from the phone. int velocity = 0; //Stores the speed based on the character sent by the phone.

void setup() { Serial.begin(9600); //Initialize serial communication with Bluetooth module at 9600 baud rate. pinMode(LCPin, OUTPUT); pinMode(LTPin, OUTPUT); pinMode(RCPin, OUTPUT); pinMode(RTPin, OUTPUT);

pinMode(pinfrontLights , OUTPUT); pinMode(pinbackLights , OUTPUT);

//Stop both motors on power up. stopMotors(); }

void loop() { det = check(); while (det == 'F') //if incoming data is a F, move forward { moveForward(); det = check(); } while (det == 'B') //if incoming data is a B, move back { moveBackward(); det = check(); }

while (det == 'L') //if incoming data is a L, move wheels left { moveLeftForward(); det = check(); } while (det == 'R') //if incoming data is a R, move wheels right { moveRightForward(); det = check(); } while (det == 'I') //if incoming data is a I, turn right forward { moveRightForward(); det = check(); } while (det == 'J') //if incoming data is a J, turn right back { moveRightBackward(); det = check(); } while (det == 'G') //if incoming data is a G, turn left forward { moveLeftForward(); det = check(); } while (det == 'H') //if incoming data is a H, turn left back { moveLeftBackward(); det = check(); } while (det == 'S') //if incoming data is a S, stop { stopMotors(); det = check(); }

//Front Lights and Back Lights on/off are cool, but for starting I haven't connect them to my circuit. //But i leave the detection in the code for further use. while (det == 'U') //if incoming data is a U, turn ON front lights { digitalWrite(pinfrontLights, HIGH); det = check(); } while (det == 'u') //if incoming data is a u, turn OFF front lights { digitalWrite(pinfrontLights, LOW); det = check(); } while (det == 'W') //if incoming data is a W, turn ON back lights { digitalWrite(pinbackLights, HIGH); det = check(); } while (det == 'w') //if incoming data is a w, turn OFF back lights { digitalWrite(pinbackLights, LOW); det = check(); } }

int check() { if (Serial.available() > 0) //Check for data on the serial lines. { dataIn = Serial.read(); //Get the character sent by the phone and store it in 'dataIn'. // Serial.println(dataIn); //this line is for debugging using Arduino serial monitor. if (dataIn == 'F') { determinant = 'F'; } else if (dataIn == 'B') { determinant = 'B'; } else if (dataIn == 'L') { determinant = 'L'; } else if (dataIn == 'R') { determinant = 'R'; } else if (dataIn == 'I') { determinant = 'I'; } else if (dataIn == 'J') { determinant = 'J'; } else if (dataIn == 'G') { determinant = 'G'; } else if (dataIn == 'H') { determinant = 'H'; } else if (dataIn == 'S') { determinant = 'S'; } //----------------------------- //Standard DC Motors are not fast enough to play with velocity. //You can set the velocity using 555 Trigger Pin with analogWrite(); //I bet you don't want to make your tank slower than its higest speed using standard DC Motors. /*----------------------------- else if (dataIn == '0') //velocity = 0 - 9, q = top speed. { velocity = 20; // value = 0 - 255; "velocity" does not need to be returned. } -------------------------------*/ else if (dataIn == 'U') { determinant = 'U'; } else if (dataIn == 'u') { determinant = 'u'; } else if (dataIn == 'W') { determinant = 'W'; } else if (dataIn == 'w') { determinant = 'w'; } } return determinant; }

//These direction functions are designed for 555 Motor Driver //You need to change them to suit your other motor drivers.

void moveForward(){ digitalWrite(LCPin, HIGH); digitalWrite(LTPin, HIGH); //L-Forward digitalWrite(RCPin, HIGH); digitalWrite(RTPin, HIGH); //R-Forward }

void moveBackward(){ digitalWrite(LCPin, HIGH); digitalWrite(LTPin, LOW); //L-Backward digitalWrite(RCPin, HIGH); digitalWrite(RTPin, LOW); //R-Backward }

void stopMotors(){ digitalWrite(LCPin, LOW); digitalWrite(LTPin, HIGH); //L-Stop digitalWrite(RCPin, LOW); digitalWrite(RTPin, HIGH); //R-Stop }

void moveLeftForward(){ digitalWrite(LCPin, HIGH); digitalWrite(LTPin, LOW); //left wheel backward digitalWrite(RCPin, HIGH); digitalWrite(RTPin, HIGH); //right wheel forward }

void moveRightForward(){ digitalWrite(RCPin, HIGH); digitalWrite(RTPin, LOW); //right wheel backward digitalWrite(LCPin, HIGH); digitalWrite(LTPin, HIGH); //left wheel forward }

void moveLeftBackward(){ digitalWrite(LCPin, HIGH); digitalWrite(LTPin, HIGH); //left wheel forward digitalWrite(RCPin, HIGH); digitalWrite(RTPin, LOW); //right wheel backward }

void moveRightBackward(){ digitalWrite(LCPin, HIGH); digitalWrite(LTPin, LOW); //left wheel backward digitalWrite(RCPin, HIGH); digitalWrite(RTPin, HIGH); //right wheel forward }

Leave a Reply