On the control side of our relays you will find a GND pin, IN pins numbered from 1 to 8 depending on the relay model, and a VCC pin. Our relays require a fair amount of power to stay activated so we'll need at least a stable 5V power supply. Otherwise the Arduino will have trouble powering the higher channel relay modules. Usually they can produce a few hundred milliamps which is more then enough to power a 2 channel relay module like our LC-200 but no where near enough for an 8 channel relay module like our LC-202. For this example we'll be using the 2 channel relay. As for wiring the relay modules you'll need to follow some simple steps.
On the control side of the relay, first we need to connect our 5V power supply to the VCC and GND pins. Next we'll need to connect the IN pin to the corresponding Arduino pin, then the relays will activate once the IN pins are connected to the GND pins. On the relay side there are three main parts of each relay, three screw terminals.
These terminals are referred to as the Normally Closed (NC) connection, the top one, the Common (COM) connection, the middle one, and the Normally Open (NO) connection on the bottom. If there are no connections to the IN pin then the relay will connect between the NC and COM terminals. If the 5V power source is connected to the IN pin then the relay will connect between the NC and COM terminals as well. Finally if you connect the IN pin to the GND pin the relay will connect between the NO and COM terminals.
Now that everything is wired up its time for some basic coding with the Arduino Uno. Below is an example showing how the programming works.
const int forwards = 7; const int backwards = 6;//assign relay INx pin to arduino pin void setup() { pinMode(forwards, OUTPUT);//set relay as an output pinMode(backwards, OUTPUT);//set relay as an output } void loop() { digitalWrite(forwards, LOW); digitalWrite(backwards, HIGH);//Activate the relay one direction, they must be different to move the motor delay(2000); // wait 2 seconds digitalWrite(forwards, HIGH); digitalWrite(backwards, HIGH);//Deactivate both relays to brake the motor delay(2000);// wait 2 seconds digitalWrite(forwards, HIGH); digitalWrite(backwards, LOW);//Activate the relay the other direction, they must be different to move the motor delay(2000);// wait 2 seconds digitalWrite(forwards, HIGH); digitalWrite(backwards, HIGH);//Deactivate both relays to brake the motor delay(2000);// wait 2 seconds }
We've included a video showing off what we talked about in this article, be sure to check it out and stay tuned for more videos like it in the coming weeks. In conclusion, using relays to control linear actuators allows for some creative control options like the one we went over above and combining them with other motion control devices provides even more capabilities. If you want to learn more about our linear step motor actuators and motion control devices check out our blog for a variety of different articles like this. You can also contact us and talk to one of our on staff expert engineers to answer some of your more specific questions.
See more:https://www.oyostepper.com/
linear actuator stepper motor
回复删除