Introduction: My Third Project: Smart Tank Chassis

This new toy is just arrived~ It is a smart tank chassis with L9110 on both side. After reading the datasheet and try to understand it with my very limited knowledge, it is a motor driver chip that can control the rotation direction of a motor directly. That means I can play it without using an additional motor shield because it's just embedded in the tank! : D A board is also included in this tank and this makes the project simpler. : )

Step 1: Parts

Step 2: First Wiring and Testing

I connect IA on the left side to Arduino pin 8 and VCC to + of the battery box. GND is wired to both - of the battery box and Arduino GND. Download the code in elab peers and test it... It moves forward. After that I test IB and it moves backward. I test it again on the other sides and figure out how to control the direction as follow:

Forward: IA on the left side and IB on the right side

Backward: IB on the left side and IA on the right side

Turn left: IB on the left side and IB on the right side

Turn right: IA on the left side and IA on the right side

Step 3: ​Second Wiring and Code

I do the wiring again as follow:

IB on the right side > pin 8

IA on the left side > pin 9

IA on the right side > pin 10

IB on the left side > pin 11

Write the simple code that instructs the tanks moving forward, backward, turn left and then turn right for 10 seconds each and then loop again:

int motorPin = 8;
//right side to IB - forward

int motorPin2 = 9; //left side to IA - forward

int motorPin3 = 10; //right side to IA - backward

int motorPin4 = 11; //left side to IB - backward

void setup() {

Serial.begin (9600);

pinMode(motorPin, OUTPUT);

pinMode(motorPin2, OUTPUT);

pinMode(motorPin3, OUTPUT);

pinMode(motorPin4, OUTPUT);

}

void forward(){

digitalWrite(motorPin, HIGH);

digitalWrite(motorPin2, HIGH);

digitalWrite(motorPin3, LOW);

digitalWrite(motorPin4, LOW);

}

void backward() {

digitalWrite(motorPin, LOW);

digitalWrite(motorPin2, LOW);

digitalWrite(motorPin3, HIGH);

digitalWrite(motorPin4, HIGH);

}

void turnLeft() {

digitalWrite(motorPin, HIGH);

digitalWrite(motorPin2, LOW);

digitalWrite(motorPin3, LOW);

digitalWrite(motorPin4, HIGH);

}

void turnRight() {

digitalWrite(motorPin, LOW);

digitalWrite(motorPin2, HIGH);

digitalWrite(motorPin3, HIGH);

digitalWrite(motorPin4, LOW);

}

void loop () {

forward();

delay(10000);

backward();

delay(10000);

turnLeft();

delay(10000);

turnRight();

delay(10000);

}

Yeah! It moves in the same way! I think I can start adding different modules and let it do more job. Thanks for watching again. See you.