In this tutorial I will focus on building the arduino robot itself, I will explain in each step which parts I used and how I connected them.
I decided to start with the final Arduino Robot just to keep you motivated (:
Goal
Creating an autonomous robot which avoids obstacles on its path
Parts
- MiniQ 2WD Chassis
- Two N20 Motors (SKU:FIT0094)
- Two Rubber Wheels (SKU:FIT0085)
- Some screws to connect the wheels and the motors
- Castor – balances the robot
- Arduino Uno
- Arduino prototype shield
- Arduino motor shield
- Servo motor
- Ultrasonic sonar
- Breadboard
- 9V battery with a connector (home made)
- Electrical wires in different colors
Let’s Build The Robot
Assembling the chassis
This part is straight forward, on the two sides of the chassis you’ll notice the holes which are the wheels placeholders. To each wheel, connect one regular motor and fasten it to the chassis using the screws.
Connect the Castor at the bottom (front) of the chassis so the robot can move and stand without one side of it falling and touching the ground.
By now you should have an assembled chassis with 2 wheels and 2 motors connected.
Connecting the distance sensor
Servos have integrated gears and a shaft that can be precisely controlled. Standard servos allow the shaft to be positioned at various angles, usually between 0 and 180 degrees.
In order to make the ultrasonic sensor more efficient, we put it on top of a servo motor which can move 180 degrees and, therefore, scans more space. Instead of just reading the signal in front of the robot, we use a servo motor to spin the ultrasonic sensor from left to right and get a distances array of all the obstacles around us.
I used a double sided tape in order to put them together.
By now you should have an assembled chassis with 2 wheels, 2 motors connected and an ultrasonic sensor on top of a servo motor. (The motor itself can be attached to the chassis with double side tape – or if you find something better, go for it).
Connecting The Boards
The Arduino boards can be easily expanded with other boards. In order to use the motors, we need an Arduino motor shield. This shield allows us to connect 2 DC motors to its two channels and control them separably. With an external power supply, the motor shield can safely supply up to 12V and 2A per motor channel (or 4A to a single channel).
To control the motors, we need to address the correct pins according to this spec:
Function | Channel A | Channel B |
Direction | Digital 12 | Digital 13 |
Speed (PWM) | Digital 3 | Digital 11 |
Brake | Digital 9 | Digital 8 |
Current Sensing | Analog 0 | Analog 1 |
First, install the motor shield on top of the Arduino Uno (the pins should match perfectly). After the two boards are connected, we’re going to connect the motors wires into the motor shield channels.
On the back of the motor shield, there is a blue connector with a few inputs. Find the two +- inputs and connect each motor respectively.
(motor A red wire goes into the first channel +)
(motor A black wire goes into the first channel -)
(motor B red wire goes into the second channel +)
(motor B black wire goes into the second channel -)
The next step is to connect the protoshield on top of the motor shield, exactly the same way the motor shield connected to the Arduino board. The protoshield goal is to let us use all the Arduino board pins easily. The motor shield blocks the pins inputs, so the protoshield extend exactly the same pins and lets us use them.
As you see in the image above, the final step is to place the breadboard on top of the protoshield, on the next tutorials we will use it for all the wiring.
You probably noticed I also connected a 9V battery to the chassis, I also used a switch and created a convenient way to turn the robot ON OFF, as I said, the switch is not something you must have, you can connect the power directly to the board and unplug the battery when you want to switch it off.
You can also use the Arduino power cable which connects the Arduino board to your computer via USB port.
Good luck, and remember trying to build a robot is already an achievement.
On the next tutorials we will connect the sensors and the servo motor to the board, so be prepared for some electricity in the air (:
The next tutorial is here
Cheers