Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 2 FirstFirst 1 2
Results 26 to 29 of 29

Thread: Teensy 4.0 and Dynamixel

  1. #26
    Junior Member
    Join Date
    Jan 2021
    Posts
    2
    how can i do controlling dynamixel AX-18A with the Teensy 4.1 ?

  2. #27
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,871
    Quote Originally Posted by Ahmad View Post
    how can i do controlling dynamixel AX-18A with the Teensy 4.1 ?
    The same ways as you would with a Teensy 4.

    There are many ways to do so.
    The Dynamixel is a half duplex serial protocol, which specification says the TTL signal is 5v, although I have never had issues with driving it with 3.3v.

    However I am not always clear if there are no chance that the DXL may drive the TTL line high to 5v and the T4.x IO pins are not 5v compatible.

    As mentioned previously in this thread and others, I have done several different circuits to do this.

    When I am living dangerously (or using a T3.2 or 3.5, which are 5v tolerant, I might simply hook up a wire, to the TTL and GND to a MUX, where the TTL connects up to a Hardware UART TX pin and I then handle the half duplex in software. The new beta version of Teensyduino actually has some of the half duplex support built in.

    Other times I hook up to TX and RX pin and direction pin like some of the circuits mentioned earlier in this thread. and again use support built into the Hardware Serial class.

    And in most all of these cases you need some way to run the servo power to the appropriate wire of the servo(s).

    There are different libraries I have used to drive these servos. Like BioloidSerial which is old and came from the old Trossen Robotics Bioloid library but made to handle different setups. I have also used some of the newer Robotis libraries and would suggest going that way.

  3. #28
    Junior Member
    Join Date
    Oct 2020
    Posts
    5
    @KurtE - I'm trying to get your BioloidSerial.h to work using Serial3 port instead of Serial1 on the Teensy 4.1. I tried changing to #define PAX12Serial &Serial3 in the dxlSerial.h but the bioloid.setNextPost(id,pos) isn't moving the AX12.
    Is there something else I need to change? I'm also setting #define AX_BUS_UART Serial3 in the Arduino sketch. Do I need to change anything in dxlSerial.h? If I use your AX12_Test program the servos work fine on Serial3. I'm using software for the half-duplex comms.

  4. #29
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,871
    As far as I know it should work. The code just figures out which Serial port gets passed in to dxlInit:
    void dxlInit(long baud, HardwareSerial* pserial, int direction_pin, int tx_pin, int rx_pin ) {

    As the AX12 sketch is setup: dxlInit(DXL_BAUD, (HardwareSerial*)&AX_BUS_UART, SERVO_DIRECTION_PIN);

    Also depending on your sketch sometimes I forget that maybe used some IO pins to debug something... So you may want to make sure that the TX pin or Serial3 is not used for something else...

    Also one of these days may make a version of the library that uses the now built in Half Duplex support that was added to HardwareSerial class...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •