Hi, I'm new here and nice to meet you all.
With Arduino Uno I'm trying to control a linear actuator named 'PLS-5030' by Potenit and I have some trouble.
The actuator has 4 pins(Vcc, TX, RX, GND). Its manual says that it has firmware in it so we can control it with TTL protocol. Aruduino Uno has only one serial port which will be busy with usb when connected to PC, so I tried to use the SoftwareSerial.
After assigning appropriat Vcc and GND, I connected the actuator's TX pin to 10(which is RX for Arduino board), and TX pin to 11(Which is TX for Arduino board), and uploaded the following code.
void loop(){
if(Actuator.available()) {
//writing 5 bytes to the actuator
Actuator.write((byte)80);
Actuator.write((byte)01);
Actuator.write((byte)00);
Actuator.write((byte)03);
Actuator.write((byte)00);
}
}
This a simplified version of what I was trying.
And the result was nothing. Nothing happens.
So there are two questions.
Am I using Serial, SoftwareSerial right?
In order to make the actuator move, the manual says I have to send 5 bytes in hexadecimal format and I'm not sure what to do. I think the code above is wrong but I don't know how to do it right.
The description of how the TX and RX pins are connected is a bit confusing. You might try switching the connections to pins 10 and 11. Otherwise, yes you are using SoftwareSerial correctly (assuming that your mysterious device communicates at the MIDI baud rate, which would surprise me).
In order to make the actuator move, the manual says I have to send 5 bytes in hexadecimal format and I'm not sure what to do. I think the code above is wrong but I don't know how to do it right.
I mean I connected the RX, TX pins crossed. I think there's no problem with this. And yes, the manual says it communicates at 38400 bps(8N1).
I also tried a debugging code which turns on LED if Actuator.available() >0. But nothing happens.
Perhaps one of the problems is the hexadecimal format, and I don't know exactly how to convert a byte to hexadecimal.
@zoomkat - In the end I am trying to attach 3 or 4 motors to arduino and make a system like a printer, but at this point I am just trying to learn how to control the actuator with arduino. So my short-term goal is to send an order to arduino from my computer and make arduino send it to the actuator.