The car used 3 IR sensors to detect the lines
The car uses three IR sensors to detect when it's on the line and make necessary adjustments
When all three sensors cannot detect the line, the car continues the previous action until it finds the line
The motors were powered by a 6V battery pack and the Raspberry Pi was powered by a portable charger, allowing for the robot to not require outside sources of power to drive
The goal of this project was to build a line-following robot that uses IR readers to detect the line. The base frame was loosely based on the main structure of a Star Wars ship, with two wheels on either side to control the car's movements. Three IR sensors were placed close to the ground to allow the sensors to easily detect changes between the line and paper. Depending on which sensor reads the line value, the Raspberry Pi would correct itself by speeding up the corresponding wheel and stopping the other. In the case of sharp turns, the car would begin to turn, and repeat its previous action until it sensed the line again. A 3D-printed Pokemon Quagsire was included for decorative purposes to fit the theme of the class.
The IR readers were initially unreliable during calibration with an example line. To resolve the issue, the car was recalibrated on the starting line to ensure it could detect the line
In the initial sensor placements, there was a gap between the sensors which led the car to prematurely stop when the line was within the gap. By moving the sensors to overlap, the gap was removed, enabling the car to continuously see the line
The car originally could not do sharp angled turns as the car would partially travel off the line when making said turn. The car was then programed to be in different states as it sensed the line, so when the car traveled off the line, it would repeat the previous action until it found the line.
Top View of car
Quagsire model created by AFASNACHT3D. https://cults3d.com/en/3d-model/game/quagsire-afasnacht2
Video of car driving a fairly straight line
Video of driving a line with sharper turns
To improve, PID controls could be added to the car to give it better control when turning. PID controls were initially attempted, as they would have significantly increased the accuracy of the car. Due to timing constraints, the use of PID controls was forgone in favor of manually improving the logic of the turns and the placement of batteries. This allowed the car to still turn when detecting the line without PID controls and not require external wires, Nevertheless, one source of improvement would be to include PID controls in the Raspberry Pi's logic.
Another source of improvement would be to place the sensors closer to the point of rotation of the wheels. Due to the sensor's placement, there would be instances where the sensors would be off the line. Although the issue was resolved using different states in the code, another solution to the issue would be to move the sensors so they were closer to the wheels, thus causing them to rotate less when the car was spinning.