ECE 110 Car
by: austin on March 20th, 2011
categories: Arduino, AVR, Computers, Engineering, Featured, Main Projects, Programs, University of Illinois
The final design project for Intro to Electrical and Computer Engineering (ECE 110) was a self navigating car. This is the design my partner and I built which was the first car to navigate the turns, zig-zags, splits, and stops of the course all the way through on its first try. Read on to see how it was done.
Introduction
The purpose of the circuit and design for this lab was to navigate a car by following a piece of tape. The circuitry was designed to control the direction of the car’s motors based on the color of the surface under the sensors (light or dark). The course consisted of various turns, a split with white tape under it, a split with colored tape under it, and a stop signal at the end of the course. The car had to turn onto the right path at the colored strip and turn onto the left path at the white path. When the car made it to the end of the course it had to stop.
Design Philosophy
Our first decision for the design challenge was the tape following method we should use. The decision was between tape avoiding, tape seeking, and tape following since these were the designs we were familiar with by lab. In the lab, we found tape seeking to be the best method as the car never veered off the track at sharp turns and headed straight in the wrong direction. Tape seeking always turned towards the tape no matter how sharp the turn. The only negative to tape avoiding was the car didn’t follow the line smoothly and couldn’t take sharp turns. On a sharp turn, the car would turn at a wide angle until it found the line. We wanted a smoother ride so we came up with the idea of combining the tape seeking design with the tape following line. Lab 5 presented the CAB module (H-Bridge motor driver) which allowed the motors to turn in both directions. With the CAB module and the tape following design, the car could turn in place and accurately follow the line without having to zig-zag. The tape following design with the CAB module worked until a sharp turn which is why the tape seeking design was also implemented. Two inner sensors were used for the tape following design, and when the car passed a sharp turn, two outer sensors would detect the line and switch the navigation mode to tape seeking. For example, if the car came to a 90 degree right turn, the car would go pass the turn if just using the tape following design with the inner sensors. Though with the tape seeking outer sensors, at a 90 degree right turn, the outer right sensor would detect the line triggering tape seeking mode. The car is then programmed to then turn right until the left inner sensor sees the line, putting the car back into tape following mode. By combining the tape following design, tape seeking design, and the CAB module, the car can navigate the course without losing track of the line. With the design for the car’s navigation set, we still had to implement a design to detect the tape splits and stop. Detecting the tape splits and stop could be done with the current sensor configuration. If the two inner sensors saw white, the car was at a split, and if all four sensors saw white, the car was at a stop. At the split detection the car still had to detect if the tape it was over was white or colored. From previous labs we learned that color reflects less light than white and that the sensors return a lower voltage over color. In the lab, a voltage divider and comparator were used to see if sensor’s voltage was in a certain threshold. Since or design used the Arduino, a much easier method of detecting color was available. The analogRead() function preprogrammed in the Arduino returned a digital reading (between 0 and 1023) based on the analog voltage. Using this function, a threshold was set in code that returned true when the sensor was over color. If the analogRead() function returned a value greater than the threshold, the sensor was over white. A fifth sensor placed between the two inner sensors was used for the color reading when over the split. This sensor was connected to an analog pin on the Arduino so the analogRead() function could be used on the color detection sensor. If the color detection sensor was over color, the car turned right, and if the sensor was over white, the car turned right. A sixth and final sensor was used to detect the left or right path in a split. The sixth sensor was placed on a separate sensor bar in front of the other sensor bars. The reason for this was to keep the sensor over black when the car detected a split. When the car detected a split, the car turned right or left until the sixth sensor sees white from ether the left or white split. Once the sixth sensor saw white, the car switched back to the tape following mode and continued its navigation along the correct path after the split. All together, six sensors and two sensor bars made up the final design to navigate the car through the course.
Downloads
Arduino Code – ECE_110_Car.pde
Schematic
Future Work
If we were to start this design challenge over, we would have started with the Arduino earlier. We spent the first two labs implementing our design with digital logic circuitry, and spent another day debugging. We got the design working, but the navigation itself didn’t work because we still needed to include PWM to slow the car down while preserving power to the motors. At this point, we realized our design would be much easier to implement with the Arduino and modifying our design would be much easier in code on the Arduino than modifying the circuitry. If we had more time, we could had improved the split navigation as we only spent one day working on it. We noticed the split navigation falsely went off at points in the track and that there were probably better ways of detecting the split. Also, we could have used the Arduino PWM to control the speed of the car at different points on the track. For example, we could have programmed the car to go faster on the smooth turns and slower on the sharp turns, but since the trials weren’t timed, speed was our last concern. The only regret we have is spending three days trying to implement our design in circuitry when we could have spent our time using the much more suitable Arduino.
Conclusion
In conclusion, our design proved to work consistently. The prelabs provided the knowledge to build a working design and our teamwork allowed us to accomplish this in the given time. This design challenge not only taught us the power of simple electronics, but moreover gave us experience we could not have learned in the classroom. We got to apply our knowledge from ECE 110, preparing us for future projects in college and beyond that in the working environment.

