The problems with monitoring positions from 2 motors

Devices and Setting
I used a Wemos D1 R32 (for multithread purpose) to connect to the PC. I also connected the Wemos D1 R32 to the dynamixel shield with three pins (direction, send, receive). Three XC-330-M288-T motors are connected to the dynamixel shield in 1 TTL port on it.
Baud Rate
The baud rate between the PC and Wemos is 115200 while the baud rates between Wemos and dynamixel shield; dynamixel shield and motors are 1000000.
Issues
When I successfully initialize the motors to velocity mode, I read the position values of 2 of the motors by dxl.getPresentPosition() function. The values returned by dxl.getPresentPosition() will often jump to the values returned by another motor. (i.e. motor 1 receives the position value from motor 2)
Status of motors
All motors have stable positions when I monitor them through Dynamixel Wizard 2.0.
Questions

  1. Are there anything on the dynamixel shield which causes the corruption of the position values?
  2. Are there anything issues with the dxl.getPresentPosition() command when monitoring multiple motors?
  3. WIll the dynamixel shield work properly if it is not directly connected to the arduino IDE or the microcontroller boards like arduino uno?
  4. Should I connect the motors in parallel on 3 TTL slots of dynamixel shield?
  1. The DYNAMIXEL Shield was not tested specifically for use with ESP32 based boards, it’s possible your issues may be a result of minor incompatibilities.
  2. There are no known issues monitoring multiple motors with any of our libraries.
  3. I’m not sure exactly what you are asking, could you provide more information on what you are trying to find out?
  4. DYNAMIXELs can be connected either in series or in parallel, there is no functional difference between the two in most cases.

Thank you very much for your reply!

For question 3, my current structure is using Wemos as the program upload target while I connected the Wemos to Dynamixel shield (powered by an independent power source) in 3 pins: DXL_RX, DXL_TX, DXL_DIR as in the picture as follows:


I am wondering if that kind of structure has certain defects.

I also have an additional question: When I monitor the position values, I kept all three motors in the velocity mode. Is setting a proper operation mode critical when monitoring the position values stably? If not, how can I read the value stably without getting some extremely high values or values from other motors?

For your first question, as long as pins 0, 1, and 2 are connected correctly and securely then this should be acceptable, but if possible I would recommend mounting the shield directly on top of the board if possible.

DYNAMIXELs can still report accurate position values in any operating mode, so velocity mode should work just fine for what you are doing.

Would you be able to post a video/photoset of your assembled system and the issues you are experiencing? Maybe I can provide some more helpful assistance with a better idea of what’s going on.

Thank you very much for your reply!

Basically, I pinned 4 looping tasks to ESP32 in order to obtain a multithread program. I used I/O 25 to connect to pin 2 (dir), I/O 17 to pin 1 (tx) and I/O 16 to pin 0 (rx). Here is the pinout for the ESP32 board I am using.

I used: ‘Dynamixel2Arduino dxl(DXL_SERIAL, DXL_DIR_PIN);’ to initialize the connection between ESP32 and dynamixel shield. What I got after uploading my code on ESP32 are getting unstable values when reading the data from the motors. I also used u2d2 to monitor the motors from the Dynamixel Wizard 2.0. Those are what I found from Dynamixel Wizard:

Present Position and Temperature from Motor 1:


Present Position and Temperature from Motor 2:

So the problem may be caused by the improper initialization on the connection between the shield and ESP32, I am wondering if you know any solutions.

Have you tried to use SyncRead instead of single-ID GetPosition() ?

Not yet, I will try it later but I don’t think that will make any difference because I am currently getting unstable values even from the Dynamixel Wizard.

Seeing the pinout diagram that you shared, I can see the cause of the issue. Even though the ESP32 uses the same physical pin arrangement to the Arduino Uno, the pin definitions are incompatible. In order to use the shield you would need to redefine the pin assignments to match with the different pin layout.

Regarding your DYNMIXEL Wizard graph results, was the DYNAMIXEL connected directly to the U2D2 without the ESP32? The graph outputs don’t look valid to me, so I’m wondering what the issue might be there.

Thank you for pointing out the pin layout issues.

Basically, my setup was as follows:

Within the setup, I got the graphs above. If I don’t pin any tasks to ESP 32 or I disconnect the Shield and ESP32, the graphs will be normal ones with stable values.

With the shown setup, packets sent from the DXL Wizard on the PC via U2D2 can interfere with packets sent from the ESP 32 as you use the DXL shield as a common communication node and when both comm. lines are used at the same time, these packets will corrupt each other before they reach the DXLs or when the packets come from the DXLs.

I don’t think that the PC’s DXL Wizard and the ESP32’s Arduino Sketch (or any other Arduino Controller) are meant to be used at the same time.

When the EXP32 is running its program, have you tried to monitor the DXLs by “printing” the various DXL Present Positions (best with SyncRead) to the Arduino’s Serial Plotter tool via USB Port?

Thank you for pointing that out.

I have not tried that yet. but the problem is: I will also get unstable values without the u2d2 connection to the PC. Therefore, the estimated Serial plotter results of DXL’s Present Positions will be the same as the plots I demostrated above.

I also tried the position reading commands (reading 3 motors’s values without delay command) on arduino uno, it delivered stable values of DXL’s Present Positions.

As per your second paragraph, if the UNO can receive stable position values then the Arduino serial plotter ought to provide stable plots also. If not then something happens with communications between UNO and PC then?

I tried the serial plotter on both esp32 and uno yesterday, I was getting unstable values on esp32 while I was getting stable values on uno. I think there are certain communication or connection problems between esp32 and shield. Do you know the correct way of connecting and communicating the esp32 (i.e. wemos d1 r32) with dynamixel shield? I am not able to find information useful online.

Unfortunately, I have no experiences in using the UNO and ESP32. I have only used the MKR DXL Shield with MKR ZERO and PORTENTA H7 Lite, or the OpenRB-150. It looks like that the Arduino2Dynamixel library may not be optimized for the EXP32?

Perhaps you should look at switching entirely to OpenRB-150? which has a very reasonable cost at present.

I’m not sure exactly what pin definitions that you will need for this connection, but this older community page post may have some information that might help you figure out what changes you need to make.

Thank you for sharing me with it.

Plus: I just noticed that I forgot to mention 2 points in the previous replies:

  1. The motors are actually connected by the so-called “daisychain” method:

  2. The other 2 pins: 5v and GND on the left side of dynamixel shield are connected to the same pin positions on the left side of wemos d1 r32.

Just wondering if there are things to be noticed within the 2 points addressed above.

Thank you for sharing the device. I am also thinking about changing to better devices.

Regarding the “daisy chain” hook up, I use that topology all the time so there is no issue there.

Regarding the 5V Pin that you tapped from the Wemos D1 R32 to drive the DXLs and as I don’t use this board, you will have to check this issue yourself:

  1. If this 5V Pin is just a tap into your 5V external power supply (which is rated at 2A or 3A probably) then you should be fine.

  2. If this 5V Pin is somehow regulated by the Wemos, then you’ll need to make sure that the Wemos can output enough current to drive your DXLs. If this turns out to be in the case, then it would be better to reroute the DXL 5V pin directly to your external power supply as per item 1), or via the DXL Shield Power Pins.

Also, from I read via the web, the Wemos D1 R32 is compatible with 3.3V shield and modules only, and here you are, trying to use it with 5V DXLs?

Thank you for your reply.

The Dynamixel shield itself is already powered by an 5v external power supply through the power connector shown in the Dynamixel shield pinmap above. So it seems just to be a tap into my 5v external.

Also when I disconnect the 5v pins and the gnd pins, I will not get any values from the dynamixel shield.

Also from I read via the web, the Wemos D1 R32 is compatible with 3.3V shield and modules only,

Thank you for pointing that out. I do not have the other 5v compatible boards allow me to do multithreading now. So maybe connecting the 3.3v pins on the wemos and shield is a good idea?

ROBOTIS eManual says this

So the XC-330 needs 5V to move the Motor: i.e. VDD pin of the TTL 3-pin connector.
But the DATA Pin prefers 3.3V but is 5V tolerant. And Wemos TX/RX lines are at 3.3 V. So it looks like that you need a Level Shifter between Wemos (3.3V) and DXL Shield (5V)