This is an old revision of the document!


Electromechanical Devices

Relay

Relays are electromechanical devices that use electromagnets to connect or disconnect plates of a switch. Relays are used to control high power circuits with low power circuits. Circuits are mechanically isolated and thus protect logic control. Relays are used in household appliance automation, lighting and climate control.

 title
Figure 1: 1 channel relay module.
 title
Figure 2: Arduino Uno and 1 channel relay module schematics.

The example code:

#define relayPin  4 //Define the relay pin
 
void setup()
{    
  Serial.begin(9600);
  pinMode(relayPin, OUTPUT); //Set relayPin to output
 
}
 
void loop()
{
   digitalWrite(relayPin,0);  //Turn relay on
   Serial.println("Relay ON"); //Output text 
   delay(2000); // Wait 2 seconds
 
   digitalWrite(relayPin,1);  //Turns relay off
   Serial.println("Relay OFF");
   delay(2000);
}

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 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 power source of the circuit. Turning the power of the coil off makes the electromagnetic field to collapse and creates very high voltage. For the semiconductor devices protection, a shunt diode is used to channel the overvoltage. For extra safety, optoisolator can be used.

 title
Figure 3: Solenoid.
 title
Figure 4: Arduino Uno and solenoid schematics.

The example code:

#define solenoidPin  4 //Define the solenoid pin
 
void setup()
{    
  Serial.begin(9600);
  pinMode(solenoidPin, OUTPUT); //Set solenoidPin to output
 
}
 
void loop()
{
   digitalWrite(solenoidPin,0);  //Turn solenoid on
   Serial.println("Solenoid  ON"); //Output text 
   delay(2000); //Wait 2 seconds
 
   digitalWrite(solenoidPin,1);  //Turns solenoid off
   Serial.println("Solenoid OFF");
   delay(2000);
}
en/iot-open/hardware2/actuators_mechanical.1692352992.txt.gz · Last modified: 2023/08/18 07:03 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0