Advice on teensy 3.6 rs485 and dynamixel - totally stuck

Status
Not open for further replies.

mr_koz

Member
I've had a few short discussions with kurtE https://forum.pjrc.com/members/36542-KurtE on another forum (hardkernel) about talking to rs485 devices (robotis dynamixel 4 wire servos) with an all in one computer, but because i have a working os for my spider running on a mega i figured i could start with the teensy 3.6 provided i can connect the dots. The previous robot OS uses an rs232 controlled servo board to control the servos so i would only be upgrading the tx modules and creating an rx setup for reading current load/ torque values etc.

But after a great deal of googling (5-6 hours) i am still quite stuck.. I started looking for how to implement it and now i'm wondering whether i can do this with the 4 wire configuration at all???

I have a solid knowledge of software, a good knowledge of c and reasonable understanding of the electronics side of things but i do not at all compare to the regular posters here.

What i know:
* I know there's a transmitter enable feature that should make this easier/possible and wildly reduces complexity
* there's a D+, a D- and a ground pin that i need to use
* i can use code from kurtE to form the control packets, thanks dude, you're a legend
* kurtE and others have had a lot of success in doing this with the half-duplex/ttl/3 wire dynamixel servos
* teensy's are awesome and the 3.6 is next-level awesome :)

What I don't know/haven't found
* how to wire and the teensy 3.5|3.6 to the D+ and D- pins to the teensy (pullups etc)
* how to utilize the transmit-enable mode and create dual tri-state comms
* how to instantiate a connection that would allow tx of data
* how to listen on the RX side

References:
* https://forum.pjrc.com/threads/3342...-with-Teensy-3-1-without-external-Buffer-chip (aka the 3 wire thread)
* http://forums.trossenrobotics.com/s...Teensy-3-1-without-external-Buffer-chip/page2 (aka the angry thread)
* https://en.wikipedia.org/wiki/RS-485#Full_duplex_operation - very useful wiki on 485
 
For starters you need a RS-485 transceiver on the master and every slave. These 'translate' the differential data lines D+/D- to logic levels.

Are you certain you need full-duplex? Half-duplex lowers the complexity, and most protocols used on RS-485 that I know of only use half-duplex.

rs485.png

This is a fail-safe RS-485 schematic using the low-cost LTC485 half-duplex transceiver. On the left side you have the Teensy pins (RX, TX and a digital pin functioning as Driver Enable), on the right side the differential RS-485 line. The 680 Ohm bias resistors aren't generally needed. The 120 Ohm termination resistor is needed on the first (master) and last (slave) device, but for short lines you will also be fine without them (I do recommend them tho).
 

Attachments

  • rs485.png
    rs485.png
    9.4 KB · Views: 730
I don't need full duplex, but i do need to send from the master and and receive status/value messages.

Are you saying i need the transceiver on every device on the bus? the dynamixel servo's i have already have built in rs485 transceivers?

The dynamixel servo's have their own reg's for communication so the 4 wire setup is D+ D- 12v GND

With that in mind i would assume that i'd only need the one transceiver chip on the teensy side?

this of course makes the resistors a bitinteresting..

I'll see if i can track down those IC's in australia :)
 
I had to look Dynamixel up. They just use regular half-duplex RS-485. One transceiver on the Teensy side should be sufficient. Placing a termination resistor on the last servo is recommended.

There are many pin-compatible transceivers (LTC485, MAX485, ...). Just make sure you use a 3.3V part (most are 5V), or use a 5V tolerant Teensy 3.2/3.5.
 
I had to look Dynamixel up. They just use regular half-duplex RS-485. One transceiver on the Teensy side should be sufficient. Placing a termination resistor on the last servo is recommended.

There are many pin-compatible transceivers (LTC485, MAX485, ...). Just make sure you use a 3.3V part (most are 5V), or use a 5V tolerant Teensy 3.2/3.5.

Awesome, i'll have a dig. I could have sworn the robotis site said they were full duplex but i must have missed that. Thank you so much - you've been a huge help :)

My project is an 8 legged 9kg 24 servo spider called Yorick, i hope to post some success in future.
 
FYI - I have not used any of the Dynamixel RS485 servos. I have only use AX-12 a few AX-18 and one MX (the cheap continuous rotation one)...

But with my later boards that I have built for myself, I have setup to use buffer chip(or chips) to convert the 3.3v to 5v output. To control these you need to use an IO pin to control the direction of the communications. I believe this is the same for the different RS485 chips.

The reason I mention it, was I then updated my version of the Bioloid libraries to allow me to specify the IO pin I am using and it then makes use of the stuff that was added to the Serial objects to control the direction, like: Serial1.transmitterEnable(pin)

When you are looking at the different RS485 chips you may want to check to see if their Transmit Enable pin (direction pin) works with the same direction signal, which I believe is HIGH transmit, LOW receive.

Also suggest you use either Serial1 or Serial2 as these two USARTS have FIFO queues for both RX/TX, whereas the other Serial ports are simple double buffer...

And if you have not already done so, you might also ask up on Trossen forum as there are others up there who use these servos, that may also have some advice.

Good Luck
 
Please be specific about which Dynamixel motors you're using.

Some use true RS485. Others have a cheaper TTL level signal. This is an important detail to get right...
 
I am pretty sure he is talking the RS485 ones as he is talking 4 pin connections and the TTL ones are 3 pin connectinos
 
Please be specific about which Dynamixel motors you're using.

Some use true RS485. Others have a cheaper TTL level signal. This is an important detail to get right...

Good point, they are the mx64r http://www.trossenrobotics.com/p/MX-64R-dynamixel-robot-actuator.aspx and the mx28r http://www.trossenrobotics.com/r/dynamixel-MX-28R-robot-actuator.aspx

I am pretty sure he is talking the RS485 ones as he is talking 4 pin connections and the TTL ones are 3 pin connectinos

Absolutely correct, these are rs485

FYI - I have not used any of the Dynamixel RS485 servos. I have only use AX-12 a few AX-18 and one MX (the cheap continuous rotation one)...

But with my later boards that I have built for myself, I have setup to use buffer chip(or chips) to convert the 3.3v to 5v output. To control these you need to use an IO pin to control the direction of the communications. I believe this is the same for the different RS485 chips.

The reason I mention it, was I then updated my version of the Bioloid libraries to allow me to specify the IO pin I am using and it then makes use of the stuff that was added to the Serial objects to control the direction, like: Serial1.transmitterEnable(pin)

When you are looking at the different RS485 chips you may want to check to see if their Transmit Enable pin (direction pin) works with the same direction signal, which I believe is HIGH transmit, LOW receive.

Also suggest you use either Serial1 or Serial2 as these two USARTS have FIFO queues for both RX/TX, whereas the other Serial ports are simple double buffer...

And if you have not already done so, you might also ask up on Trossen forum as there are others up there who use these servos, that may also have some advice.

Good Luck

Thanks mate, i will do that.
 
For anyone else looking :)

I ended up buying a couple of max485 boards, unfortunately finding a 3.3v one in a short period of time (this was unfortunately an oversight so i'm last minuting :( ) isn't feasible so i wont be able to use the teensy 3.6 :(

Anyways, i found this: https://smartgrasp.wordpress.com/dynamixel-rx-28-rs-485-arduino/

and my plan is to use one of my spare Teensy3.2 boards because its 5v tolerant.

Thank you all for your help and advice, this looks like the best way to get it going in a short time.

Cheers!
 
Note in my quick look, I looked at Sparkfun and found: https://www.sparkfun.com/products/10124

Which at least here I can order also from Amazon.com. Amazon has another one which is probably also by Sparkfun or direct copy:
https://www.amazon.com/XINY-serial-...id=1494421066&sr=8-1&keywords=rs-485+breakout

Cool, thanks :)

I'm currently using the docs and the blog post above to try and get the MAX485 board working. At the moment I'm trying to figure whether the teensy, max485 and the servo's have a compassionate link for board rates - unfortunately i'm also testing basic commands :) time to get he oscilloscope out :)
 
Success!

I stumbled on this page:
http://forums.trossenrobotics.com/s...ing-Max485-module&highlight=max485&styleid=17

that had a PDF (attached for posterity) with the exact wiring which was the same as: https://smartgrasp.wordpress.com/dynamixel-rx-28-rs-485-arduino/ but a better reading resolution.

The pdf has a link to these libraries:
https://sourceforge.net/projects/dynamixelforarduino/?source=typ_redirect

In the library are examples and the example called dynamixel3 or similar worked out of the box at 1mbit.

Needless to say, the spider project is back on.
 

Attachments

  • DynamixelArduinoMax485Wiring.pdf
    191.5 KB · Views: 720
...

And if you have not already done so, you might also ask up on Trossen forum as there are others up there who use these servos, that may also have some advice.

Good Luck

PS i couldn't get an account on their forum because the honeypot captcha was broken :/
 
PS i couldn't get an account on their forum because the honeypot captcha was broken :/
Sorry to hear that, you might try emailing support. Note: the Trossen company employees do not monitor or post much up on there own forums... But there are some very knowledgeable an helpful people who try to help out.

Note: If your main goal is to mainly use the Teensy for a Servo controller and have most of the processing done on a Unix board, such as one from Odroid, you might also look into something like a USB2Dynamixel. I don't typically use these as for my own stuff I like Teensy processors or since I am only doing TTL servos I may use the USB2AX by Xevel
 
Sorry to hear that, you might try emailing support. Note: the Trossen company employees do not monitor or post much up on there own forums... But there are some very knowledgeable an helpful people who try to help out.

Note: If your main goal is to mainly use the Teensy for a Servo controller and have most of the processing done on a Unix board, such as one from Odroid, you might also look into something like a USB2Dynamixel. I don't typically use these as for my own stuff I like Teensy processors or since I am only doing TTL servos I may use the USB2AX by Xevel

I'll let them know, it will be very useful in future.

I've built up a usb controller for the odroid xu4 to control the servos eventually but i wanted to get the robot moving with the teensy because i have a full spider OS written for the arduino and its going to take me months to learn rustlang and write it all and use IK/FK for its calculated movement.
 
I've built up a usb controller for the odroid xu4 to control the servos eventually but i wanted to get the robot moving with the teensy because i have a full spider OS written for the arduino and its going to take me months to learn rustlang and write it all and use IK/FK for its calculated movement.

I can understand. A few years ago, I took a different approach. That is I had/have the Phoenix Hexapod code base for the Arduino and I wanted to run it on the newer Linux controllers. At that time a RPI2, So I ported the code over to linux.

What I did was to port over some of the main Arduino stuff I was using, like some Serial port stuff and the like. I then also ported over the Bioloid Library to run on it. The code is setup to be able to use a few different controllers, like the USB2AX, Arbotix Pro, Teensy..

I then ported the code to run on the RPI... Later had it also working on BeagleBone Black, then Edison, then Odroid, then UP... If you want to take a look it is up at: https://github.com/KurtE/Raspberry_Pi

I need to go up there and clean it up some more. I keep meaning to get back to my PhantomX, to work on this code base again and/or get back to ROS.

But I keep diverting myself to other things like SPI...
 
I can understand. A few years ago, I took a different approach. That is I had/have the Phoenix Hexapod code base for the Arduino and I wanted to run it on the newer Linux controllers. At that time a RPI2, So I ported the code over to linux.

What I did was to port over some of the main Arduino stuff I was using, like some Serial port stuff and the like. I then also ported over the Bioloid Library to run on it. The code is setup to be able to use a few different controllers, like the USB2AX, Arbotix Pro, Teensy..

I then ported the code to run on the RPI... Later had it also working on BeagleBone Black, then Edison, then Odroid, then UP... If you want to take a look it is up at: https://github.com/KurtE/Raspberry_Pi

I need to go up there and clean it up some more. I keep meaning to get back to my PhantomX, to work on this code base again and/or get back to ROS.

But I keep diverting myself to other things like SPI...

Sorry for the delayed response! i've been assmebling like mad :) the spider is now in one piece and i'm re-writing the basic parts of my existing spider OS to use the basic motion commands, i'll have a peek at your repo. Thank you for all your advice :)

The next stage is a very long one, i'm going to re-write a version of the dynamixel wizard for MacOS, its annoying its only for windows/linux - i found a semi-working one that i'll extend to be fully working. Once that's done i'll learn rust and write a full implementation of my spiders in rust :) should be awesome!
 
Status
Not open for further replies.
Back
Top