BRUTE FORCE
ELECTRONICS-PROGRAMMING-ROBOTICS
Course Overview
▪ Week 1 – Electronics
▪ Week 2 – Programming
▪ Week 3 – Arduino
▪ Week 4 – Robotics
Tutorial 5
Arduino AC + Relays
Focus
● Arduino Relays
Relays
● We can control high voltage electronic devices using relays.
● A Relay is actually a switch which is electrically operated by
an electromagnet. The electromagnet is activated with a low
voltage, for example 5 volts from a microcontroller and it pulls
a contact to make or break a high voltage circuit.
● It is used to programmatically control on/off the devices, which
use the high voltage and/or high current.
● It is a bridge between Arduino and high voltage devices.
Arduino Relays
● Relay has two groups of pins:
✓ low voltage group
✓ high voltage group.
● Pins in the low voltage group are connected to Arduino, including three pins:
✓ GND pin needs to be connected to GND (0V)
✓ VCC pin needs to be connected to VCC (5V)
✓ IN pin receives the control signal from Arduino
● Pins in the high voltage group are connected to high voltage a device, including
three pins (usually in screw terminal):
✓ COM pin is the common pin. It is used in both normally open mode and
normally closed mode.
✓ NO pin is normally open pin. It is used in the normally open mode
✓ NC pin is normally closed pin. It is used in the normally closed mode
● In practice, we usually do NOT use all of the pins in the high voltage group. We
use only two of them:
● We use only COM pin and NO pin if we use normally open mode.
● We use only COM pin and NC pin if we use normally closed mode.
Arduino Relays
● COM: common pin
● NC (Normally Closed): the normally closed configuration is used when you
want the relay to be closed by default, meaning the current is flowing unless
you send a signal from the Arduino to the relay module to open the circuit and
stop the current.
● NO (Normally Open): the normally open configuration works the other way
around: the relay is always open, so the circuit is broken unless you send a
signal from the Arduino to close the circuit.
Normally Open Mode
● To use this mode, we need to connect the high voltage device to the COM pin and NO pin.
● If the IN pin is connected to LOW (0V), the switch is open. The device is OFF (or inactive).
● If the IN pin is connected to HIGH (5V), the switch is closed. The device is ON (or active).
Normally Closed Mode
● To use this mode, we need to connect the high voltage device to the COM pin and NC pin.
● If the IN pin is connected to LOW (0V), the switch is closed. The device is ON (or active).
● If the IN pin is connected to HIGH (5V), the switch is open. The device is OFF (or inactive).
● Controlling a relay is simple. We just need:
✓ Connect an Arduino's pin to the IN pin of the relay
✓ Control the relay by programming the pin to LOW or HIGH
Interfacing Arduino with 1-channel Relay module
● You will need:
1. Arduino board
2. LED
3. 1K Resistor
4. 5v power supply
5. 1-channel relay
void setup(){
pinMode(7,OUTPUT);
}
void loop(){
pinMode(7,OUTPUT);
delay(2000);
digitalWrite(7,LOW);
delay(2000);
}
BRUTE FORCE [email protected] +263718384192
THANK YOU ARDUINO GEEKS!
IGNITING CREATIVITY - LEARN BY DOING
BRUTE FORCE
[email protected] +263718384192