Software apps and online services
Well...I got me some TTL to UART, 12v Servos from Dynamixel. Personally, I wanted to test out some more powerful servos compared to the regular Futaba servos I have been known to use.
So, I got two and figured out that the TTL to UART circuit is not as plain-Jane as I would have liked it. Luckily, there was an adapter board called a U2D2 from Dynamixel.
I tried to figure it out anyway. The TTL to UART connection is not in any of my books that I have been reading (so far). It may be in one of them or two of them but I have not come across the circuit just yet. Anyway, the nice fellows/ladies at the Dynamixel forum helped me try to put the circuit together. That can be found here:
Just in case you want to try the circuits from that post w/ your BBBW (BeagleBone Black Wireless), you have a basis.
I was attempting to use the HC04 and HC126 chips for communicating to and from the power supply and BBBW. I came up short. Long story short, I wanted to test out the SDK and attempt the servo maneuvers before finishing the circuit. So, I purchased the U2D2 and a trossenrobitics power hub for the communication and power management.
TrossenRobotics can be found here: https://www.trossenrobotics.com/.
The beagleboard.org company or 501(c) is located somewhere in MI and they are located online either at their site online or their google groups page online at:
Okay, back to business.
So, attach your BBBW to the development desktop, either Win 10, a recent version of Linux (Debian or Ubuntu) with an updated kernel, and/or a Mac, by way of micro USB to USB A. First, we are going to try to compile the Dynamixel SDK onboard the BBBW, i.e. also called a Linux SBC. SBC is an abbreviation for Single Board Computer.
Unlike the SoC (System on Chip) like the BeagleBone Black, the BeagleBone Black Wireless has a SiP (System in Package).
Okay so, if you have a working image on your board and have used these commands to update and upgrade the existing image and packages, please clone the SDK.
sudo apt update && sudo apt upgrade
You may need to install git if you did not get your image from bbb.io/latest-images.
Also, if you are needing help with your current image, please see: https://beagleboard.org/getting-started.
There you will find a good starting basis for creating and booting your image which can be also found on their site.
Now, if you are wanting to use Python3 or C or C++ or another version of source they have in their SDK, you can. i.e. like w/ ROS or C#.
Me personally, I am going to review the C/C++ and Python install and how to use the Dynamixel Wizard 2.0 so we can just get some basic movement on the 12v servos.
Then, we can move onto the SDK within the BBBW to use the SDK to make our motors move around at our discretion.
So first, we should already have our cloned version of the Dynamixel SDK onboard the BBBW.
Now, go into the SDK.I am using PuTTY on Win 10 for now. You are freely welcome to use a Linux Distro or a WSL (Windows Subsystem for Linux) Distro like Debian or Ubuntu which can be found on their Windows App Store.
So, if you are already caught up and in your Debian Distro on your BBBW and have cloned the SDK into the Black Wireless, let us go into the /c directory first.
So, we can now go into the /build/linux_sbc/ directory. You should see a Makefile for making the c library available on your board.
Then, type this command once the make command has finished:
sudo make install
That command will install the proper files in the correct directories so that your c examples can be used from your BBBW.
If you are having any trouble, do not hesitate to ask here or on another forum where I am view the issues pertaining to this small write up.
The C++ source to compile is similar. make and then sudo make install.
That will compile and install your C++ source for use.
With Python3, we are going to use:
python3 setup.py install
This info, a more in depth set of instructions, can be found here: https://docs.python.org/3/install/.
Now, we need to change some items in the Dynamixel Wizard 2.0 so that our servos are working at the same baudrate for when using two of them instead of just one in sync_write.py for testing at the command line.
Go here online, https://emanual.robotis.com/docs/en/software/dynamixel/dynamixel_wizard2/, and gather the software.
Download and install.
Once you have you U2D2, only one motor at a time plugged in to the power hub, and the Micro USB to USB A plugged in to the development desktop, open Wizard 2.0.
Once open, go to your option tabs and click Options, click the COM port of your U2D2 if you are on Windows or another port for Linux, most likely /dev/ttyUSB0, click the 1 Mbps radio button too, and then click okay. Then, click Scan.
The software should scan for 1 Mbps baud rate on your COM port.
It will find what type of servo you have and list it with all the options available.
Now, go to the baud rate on your Wizard 2.0, double left click with the mouse over the Baud Rate section in the middle of your Wizard 2.0 for your servo type, and then change your 1 Mbps Baud Rate to 57600 bps.
Do the same with the other servo motor. Now, we have both of them being controlled at 57600 Baud Rates.
This way, we can use sync_write.py to make both of them work.
In the source of sync_write.py, we need to alter it a bit to work with our current set up. First off, we have, well, I have, AX-12A servos from Dynamixel.
So, they have a protocol1 versioning system and other relative info. that we need to deduct to enter it in finally in our python file so that communication can be accomplished.
Here is the source we can use:
from dynamixel_sdk import * # Uses Dynamixel SDK library
# Control table address
ADDR_MX_TORQUE_ENABLE = 24 # Control table address is different in Dynamixel model
ADDR_MX_GOAL_POSITION = 30
ADDR_MX_PRESENT_POSITION = 36
# Data Byte Length
LEN_MX_GOAL_POSITION = 4
LEN_MX_PRESENT_POSITION = 4
# Protocol version
PROTOCOL_VERSION = 1.0 # See which protocol version is used in the Dynamixel
# Default setting
DXL1_ID = 1 # Dynamixel#1 ID : 1
DXL2_ID = 2 # Dynamixel#1 ID : 2
BAUDRATE = 57600 # Dynamixel default baudrate : 57600
DEVICENAME = '/dev/ttyUSB0' # port when attached to the BBBW
# ex) Windows: "COM1" Linux: "/dev/ttyUSB0" Mac: "/dev/tty.usbserial-*"
TORQUE_ENABLE = 1 # Value for enabling the torque
TORQUE_DISABLE = 0 # Value for disabling the torque
DXL_MINIMUM_POSITION_VALUE = 0 # Dynamixel will rotate between this value
DXL_MAXIMUM_POSITION_VALUE = 1023 # and this value (note that the Dynamixel would not move when the position value is out of movable range. Check e-manual about the range of the Dynamixel you use.)
DXL_MOVING_STATUS_THRESHOLD = 20
Now, outside of this altered source, there are other things one can accomplish with the SDK and programming in Python.
But for now, this will get us some nice sensations of making servos move at 12v and from a TTL to UART communication.
Plus, we are making it all available from the BBBW for promoting the source.
Okay so, the above file is called sync_write.py and it can be found at /DynamixelSDK/python/tests/protocol1_0/ since we are using the 1.0 protocol. I do not think that the 2.0 version of their protocol is available for my specific motors.
Okay. Okay. Okay.
Now, use this command to run it:
That should make both motors move around without compilcation.
In the provided, changed source above, most of the addresses on the servo and the byte sizes and values can be found at https://emanual.robotis.com/docs/en/dxl/ax/ax-12a/.
P.S. If you come across some neat scripts and programs relating to Dynamixel and the BBBW, let me know!