In the discussion and hardware build-up that follows, ourcollective programming and hardware design/assemblyefforts will be focused on the Microchip PIC18F2620,which will be coded to drive a Dynamixel AX-12+ robotactuator. There are several Dynamixel robot actuators inaddition to the AX-12+. This month, we will center exclusively on instructing the F2620 to drive a Dynamixel
AX-12+ robot actuator. Weve got some specialized AX-12+hardware to design and assemble before we can begin tocode the driver firmware. So, lets get started.
The Dynamixel AX-12+
I can easily describe the Dynamixel AX-12+ robot actuator you see in Photo 1 with a singleword: SuperServo. The AX-12+ can doeverything a standard hobby servo can andbetter. For instance, to obtain continuousrotation you dont have to disassemble andintentionally break it. You simply com-mand it to perform an endless turn. Need toknow where the servo shaft is? Dont ask ahobby servo, because unless its one of thenew digital models, it cant tell you. ADynamixel can not only tell you where itsshaft is, it can also tell you if its moving.
In that youre reading this magazine,odds are that you have some prior exposureto hobby servos. For those experienced readers, you know that hobby servos moveat their own mechanical pace with a setamount of torque. The Dynamixel can be
I love to write robotic driverfirmware and scratch build PICmicrocontroller-based robotic
hardware to run it. In thisedition of SERVO, were notonly going to sharpen our
driver authoring skills, wellalso get some flight time on
the handle of a soldering iron.
by Fred Eady
30 SERVO 04.2009
PHOTO 1. The daisy-chained one-wire RS-232link I am referring to is actually a DATA line anda GROUND line. The AX-12+ also distributespower on a third daisy-chained line.
commanded to move at your selected angular velocity withyour desired amount of torque to within 0.35 of thedesired endpoint position. The AX-12+s maximum ratedholding torque is 229 ounce-inches and it can rotate at amaximum angular velocity of 114 rpm. Needless to say, ifyou get one of your humanoid body parts in the way of ahigh-speed max-torque AX-12+ mechanical operation, itsgonna leave a mark.
Standard hobby servos use a variable duty cycle pulsetrain to control their shafts angular velocity and position.The duty cycle of the servo control pulse determines theservo shafts rotational position while the angular velocityof the servo shaft is dictated by the speed of the duty cyclemodulation. Thus, the slower the duty cycle change, theslower the angular velocity. A pulse width of 1.0 ms willmove a standard hobby servo shaft to the extreme left,while a 2.0 ms pulse will move the shaft to the far right.Centering the shaft requires a pulse with a width of 1.5 ms.
When a flock of hobby servos need to be individuallypositioned to achieve a common goal such as in modelaircraft and boats, each servo must have access to itsunique pulse width information. In these cases, theunique pulse widths are multiplexed by a transmitter anddemultiplexed at the receiver. If the hobby servos arent inthe air or on the water, an elaborate microcontroller-basedmultiple pulse width generator is normally used to controlthe servo positions.
The Dynamixel robot actuators dont depend on pulsewidths for their position information. Instead, a half-duplex,one-wire, RS-232 protocol-based TTL communications linktransfers command and status information between a hostcontroller and the robot actuators. The TTL-level status andcommand messages are called digital packets. The termhalf-duplex means that devices attached to a common communications link are only allowed to talk when no otherdevice is talking. In the case of the Dynamixel robot actuators, all of the robot actuators that are daisy-chainedon the one-wire link spend most of their time listening andonly speak after being spoken to.
It is also possible to command the robot actuators in
the daisy chain to listen and obey only. All of the Dynamixelrobot actuators on the link are able to hear every messagethat is transmitted on the wire. However, each actuator thatparticipates on the half-duplex one-wire TTL link is assigneda unique address between 0 and 253 decimal. If an actuator hears a message that does not contain its assignedaddress, the message is ignored. The only way to get theattention of every AX-12+ on the link at the same time is tosend a digital packet using the broadcast address, which is254 decimal (0xFE).
In addition to carrying precision position and speedinformation, the digital packets can also transport robotactuator feedback data. We already know that with theissuance of a command from the host controller, an AX-12+can report its angular position and/or its angular velocity.Other robot actuator parameters such as internal tempera-ture, input voltage, and load torque can also be queried bythe host controller. The fact of the matter is, we can issue asingle READ command and gain access to all of the dataheld in the AX-12+s Control Table.
I could expound on the virtues of the AX-12+ all day.However, youre not here to listen to me talk. Youre hereto get the skinny on how to put an AX-12+ to work underthe control of a PIC18F2620. With that, lets determinewhat we need in a hardware way to get the PIC and an AX-12+ to communicate with each other.
An AX-12+ ControllerHardware Design
Behold Schematic 1. Ive used a pair of CD4069 invertergates to mirror the half-duplex transmit/receive logic that isset forth by the AX-12+ datasheet. A TTL high applied tothe MODE_SW inverter input enables U3A, the transmitbuffer, and tristates the output of U3B, the receive buffer.Conversely, a TTL low at the MODE_SW input tristates thetransmit buffers output and enables the receive buffer output of U3B. This simple circuit is the key to the implementation of the one-wire half-duplex TTL linkrequired by the AX-12+. The AX-12+ datasheet presents the
SERVO 04.2009 31
1. POWER FOR CD4069 AND 74HC125 -- PIN 14 = +5.0 - PIN 7 = GND.
2. ALL UNUSED CD4069 INPUTS TIED TO GROUND.
3. ALL UNUSED 74HC125 OUTPUT ENABLE PINS TIED TO +5.0.
SCHEMATIC 1. I didnt havean 74HC126 part in myinventory. So, I made dowith what I had. This74HC125 circuit is logicallyequivalent to the 74HC126circuit shown in the AX-12+datasheet.
circuit you see in Schematic 1 using a 74HC126. I didnthave a 74HC126 in my IC inventory. Being that the only difference between the 74HC125 and the 74HC126 is theactive polarity of the tristate control inputs, I added theinverter U2A to make the 74HC125 appear as a 74HC126
to the firmware logic. Since were writing our own AX-12+driver, we could dispense with U2A and run the transmit/receive switching logic in the reverse direction of the AX-12+ datasheet. However, to maintain continuity with theAX-12+ system logic, its best to keep with the datasheet
logic and perform the switching logic inversionwith U2A.
Schematic 2 adds the detail you need toenvision the entire one-wire interface and itsinterconnection with the PIC18F2620s I/O subsystem. The communications link DATA portalat pin 3 of the 74HC125 connects to the AX-12+s physical DATA pin, whose logical statecan be transmitted via daisy chain to other AX-12+ DATA pins on the link. Note that the+9.6 volt bulk motor voltage and the commonground are also included in the daisy chain link.
32 SERVO 04.2009
SCHEMATIC 2. Transmit and receive data iscommon to the DATA line as the 74HC125active-low OE (Output Enable) lines are wiredto only allow half-duplex communications.
PHOTO 2. The circuitry for the SuperServo isSuperSimple. So, a printed circuit board is notnecessary. I used standard point-to-point soldertechniques to wire up this AX-12+ controller design.The three-wire interface for the AX-12+ is made upof a portion of a SIP header strip.
Each AX-12+ attached to the common link can draw up to900 mA. So, we need to make sure we provide a +9.6 voltpower source that is hefty enough to support every AX-12+in the daisy chain.
If youre wondering what happened to thePIC18F2620s crystal, it is not necessary in this design as wewill be coding in the internal 32 MHz clock. We can conserve I/O pins by building up the design you see inSchematic 2.