Switching mains voltage with Arduino and relays

Summary

Johannes Findeisen shows a small relay setup that periodically switches a mains line using the Arduino Blink example. The setup switches on and off for ten seconds each.

Ideas

  • A digital output can drive a relay through a suitable driver stage.
  • The Blink example is a simple functional test for timed switching.
  • Relays galvanically isolate the control logic from the switched circuit.

Insights

  • A minimal software example can quickly make real hardware testable.
  • Mains voltage turns a simple Arduino experiment into a safety-critical project.

Facts

  • An Arduino serves as the controller.
  • The article documents the visible on and off states.

Recommendations

  • Use touch-safe enclosures, a fuse and sufficient clearances between conductors.
  • Test the logic with harmless extra-low voltage only at first.
  • For experiments at safe low voltage, a ready-made relay module with optocoupler (affiliate link: if you buy something, I get a small commission and the price does not change for you) already includes the driver stage and flyback diode.

References

Read the original article on hanez.org

Search the Web Archive

Found a mistake or have something to add? Get in touch.