Introduction: Very Simple Robot for Beginners

This instructable shows you how to make very simple robot. It will detect obstacles and avoiding it. This is great project for someone who is new to arduino and want to make first robot.

Why robot?

Because it's great way to learn arduino programming and how e.g. motor driver works. In addition It's nice feeling when you build your first robot and its detects and avoids objects.

Why this kit is good for start?

When I started with arduino I don't know what e.g. H bridge means, which sensors or motors to buy. This kit is very practical, because you don't need to buy anything else to build your own robot. Only you need is screwdriver, zip-ties, nippers and arduino IDE.

Step 1: Parts

In this instructable I will use kit from gearbest.com:

http://www.gearbest.com/kits/pp_226901.html?lkid=10111319

Because it is only 50$, it's pretty cheap and in this kit you have all things that you need to start with arduino. Instead of 6 x 1.5V batteries I use my 6V accumulator because I haven't 6 batteries. Additionally you need 2 zip-ties to fasten ultrasonic sensor.

What you can find in the kit?

- arduino clone

- motors driver

- motors

- ultrasonic sensor

- servo

- plastic plates to build a chassis

- pieces of plastic to fasten a servo

- wheels (two big and one small)

- cables

- 6 x 1.5V and 9V battery holder

- USB cable

- some small screws and other stuff

Step 2: Chassis Building

This chassis is very easy to build, it came with fitted motors, rear wheel and motor driver. On the video you can see what is inside the pack and how to build it. If this video is too fast for you, you can slow it down in video options on YouTube.

Step 3: Connection

Sorry, that I added notes with names of pins but I can't find this parts on the internet. I connect all things without breadboard. If you have any questions leave a comment. I have not used breadboard to simplify connection and so looks less complicated.

Step 4: Program

In comments I explained what each line makes. This is very simple code I have hope that you understand it.

/*
* Code wrtitten by Nikodem Bartnk * visit: * https://www.instructables.com/member/Nikus/ * http://arduinopolska.cba.pl/ * https://spongepie.com/ * * C by Nikodem Bartnik * If you have question you can write here: * nikodem.bartnik@gmail.com */

//speed of motors betwen 0 and 255, if you like you can change it int pwm_speed = 255; //trig of ultrasonic sensor int trig = 12; //echo of ultrasonic sensor int echo = 13;

void setup() {

//pins for motor controller pinMode(11, OUTPUT); pinMode(10, OUTPUT); pinMode(9, OUTPUT); pinMode(6, OUTPUT); pinMode(5, OUTPUT); pinMode(3, OUTPUT); //set trig as output and echo as input for ultrasonic sensor pinMode(trig, OUTPUT); pinMode(echo,INPUT);

}

void loop() {

digitalWrite(trig, LOW); delayMicroseconds(2); digitalWrite(trig, HIGH); delayMicroseconds(5); digitalWrite(trig, LOW);

int duration = pulseIn(echo, HIGH); int distance = duration / 29 / 2;

if(distance > 10){ //move forward by 100 ms forward(100); }else if(distance < 10){ //backward by 1000ms = 1 second backward(1000); //left by 1000ms = 1 second left(1000); } }

// function for driving straight void forward(int delay_time){ digitalWrite(11, HIGH); digitalWrite(10, LOW); digitalWrite(9, HIGH); digitalWrite(6, LOW);

analogWrite(5, pwm_speed); analogWrite(3, pwm_speed); delay(delay_time); }

//function for reversing void backward(int delay_time){ digitalWrite(11, LOW); digitalWrite(10, HIGH); digitalWrite(9, LOW); digitalWrite(6, HIGH);

analogWrite(5, pwm_speed); analogWrite(3, pwm_speed); delay(delay_time); }

//function for turning left void left(int delay_time){ digitalWrite(11, HIGH); digitalWrite(10, LOW); digitalWrite(9, LOW); digitalWrite(6, LOW);

analogWrite(5, pwm_speed); analogWrite(3, 0); delay(delay_time); }

//function for turning right void right(int delay_time){ digitalWrite(11, LOW); digitalWrite(10, LOW); digitalWrite(9, HIGH); digitalWrite(6, LOW);

analogWrite(5, 0); analogWrite(3, pwm_speed); delay(delay_time); }

//function for stopping motors void motors_stop(int delay_time){ digitalWrite(11, LOW); digitalWrite(10, LOW); digitalWrite(9,LOW); digitalWrite(6, LOW);

analogWrite(5, 0); analogWrite(3, 0); delay(delay_time); }

Step 5: Conclusion

I think that this robot is great for someone who just started with arduino and like to build first robot. Of course if you like you can add some parts and make it more advanced e.g. add bluetooth, android phone and make object tracking robot. Don't forget to leave a comment :)

Have fun with your robot!

Comments

author
diki578. made it!(author)2016-12-27

thank's for your article, maybe i can give you more information about robot

<a href="http://robotika.blog.gunadarma.ac.id">more robot</a>

author
FaisalF14 made it!(author)2016-07-30

Hi, I have a question how to assemble wheels on chassis boards.

author
jhunmar100 made it!(author)2015-10-02

can i ask what title or music did you use as background please??

author
Nikus made it!(author)2015-10-03
author
jhunmar100 made it!(author)2016-07-01

Thank You! ^_^

author
wstewl made it!(author)2016-02-09

Now that I've made this 'robot' (what defines a robot?) I have some useful comments:

Don't bother with the front servo & its mounting hardware-it is not used in the program/'sketch', nor is it included in the wiring diagram above. I used the white circuit board to hold the sensor. We used some duct tape in small loops to attach the board and the clone to the plastic chassis.

The kit includes a 6 position AA battery holder, but he shows above, using only 4 cells - to do so you would have to bypass the others with a jumper wire attached to the springs. We wound up using the 9V holder and inserted the connector into the clone board to power up the whole robot.

Here was a major source of frustration for me: the kit I received had a 'funduino' clone of the Arduino. On the back the printing says: 'www.funduino.com' - but there is no legitimate web site associated with that address. This clone has the square USB connector, as opposed to the rectangular, more common USB connector. A blue cable is provided with the kit. The problem came when I tried to upload the compiled code using the Arduino programming software - it wouldn't upload. Some research suggested to install the drivers for the Chinese clones. A bit confusing since all associated instructions are in Chinese. Finally installed those drivers, but they didn't help. Spent several hours playing with COM port speeds and other options for the Arduino software interface. Here's the answer: chose Arduino Mini as the board! Then it worked immediately.

He doesn't give you clear pin connections for wiring the clone board, but if you blow up the wiring diagram a bit and duplicate his positions it should work. The wiring diagram does show a clone that does not exactly match the pin connections on the one included in the kit.

All in all, it was fun and educational to put it together with my grandkids, and they were delighted when it started working.

author
robobot3112 made it!(author)2016-04-29

the power of concentration!

author
wstewl made it!(author)2016-01-18

I see the code sending data to the front servo,

but I can't understand what function that servo is performing.

It looks as if it can change where the ultrasonic sensor is pointing,

but it doesn't seem to be moving in the video.

Why would you move it? It is not 'scanning' the area in front of the robot, is it?

The code is not processing any angular geometry.

author
WalidM made it!(author)2015-12-17

I made it . it works when i use usb for power supply, but it dsnt wrk when i use battery :( whn i cnnct 9v. to arduino , motor dsnt response but arduino still run.

author
AsifS6 made it!(author)2015-11-10

hey, is there any function to use the servo?
Cause i cant find the servo in the code, or diagram!!!!

author
WalidM made it!(author)2015-12-17

Pin 5 and 3 for servo motor

author
AmateurHour made it!(author)2015-11-03

I saw in your chassis video you attach the ultrasonic sensor's servo to digital pin 11 but in your other video it looked like all the digital J4 pins were taken, is there an alternative wiring diagram that incorporates the extra servo?

author
Breathelessravi26 made it!(author)2015-10-14

From where u learn aurdino programming??? I want to learn

author
lokeshcham made it!(author)2015-10-10

hi this is a great instructable. Thanks for this.
but, Which type of motor driver did you use?

author
MegaDAS made it!(author)2015-10-13

L298N stepper motor driver ;)

loghlj1339666474374.jpg
author
AdrianR11 made it!(author)2015-10-01

I made a very similar robot. I added bluetooth and I was able to control it from my Android phone.

author
ed+shtern made it!(author)2015-10-07

how did you add bluetooth?

author
Nikus made it!(author)2015-10-09

Code or connection?

author
Nikus made it!(author)2015-10-01

Few days ago I was bored and I made app to controling my object tracking robot , it's very fun when you can control robot with your phone. Thanks for comment!

author
onemocke made it!(author)2015-10-09

Nice project

author
Nikus made it!(author)2015-10-09

Thanks!

author
BrownD made it!(author)2015-10-07

how to order the robot need full details thanks

my email is perekos@ekurhuleni.gov.za

0722907681

author
ajmaln77 made it!(author)2015-10-06

how to program these thing ?

author
Dawn+Chang made it!(author)2015-10-04

Well Done

author
Nikus made it!(author)2015-10-05

Thank you!

author
chathurajay made it!(author)2015-10-03

Nice Work.....

author
Nikus made it!(author)2015-10-03

Thanks :D

author
PopeLevi made it!(author)2015-10-02

Wouldn't it make more sense to call the variable `pwm_speed` just `speed`? This code does not make use of the ATmega's PWM - rather, it uses the DAC. Otherwise, nice tutorial!

author
Nikus made it!(author)2015-10-03

You can't call variable speed because it's reserved for some function in arduino IDE. Thanks for comment!

author
PopeLevi made it!(author)2015-10-02

Oh sorry, I meant to say ADC

author
EmrahE made it!(author)2015-10-02

You can teach it not to hit any walls in your house ! Just like the Mario playing computer program it can learn in my opinion

author
sruiz16 made it!(author)2015-10-01

but in the first link you gave us, it is to buy the robot itself not the parts?

author
Nikus made it!(author)2015-10-02

This link is to kit which includes all parts that you need to build this robot.

author
GLaDOS_ made it!(author)2015-10-02

wololololololo

author
lokeshcham made it!(author)2015-10-01

Wow thanks for this.

author
Nikus made it!(author)2015-10-01

Thanks for comment! :)

author
Nikus made it!(author)2015-10-01

Thanks for comment! :)

About This Instructable

36,737views

647favorites

License:

Bio: Hi, my name is Nikodem Bartnik. I live in Poland, I'm 18 years old. I like to program and create robots, devices and things ... More »
More by Nikus:BoseBuild GoPro MountCheap 30x30x40cm 3D PrinterFidget Spinning Robot
Add instructable to: