Relay Module Control With Arduino
by STEAM-DIY in Circuits > Arduino
79 Views, 1 Favorites, 0 Comments
Relay Module Control With Arduino
Hello guys, Welcome back to my SriTu Hobby blog. Are you a new member of my blog? Please read my previous posts. So, let’s go to today’s post. Today we will be going to talk about high voltage control with the Arduino. Did you know that the maximum voltage of an Arduino board is 5v and the current is 40mA? We cannot control devices over 5v via the Arduino board. For that, we have to get the help of another component. That is, the transistor or relay must be used. Today we will use a relay for our project as a relay has the ability to control AC and DC voltages.
What is a relay?
Relay is an electronic switch. We can see this as a small box. It has five pins. Three pins can be used to input and two pins to receive output. Look at the picture below.
Supplies
Pins 1 and 2 are used to power this component. It is mentioned above on this device. We can get different types of relays like 5v, 6v, 9v, etc. The third pin must give us the potential we need to get the output. It can supply AC or DC voltage. However, the current available through this is shown at the top of the relay. That is, when the value is exceeded, the relay will burn out. Therefore, use devices with less current than the specified level. we can get outputs using 4 and 5 pins. The four-pin is called Normally closed (NC) and the five-pin is called Normally open(NO). The four-pin is usually connected to the 3rd pin. The 5th pin connects to the 3rd pin when the relay is activated.
Okay, now let’s look at the relay structure. It contains an electromagnetic coil. This coil is activated by the force applied through pins 1 and 2. We can ON/OFF this coil using the Arduino pin pulse. When this is ON and OFF, the copper plate at the end of the coil is connected to pins 4 and 5. This is why a sound is emitted when the relay is operated. This copper plate is NC under normal conditions. Is associated with the pin and the copper plate is connected to the NO pin when the relay is in the active state. Depending on your needs, you can get outputs from either of these NC or NO pins. Please remember that the potential given for pin 3 can be obtained from pins 4 and 5. I think you learned about how to work relay.
This relay cannot be connected directly to the Arduino board. This is because the high voltage we apply to the relay can cause it to burn out if it returns to the Arduino board. For that, we need to create a small circuit. But for this, we will use the relay module designed for Arduino.
It is designed as a very safe circuit. An optical coupler IC and a diode were used to stop the return of electricity. It includes three pins and three terminals. The VCC and GND pins are used to power this relay module and the IN pin is used to give the signal through the Arduino board. The middle terminal is called a common pin. It must be given an input voltage. The other two terminals can get outputs. The right terminal is NC and the left terminal is NO. The voltage we supply to terminal 3 can be obtained through terminals NO or NC. You must remember the AC voltage is very dangerous. Must be careful working with AC voltage.
Hardware Required
- Arduino Uno board x1
- Relay module x 1
- Jumper wires
Diagrame
Connect these components as follows.
Code and Test
Let’s look at the code. This project uses the LED blink example code.
- The complete program of this project –
Now, select the board and port. After, click the upload button
OK, now you can test this project. The video below shows how to install an AC bulb in this project. Please try it safely. So we will meet in the next post.
Have a good day.