The goal for this project was to create a line follower robot and learn, experiment and implement PID control, doing so in a cheap and affordable way.
The designThe design of this robot was intended to be cheap and to build a decently paced line following robot that uses PID control for best results. The IR sensors as seen in the image are mounted onto a painter's stick, and mounted to an angle bracket. I have chosen an Arduino Uno for the micro controller and a L298N motor controller module to drive the DC motors. For power supply, I chose a 6V NiMh battery for the motors, and a 9V battery primarily for the Arduino Uno and the IR sensors. All components are attached to a fixture that I purchased online.
How it worksThe IR sensors mounted in front of the robot are used as digital sensors rather than analog sensors as they could be used as. Therefore, each sensor will return either a 1 (High) or 0 (Low), depending on the surrounding environment. A brief description of how these sensors work is as follows: basically each sensor is comprised of both an IR led and IR receiver. Infrared light/rays is emitted from the IR led and when an object is in close range to the sensor the infrared rays are absorbed by the object but enough is reflected back to the receiver, therefore it knows an object is there and vice versa. Now in our case we want to distinguish between the colors black and white. Truly it works in the same manner as it does when detecting objects. When white or many other colors are in its range the IR receiver will detect the reflected IR rays and we can distinguish that as white. While on the other hand when a black surface is below the sensor the IR rays are only absorbed by the black surface and will not trip out the receiver. Now that we get our readings from the sensors through software, we can now determine an error based on the readings and do the PID calculations. The output that is calculated is the value we are going to change each motor's speed by (so the PWM value). After I went through quite some time of tweaking the code and going through the PID tuning process, I was able to get results from Elliot that pleased me.
ConclusionAgain, I'm very happy with how this project turned out and found it as a very rewarding experience. I would also definitely recommend and encourage anyone starting with Robotics or have some experience already to build one of these, as it can build many skills and introduce you to the world of robotics. Below I have attached videos of some of the runs I did with this robot. The first two videos is the robot running the more simple track as that was my first goal for the robot, and the last video is the more difficult track that I had also built.
Comments
Please log in or sign up to comment.