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
Are there anything on the dynamixel shield which causes the corruption of the position values?
Are there anything issues with the dxl.getPresentPosition() command when monitoring multiple motors?
WIll the dynamixel shield work properly if it is not directly connected to the arduino IDE or the microcontroller boards like arduino uno?
Should I connect the motors in parallel on 3 TTL slots of dynamixel shield?
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.
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:
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.
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?
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.
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:
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.
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?
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)