Seatbelt Reminder Lamp
On an Arduino Nano 33 BLE, flash a belt warning lamp when the ignition is on and the belt stays unlatched for two seconds, and start the grace period over every time the situation begins again.
- Board
- Nano 33 BLE · Arduino
- Difficulty
- Easy
- Topic
- Timing & Program Flow
- Access
- Free
The task
Seatbelt Reminder Lamp
A delivery-van maker is adding a belt reminder to its instrument cluster. When the ignition is on and the driver's belt is not latched, the belt lamp must start flashing after a short grace period, and go dark the moment the buckle clicks in. Times are shortened for the bench.
Hardware
- Arduino Nano 33 BLE (nRF52840, 3.3 V logic). Serial console on
Serial1(D0/D1), 115200 baud.Serialis USB and is not seen by the tests. - D2: ignition switch, closes to GND while the ignition is on. Use the internal pull-up:
LOW= ignition on. - D3: buckle switch, closes to GND while the belt is latched:
LOW= latched. - D4: belt warning lamp (LED with a series resistor to GND),
HIGH= lit. - Both switches reach the board through the cluster's input filter, so they do not bounce.
Write the sketch in sketch/sketch.ino. In setup() open Serial1 at 115200 baud, set up the pins with the lamp off, then print READY. Never block with delay(): both switches are read all the time.
Requirements
- When to remind. The reminder applies only while the ignition is on and the belt is not latched. In every other situation the lamp is off.
- Grace period, then flashing. Once that situation has lasted 2000 ms without a break, print
REMIND ONand flash the lamp 500 ms on, 500 ms off, starting with on, for as long as the situation lasts. - Cancel and start over. When the belt is latched or the ignition is switched off, the lamp is off within 20 ms; if it was flashing (and only then), print
REMIND OFF. Each time the reminder situation begins again, the 2000 ms grace period starts again from zero.
Example console output:
READY
REMIND ON
REMIND OFF
Wiring
Build the circuit in the Wiring tab: the ignition switch between D2 and GND, the buckle switch between D3 and GND, and the warning lamp LED on D4 with a series resistor of 220 to 1000 ohm on the pin side and the LED cathode to GND. A wrong or incomplete circuit blocks Run.
Success criteria
- The sketch builds.
- The lamp stays dark while the ignition is off or the belt is latched.
- With the ignition on and the belt open,
REMIND ONcomes after 2 s and the lamp flashes at 1 Hz. - Latching the belt or switching off stops the lamp at once, and the next reminder waits the full 2 s again.
What you get
- Your firmware is built and run on an emulated board and checked by hardware-level tests.
- A written walkthrough of the solution.
- No development board or local toolchain needed.
New to embedded? Start with the roadmap: How to learn embedded systems