Calling VESC UART Arduino experts

Trying to get vesc data from the UART port, but I am for some reason getting the same data that it sends for the command.

So for example, a COMM_GET_VALUES command is sent in a packet with this data: 2 1 4 64 132 3 0 And when it detects a packet, it finds a packet with this data: 2 1 4 64 132 3 0 So essentially, I’m picking up the packet I’m suppose to be sending and never getting the right response back. I confirmed with my bluetooth app and I get the same packet sent for the COMM_GET_VALUES command, but I actually get good data back.

I’m using an ardunio Mega 2560, VESC Rx to Mega Tx, VESC Tx to Mega Rx.

Also using this library: https://github.com/R0b0shack/VESC-UART-Arduino/tree/Arduino-Mega-with-debugging-code

I tried the RollingGecko library, but I couldn’t get past the many compiling errors, even after many hours of debugging.

Any help is much appreciated!

1 Like

It may be possible that unrecognized values are echoed back. Perhaps your boad rate is incorrect.

1 Like

I have the buad rate set to 9600 on both the vesc and when I open the serial connection on the arduino. Should I have it set to a different value?

it was just a guess i am not sure, try a few different baud rates.

Try looking at this library: https://github.com/bastianraschke/ESP8266VESC

I am using ESP32(s) (and/or ESP8266) and I couldn’t get RollingGecko’s library to compile either (I’m not very good at this stuff and I’m lazy).

I would try a different value just for shits and giggles. ( 115200 )

Tried 115200 on both, but no luck :frowning:

@skelstar Thank you. I’ll check it out and try it.

1 Like

make sure you are using UART mode on VESC and the UART band width is the same on the VESC

I honestly can’t imagine whats wrong with the RollingGecko library. For me it has always been using the example sketch without any problems. Maybe you could try reinstalling arduino? Also, are you using the latest VESC 6 Branch of Rolling Gecko? It’s also for 4.12 HW running 3.x firmware.

I’m not trying th latest branch, I will try that.

With the RollingGecko, first I got this:

Arduino/libraries/VescUart/VescUart.h:45:21: fatal error: arduino.h: No such file or directory #include “arduino.h”

Then, If I removed that include, I get:

Arduino/libraries/VescUart/VescUart.cpp:18: Arduino/libraries/VescUart/local_datatypes.h:25:2: error: ‘boolean’ does not name a type boolean valUpperButton;

I tried changing that to bool, and I got some other error.

you can’t just remove includes. You need to figure out why that include wasn’t found, it should be installed with standard arduino installation. Unfortunely in C solving one error can allow the compiler to get further along until it hits an error it didn’t before, so playing bug wack-a-mole is not the right strategy.

Still trying to get a library to work.

I think my wiring is the issue.

Currently, I am trying the RollingGecko library to work again. But all I get is “Failed to get data”.

Baud rates are both 115200 on vesc uart and arduino serial. Using a mega, with Searial1 for the VESC connection.

I’m just linking Rx to Tx and Tx to Rx. Do I need to connect any other cables? I tried with firmware 2.16 and 2.54, neither work.

So finally figured it out. Hopefully this helps others with the same issue. You need to connect the ground of the uart to the arduino ground, in addition to the tx->rx and rx->tx.

1 Like

Hi, Im also new to the VESC community and I was wondering if it was possible to make an arduino controlled VESC using Blynk’s APP UI to control the arduino over wifi connectivity (if that makes sense). I know using a phone as a speed controller is a “bad idea” but this is really just a proof of concept and I dont know if I’ll be using it in the future. If anybody could help we with figuring this out that would be great.

Definitely possible. You would have to make a unit that would be on the board connected to the VESC and it would communicate via UART.

Wifi can be a bit flakey… I found (and I’ve been told I’m wrong) that there was a bit of latency/delay with wifi. Now using nRF24L01 2.4GHz radios (super cheap).

My main criteria for the project is using an Arduino and having the board being mainly controlled from my phone. If I use a nRF24L01 2.4GHz radio will I still be able to connect to the Blynk IOS app? I would prefer not to write my own app that allows for full control if I can use Blynk.

Blynk (or at least your phone does) needs Wifi. The nRF, is that what your remote is using? You can out the VESC into PWM/UART mode and control it and talk to it using Arduino. Fairly certain that is right.

Is that what you mean?

I basically want to substitute the nRF24L01 controller with a project on the Blynk app on my phone. My question is will this be possible. If so, how can I combine the Blynk codes with the vesc/uart/arduino codes so the information goes from my phone to the Arduino which acts as a main transmitter to the VESC and in turn controls my motor?

I’m finding it difficult to understand everything you’ve explained.

To put it simply: you could have your phone (Blynk) talk to an Arduino (connected physically to the VESC, on the board) which can (at the same time) talk to the VESC and pass on the commands/information that originated in the Blynk app.

So technically possible. I’m sure I had a play with doing this at one stage.

You’re going to have to work out how to do this by experimenting TBH.

hint: get an ESP32 if you don’t already have one. Aliexpress.com, TTGO store.

Have fun!

Thanks for the feedback. Btw, what makes you recommend an ESP32 over an arduino, Im unfamiliar with board so what specifically would make it “better” for my project?