Both sides previous revisionPrevious revisionNext revision | Previous revision |
en:iot-open:hardware2:actuators_mechanical [2023/08/18 20:55] – pczekalski | en:iot-open:hardware2:actuators_mechanical [2023/11/23 10:39] (current) – pczekalski |
---|
==== Electromechanical Devices ==== | ====== Electromechanical Devices ====== |
| {{:en:iot-open:czapka_b.png?50| General audience classification icon }}{{:en:iot-open:czapka_e.png?50| General audience classification icon }}\\ |
| == Relay == |
| |
=== Relay === | Relays are electromechanical devices that use electromagnets to connect or disconnect the plates of a switch. Relays are used to control high-power circuits with low-power circuits. Both circuits are electrically isolated; thus, the control logic is protected from high voltage, sometimes from the power mains. Relays are used in household appliance automation, lighting and climate control. Although the electromagnet's coil of the relay requires relatively low power compared to the power capability of the output circuit, it cannot be connected directly to the microcontroller's pin. Creating the transistor driver or using a relay module with the driver built-in is possible. The sample relay module is present in figure {{ref>relay_photo}} and its connection to the Arduino development board in figure {{ref>relay_schematic}}. |
| |
Relays are electromechanical devices that use electromagnets to connect or disconnect the plates of a switch. Relays are used to control high-power circuits with low-power circuits. Circuits are electrically isolated and thus protect logic control. Relays are used in household appliance automation, lighting and climate control. Although the electromagnet's coil of the relay requires relatively low power compared to the power capability of the output circuit, it cannot be connected directly to the microcontroller's pin. Creating the transistor driver or using a relay module with the driver built-in is possible. | <figure relay_photo> |
| {{ :en:iot-open:getting_familiar_with_your_hardware_rtu_itmo_sut:arduino_and_arduino_101_intel_curie:relay_c_2.jpg?100 | 1 channel relay module}} |
<figure label> | <caption>One-channel relay module</caption> |
{{ :en:iot-open:getting_familiar_with_your_hardware_rtu_itmo_sut:arduino_and_arduino_101_intel_curie:relay_c_2.jpg?100 }} | |
<caption>1 channel relay module.</caption> | |
</figure> | </figure> |
| |
<figure label> | <figure relay_schematic> |
{{ :en:iot-open:getting_familiar_with_your_hardware_rtu_itmo_sut:arduino_and_arduino_101_intel_curie:sch_apz_shemas_relay.png?200 }} | {{ :en:iot-open:getting_familiar_with_your_hardware_rtu_itmo_sut:arduino_and_arduino_101_intel_curie:sch_apz_shemas_relay.png?200 | Arduino Uno and 1 channel relay module schematics}} |
<caption>Arduino Uno and 1 channel relay module schematics.</caption> | <caption>Arduino Uno and one-channel relay module schematics</caption> |
</figure> | </figure> |
| |
The example code: | The following example code should work properly for the relay module. It turns the relay on while there is a "1" state at the microcontroller's output and turns the relay off while there is a "0" state at the output. |
<code c> | <code c> |
#define relayPin 4 //Define the relay pin | #define relayPin 4 //Define the relay pin |
void loop() | void loop() |
{ | { |
digitalWrite(relayPin,0); //Turn relay on | digitalWrite(relayPin,1); //Turns relay on |
Serial.println("Relay ON"); //Output text | Serial.println("Relay ON"); //Output text |
delay(2000); // Wait 2 seconds | delay(2000); // Wait 2 seconds |
| |
digitalWrite(relayPin,1); //Turns relay off | digitalWrite(relayPin,0); //Turns relay off |
Serial.println("Relay OFF"); | Serial.println("Relay OFF"); |
delay(2000); | delay(2000); |
</code> | </code> |
| |
=== Solenoid === | == Solenoid == |
Solenoids are devices that use electromagnets to pull or push iron or steel core. They are used as linear actuators for locking mechanisms indoors, pneumatic and hydraulic valves and in-car starter systems. | Solenoids use electromagnets to pull or push iron or steel cores. They are used as linear actuators for locking mechanisms indoors, pneumatic and hydraulic valves and in-car starter systems.\\ |
| Solenoids and relays use electromagnets, and connecting them to Arduino is very similar. Coils need much power and are usually attached to the circuit's power source using a transistor driver. Turning the coil's power off makes the electromagnetic field collapse and creates a very high voltage. A shunt diode channels the overvoltage for the semiconductor devices' protection. For extra safety, an optoisolator can be used. Sample solenoid is present in figure {{ref>solenoid_photo}} and connection to the MCU in figure {{ref>solenoid_schematics}}. |
Solenoids and relays both use electromagnets, and connecting them to Arduino is very similar. Coils need a lot of power, and they are usually attached to the circuit's power source with the use of a transistor driver. Turning the coil's power off makes the electromagnetic field collapse and creates a very high voltage. A shunt diode is used to channel the overvoltage for the semiconductor devices' protection. For extra safety, an optoisolator can be used. | |
| |
<figure label> | <figure solenoid_photo> |
{{ :en:iot-open:getting_familiar_with_your_hardware_rtu_itmo_sut:arduino_and_arduino_101_intel_curie:solenoid_c.jpg?100 }} | {{ :en:iot-open:getting_familiar_with_your_hardware_rtu_itmo_sut:arduino_and_arduino_101_intel_curie:solenoid_c.jpg?100 | Solenoid}} |
<caption>Solenoid</caption> | <caption>A solenoid</caption> |
</figure> | </figure> |
| |
<figure label> | <figure solenoid_schematics> |
{{ :en:iot-open:getting_familiar_with_your_hardware_rtu_itmo_sut:arduino_and_arduino_101_intel_curie:sch_apz_shemas_solenoid.png?200 }} | {{ :en:iot-open:getting_familiar_with_your_hardware_rtu_itmo_sut:arduino_and_arduino_101_intel_curie:sch_apz_shemas_solenoid.png?200 | Arduino Uno and solenoid schematics}} |
<caption>Arduino Uno and solenoid schematics</caption> | <caption>Arduino Uno and solenoid schematics</caption> |
</figure> | </figure> |
| |
The example code: | The example code to control solenoid is present below: |
<code c> | <code c> |
#define solenoidPin 4 //Define the solenoid pin | #define solenoidPin 4 //Define the solenoid pin |
void loop() | void loop() |
{ | { |
digitalWrite(solenoidPin,0); //Turn solenoid on | digitalWrite(solenoidPin,1); //Turns solenoid on |
Serial.println("Solenoid ON"); //Output text | Serial.println("Solenoid ON"); //Output text |
delay(2000); //Wait 2 seconds | delay(2000); //Wait 2 seconds |
| |
digitalWrite(solenoidPin,1); //Turns solenoid off | digitalWrite(solenoidPin,0); //Turns solenoid off |
Serial.println("Solenoid OFF"); | Serial.println("Solenoid OFF"); |
delay(2000); | delay(2000); |