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.
Add kit to cartOption 2 — Individual components
₹1,093The full parts list is ₹1,093 for all 7 items. Add them all at once, or pick single items from the list below.
- Arduino Uno R3 Compatible Board with USB CableCB-UNO-R3₹499Add to cart
- HC-SR04 Ultrasonic Distance SensorCS-HCSR04₹79Add to cart
- LED Assortment Pack 100 Pieces (5 Colours)CA-LED-PACK₹79Add to cart
- Resistor Assortment Pack 600 PiecesCA-RES-PACK₹149Add to cart
- Active and Passive Buzzer PairCA-BUZZ₹49Add to cart
- 830 Point Solderless BreadboardCA-BB-830₹89Add to cart
- Jumper Wire Set 120 Pieces (M-M, M-F, F-F)CA-JUMPER-120₹149Add to cart
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.