Arduino integration with VESC issue

I am trying to integrate the vesc with arduino and I am running a simple code to print the voltage and other data into the serial monitor. Below is the code for reference. When I chekc the output, it doesnt seem to be parsing the data correctly. I see the output as @⸮
I am using the code from this github page: VESC-UART-Arduino/VESC_UART_Nano.ino at master · R0b0shack/VESC-UART-Arduino (

Arduino UART communication with VESC. This software reads VESC telemetr data
and displays it on an OLED display. This code is under development for an
improved ppm remote control.

It is written by Sascha Ederer (, based on the code
of jenkie (, Andreas Chaitidis (
and Benjamin Vedder (
Copyright (C) 2016

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
#include "config.h"
//#include "printf.h"
#include "datatypes.h"
#include "vesc_uart.h"
#include <SPI.h>

//Library for the OLED Display
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

mc_values VescMeasuredValues;

float current = 0.0;           //measured battery current
float motor_current = 0.0;     //measured motor current
float voltage = 0.0;           //measured battery voltage
float c_speed = 0.0;           //measured rpm * Pi * wheel diameter [km] * 60 [minutes]
float c_dist = 0.00;           //measured odometry tachometer [turns] * Pi * wheel diameter [km] 
double power = 0.0;              //calculated power

#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);

void setup()
     /*   // initialize with the I2C addr 0x3C
        display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
	// set text color
	// set text size
	// set text cursor position
	// show text
	display.println("System startup");

void loop()
    if (vesc_get_values(VescMeasuredValues)) {
        // calculation of several values to be displayed later on
        voltage = VescMeasuredValues.v_in;
        current = VescMeasuredValues.current_in;
        motor_current = VescMeasuredValues.current_motor;
        power = current*voltage;
        c_speed = (VescMeasuredValues.rpm/38)*3.14159265359*0.000083*60;
        c_dist = (VescMeasuredValues.tachometer/38)*3.14159265359*0.000083;

        Serial.println(" ");

Does anyone know what can be causing this issue?

Try changing this to Serial.begin(115200);
Never seen it like that. You can also start in baby steps. See if Serial.println(“Hello”); prints something and make sure that part is working


I tried the baud rate to be 115200 with just printing Hello and it worked. But when i started including voltage, it started giving those weird output

I’m not familiar with the VESC uart library so not sure what to do. Looks there is a communication problem between the VESC and arduino or something wrong in the VESC uart library

You have everything wired correctly?

1 Like

Yes the wiring is correct. VESC TX-> Arduino RX, VESC RX-> Arduino TX, 5V and GND from vesc to ARDUINO.

Just for the test purposes, I have powered the Arduino from the USB of the laptop to watch the serial monitor o/p.

If you power the arduino via the VESC motor controller, you should not connect to the arduino via USB at the same time. Use a USB decoupler! Otherwise you feed the arduino via the VESC device and the computer.

1 Like

I am powering the Arduino using the USB and, connecting the TX, RX and GND from the vesc to the Arduino.

That is not so good. You need to power it from the VESC motor controller and use a USB decoupler

Is there a reason why the code seems to be having an issue. The code has set the baud rate as 115200, and I have set the control as “ADC and UART” with the CAN baud rate as 100k and also tried 125k. Can that be a reason why it is not working?

1 Like

Why ADC and UART?

I am also using ADC based remote control to control the speed of the motor.


Why do you say this? I seem to recall a few lighting projects that use a buck converter to power an Arduino direct from battery.

As long as everything is on the same ground, i don’t see where the issue is.

Additionally, most esc seem to have a low max current on their aux port, in the 150-300 mA range.

1 Like

When I probe the TX and RX pin on a logic analyzer, I do not see any data. It always remains high. could there be a reason why?
I tried 2 different vescs and both of them behave the same and both of them are on the latest firmware version. I am using VESC 6 MKv5

Tried a brand new vesc and I can see data in the logic analyzer but the arduino is unable to debug it.
Any help?

I believe the data structures used by the VESC have changed quite a bit since fw5 came out.

AFAIK many off the VESC Arduino library’s are not maintained and have not been updated to support these new structures.

Hi @ducktaperules, do you know of any example or code which I could use to make it work?

1 Like