ODrive & Arduino Nano, TX-line (Odrive side) not working


#1

Hi there!

For my latest project I can not use the SoftwareSerial Libary to communicate with ODrive from my Arduino,
beacuse of it blocking interrupts and/or messing up timer1.
So my goal is to communicate over HardwareSerial.
I am using Arduino Nano MEGA 328P and with HardwareSerial & odrive_serial = Serial;, I was able to use the ODrive Arduino Libary like shown in the example sketch.

Writing velocitiy commands to the ODrive worked fine, however when I tried to read the bus voltage with odrive.readFloat(); it always returned 0.00!

Investigating that problem I found out that the TX-line (ODrive side) is always high when connected to the Arduino, when I detached it from the Arduino however, I could read the correct response on my Oscilloscope from the ODrive TX pin!

My assumption is that the USB to Serial chip on the Arduino Nano, or maby the 1k resistors are disturbing the signal. (Edit: Probably not…)

When I tried it with Arduino Pro Mini (No onborad USB to Serial chip) and Arduino Leonardo (seperate Serial) it worked fine!

Is there an easy way to fix this problem? Or can it be avoided by adding resistors to the connection?


#2

Okay, I removed the connection from the USB to Serial chip of the Arduino Nano and it still doesnt work!

I have no clue why…


#3

The Arduino nano uses 5V signalling logic, but the Odrive unit uses 3.3V signalling logic.

You’ll have to put logic-level converting circuitry in between the Arduino and the Odrive.

See the following for some example circuits:

Alternatively, you could use an off-the-shelf converter board:


#4

Thank you for the suggestion!
I have one of those converters lying around, I am going to try it tomorrow!

I was wondering because everyone was using the UART without any conversion. I read that ODrives inputs can handle 5V and the Arduino should read 3.3V as high? Where is my error in reasoning?
For SoftwareSerial it works too?


#5

Today I tried two more things.

Communication with an 3.3V USB to serial adapter, this worked.

Afterwards I tried communication with the ESP8266. Same failure. The RX line of the odrive recieves the signal, but the TX line is 4.2V all the time when connected. If I disconnect it and read the signal with my oscilloscope I can read odrives response!

This is my code for the ESP8266:

#include <ODriveArduino.h>

float volt = 0.;

HardwareSerial & odrive_serial = Serial;
ODriveArduino odrive(odrive_serial);

void setup() {
  odrive_serial.begin(115200);
}

void loop() {
  odrive_serial.print("r vbus_voltage\n");
  volt=odrive.readFloat();
  odrive_serial.println(volt);
  delay(100);
}

And my readouts from the serial monitor:

r vbus_voltage
0.00

Can someone maybe replicate this?


#6

You don’t need a level shifter to connect to an arduino in general.
It sounds to me like the receive pin on your arduino is not the pin you think it is. I.e. it’s likely plugged into the wrong pin.