Help. Serial communication of HEX

I want to control a linear actuator which uses I/O (TTL) signal to control the load output and position.

From the manual, I got communication protocol (the commands are hexadecimal format) and checked the commands using my computer.

But I got in trouble when I tried to send the data with the Arduino.

So, would you check my very simple code and tell me the problem?


// command based on communication protocol byte servoset[] = {0x80, 0xEA, 0x01, 0x00, 0x00}; byte servopush[] = {0x80, 0x01, 0x00, 0x03, 0xDE}; byte servopull[] = {0x80, 0x01, 0x00, 0x00, 0xF0};

// I want to operate the actuator once void setup() {

Serial.begin(38400);

delay(1000);

Serial.write(servoset, sizeof(servoset));

delay(1000);

Serial.write(servopush, sizeof(servopush));

delay(3000);

Serial.write(servopull, sizeof(servopull));

}

void loop() {

}

Have you tried Google? Something similar to this was discussed not too long ago but I don't think that the site search feature is working too well at the moment.

I searched about 10 hours.

And the coding is the result.

Which linear actuator?

How do you have it wired up?

Would you please refer this attachment?

I cannot explain what it is in my words.

My circuit is also very simple.

Arduino as well as the actuator are parallelly powered by 7.4 V and both have common ground. Arduino's pin 1(TX) is connected to the RX of actuator. But I reduced the 5 V (TX) to 3.3 V (RX) because the actuator is suited for 3.3 V. I used voltage divider to lower the voltage. TX (5V) --- 1.8k ohm----3.3k ohm---GND l_ _ _ _RX

Bemong: Would you please refer this attachment?

I cannot explain what it is in my words.

Can you post a link to the website where you got that document. Hopefully there is also a wiring diagram.

From reading it I suspect you can control the Actuator as a regular servo using the Arduino servo library.

...R

The spec sheet image certainly says PWM, and the timings are consistent with the Servo library. In fact, I can't see from that where the serial is even connected

I checked this actuator can be controlled by serial communication without PWM.

With my computer and USB-to-UART, I sent the HEX data to the actuator and operated it.

In fact, I tried PWM control using the arduino library. But I failed.

I think that focusing on serial communication is the easy way to solve my problem which is simply move the actuator.

Bemong: I checked this actuator can be controlled by serial communication without PWM.

With my computer and USB-to-UART, I sent the HEX data to the actuator and operated it.

In fact, I tried PWM control using the arduino library. But I failed.

I think that focusing on serial communication is the easy way to solve my problem which is simply move the actuator.

You have not posted a link to the datasheet (as I requested earlier) so how can I help?

...R

You have not posted a link to the datasheet (as I requested earlier) so how can I help?

…R
[/quote]

Oh, that is my mistake!

This attachments are all I can have from the manufacturer.

The site do not provide English, but I put the link here.

http://www.potenit.com/page.php?LinkPage=view_product2&Code=20130325180056

You might want to consider using a level-shifter instead of the voltage divider.

https://learn.sparkfun.com/tutorials/bi-directional-logic-level-converter-hookup-guide

http://playground.arduino.cc/Main/I2CBi-directionalLevelShifter

Bemong: This attachments are all I can have from the manufacturer.

OK - we will have to try to work with that.

It almost seems to me that the two pages are for different devices. In the first case it looks like a servo signal on the white wire would control the device - have you tried that? If so maybe you would post the test code and a diagram of how you actually connected everything. If this works it would be by far the simplest solution so I would certainly try hard to get it to work.

In the other page it seems that you need to send 5 byte messages to the device at 38,400 baud. From your original post it seems that you have tried the examples the same way I would have.

Can you post a drawing (photo of a pencil drawing will be fine) showing how everything is connected.

...R

Robin2:

Bemong:
This attachments are all I can have from the manufacturer.

OK - we will have to try to work with that.

It almost seems to me that the two pages are for different devices. In the first case it looks like a servo signal on the white wire would control the device - have you tried that? If so maybe you would post the test code and a diagram of how you actually connected everything. If this works it would be by far the simplest solution so I would certainly try hard to get it to work.

In the other page it seems that you need to send 5 byte messages to the device at 38,400 baud. From your original post it seems that you have tried the examples the same way I would have.

Can you post a drawing (photo of a pencil drawing will be fine) showing how everything is connected.

…R

borland:
You might want to consider using a level-shifter instead of the voltage divider.

Bi-Directional Logic Level Converter Hookup Guide - learn.sparkfun.com

http://playground.arduino.cc/Main/I2CBi-directionalLevelShifter

Thank you Robin2 and borland. Owing to your help, I solved the problem.

I attached the picture of my circuit.

The problem was my poor analog voltage divider between the TX and RX.

The linear actuator is suited for 3.3 V so I tried to decrease the 5 V from TX by using the wrong voltage divider.

From the borland’s post, I guessed that my voltage divider would be the problem and I removed it.

Then it worked even though the linear actuator requires 3.3 V to be sufficient condition.

I am really touched by your voluntary helps. Thank you so much.

My last question, do any body know why my analog voltage divider caused the problem?