0

members

Easy Basics: Project 011a 5V relay

of Acoptex.com in UNO

Basics: Project 011a

Project name: 5V relay

Tags: Arduino, 5V relay module, 5V relay

Attachments: sketch

In this project, you needed these parts :

1.Aruduino Uno R3 (you can also use the other version of Arduino)

2.5V Relay module 1 pc (or 5V relay 1 pc + resistor 1 KOm 1 pc + S8550 NPN Transistor 1 pc + diode (Rectifier) 1N4007 1 pc+ LED red 1 pc + resistor 220 Om 1 pc)

 or + ++++

3.Arduino IDE ( you can download it from here  )

4.Jumper cables F-M, M-M

5. Breadboard 1pc

Understanding the Relay

Relay is a device which is used to provide connection between two or more points or devices in response to the input signal applied. In other words, relays provide isolation between the controller and the device as devices may work on AC as well as on DC. However, they receive signals from a microcontroller which works on DC hence requiring a relay to bridge the gap. Relay is extremely useful when you need to control a large amount of current or voltage with small electrical signal.

There are 5 parts in every relay:

  1. Electromagnet – It consists of an iron core wounded by coil of wires. When electricity is passed through, it becomes magnetic. Therefore, it is called electromagnet.
  2. Armature – The movable magnetic strip is known as armature. When current flows through them, the coil is it energized thus producing a magnetic field which is used to make or break the normally open (N/O) or normally close (N/C) points. And the armature can be moved with direct current (DC) as well as alternating current (AC).
  3. Spring – When no currents flow through the coil on the electromagnet, the spring pulls the armature away so the circuit cannot be completed.
  4. Set of electrical contacts – There are two contact points: a)Normally open - connected when the relay is activated, and disconnected when it is inactive; b)Normally close – not connected when the relay is activated, and connected when it is inactive.
  5. Molded frame – Relays are covered with plastic for protection.

The working principle of relay is simple. When power is supplied to the relay, currents start flowing through the control coil; as a result, the electromagnet starts energizing. Then the armature is attracted to the coil, pulling down the moving contact together thus connecting with the normally open contacts. So the circuit with the load is energized. Then breaking the circuit would a similar case, as the moving contact will be pulled up to the normally closed contacts under the force of the spring. In this way, the switching on and off of the relay can control the state of a load circuit. 

You can find 5V relay module datasheet here.

You can find 5V relay datasheet here.

Understanding the Transistor

Transistor is a semiconductor device that controls current by current. It functions by amplifying weak signal to larger amplitude signal and is also used for non-contact switch. A transistor is a three-layer structure composed of P-type and N-type semiconductors. They form the three regions internally. The thinner in the middle is the base region; the other two are both N-type or P-type ones – the smaller region with intense majority carriers is the emitter region, when the other one is the collector region. This composition enables the transistor to be an amplifier.

From these three regions, three poles are generated respectively, which are base (2), emitter (1), and collector (3). They form two P-N junctions, namely, the emitter junction and collection junction. The direction of the arrow in the transistor circuit symbol indicates that of the emitter junction. Based on the semiconductor type, transistors can be divided into two groups, the NPN and PNP ones. From the abbreviation, we can tell that the former is made of two N-type semiconductors and one P-type and that the latter is the opposite. See the figure below. 

When a High level signal goes through an NPN transistor, it is energized. But a PNP one needs a Low level signal to manage it. Both types of transistor are frequently used for contactless switches, just like in this experiment.

You can find S8550 NPN Transistor datasheet here.

You can find Diode (Rectifier) 1N4007 datasheet here.

Signals and connections of 5V Relay and S8550 NPN Transistor

The SRD-05VDC-SL-C relay has three high voltage terminals (NC, C, and NO) which connect to the device you want to control. The other side has three low voltage pins (Ground, Vcc, and Signal) which connect to the Arduino.

5V Relay Pinout

NC: Normally closed 120-240V terminal
NO: Normally open 120-240V terminal
C: Common terminal
Ground: Connects to the ground pin on the Arduino
5V Vcc: Connects the Arduino’s 5V pin
Signal: Carries the trigger signal from the Arduino that activates the relay
Inside the relay is a 120-240V switch that’s connected to an electromagnet. When the relay receives a HIGH signal at the signal pin, the electromagnet becomes charged and moves the contacts of the switch open or closed.
NORMALLY OPEN VS. NORMALLY CLOSED
The relay has two different types of electrical contacts inside – normally open (NO) and normally closed (NC). The one you use will depend on whether you want the 5V signal to turn the switch on or turn the switch off. The 120-240V supply current enters the relay at the common (C) terminal in both configurations. To use the normally open contacts, use the NO terminal. To use the normally closed contacts, use the NC terminal.

The 5V Relay module has three high voltage terminals (NC, C, and NO) which connect to the device you want to control. The other side has three low voltage pins (GND (0V), VCC (+5V), and S(Signal)) which connect to the Arduino board.

 5V Relay Pinout

  • NC: Normally closed 120-240V terminal
  • NO: Normally open 120-240V terminal
  • C: Common terminal
  • Ground: Connects to the ground pin on the Arduino board
  • 5V VCC: Connects the Arduino’s board 5V pin
  • S(Signal): Carries the trigger signal from the Arduino board that activates the relay

Inside the relay is a 120-240V switch that’s connected to an electromagnet. When the relay receives a HIGH signal at the signal pin, the electromagnet becomes charged and moves the contacts of the switch open or closed.

NORMALLY OPEN VS. NORMALLY CLOSED

The relay has two different types of electrical contacts inside – normally open (NO) and normally closed (NC). The one you use will depend on whether you want the 5V signal to turn the switch on or turn the switch off. The 120-240V supply current enters the relay at the common (C) terminal in both configurations. To use the normally open contacts, use the NO terminal. To use the normally closed contacts, use the NC terminal.

NORMALLY OPEN

In the normally open configuration, when the relay receives a HIGH signal the 120-240V switch closes and allows current to flow from the C terminal to the NO terminal. A LOW signal deactivates the relay and stops the current. So if you want the HIGH signal to turn ON the relay, use the normally open terminal.

NORMALLY CLOSED

In the normally closed configuration, a HIGH signal opens the switch and interrupts the 120-240V current. A LOW signal closes the switch and allows current to flow from the C terminal to the NC terminal. Therefore, if you want the HIGH signal to turn OFF the 120-240V current, use the normally closed terminal.

 

Wiring

The following picture shows the needed connections with the Arduino Uno 

Or

Connect a 1K resistor (for current limiting when the transistor is energized) to pin 8 of the Arduino Uno board, then to an NPN transistor whose collector is connected to the coil of a relay and emitter to GND; connect the normally open contact of the relay to an LED and then GND. Therefore, when a High level signal is given to pin 8, the transistor is energized, thus making the coil of the relay conductive. Then its normally open contact is closed, and the LED will light up. When pin 8 is given a Low level, the LED will stay dim.

Function of the freewheeling diode: When the voltage input changes from High (5V) to Low (0V), the transistor changes from saturation (three working conditions: amplification, saturation, and cut-off) to cut-off, the current in the coil suddenly has no way to flow through. At this moment, without the freewheeling diode, a counter-electromotive force (EMF) will be generated at the ends of the coil, with positive at the bottom and negative at the top, a voltage higher than 100V. This voltage plus that from the power at the transistor are big enough to burn it. Therefore, the freewheeling diode is extremely important in discharging this counter-EMF in the direction of the arrow in the figure above, so the voltage of the transistor to GND is no higher than +5V (+0.7V).

In this experiment, when the relay closes, the LED will light up; when the relay opens, the LED will go out.

Now, send a High level signal, and the relay will close and the LED will light up; send a low one, and it will open and the LED will go out. In addition, you can hear a tick-tock caused by breaking the normally close contact and closing the normally open one.

Step by Step instruction

  1. Open Arduino IDE
  2. Plug your Adruino Uno board into your PC and select the correct board and com port
  3. Open up serial monitor and set your baud to 9600 baud
  4. Verify and upload the the sketch to your Adruino Uno

Libraries:

  • No libraries required for this project

Sketch:

  • See attachment on the begining of this project description.


Other projects of Acoptex.com
Easy Basics: Project 086d ESP-12E module, BME280 sensor - Web server of Acoptex.com in ESP8266 ESP-12 18-07-2019

« Go back to category
Is this project fake? Report it!   
Recommend to a friend
Published at 09-07-2017
Viewed: 1080 times