Background
A relay is an electromagnetic switch that operates on the principle of electromagnetic induction.
Project 1 – Hello World
The relay will toggle, illuminating an LED every other second.
However, it’s not any LED. It’s a 12V, 360mA LED commonly found in automobiles.
Hardware Connections
The purpose of the ULN2803 is to increase the IO pin current to sufficiently drive the coil of the relay plus it has other protection features. Inside the ULN2803 are 8 Darlington transistor configurations. This is more than sufficient.
I created a custom schematic symbol for the SPST relay. Feel free to roast me on it.
The schematic is available at my GitHub repository.
Software
The full source code is available in my GitHub repository.
Showcase
Project 2 – Sentinel – A Relay Controller
Toggling a load is good and all but what if we want specific behaviours? Let’s expand on the original by adding 3 modes of operation:
- Latching (thereby preserving a specific state)
- Disabling the relay
- Manual
A debounced push button lets a user select the mode. A short press toggles AUTO/MANUAL, long press forces the relay off (lockout).
Hardware Connections
The schematic is available at my GitHub repository.
The Software
Full source code is located in my GitHub repository.

