On the ac side connect your feed to common middle contact and use no normally open to lamp.
Interface relay module with arduino.
As mentioned earlier by interfacing arduino with 5v relay module we intend to operate an ac load like lamp.
The working of the above sketch is as when the ldr senses darkness i e.
Then connect the signal pin of the relay module with the pin 12 of the arduino.
A relay is basically a switch which is operated electrically by electromagnet.
The arduino can be programmed to turn on the 4 channel relay module when a certain event occurs for example when the temperature of a thermistor gets higher than 30 c.
A normally open configuration works the other way in which the relay is always open until you send a signal from the arduino to the relay module to close the circuit.
2 relay module interfacing with arduino 2 relay module is an electronic device consists of two relays as its major components.
The further detail about 2 relay module interfacing with arduino will be given later in this tutorial.
Code for relay with arduino.
In this configuration the relay is always closed and remains closed until you send a signal from the arduino to the relay module to open the circuit.
The connections for connecting the relay module with arduino are very simple.
It will get power when s is high.
A relay is an electrically operated switch that can be turned on or off letting the current go through or not and can be controlled with low voltages like the 5v provided by the arduino pins.
The working of the project is based on the functioning of the relay and the ability of arduino to control the relay.
Arduino digital pin 10 module pin s arduino gnd module pin arduino 5v module pin ac part of the circuit.
Controlling a relay module with the arduino is as simple as controlling any other output as we ll see later on.
We just programmed the arduino to make the relay pin a0 high and low with a delay of 1 second.
For the dc part of the circuit.
A relay can be used to control high voltage electronic devices such as motors and as well as low voltage electronic devices such as a light.
In this example we will connect the relay module with arduino in the normally open state.
Let us discuss the working of the project.
So connect the 5v and the ground of the arduino with the 5v and the ground of the relay module.
Introducing the relay module.
Arduino connection with relay module.
A simple project in which arduino uno controls a 5v relay is explained here.
Working is simple we need to make the relay pin pin a0 high to make the relay module on and make the relay pin low to turn off the relay module the ac light will also turn on and off according to relay.
Relay module for arduino is one of the most powerful application for arduino as it can be used to control both a c and d c devices by simply controlling the relay by giving 5v.
Almost any sensor can be used to trigger the relay to turn on or off.