Reading Supply Voltage W/ Arduino

I am building an electric vehicle involving an O-Drive and a 36V 10s4p battery pack, and would be nice to know the battery voltage for range estimation. The only voltage sensors I can find go up to 36V, which will fry when the battery is fully charged (42V). I couldn’t find anywhere in the Arduino library for the Odrive to read supply voltage, but found that the Odrive can sense supply voltage, and can output with the Odrive tool. Is there anyone who has figured out how to read the supply voltage with I2C or UART with an Arduino?

Hello CrispyFungus, is there any reason you can’t use a voltage divider like ODrive does? The schematic of the ODrive board can be found here

Is this what you’re looking for? Taken from the ODriveArduinoTest.ino example:

SoftwareSerial odrive_serial(8, 9)
ODriveArduino odrive(odrive_serial);

odrive_serial << "r vbus_voltage\n";
float voltageIn = odrive.readFloat();

Sidenote, from my experience, I’ve had to add a delay of a half second or so in the Arduino’s setup before reading floats from the ODrive (it returns 0 otherwise).

This is exactly what I need thank you! Also, that delay is fine, since it will only be reading it every 30 seconds or so to display on an OLED