Microcontrollers generally have no pin I / O capable of providing high current, such as to trigger an engine, high-current LED or lamp. Digital pin ARDUINO UNO provide a DC voltage of 5 volts accurate and maximum current up to 40 mA.
This topic will be presented techniques for using relays, which is nothing more than an electromechanical switch, comprising a coil that acts as a solenoid, which by electromagnetic action triggers a lever, causing the closure of the contacts of the relay. With this component can trigger high current loads and different voltages.
For this project we will use Relay (Metaltex ML2RC1-6V), which you can trigger AC loads of 127V / 15A and 250V / 10A or DC loads up to 110V / 15A. Its activation is made with a 6V DC voltage but may use the voltage of 5 volts without problems.
But in order to use a relay connected to ARDUINO, we have to use an intermediate component. We will use a transistor as an electronic key for the activation of the relay, this is due to the fact that the relay requires a current of 40 to 100 mA to your drive. Further on we will see how to do the calculations for the use of this important component.
Below the wiring diagram:
Circuit schematic:
Material list :
Ref. Des.
|
Name
|
Value
|
D1
|
Diode General
|
1N4148
|
RY1
|
RELAY, SPDT
|
Metaltex ML2RC1-6V
|
R1
|
RESISTOR
|
2K2
|
Q1
|
NPN
|
BC 548
|
R2
|
RESISTOR
|
1K
|
L1
|
LED
|
Red one
|
Program :
// the setup function runs once when you press reset or power the board void setup() { // initialize digital pin 13 as an output. pinMode(7, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(7, HIGH); // turn the LED on (HIGH is the voltage level) delay(3000); // wait for 3 seconds digitalWrite(7, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second }
This simple program is used only to demonstrate the operation of the relay.