Hello Guys,
For the past few days i have been trying to read data from VESC 4 using an Arduino Mega into the serial monitor. As a first approach, I am using VESC Tool (v1.012) to command the VESC and then send the data to the Arduino, so far unsuccessfully. For context, the Hardware version is 4.10 and Firmware is 3.56. Below follows a list of the things that I have already tried, which might give you light on what i am maybe missing here:
From the VESC Tool:
-Used UART app combinations (UART, PPM+UART, ADC+UART)
From the hardware:
- Measured RX and TX voltages which were giving approximately 0.5 V and 3.3 , respectively. When connecting the ground pin from the VESC to the Arduino ground, also gave those values. I am assuming here that both grounds must be connected.
- Connected a potentiometer to the ADC port and set that as input in the VESC Tool (just to check if that pin worked, is not required here).
- VESC RX to Arduino TX and Arduino RX to VESC X, ground connected. Pins 18 and 19 of the Arduino Mega (SERIAL1).
From the software:
As said before, the idea was for the messages to appear on the serial monitor. The SERIAL1 was set for SERIALIO and the SERIAL set for DEBUG. I have tried the following libraries, without success:
- RollingGecko's library, set the Debug in the c files and uncommented a few lines relative to the Debug, did not touch the remain code. Should i add local_datatypes.h to the Arduino sketch? In this one i could see the UART data package sent to the VESC through the serial monitor, but could not get the VESC values https://github.com/RollingGecko/VescUartControl
- SolidGeek's library, changed the baud rate from 19200 to 115200 on SERIAL1 https://github.com/SolidGeek/VescUart
- R0b0shack's library, which I changed the info to be displayed into the serial monitor instead of the OLED https://github.com/R0b0shack/VESC-UART-Arduino
As of this moment i will try this one https://github.com/Iscle/VESC_Arduino_Library to see if i get any results.
Baud rates were always set for 115200 between VESC and Arduino. I changed between 9600 and 115200 for the serial monitor just to see if that made any change. I also used a delay at the end of the of each loop in the Arduino sketches, to make sure that the info could be read and written onto the display.
The issue here is that i don't seem to get the function that retrieves data from the VESC to work properly. Every time i got the message "Failed to get data" or its similar, depending on the sketch i was using. I do not have background with c or c++ but I will learn it if i cannot get this last library to work properly. In the meantime, if any of you have proper code working for this Hardware and Firmware versions, please let me know, as debugging a situation like this is quite time consuming.
Appreciate any feedback,
José
Give mine a try : https://github.com/Peemouse/VescUart
It works using COMM_GET_VALUES_SETUP_SELECTIVE.
Depenfing on your needs, you may want to change the mask and the deserialization.
For calculating the mask, use my tool VESC_COMMUNICATION available here :
https://drive.google.com/folderview?id=1cz4vvPLa9w7otzsrnxXuGm6yhv0MWV9E