Line Follower Bot and Mesh Solver for Meshmerize Competition
by Team MATT in Circuits > Arduino
6215 Views, 7 Favorites, 0 Comments
Line Follower Bot and Mesh Solver for Meshmerize Competition
Hello there, welcome to our project.
Every year IIT Bombay organizes an event called Techfest. It consists of various competitions, exhibitions, events, guest lectures and many more. In short every engineer should participate and experience that once in a life. Anyways so, there is a competition called as MESHMERIZE in which we have to make a line follower bot which can follow a line and complete the maze in shortest time. Every year few rules changes but basic idea remains the same. At first we have to run the bot to let it know the map and dead ends and in second run bot should eliminate the dead ends and complete the maze in shortest path with shortest time.
Supplies
The major components used are -
- Pololu QTR-8A sensor
- N20-12V-600 Rpm Micro Metal Gear Motor
- Motor Driver TB6612FNG Module
- Arduino Nano
- Voltage Booster (3.7V - 12V)
- 3PI miniQ car wheel
- Caster wheel
- IR Module
- 3.7V Samsung 18650 Battery
Pololu QTR sensor is purchased from MgSuper Lab
Rest all majorly are bought from Robu.in
Connection Circuit and PCB
So, to make a bot usually we require a chassis but we designed the PCB in such a way that it does a work of both. The circuit diagram of all the components is shown above. Basically all the sensors, motors and their drivers are interfaced with Arduino nano. They are assigned their respective pins and power supply connection is made. All the grounds should be common. This PCB is made on EAGLE software and then fabricated on milling machine and the cuts are made using CNC router.
We have attached the front and back end of the PCB below.
Assembly and Shouldering
The video above shows the simulated version of the bot on FUSION 360 software.
For components such as Arduino, motor driver and voltage booster headers were shouldered first on the PCB so that whenever required we could remove them and replace. This is required to prevent the damage to PCB if one of the components gets short circuit.
In this PCB few wires are visible because we were unable to fit their routing. So we decided to keep that open as a single wire.
Any wireless device is not allowed in the competition. You can see we used Bluetooth module but that can be removed and was used to print the reading values of IR sensor on serial monitor of Arduino during testing and tuning of bot and then later removed.
Designing PATH and Printing on Banner
In this MESHMERIZE competitions there are two rounds. First you have to qualify for zonal then only you are eligible for finals.
ZONAL Round - In this round the path only consists of 90 degree turns.
FINAL Round - In this round the path has 90, 45 and also 135 degree turns. Also one additional element is about object detection. An object is kept in between the path. While short run we have to consider it as a dead end and neglect that node and find shortest path by deviating the track.
The strip of white line is of 3cm. Which is always constant every year but track changes every time. And the above paths are only for sample, in competition they are different.
We have given the files of path for both rounds below. You can print them from any banner printing shop of any required size. We would recommend of size 8X8 feet.
Tuning of PID
This is the most difficult step in whole project because it vary from bot to bot manufacturing, its material used, weight of bot, motors used etc.
As it is a line follower bot, so there comes the typical concept of PID i.e. Proportional Integral Derivative. It basically comes under control system where we have to tune our bot in such a way that it will get feedback of its errors and then set the motor speed in such a way to minimize that error in next iteration. There are three parameters that we have to set. They are - Kp, Kd, Ki
Kp - It is a positional constant. It helps to keep the bot on line, so that when the curve comes it doesn't leave the line.
Kd - It is a differential constant. You know that any motors never have equal resistance, that maybe due to build quality, material used or anything. Due to this a jitter is created and you see wobbling of bot. Kd helps to reduce wobbling of bot.
Ki - It is a integral constant. It does not have much use but it helps to remove errors in long run. All this values goes into PID equation and according to that the speed of the motor is varied to follow line.
You can refer our video from another project to understand more clearly. This is the link.
You have to put this values of Kp, Kd in the equation of PID and check its value continuously on the serial monitor. Most important observation to follow is that "Your value of PID should be in the range of 2 to the power bits of controller used" For example, as we used Arduino nano which is 8 bit controller. Therefore, 2 to the power 8 is 255. So after putting the values of Kp and Kd the output of PID equation should be in the range of 0 to 255. If this is not so then you can manipulate the equation by dividing the values of Kp by 10 and Kd by 100. Just any how bring them in range and also check the operating bit of the micro controller you used.
Steps to set Kp and Kd values -
- Set Kp=Kd=0 and check the value of PID. This should be checked during run-time using serial monitor. For this purpose only we used Bluetooth module.
- Now Start the value of Kp with 1 and keep Kd=0 and check value of PID.
- Increment the value of Kp until bot follows the line and doesn't leave it when the curve comes. You can refer the curve in this video.
- Now when the bot has started following the line and also curve, you might observe that it is wobbling too much. Wobbling means rapidly vibrating left to right.
- To improve this start with the value of Kd=1 and keep Kp as the value on which it started following curve.
- Increment the value of Kd till Wobbling becomes minimum and check value of PID. At one point you will observe the bot is running smoothly.
- Pro tip to set Kd use long Straight path and make a slow motion video using your mobile camera to check wobbling.
Kp and Kd values changes with decrease in voltage and also with change in speed. Please take a note of it. So set the constant speed before tuning Kp and Kd
You can use Ki or can neglect that. If using then keep Ki=0.
Coding
There is minor changes in the codes of zonal and final round. Please understand the code, see that the use of every function and most important understand how the PID changes and controls the speed of bot. This will help you to easily implement this code on your bot.
For more details about Line Following Bot visit this website and explore that. The PDF of that website is also attached below.
The codes for zonal and final is also attached below. These codes has comments for better understanding.
If you like our project please appreciate and for any query contact us on - teammatt4@gmail.com