I can't get "ODriveArduinoTest" to work

I am using Arduino 1.8.8
when I send it “0” command it just prints out : “Axis0: Requesting state 4”

I got the motor to do the calibration move in Python.

This is expected, by default the “ODriveArduinoTest” does motor calibration followed by encoder offset calibration and then puts odrive in closed-loop control mode. I found it surprising that there were no delays in between each of the calibration commands.

A better approach would be to start by checking with ‘b’ command (reads bus voltage and prints it). If that is working properly, then try modifying the calibration sequence to match what was done from python. Usually it is AXIS_STATE_FULL_CALIBRATION_SEQUENCE, so if appropriate you may edit the calibration section of code to something like:

requested_state = ODriveArduino::AXIS_STATE_FULL_CALIBRATION_SEQUENCE;
Serial << “Axis” << c << ": Requesting state " << requested_state << ‘\n’;
odrive.run_state(motornum, requested_state, true);
delay(15000); //wait for 15 secs
// requested_state = ODriveArduino::AXIS_STATE_ENCODER_OFFSET_CALIBRATION;
// Serial << “Axis” << c << ": Requesting state " << requested_state << ‘\n’;
// odrive.run_state(motornum, requested_state, true);

requested_state = ODriveArduino::AXIS_STATE_CLOSED_LOOP_CONTROL;
Serial << “Axis” << c << ": Requesting state " << requested_state << ‘\n’;
odrive.run_state(motornum, requested_state, true); // don’t wait

My issue was the RX And TX lines were swamped. I wish a note/comment was in the Arduino code on where PIN 8 & 9 goes on the ODrive.

1 Like

Glad to know that the issue is solved. Filling in the info, just in case someone else comes across this thread:

Channel Odrive Pin Arduino Pin
Rx 2 8
Tx 1 9

I found it to be the exact opposite on my ODrive

Hi,

I think we are both correct :innocent: . In UART communication (tx-rx), we cross connect the lines between devices, so here Arduino pin 8 (rx), should go to tx pin of Odrive ie pin 1, and vice versa.

Cool Insta channel btw :smiley:.

1 Like