I just finished to write a Dynamixel library for Arduino. There are many libraries to drive Dynamixel actuator, but i didn't find any that required no additional hardware (or they have some limitations).
Mine is just as simple as connecting one pin ! (take care that it should support change interrupt, see the readme file in SoftHalfDuplexSerial lib).
This library inherits from SoftHalfDuplexSerial, available here :
I basically hack a little the "official" SoftwareSerial library to allow it to switch Tx and Rx on one pin. The timing is quite important during this kind of operation, unfortunately, my logic analyser die during the development (10$ chineese one ). I run it out with success at 115200bps, but I faced some communication errors at this speed, so I think that 57600bps is a great deal.
All the required hardware and software help is available in the github wiki page. There is an axemaple for each of the lib, you just have to clone in the arduinox-x-x/libraries folder and run it.
Basically to get it work, construct a dxl object, start com using dxl::begin method, and play with your servo !
dxl dxlCom(8); // Construct a dxl object using pin 8 to communicate
dxlCom.begin(57600); // Start Communication at 57600bps
dxlCom.setGoalPosition(1, 1000); // Servo ID 1 will move to 1000
As I have only one AX servo, all my tests have been carried out with one servo connected. I assume that it could work with many AX servo daisy-chained, please let me know if anyone can test that.
akira215:
That's beacause the softserial lib emulate a serial port on a digital pin. Pin 8 support change interrupts, that's why it is connected on the drawing.
You should picture an Arduino for which SoftwareSerial IS necessary.
It is necessary to do this to drive dynamixel servo. There is unfortunately no way to communicate in half duplex mode using built in serial port, without any additional hardware. Tx & Rx buffer are separeted in Arduino µC, so Tx & Rx pin should be connected, requiring a triple state external buffer.
Hi, yes you can use it on Arduino UNO. Be sure to connect the data pin to a pin which support change interrupt (I think not on pin 2 or 3), and set the dynamixel servo baudrate to 57600 bps before starting.
I was unable to make it work with your library. (I copied the source file of the SoftHalfDuplexSerial library into the DynamixelArduino library - otherwised it wouldnt compile).
I can communicate with the arduino through your protocoll, but the answer I get is usually:
" voltage out of range-angle out of range-overheating-cmd out of range-Tx CRC invalid-overload-undefined instruction-Tx No header-Rx No header-Tx error-Rx waiting-timeout-Rx CRC invalid-Wrong ID answered"
the connection diagram is straight forward and I dont think I did anything wrong there.
I am using an arduino MEGA and would have two AX12A, so I could actually test if your library works with daisychain.
Sorry for the late answer, I was away.
I just updated the libs (the two ones). There was a mistake in the error routine, it was correted (in the example .ino file).
Please check what error you get with the new lib, it will be easier to help you.
Your libary gives this error, it misses the HardHalfDuplexSerial.h:
C:\Users\michel\Documents\Arduino\libraries\DynamixelArduino-master\examples\DynamixelMxMonitorBlock\DynamixelMxMonitorBlock.ino:32:34: fatal error: HardHalfDuplexSerial.h: No such file or directory
#include <HardHalfDuplexSerial.h>
^
compilation terminated.
exit status 1
Error compiling.
Before running the example, you have to paste the entire the library directory in your arduino folder (i.e. /opt/arduino-x.x.x/libraries on linux, I don't know the correct path on windows).
The include path of Arduino IDE is setup to seach header in this directory.
C:\Users\michel\Documents\Arduino\libraries\DynamixelArduino-master\examples\DynamixelMxMonitorBlock\DynamixelMxMonitorBlock.ino: In function 'void setup()':
DynamixelMxMonitorBlock:56: error: 'hdSerial1' was not declared in this scope
hdSerial1.setDirPin(53); // dirPin pin 53,
^
exit status 1
'hdSerial1' was not declared in this scope
The RS485 tranceiver enable is drive by the RTS pin on Due, so the HalfDuplex serial lib has changed :
SoftHalfDuplexSerial is not yet supported for the Due board, it could be but I have to take some time to tweak it. If anyone is interested, let me know.
This simply does not work. I'm not sure if it's the interrupt pin chosen on the Mega; or if there's something wrong with the serial comm or the BAUD of the servo vs the serial. But it just does not work. Do you have any more pointers?
Hi,
I tried to use a lot of libraries that I found on the forum and all of them needed an extra hardware component to communicate with arduino (RX TX communication). This lib is interesting and I am trying to use, I'm using the AX example program, but in some way, there is no communication with the servo. Ping's answering is timeout and a I have no idea about what's going on. If anyone have any idea that can help me, I would be really really thankfull.