loading

Hello everyone. I just decided to make something easy and accessible to everyone. I saw a lot of videos and descriptions how to build an remotely controllable cars, truck. So my point is to invest as little as possible of efforts and money to build something incredible and useful toy. I wonder if I could keep in mind the operation by remote control, but in the same time I would like to improve my abilities and implant a bluetooth overall so make it possible to control via bluetooth and via remote control.

Step 1: Installing the Connectors in the Rear Side of the Truck

We simply need to make some entrance for connectors which consists of 5 wires (DTR, RX, TX, GRND and +5V VCC). You don't really need to connect 3.3V to GRND (nothing will happen seriously but you will not be able to upload your sketch on Arduino).

Step 2: Connect Male Side of Wires to Arduino Pro Mini

Once you connected them, you can apply some force to bend the terminals like "L" and then solder to arduino board.

Step 3: Upload the Sketch

/* DTR connexion is on left side from back look. 3.3 V pin is free (not connected)

Enable 1 on A0 and Enable 2 on A1

Motor A, rear motor (pin 2 and pin 4) motor B front motor (pin 6 and pin 8)

*/

const int pinMA1=2;

const int pinMA2=4;

const int pinMB1=6;

const int pinMB2=8;

const int Enable1=A0;

const int Enable2=A1;

int Byteout=0;

int space=32;

float val=255;

void setup(){

Serial.begin(9600);

pinMode(pinMA1,OUTPUT);

pinMode(pinMA2,OUTPUT);

pinMode(pinMB1,OUTPUT);

pinMode(pinMB2,OUTPUT);

pinMode(Enable1,OUTPUT);

pinMode(Enable2,OUTPUT);

}

void loop(){

if(Serial.available()>=0){

char Byteout=Serial.read();

Serial.write(space);

Serial.print("Enable1=");

Serial.print(Enable1);

digitalWrite(Enable1,LOW);

Serial.write(space);

Serial.print("Enable2=");

Serial.print(Enable2);

digitalWrite(Enable2,LOW);

if(Byteout=='w'){ //Move forward

Serial.print("forward A");

Serial.write(space);

digitalWrite(pinMA1, HIGH);

digitalWrite(pinMA2, LOW);

char Byteout=Serial.read();

analogWrite(Enable1, val);

}

if(Byteout=='q'){ //Turn left and move forward

Serial.print("left && forward");

Serial.write(space);

digitalWrite(pinMA1, HIGH);

digitalWrite(pinMA2, LOW);

digitalWrite(pinMB1, LOW);

digitalWrite(pinMB2, HIGH);

char Byteout=Serial.read();

analogWrite(Enable1, val);

analogWrite(Enable2, val);

}

if(Byteout=='e'){ //Turn right and move forward

Serial.print("right && forward");

Serial.write(space);

digitalWrite(pinMA1, HIGH);

digitalWrite(pinMA2, LOW);

digitalWrite(pinMB1, HIGH);

digitalWrite(pinMB2, LOW);

char Byteout=Serial.read();

analogWrite(Enable1, val);

analogWrite(Enable2, val);

}

if(Byteout=='s'){ //Move backward

Serial.print("backward A");

Serial.write(space);

digitalWrite(pinMA1, LOW);

digitalWrite(pinMA2, HIGH);

char Byteout=Serial.read();

analogWrite(Enable1, val);

}

if(Byteout=='a'){ //Move backward

Serial.print("backward A");

Serial.write(space);

digitalWrite(pinMA1, LOW);

digitalWrite(pinMA2, HIGH);

digitalWrite(pinMB1, HIGH);

digitalWrite(pinMB2, LOW);

char Byteout=Serial.read();

analogWrite(Enable1, val);

analogWrite(Enable2, val);

}

if(Byteout=='d'){ //Move backward

Serial.print("backward A");

Serial.write(space);

digitalWrite(pinMA1, LOW);

digitalWrite(pinMA2, HIGH);

digitalWrite(pinMB1, LOW);

digitalWrite(pinMB2, HIGH);

char Byteout=Serial.read();

analogWrite(Enable1, val);

analogWrite(Enable2, val);

}

if(Byteout=='x'){ //Turn right

Serial.print("forward B");

Serial.write(space);

digitalWrite(pinMB1, HIGH);

digitalWrite(pinMB2, LOW);

char Byteout=Serial.read();

analogWrite(Enable2, val);

}

if(Byteout=='z'){ //Turn left

Serial.print("backward B");

Serial.write(space);

digitalWrite(pinMB1, LOW);

digitalWrite(pinMB2, HIGH);

char Byteout=Serial.read();

analogWrite(Enable2, val);

}

if(Byteout=='h'){ //Breaking all motors high

Serial.print("high A && B");

Serial.write(space);

digitalWrite(pinMA1, HIGH);

digitalWrite(pinMA2, HIGH);

digitalWrite(pinMB1, HIGH);

digitalWrite(pinMB2, HIGH);

char Byteout=Serial.read();

analogWrite(Enable1, val);

analogWrite(Enable2, val);

}

if(Byteout=='l'){ //Breaking all motors low

Serial.print("low A && B");

Serial.write(space);

digitalWrite(pinMA1, LOW);

digitalWrite(pinMA2, LOW);

digitalWrite(pinMB1, LOW);

digitalWrite(pinMB2, LOW);

char Byteout=Serial.read();

analogWrite(Enable1, val);

analogWrite(Enable2, val);

}

}

delay(500);

}

Step 4: Favorite Part Is to Connect L298N to 2 Motors

You can refer on L298N motor driver picture. There is the rest information how to connect the L298N to the motors and to Arduino. You can skip 10 OHM resistor which links the GRND with current sensor. Enable1 and Enable2 pins goes to A0 and A1 respectively. Pins 2, 4 ,6, 8 on Arduino plugs to motor A and motor B.

Step 5: L298N (motor Driver Chip)

Every single pin on L298N chip should be linked to motors to Arduino, to power supplying the chip, for power supplying the motors and 2 wires Enable1 and Enable2 to GRND. GRND linked to GRND Arduino board. No free pins should be left on L298N.

Step 6: L298N Chip

10OHM resistor is heating up, you can try to mount something greater than 10OHM, but the current will get too imitated and current sensing will not work. You will be not able to rotate the motors direct and opposite senses..

Step 7: Arduino Pro Mini to Converter FTDI

If you don't see your port in Serial port. It does not mean that your connexion is wrong. You should probably go check your FTDI drivers for Arduino pro mini. You can go:

https://learn.sparkfun.com/tutorials/how-to-instal...

Step 8: Connexion Arduino Board to Bluetooth

This diagram illustrates how to provide 3.3V to bluetooth's RX from TX Arduino's board pin. The only thing is different is the board itself. I am using Arduino Pro Mini (I find it more practical for projects like this).

Step 9: SPDT Switch

SPDT switch provides the power from the 7.5V batteries to RAW pin of arduino UNO. In case, when a remote control is used this switch cuts the power off of arduino Pro Mini board and it allows to save the power. Another switch would be preferable to access to VCC of bluetooth. Instead of open up each time the truck and take away VCC's bluetooth, that would be easier to switch the power to upload the sketch.

<p>Thank you! I am very glad you appreciate it. ROBOTRON is also my creation. I just build it with things I had around me. And I used 4 transistors IRLU014 per motor, Arduino UNO', bluetooth XBEE and LED's to dissipate over current. </p>
<p>Very cool!</p>

About This Instructable

1,532views

17favorites

More by ngrigoriev:RFID and wireless transmission   RFID RC522 and normal DC motor RTCModuleDS1302 and LCDI2C16x02  (A0, A1, A2 not soldered-without a bridge) 
Add instructable to: