Arduino-relay controlled solenoid valve

The purpose of writing this article is to control the flexible claw recently. There is no detailed tutorial, so I write down the process of my own implementation for the purpose of recording.
To make a long story short, the arduino is used to control the relay to start and stop the solenoid valve, and then reach the state of contraction and expansion of the flexible claw.

The main components are shown in the figure below
It is worth noting that the com terminal of the relay is connected to The + pole of the switching power supply; The NC terminal of the relay is connectedConnectThe - pole of the solenoid valve;The + pole of the solenoid valve. The second air hole under the solenoid valve is used to vent air, and there is no need to connect it to anything. It is better to buy a two-position three-way solenoid valve

By delaying 2s, the relay is turned on and off to inflate and deflate the solenoid valve.
 

int pin= 3;  // 继电器引脚

void setup()
{
 pinMode(pin, OUTPUT); 
}
 
void loop(){
  digitalWrite(pin, HIGH);
  delay(2000);
  digitalWrite(pin, LOW); 
  delay(2000);
}

Guess you like

Origin blog.csdn.net/Zeng999212/article/details/134816972