This shows you the differences between two versions of the page.
|
pm:prj2026:bianca.popa1106:ana.stanciulescu [2026/05/16 23:06] ana.stanciulescu |
pm:prj2026:bianca.popa1106:ana.stanciulescu [2026/05/25 01:42] (current) ana.stanciulescu |
||
|---|---|---|---|
| Line 29: | Line 29: | ||
| | 3× RGB LEDs (CC) | Optical indicator for each sensor (Green = Safe, Red = Stop) | | | | 3× RGB LEDs (CC) | Optical indicator for each sensor (Green = Safe, Red = Stop) | | | ||
| | 6x Resistor | A separate 220Ω resistor was used in series with the anode of each RGB LED | | | | 6x Resistor | A separate 220Ω resistor was used in series with the anode of each RGB LED | | | ||
| - | | Passive Buzzer | Variable sound alarm | [[https://www.alldatasheet.com/datasheet-pdf/pdf/1284499/JOY-IT/KY-006.html|Buzzer]] | | + | | Passive Buzzer | Variable sound alarm | [[https://www.alldatasheet.com/datasheet-pdf/pdf/1284499/JOY-IT/KY-006.html|Buzzer]] | |
| | LCD 16×2 | Displays measured distances | [[https://www.datasheetcafe.com/JHD162A-pdf-14977/|LCD 16×2]] | | | LCD 16×2 | Displays measured distances | [[https://www.datasheetcafe.com/JHD162A-pdf-14977/|LCD 16×2]] | | ||
| Line 113: | Line 113: | ||
| ===== Results ===== | ===== Results ===== | ||
| - | The system achieves an accuracy of approximately 1–2 cm. The interface is intuitive, allowing the driver to quickly identify which part of the car is closest to an obstacle. | + | The completed system was mounted on a toy car and powered by a portable USB |
| + | power bank, making it fully self-contained and independent of a development | ||
| + | computer. | ||
| + | |||
| + | The three ultrasonic sensors achieve a ranging accuracy of approximately | ||
| + | 1-2 cm across their effective operating range. The exponential moving average | ||
| + | filter applied to each sensor's readings eliminates the characteristic | ||
| + | +/-1-2 cm jitter of the raw HC-SR04 output, producing stable distance values | ||
| + | without introducing perceptible lag (the system reacts to a real distance | ||
| + | change in under ~600 ms). | ||
| + | |||
| + | The three-zone feedback proved intuitive: each RGB LED independently reflects | ||
| + | the proximity state of its corresponding sensor (green / yellow / red), | ||
| + | letting the driver instantly identify which side of the vehicle is closest to | ||
| + | an obstacle. The buzzer, driven by the minimum of the three measured | ||
| + | distances, varies both its beep cadence and its tone frequency continuously | ||
| + | as the nearest obstacle approaches, culminating in a continuous tone below | ||
| + | 10 cm. The LCD provides a precise numeric readout of all three distances | ||
| + | simultaneously, for drivers who prefer a "dashboard" view. | ||
| + | |||
| + | The asymmetric hysteresis on the LED state machine eliminated the boundary | ||
| + | flickering observed in early prototypes, and the non-blocking architecture | ||
| + | keeps the buzzer responsive even while the sensors are being polled. | ||
| + | |||
| + | A demonstration of the complete system in operation: | ||
| + | |||
| + | [[https://youtube.com/shorts/_dmrASQBtu4|Watch here]] | ||
| ===== Conclusions ===== | ===== Conclusions ===== | ||
| - | The implementation on the ATmega328P demonstrates efficient handling of multiple sensors simultaneously using interrupts and timers. The project is scalable and can be integrated into any small vehicle. | + | Building this project taught me a lot about how embedded systems work in |
| + | practice - not just coding, but also designing the hardware, debugging odd | ||
| + | issues, and getting everything to run smoothly on a moving toy car. | ||
| + | |||
| + | One of the biggest lessons was learning how limited hardware resources have | ||
| + | to be shared carefully. The ATmega328P only has three timers, and I needed | ||
| + | them for the buzzer, LEDs, and time measurements at the same time. I ran | ||
| + | into conflicts where the LEDs flickered whenever the buzzer was active, which | ||
| + | forced me to better understand how the timers and pins are connected. In the | ||
| + | end, I simplified the LEDs to basic on/off colors to avoid those conflicts. | ||
| + | |||
| + | I also learned how important pin selection is. At one point I connected a | ||
| + | sensor to PB5, not realizing it was also used by the programmer. That caused | ||
| + | upload failures until I rewired the sensor, and after that I became much more | ||
| + | careful about checking pin functions beforehand. | ||
| + | |||
| + | Another challenge was dealing with noisy sensor readings. The measured | ||
| + | distance constantly shifted by small amounts, which made the LEDs flicker and | ||
| + | the buzzer react unpredictably. Adding a simple averaging filter and some | ||
| + | hysteresis made the whole system feel much more stable and reliable. | ||
| + | |||
| + | Writing the I2C LCD driver and interrupt handlers from scratch also gave me a | ||
| + | much better understanding of what happens behind the scenes, compared to just | ||
| + | using ready-made libraries. | ||
| + | |||
| + | If I continued developing the project, I would add a low-power sleep mode, | ||
| + | improve the LED fading effects, and possibly include more sensors for better | ||
| + | coverage around the car. | ||
| + | |||
| + | Overall, the project showed that the ATmega328P can reliably handle multiple | ||
| + | sensors and peripherals at once using timers and interrupts, while the | ||
| + | modular structure makes the system easy to adapt for other small vehicles. | ||