Use a DC Signal to govern another circuit using AC
simulate this circuit &ndash; Schematic created using CircuitLab

Figure 1. Relay board.

The simplest and safest option for you is to use a relay interface board. A typical wiring schematic is shown in Figure 1.


Q1 is a transistor used to boost the current from your micro's GPIO (general-purpose input-output pin enough to energise the 5 V relay, RLY1.
The relay provides electrical isolation between your low voltage circuit and the mains.
D1 protects the transistor from the inductive kick when the coil is switched off.




Figure 2. A typical 4-relay board. Also available in single, double, sixes and eights.

A few points.


Keep mains wiring away from the low-voltage wiring.
Protect the relay and wiring with a suitable fuse.
Mount the relay module properly so it's not free to move while you're working on it.