Introduction: Line & Wall Following Robot
By: team Baymax
3 wheeled automated track robot.
Description: This is an instructable for the construction of a three wheeled robot with aim of completing a walled track/circuit using an ultrasonic sensor and a line follower. ON completion, the robot will be able to complete the track completely using combination of its ultrasonic sensor and its line follower system to finish the track as quickly as possible. In the event that the walls are removed, the robot will still be able to still complete the track solely on its line sensors and if the track lacks lines to follow, it can again fully depend on its ultrasonic sensor.
Step 1: Requirements
The folllowing materials are required for the construction of your robot. its best to have all of them, or a suitable substitute at the begining.
· intel Galileo (gen 2)
· ultrasonic sensor
· three wheeled chassis
· Two DC motors
· 11-volt Li-Po power pack
· Motor driver
Step 2: The Rolling Chassis
Assemble the chassis and motor together in order to obtain what is commonly known as a rolling chassis
Step 3: Mounting the Intel Galileo
find a small non-functional electronic device with a plastic housing that you don’t mind taking apart. The device is likely to me closed up using screws which are screwed into a cylindrical mounting inside the housing. These cylinders are what you want and the screws that fit right into them
Using some cutting tool, cut out these cylinders from where they meet the plastic casing taking care not to damage the cylinder itself where the screw fits into
mount two of these cylinders using their screws on the chassis such that they are at an equal distance as the distance between the two mounting holes on the Galileo such that you still have plenty of space on your chassis.
Mount the galileo via its mounting holes onto the opposite end of the cylinders that are already mounted onto the chassis.
Step 4: Mounting the IR Sensors
Find two appropriate holes on the robot from which you can mount the two ir sensors each the same distance from the center of the chassis. This distance should also correspond to the lines on your track such that the reflective sensors fall just on the inside of their respective line. You can use the inner tube of a pen to make the connection between the reflective sensors and the holes on the chassis.
Step 5: Testing What You Have So Far.
As this point it is best to test out what you have done so far.
Set up the galileo programming environment by following the startup guide for the intel galileo. Upload the simple blink sketch from the Arduino IDE library and watch it blink!
Okay now to more serious business, using a bread broad, wire up your motor to your motor driver and then the motor driver to the galileo via its digital pins (for now). Write a code to enable the motor driver enable pins and set the relevant logic pins to high or low to turn the wheels forward then backward. (google is your friend to help you do this as well as the datasheet to the motor driver.) don’t be afraid to play around with it as well.
Even more serious stuff, how do we get the robot to turn corners? Easy just make one wheel go faster than the other. So how do we do this, first remove the two enable pins from where they enter into the galileo and plug them into the PWM capable pins on the galileo (any of them). The PWM pins are usually identified by the tilde character drawn next to the pin number.
Now back to the code. You must have used a digital write function to set the logic pins high or low. Now we want to change that, instead we want to use the pulse width modulation (PWM) to modulate how fast the motors turn by ‘modulating the power going to the enable pins’. This is possible using analogWrite function to make one wheel turn faster than the other. Voila your turning a corner. (I know easier said than done right)
Now wire up your infrared reflective sensors (again google is your friend to find the circuit diagram for them). locate the sample code on the Arduino library that belongs to the reflective sensors, study it and run it so that you may know how the reflective sensors work. Now you know how to operate the galileo, make your robot move forward back left and right, as well as taking readings from the IR sensors.
You may go ahead and add ultrasonic sensors onto the front of the bot two facing directly away from the center looking left and right, and one looking ahead, in order to follow walls apart from just lines. The Arduino has a neat little sample code for the ultrasonic sensors (ping library) that can teach you how this very useful range finders Work.
Step 6: Wiring Up the Battery.
This is a very crucial stage as the li-po battery is
very sensitive and should be handled with extreme caution especially when charging. I recommend reading on li-po batteries before using yours. The intel Galileo Gen 2 takes 7-15 volts so your li-po battery should be either 2 celled or triple celled. If by any chance you are using the Intel galileo gen 1, you MUST use and external voltage regulator because the gen 1 takes strictly 5 volts. Connect the battery’s positive terminal into the VIN pin of the galileo. And the negative to ground. This provides it with power and the galileo should light up at this point. If not give all your reconnections are in order and confirm that the galileo is charged above the 7 volts that the galileo gen 2 requires using a multimeter
the battery can then be mounted to the underneath of the chassis using s oair of zip ties or more to hold it in place
Step 7: Code Away!
Now it is all up to you and your coding skills to get your bot to actually relate the data from the sensors to how it should be turning. A word of advice, PID is a good way to go. PID stands for Proportional, Integral and Derivative. It is a neat little trick that can really smoothen your robots movement. It is even used in industrial applications.
We have a be nice policy.
Please be positive and constructive.