Two ultrasonic sensors watch both approaches of a blind U-turn and drive traffic signals plus a buzzer, holding the approaching side until the turn clears. A road-safety build aimed at hill bends and blind corners.
What it does
Each sensor covers one approach. A vehicle inside the danger distance turns the opposing signal red and sounds the warning. Fourteen pins in use makes this an honest lesson in pin budgeting.
Circuit connections
| Connection | Arduino pin |
|---|---|
| Sensor 1 Trig | D6 |
| Sensor 1 Echo | D8 |
| Sensor 2 Trig | D7 |
| Sensor 2 Echo | D9 |
| Light 1 red / yellow / green | D10 / D11 / D12 |
| Light 2 red / yellow / green | D13 / A1 / A2 |
| Buzzer | A3 |
Bench note: A0 to A5 work as ordinary digital pins. Declare them with pinMode(A1, OUTPUT) and the rest of the sketch treats them exactly like D-pins.
Libraries used
(no external libraries)Get the parts
Two ways to build this, and you can choose either. Take the complete kit in one box, or buy only the individual components you are missing. Both use the normal shop cart.
Option 1 — Complete kit
₹2,499eARgle Arduino Fundamentals Kit (20-Day Programme) — everything needed, boxed, with the quick-start card and reference sketches.
Enquire to orderOption 2 — Individual components
₹581Live prices from our partner Robolark: ₹581 for 5 of 8 parts in stock. Add them all at once, or pick single items from the list below.
Add all 5 components- Uno R3-Microcontroller (ATmega328p)-Arduino CompatibleR-0007₹380Add to Parts Box
- Ultrasonic Sensor-HC-SR04R-0377₹86Add to Parts Box
- Red LED-5mm (Pack of 5)R-0535₹5Out of stock
- Green LED - 5mm (Pack of 5)R-0364₹5Out of stock
- Resistor Box- AssortmentR-0541₹80Add to Parts Box
- Buzzer 5VR-0273₹15Add to Parts Box
- MB-102 Solderless Breadboard - 830 Tie PointsR-0204₹69Out of stock
- Jumper Wires - Male to Male × 2R-0457₹20Add to Parts Box
Already own the board or the display? Skip them — the sketches do not care where the parts came from.
Source code
Every sketch on this page is open source. Clone it, change it, break it, tell us what you learned.
Want to be taught this, not just handed the code?
We run this as a mentor-led session for schools, colleges and individual learners, online or at our centre. Tell us what you want to build.