September - November, 2017
Introduction:
In this project, we designed a vehicle that follows the map from the starting point to the end then move backward for more than 15 cm. For the vehicle design, we placed three sensors to ensure the vehicle goes on the correct path, while another sensor is responsible for detecting the white wall at the end point. Once the signals received from the sensors, they pass through numbers of logic gates to make sure the motors receive the correct signals and make the correct turns.
Design:
We used three sensors to detect the white line on the ground and another sensor to detect the white wall ahead. There are three types of inputs before going into the logic of the motors, according to the diagram below:
![](https://static.wixstatic.com/media/24faeb_3902788b76854691bd9979c719f9a58a~mv2.jpg/v1/fill/w_752,h_348,al_c,q_80,enc_auto/24faeb_3902788b76854691bd9979c719f9a58a~mv2.jpg)
Determining when to increment the counter:
Truth Table:
![](https://static.wixstatic.com/media/24faeb_0ae8c078e906403baa82005bd8b01808~mv2.png/v1/fill/w_980,h_488,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/24faeb_0ae8c078e906403baa82005bd8b01808~mv2.png)
K-Map:
![](https://static.wixstatic.com/media/24faeb_9a8cb093095949fab38536681ef34a12~mv2.png/v1/fill/w_936,h_120,al_c,q_85,enc_auto/24faeb_9a8cb093095949fab38536681ef34a12~mv2.png)
Output = L+M’+R
According to the truth table and K-map, the output is always 1 unless the car encounters a split (when both left and right sensors are sensing a white line but the middle sensor is not). This is because the 4-bit counter counts up only if there is a rising edge in the clock signal. By connecting this logic to the CP of 74LS161, the counter will only increment the value after the car travels past the split.
Determining when to use each output:
The outputs of the counter (Q0 and Q1) are used to determine which direction to turn when encountering a split, and thus are only passed to the motor logic under the exact opposite condition stated above, which is Output = L’MR’. On the other hand, the outputs of the left and right sensors are used in all of the other cases, meaning that their outputs will be passed to the motor logic when Output = L+M’+R. These are accomplished by adding a 2-input AND gate to each case that takes in the Output (the conditions mentioned above) and the corresponding outputs from either the counter or the sensors.
Front Sensor:
When the front sensor detects a white color, the values being passed to the motor logic must remain 1 even if it does not detect the color white anymore so that the car may continue to move backwards. In order to achieve this, we used a S-R Latch to store the value. By connecting the front sensor out to a NOT gate and then to the CP of 74HC74, the S-R Latch’s Q value will change to the D value (presets to 1) and remains that value. Therefore, this value can then be passed to the motor logic and allow the car to keep moving backwards.
Motor Logic:
Left Motor:
Truth Table:
![](https://static.wixstatic.com/media/24faeb_2b3ae7a0a6be4d6eb8936deeb64138e8~mv2.png/v1/fill/w_980,h_265,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/24faeb_2b3ae7a0a6be4d6eb8936deeb64138e8~mv2.png)
K-Map:
![](https://static.wixstatic.com/media/24faeb_ebaf6917fc834aa783e1933854ce3f1b~mv2.png/v1/fill/w_780,h_275,al_c,q_85,enc_auto/24faeb_ebaf6917fc834aa783e1933854ce3f1b~mv2.png)
Output = L’
Right Motor:
Truth Table:
![](https://static.wixstatic.com/media/24faeb_d61dd1cc9112411383a45460086d2b2c~mv2.png/v1/fill/w_980,h_265,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/24faeb_d61dd1cc9112411383a45460086d2b2c~mv2.png)
K-Map:
![](https://static.wixstatic.com/media/24faeb_ebc3503105c14f7fad9e8724d0e96897~mv2.png/v1/fill/w_780,h_275,al_c,q_85,enc_auto/24faeb_ebc3503105c14f7fad9e8724d0e96897~mv2.png)
Output = LR’
Sensors Placement:
We used a total of four sensors, one for detecting the white wall ahead while the others for detecting the white line on the ground. We placed the one for detecting the wall at the very front of the vehicle and facing the front. This can make sure that nothing will block the way of this sensor from moving close to the white wall and receiving the signal. For the placement of the other three sensors, we placed them in front of the wheels and facing downward. The placement of the middle sensors is slightly in front of the left and right sensors, because we want it to detect the black areas when both of the left and right sensors are detecting the white lane. This can ensure that the vehicle is at the “Y” turning point and make the correct decision of the turn.
Debugging Report:
At first, we only used two sensors to detect the white lines on the ground. But eventually, we decided to add another one in the middle in order to detect the splits more accurately. However, when we added the third sensor, the car did not even turn when it encountered a split. We suspected that the sensor might be too low to the ground that it did not sense the white line, but that was not the case. We used the multimeter to check whether or not the output of the sensor was broken, and found out that the output was only about 1.5 V even when it was sensing the color black. However, when we took out the sensor and tested it individually, its output was 5V without any problems. We realized that the sensor output had to go through too many logic gates that the voltage value of the high logic level of the sensor output was decreased significantly. Thus, it affected the logic interpretation of the logic gates that followed. In order to fix this, we created a line sensor output buffering by using 74HC14 as suggested by the supplementary guide and fixed the issue.
After we finished building the circuit for our car, we tested the motor logic when encountering a split. The first two splits were correct as the car turned left, but the car continued to move forward on the third split. In order to find out why this happened, we used the multimeter and started debugging. We first tested the 74LS161 4-bit counter to make sure that the output of Q0 and Q1 were correct, incrementing by one every time the car finished crossing the split. Then, we figured that the right motor should be turning backwards instead of forwards on the third split, so we started debugging the output for the right motor. We soon found out that the output of R’ was 0 on the third split, so we checked the NOT gate for R input. We found out that the NOT gate was actually broken, as it did not invert the R input from 0 to 1. We switched the R input to another NOT gate, and finally the car worked as intended.
Results:
Overall, we think that the logic design of our car works well as it is able to correctly turn and follow the white lines under all the different cases. Moreover, the structure of the car and the placement of the wheels also work well as the car is able to make the right angle turns correctly. Nevertheless, it still has trouble making the correct turns smoothly when encountering a split.
At first, the car was not able to make the right angle turns as it turns too quickly and misses the next following white line. In order to fix this, we moved the wheels from the back of the car to the front, so that the car turns in the front instead of the back, allowing it to sense the white line that is next to the front of the car. Another unexpected issue is that the car sensed the split too early when we were using only two sensors to detect the white lines on the ground, causing it to turn as soon as the sensors reached the split. This causes the car to turn too early, and then either gets stuck or misses the following white lines. We tried to fix this by adding another sensor in the middle, so that the car recognizes the split only when this sensor does not detect a white line, allowing the car to travel forward more than before so that it does not make the turn too early. However, this has not fully fixed the problem as the car was still stuck at the split during our demo.
If we could start over, we would plan out everything before building the circuit. This is because we had to make a lot of changes on the way in order to accommodate more features, such as turning right angles and moving backwards when encountering a wall in the front. This caused our design to be overly complicated by going through a lot of logic gates, which could be simplified further if planned ahead of time. If we had more time to do the project, we would improve our design by making sure that our car is able to turn correctly at the split. This could be done by adding a capacitor or storing the state of the split in the memory for the duration of moving across the split. This way, the car would have a more stable result in making the right turn at the split. Some of the bad decisions we have made during the project period includes not cutting the wires properly and caused the wires to loosen all the time, as well as not fully tightening the sensors and caused them to move away from the desired positions.
Conclusion:
We think this final project is a challenging and interesting one. Since there are lots of ways and designs to make a vehicle that follows the tasks, we are allowed to come up with a solution with our own abilities and knowledge. Even though we figured out the logic for the correct path, there were still bugs that needed to be fixed. Overall, this project requires us to overcome multiple challenges and look for our mistakes or bugs. Unlike other courses that require memorization of facts, this course is very practical and challenging, thus we enjoyed it a lot.
コメント