Introduction: Simple & Smart Robot Using Arduino.
Today I'm going to share information about a simple robot made using Arduino UNO , motorshild and some basic components.
This project is easy to make and helps in learning about basic robotics and programming.
The robot will be autonomous.
In following Instructables I will be posting about modifications to make the robot obstacle avoidance and then controlled by IR.
so this will be series of Tutorials,
hope you like it and learn something from it.
Check out this Robotic certification course at LearnRobotics.
Step 1: What Is an Autonomous Robot?
An autonomous robot is simply a machine which is programmed once and then performs tasks on its own.
Basic examples of autonomous robots are ,
1. Obstacle Avoidance.
2. Line Follower.
In this Instructable we are going to learn about a simple Line Following Robot which uses Infrared sensors to detect Black line on White surface.
These sensors can be bought online for cheap or you can make them yourself which is even better as it is fun and educational.
I have posted a tutorial about how to make these sensors, you can check it out :
IR Proximity Sensor
Now as you know what the project is ,
We can move ahead to gather all the required components.
Step 2: Required Components.
I have provided all the required links .
2. Adafruit motorshild.
Link for US
Link for Europe (any dual motor drive module would work but code must be modified accordingly, if you have any other Motordriver and have problem in writing the code you can ask me , I'll be happy to help)
7. Two wooden pieces for the chassis and a piece of hardboard to attach sensors.
8. Spacers. (I couldn't find in store and didn't want to purchase a lot of them so I made them using paper. I know it sounds cheap and weak but trust me it's not as weak as you think . just roll paper tightly and secure it with tape. and cut it into height required)
9. Female to female connector wires.
Link for US
Link for Europe
Once all parts are gathered we can move ahead to begin the construction.
Step 3: Building the Chassis:-
First you need to cut the wood into two pieces.
1st one is about 12cm x 10cm.
2nd one is about 10cm x 7cm.
The larger piece is the base where motors will be attached and batteries will be kept.
The smaller piece will be used to mount the Arduino and will be placed on top.
Once you have the two pieces according to the measurements , first drill holes in the larger board to attach the angle brackets for motors. Refer to the picture.
Next connect the motors to the brackets and screw them in place.
Now attach the wheels to them and secure them using some screws.
Now flip the board upside down and stick the caster wheel , you can drill a hole and connect it using screw but then the screw makes a bump in the front which doesn't look very good.
The lower base is done with this and now we make the upper base to mount the Arduino . For this first place the Arduino on the board and mark the screw holes with a marker. and drill through them . Now screw down the Arduino in place.
Now we have to connect the motorshild to the Arduino but before that we have to solder some pins to the shield .
If you look at the bottom right corner you will see some holes which are the Analog pins next to them is the ground rail and next to it is the +5v rail , solder header pins to all this holes as we will need to connect sensors.
After the soldering is done , we can connect the motorshild on top of Arduino.
Next we will take some double sided tape and stick it to the bottom of this board and place it on top of the motors , to prevent it from falling we can add some spacers in front as I have shown In the Picture.
If you are too lazy to build a chassis you can buy one online but whats the fun in that??
With this The basic body structure is done and we can move on to the Next part.
Step 4: Power Supply Unit.
Now once the base is done , we can move on to start making the power unit .
To power our robot we will be using two 9v batteries and use a DBDT switch to turn the circuit on.
Follow the diagram and attach male header pins to one side of the wires or you can leave it as it is . These wires are going to power the motorshild.
Solder a DC power jack to the other two terminals for the Arduino.
NOTE:- As here we are using two separate batteries to power the Arduino and Motorshild, we will have to remove the jumper from the Motorshild which is next to the power terminal of the Shield on right side.
If you don't do it there is chance that you may damage the Microcontroller.
Refer to the image above to find out the jumper.
Okay so once we have a power supply unit ready we have to connect the pins to the motorshild and Jack to the Arduino.
(Make sure that you don't plugin the batteries right now, Cause nothing will work anyway.)
connect the red (+ve terminal) to the left side of power terminals of motorshild and the Black(-ve terminal) to the right side .
Now find a place around the robot to place the switch, I have placed it behind , near the motors .
Just keep it where it is easily accessible.
Step 5: Connecting Sensors.
Now we will add sensors to our robot , so it can scan the for the black lines.
These Infrared sensors I've used have 3 Pins ,
1. VCC which is the +be terminal and should be connect to the +5v .
2. GND which is the -ve terminal and must be connected to the ground.
3. Signal pin. which is connected to any Analog pin on Arduino.
here we are using 2 sensors so we will need 2 Analog pins ,
just connect the pins to the Motorshild and place the sensors infront, one left , one right .
Use a small hardboard piece to mount sensors on.
Connect the sensor's VCC pin to +5v and GND to GND pin on motor shield.
Connect the Out pin of right sensor to A4 and left to A5.
With this the Robot is ready , it just needs a program to run and perform its task of avoiding obstacles.
Step 6: Programming and Testing.
To program the robot first connect the USB cable of arduino to the port as shown in the picture .
Now connect it to your PC. and open the code given and hit upload.
For those who are new to arduino you first have to download the Arduino IDE.
then you can upload the code .
Once the code is uploaded the robot is ready to start the action you can now connect the 9v batteries and test .
For the track use an electric tape that is black and stick it in a circle on a White surface. Now place the robot on the line and switch it On. the bot should start to follow the line if it does not follow the line the you may have to adjust the pot on the module just slowly turn it one side until it turns on then turn it the other side until it is off now it now it should turn on when on white and off when on black this means the robot is ready to go.
Hope this tutorial was informative and helpful .
If you have any questions fill free to ask in the comments.
In next tutorial I will make this robot into obstacle avoiding robot along with Line following.
Participated in the
Robotics Contest 2017