OpenSource Remote for VESC ArduBoardControl

This is what it shows me, i tried all baud rates, maybe a defect arduino board?
 

Attachments

  • TX.png
    TX.png
    11.9 KB · Views: 4,388
  • RX.png
    RX.png
    11.2 KB · Views: 4,388
This seems to be the same type i got when reading the serial while it is sending data to VESC

And speaking on serial, finally everything works, rode my board a lot this last days, but today when i was implementing the battery capacity led's i realized i'm no getting any data back from VESC, anyone have a guess? shame i don't have a Mega, so no debugging to see where is the problem, i will dig a little further
 
OK. Get it sorry.

To check the serial stream to the controller you can not use the terminal because you have to check an uint8 stream.
I use realterm instead http://realterm.sourceforge.net/
Select display as uint8. You need to switch the Arduino IDE Terminal of to use Realterm.
 
Yeah ! That's sounds really great ! :D
I had a look on the website and the others products (and android app associated), they have some cool stuff !
But quite more expensive than Adafruit.
Let us know if it seems to be a great solution. In this case, I order one and try to give you my hand. :wink:
 
I looked at those and they don't currently have the firmware out for central mode. I have however found and ordered some of laird bluetooth modules and I will begin playing with them this week. They do support central mode and have a firmware updating utility for their breakout boards.

http://www.mouser.com/new/lairdtechnologies/laird-bl620-ble-module/
 
I really late to the party, but i'm starting to build my first esk8 atm. I love this VESC controller and was wondering where I could find a link to the Remote Housing File. Cheers! :D
 
I have been playing around with these bluetooth modules and I have done some more digging with regards to the feather. The feather uses the exact same chip as the ble nano and nordic gives out their firmware for it which supports central role. I have looked at schematics and pinouts and the programming pins for the ble on the feather are located on the bottom. I am going to order a debugging/programming adapter and try loading this firmware onto it. I will most likely have to write a program in the firmware to communicate with the arduino but we will see. I'll update as soon as I get more info.

@zmoney I have yet to upload the latest hosing file due to complications with the electronics. I will upload them as soon as we have this sorted out and tested.

Cheers!
 
@28400:
We should not forget, that the most of users here will not be able to program the ble chip that way. So we should take a look at a easy to reproduce way.

When can you release the code for your sensor?

Regards

Andy
 
@dl28400 :
Rollinggecko is not wrong on it, but maybe can you send the link of the firmware to Adafruit ?
It's maybe a way to help them in the development for their own BLE chipset and thus we can obtain official update af the feather with central mode ! :D

@Rollinggecko :
I'm in lack of free memory space on my Nano.
Is there a way to light a bit the VescUart library if I only use telemetry ?
I'm doing some test commenting some part of datatypes.h but it doesn't make my code lighter... :(
In the datatype.h file, Vedder bring the possibility to reach each BLDC parameter but it's a bit overkill for my (our) use. :D

Thank a lot !
 
I know its a huge step - but change the Arduino libs to native C Code for UART/Display/Serialcommands and you should get tons of free memory
 
As you say, it's a huge step. :D
It's not like I know only make the built-in LED blink, but... almost ! :mrgreen:

First, I have to clean my code, optimize variables (using byte instead of int, reduce strings length and amount...).
 
@RollingGecko
If the chip isn't locked it should be easy to flash while on the feather via the two pads under the chip. Only a programmer is necessary. I will release more details about this once I have done it successfully.

The code I wrote for the hall effect sensor is pretty basic and is currently being used in my test program (seen in my videos). I made a quick calibration routine for a few seconds when the remote is first turned on or reset. It looks for the absolute minimum and maximum values of the sensor and records them. It would be good to have something like this in a menu with a step by step guide on screen to calibrate if necessary.

Also note the pins may be different as I threw it together quickly.
Here is the code:

Code:
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

// If using software SPI (the default case):
#define OLED_MOSI   6
#define OLED_CLK   10
#define OLED_DC    11
#define OLED_CS    12
#define OLED_RESET 13
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);




#define XRANGE  19

int x,gss,y;

const int sensorPin = A0;

int sensorValue = 0;         // the sensor value
int sensorMin = 700;        // minimum sensor value
int sensorMax = 200;           // maximum sensor value

void setup()   {                
  Serial.begin(9600);
  
  // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
  display.begin(SSD1306_SWITCHCAPVCC);
  // init done
  
  // Show image buffer on the display hardware.
  // Since the buffer is intialized with an Adafruit splashscreen
  // internally, this will display the splashscreen.
  display.display();
  delay(2000);

  // Clear the buffer.

display.clearDisplay();

  while (millis() < 10000) {
    sensorValue = analogRead(sensorPin);
 
    // record the maximum sensor value
    if (sensorValue > sensorMax) {
      sensorMax = sensorValue;
    }
 
    // record the minimum sensor value
    if (sensorValue < sensorMin) {
      sensorMin = sensorValue;
    }
  }
}


void loop() {

#define VBATPIN A7
   
float measuredvbat = analogRead(VBATPIN);
measuredvbat *= 2;    // we divided by 2, so multiply back
measuredvbat *= 3.3;  // Multiply by 3.3V, our reference voltage
measuredvbat /= 1024; // convert to voltage

int percent;
const float lipoDc[2][11] = { { 3.2, 3.680,3.740,3.780,3.810,3.850,3.870,3.960,4.02,4.100,4.200 } ,{ 0.000, 0.100,0.200,0.300,0.400,0.500,0.600,0.700,0.800,0.900,1.000 } };
int ind;
  if(measuredvbat>=4.2)
    percent=100;
  else
  {
    while (!(measuredvbat<=lipoDc[0][ind+1] && measuredvbat > lipoDc[0][ind])&& ind<=10)
    {
      ind++;
    }
  

    if (measuredvbat <= lipoDc[0][ind + 1] && measuredvbat > lipoDc[0][ind])
    {
      float CapacPers = (((lipoDc[1][ind + 1] - lipoDc[1][ind])/ (lipoDc[0][ind + 1] - lipoDc[0][ind]))*(measuredvbat - lipoDc[0][ind])) + lipoDc[1][ind];
    //  int intCapacPers = (int)(CapacPers * 100);
      percent = (int)(CapacPers*100.0);
    }
  }

  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(48,0);
  display.clearDisplay();
  display.print(percent);
  //display.print(measuredvbat);
  display.println("%");

  display.setCursor(0,30);
  display.setTextSize(1);
 
   
  int aValue =analogRead(0);
  
  y = map(aValue, sensorMax, sensorMin, 0, 1024);

  if (y < 552 && y > 472)
    y = 512;
  if (y < 0 || y < 10)
    y = 0;
  if (y > 1024 || y > 1014)
    y = 1024; 

  x = map(y, 0, 1024, 0, 18);


  
  display.print("|"); 
  for (int i=0;i<x;i++){
    if(i==XRANGE/2)display.print("|");
    else display.print("-");
  }
  display.print("O");
  for (int i=x+1;i<XRANGE;i++){
    if(i==XRANGE/2)display.print("|");
    else display.print("-");
  }
  display.print("|");

  display.setCursor(53,50);
  display.print(y);

 display.display();
  
}

Cheers!
 
Alright guys, excellent news!
I have been working with someone in my lab on the feather BLE module and we have successfully flashed and tested firmware with central mode functionality!!! :D :D :D We used an existing stack (heartbeat) used for fitness devices and was able to communicate with a usb bluetooth module which was configured as a peripheral device. This proves the feather can work for what we need.

The next step will be to load a UART stack and play with that. I will have more details as progress is made. Also I will be writing a log on my site as well.

Cheers!
 
Hey guys,

I know I am a bit late to the whole topic - planing my own esk8 build to have a project for winter time I had to realized that the remote control options for DIY are really bad (and/or expensive).
I had the idea to use the upcoming esp32 ( https://espressif.com/en/products/hardware/esp32/overview ) - which has different communication stacks on board (Wifi, BLE) and massive amount of IOs.

I am not sure if it is too late to throw in the esp32 as an viable option, but my thoughts where:
- it would allow to create more complex applications on the remote (thinking about a wifi communication interface, allowing remote fw updates, configuration from almost any wifi device etc)
- has 2 cores/threads - so should easily handle all io tasks and keep communication flowing
- has a cryptographic stack on board (securing the connection between board and remote)

Also the esp32 is expected to be around 4-5 Euros/piece

Also there is strong support from the arduino community for this chip - it is possible to reuse most common arduino libraries. Although to fully utulize it`s potential, going with the espressif sdk will provice more control over firmware and afaik the arduino version does not yet utilize RTOS (threads)


I`ve been using the predecessor (esp8266) for a lot of projects (can`t beat the price and ease of use)
 
s28400 said:
Alright guys, excellent news!
I have been working with someone in my lab on the feather BLE module and we have successfully flashed and tested firmware with central mode functionality!!!

You know you can just use a central enabled bluethooth module on the vesc, and then use the feather as it is as a peripheral. No need for all that hassle :)
EDIT: It seems that the bluefruit BLE does not support SPP and cannot communicate with standard Bluetooth modules, it has a proprietary firmware and can only pair with IOS and Android. It would be interesting to see how it turned out after re-flashing it.
 
WTech said:
You know you can just use a central enabled Bluetooth module on the vesc, and then use the feather as it is as a peripheral. No need for all that hassle
EDIT: It seems that the bluefruit BLE does not support SPP and cannot communicate with standard Bluetooth modules, it has a proprietary firmware and can only pair with IOS and Android. It would be interesting to see how it turned out after re-flashing it.

We discussed moving the central role to the board side but it would not allow for a phone app to connect to it in the future. The bluefruit ble module uses a common ble chip and has many stacks available for it. I recently got the adafruit ble friend uart module with the same chip and will try and get it flashed with the uart program as the peripheral device. This module can then be interfaced with the vesc directly with no arduino in between just like we wanted. I'll post an update as soon as I get it to that point

Cheers!
 
Even if I don't paraticipate a lot, I follow your work both, and it's a great pleasure to see how it is going on !
I just played a bit with a HC05 and discover how powerful could bluetooth be with a VESC !
I still have a Feather BLE in a box, let me know if you need a beta tester for testing the upgrade procedure. :wink:

Oh and I remember you find BLE boards which were working in central mode (Laird). Any news about those ?
 
Hi guys,

At the moment I'm a bit more a passive participant as I started already with some new projects. I don't find the time to participate in the bluetooth implementation. But it is great to see your progress. Please don't forget to share your process here with us. I will review all pull-requests and at them to new releases. I will react to buck reports and will try to fix them. There is also already a bugfix as a pullrequest I will merge this week.
If you go on with the interface please contact me in advance. There is already an Interface Object class prepared on https://github.com/RollingGecko/VescUartControl/tree/DEVas a new branch on VEscUArtControl. Just contact me. Than we can skype to the details.
Even if you are not a programmer, everybody can support the project. Everyone who builds this remote can share his experiences and we can put it in the wiki to support all the others.
I updated the wiki a bit with some details for nRF24L01 (Capacitor!) and OLED. https://github.com/RollingGecko/ArduBoardControler/wiki



Andy
 
Josh (s28400),
did you make any progress in configuring the Feather as a central BLE device? If so, I would be very interested in some advice to go for that approach too.

Dude
 
Sorry for the long silence. I have not made much progress recently as other things have come up. I left off with the Bluetooth and programming a menu system. I hope to finish both up in the coming weeks when I have some free time. I will keep you guys updated as I make progress.
Cheers!
 
Has anyone tried getting the VescUartControl library to work on a Simblee (https://www.simblee.com/)? Given Simblee's built-in BLE and simple mobile-app programming environment (one app coded in Arduino works on both Android and iOs), it might be the easiest way to just get VESC data displayed on everyone's phones (while using an independent throttle).

I'm pretty new to library dev, but Simblee runs on an ARM Cortex M0 so I believe a modified library would be required? (I tried using VescUartControl as-is on a Simblee connected to a VESC, but got a bunch of compile errors and even after commenting out the offending code so it would compile, was not able to get any data from the VESC).

My ultimate goal is to both read VESC data and control the VESC (setcurrent and setRPM) from a Simblee connected via UART, so it would be fantastic if someone could help me make this work!
Thanks!
 
Hi,
my name is Max.
I am currently building my first electric board controlled by a custom Controller using an OLED Display, NRF24L01 and Atmega 328P. I am using the VescUart library by RollingGecko. Current Control works already but I am not receiving any data from the VESC. The strange thing is that I got it working once, then changed a few code lines and got it working never again. I know this is an issue that keeps popping up with beginners and is annoying to most experienced users. I really hope someone can head me in the right direction.
Things that I checked already:
-Baudrate
-Connection RX to TX and TX to RX
-Redownloaded the library
-Firmware of VESC (2.18)

This does not write any values to my bldcmeasure structure:
Code:
VescUartGetValue(VescMeasuredValues);

I would really appreciate some help on this matter.

Thanks.
 
Hey

first of all thanks for this awesome project.
How did you connect the 2s lipo to the volltage measurement pin?
 
Back
Top