Things used in this project
Traditional way of making a Line follower robot is by using IR array sensors, but in this project we want to make it in a smart way using evive, smart phone and 1sheeld. The camera of mobile phone captures and discretize the video using the 1sheeld app and send it to 1sheeld shield mounted on evive via Bluetooth communication. Since evive has inbuilt motor drivers, we just need to plug and play the motors. Lets make this.
Connect phone to 1Sheeld
First install the app as mentioned in previous step.
- Start your phone's Bluetooth connection and try to connecting "1Sheeld" named Bluetooth. The password will be "
- The open the 1Sheeld app and connect to the 1Sheeld shield. Then scroll down the menu and select the "Color Detector option".
- Now click on the shield icon near right top.
- Set the color detector settings as shown in image. Bits should be set to 3Bit. Full should be unchecked while Color and Common were selected.
- Also click on the Lock icon on bottom left side of app.
- You can now see the discritized image on screen.
You can use masking tape to stick the phone on your robot as masking tape will not leave any sticky glue on removing it form phone or robot.
Program for Line Follower
1Sheeld gives output of color values. The video is divided in a matrix of 3X3 and total 9 numbers are returned to the function parameters. The numbering starts from left to right (row first) and then top to down (column second). We will only use the first row readings. The program is derived from 1Sheeld examples and it is modified for evive motor driver pinouts.
This code is made for black line in white background as you seen in the video. We have used following conditions:
if (three == white && one == white) moveForward() else if (three == white && one != white) moveLeft() else if (one == white && three != white) moveRight()
All the codes can be found here. Also we tried to improve the code little bit by adding history term, so that if robot losses line that it tries to come back.
Tune the parameter and calibrate
We need to tune the parameters like the robot speed for left and right turn or the maximum speed. Adjust the PWM values for both the motors in the functions:
Also we need to adjust the height of camera from ground so that the black line is captured in one "discretized" pixel (remember the 3X3 matrix) in 1sheeld app, ie. if we place the robot on the line at center, then the 1sheeld app should show black only in center pixel. You can select the pink icon on bottom of phone screen to see the real video for calibration.
Note that some smartphone may not have the camera on center, so fix the phone such that the camera is on center-line of robot. In our case, the camera was not on center.
This steps will be our calibration steps.
And the robot follows line!
Test the robot and it should now follow the line. You can improve the speed can calibrate to make it better. Together with 1sheeld and evive, this would be very fun as both simplifies our life a lot. Evive has tons of features for lots of varieties of projects. You can explore more about evive here: http://igg.me/at/evive
Watch this video for more details:
Did you replicate this project? Share it!I made one
Love this project? Think it could be improved? Tell us what you think!