We just programmed the arduino to make the relay pin a0 high and low with a delay of 1 second.
Interface relay module with arduino.
2 relay module interfacing with arduino 2 relay module is an electronic device consists of two relays as its major components.
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.
On the ac side connect your feed to common middle contact and use no normally open to lamp.
So connect the 5v and the ground of the arduino with the 5v and the ground of the relay module.
A relay is basically a switch which is operated electrically by electromagnet.
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.
The further detail about 2 relay module interfacing with arduino will be given later in this tutorial.
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.
Arduino connection with relay module.
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.
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.
Then connect the signal pin of the relay module with the pin 12 of the arduino.
Introducing the relay module.
Or when the resistance of a photoresistor drops below 400 ohms.
Code for relay with arduino.
The connections for connecting the relay module with arduino are very simple.
In this example we will connect the relay module with arduino in the normally open state.
Let us discuss the working of the project.
Almost any sensor can be used to trigger the relay to turn on or off.
A simple project in which arduino uno controls a 5v relay is explained here.
Light intensity below 500 then the relay module gets input from arduino through pin 9 and there is a connection between the com and no pin is established and turns on the light.
The working of the above sketch is as when the ldr senses darkness i e.
The working of the project is based on the functioning of the relay and the ability of arduino to control the 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.
For the dc part of the circuit.
When ldr senses light intensity above 500 than the connection between com and no pin is broked and the light turns off.
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.