Make Simple Robot

by hallou in Circuits > Robots

387 Views, 0 Favorites, 0 Comments

Make Simple Robot

DSC_0353.jpg
Screenshot_20180203-183715.png
hbridge-500x442.png
41BqE0lVe1L._AC_US218_.jpg
arduino-uno-dip-rev3.jpg

It's easy to make a simple robot that can be controlled with bleutooth, we will use a robot kit, an arduino uno and a l9110 driver, and a bluetooth module for control.

In the end we will download an android application to control the robot.

Connect the Robot Parts

DSC_0349.jpg
DSC_0350.jpg
DSC_0351.jpg
DSC_0352.jpg
DSC_0354.jpg

All you need is to connect the parts of the robot

Programming Step

For programming we use arduino IDE, and we will connect the bluetooth in pins (10, 11) with SoftwareSerial #include <SoftwareSerial.h>

Step 2 is to init driver pins:

#define MOTOR_A_PWM 5 // Motor A PWM Speed

#define MOTOR_A_DIR 7 // Motor A Direction

#define MOTOR_B_PWM 6 // Motor B PWM Speed

#define MOTOR_B_DIR 8 // Motor B Direction

And now we will write functions to control the robot, the functions we need is up, down, left, right, stop each one of them has one parameter (force)

This is an example for up function:

void up(int force){

digitalWrite( MOTOR_A_DIR, HIGH );

analogWrite( MOTOR_A_PWM, -force );

digitalWrite( MOTOR_B_DIR, HIGH );

analogWrite( MOTOR_B_PWM, -force );

}

For decode the received data by the app we will use arduinojson library

First we need to collect the received data :

while (bluetooth.available()) {

char c = bluetooth.read();

if (c == '\n') { break; }

readString += c;

delay(1);

}

now we can decode the data

if (readString.length() >0) {

Serial.println(readString);

JsonObject& root = jsonBuffer.parseObject(readString);

if (!root.success()) {

Serial.println("parseObject() failed");

return;

}

const String angle = root["angle"];

const String _force = root["force"];

}

You can fined the code in https://github.com/Helektrika/BlueControl

for using this code you will download the app in Google Play: https://goo.gl/GHLe4m

bleucontrol
Robot control using bluecontrol