All projects

Embedded Systems · Hardware / PCB Design

TimeBell — Automatic School Bell

A small embedded controller that rings a school's bell on its daily timetable. It keeps time with a battery-backed DS3231 RTC, stores two timetables (winter and summer), shows the time on a seven-segment display and switches the bell through a relay. It has been in service for approximately five years.

Deployed· in service ~5 years2021 – present
Source on GitHub(opens in a new tab)
TIMEBELL / AUTOMATION
MCUBELL CONTROLLERDS3231 RTCBUTTONSPOWERRELAYBELLDISPLAY
Hardware → firmware → softwareConcept diagram

Problem and motivation

The school needed its bell to ring on a fixed timetable of 28 events a day, with different timetables for winter and summer. The goal was a controller that rings the bell on time every day without anyone touching it.

Requirements

  • Ring the bell at each scheduled time, exactly once per event.
  • Switch between two timetables (winter and summer) with the button panel.
  • Keep correct time through power cuts.
  • Let staff set the time on the device, without a computer.
  • Run unattended for years.

Hardware architecture

  • Arduino-class microcontroller with a DS3231 temperature-compensated RTC on I²C.
  • Four-digit common-anode seven-segment display, multiplexed by the MCU.
  • Two push buttons for setting the time and switching timetables.
  • Active-low relay output switching the existing bell circuit.
  • A custom carrier PCB around an Arduino Nano Every was designed in KiCad.

Firmware architecture

  • Two-state machine: ARMED (normal operation) and SETUP (time adjustment).
  • Both timetables are compiled into the firmware as constant tables. Each second, the current RTC time is compared against the active table.
  • A 'rang' flag ensures that each scheduled minute triggers the relay only once.
  • Debounced buttons: a short press toggles the timetable, a 3-second long press enters or leaves setup mode and writes the new time to the RTC.
  • The selected timetable is stored in EEPROM, so it survives power loss.

Engineering decisions

  • Timekeeping comes from a dedicated RTC rather than the MCU's oscillator, so accuracy and power-loss behaviour don't depend on the MCU.
  • Timetables are fixed in firmware instead of editable at runtime. There is less to go wrong, at the cost of reflashing when the timetable changes.
  • Physical buttons and a display, so school staff can set the time without any tools.

Problems and challenges

  • Display multiplexing shares pins with the serial port on some boards, which constrained the pin assignment.

Testing and validation

  • Validated by approximately five years of daily operation at the school.

Results

The controller has rung the school's daily timetable for around five years. It is the clearest evidence in this portfolio of a device running unattended in production for a long time.

Potential improvements

  • Replace the blocking relay delay with non-blocking timing so the display keeps refreshing while the bell rings.
  • Allow the timetable to be edited without reflashing (buttons or USB).
  • Add a watchdog timer and log brown-out resets.