ARDUINO - help and ideas thread

Hey, that’s great news! Im really happy someone has decided to make this public! (arduino code & instructions on how to fine tune the PPM/PWM signal)


I first heard about this ‘‘throttle ramping’’ on an instructable about making electric scooter. The guy who wrote it had some serious background in robotics and he was also studying at MIT or a similar level school. Too bad he did not give much instructions on how to make one, though.


Good to hear you will get some help, I have very limited arduino knowledge, I’ve turned on some basic matrix displays, did ultrasonic and light sensor things, perhaps a few other little tweaks but nothing major so far… I would appreciate if arduino code and all the instructions / functions were more easy to understand as it gets quite intense and non - understandable fast :slight_smile:

Also takes a lot of time, patience and endurance to find what is not working! Once I spent about 3 hours to get some basic lights working :smiley:

Well I had a quick look at my code and added a few comments to try and make it clear, you can grab it here - https://drive.google.com/drive/folders/0B9G-85jU01X5RUZoNGpRczRNcms?usp=sharing

I have only tested this with a servo at the other end but it does work. Pin 2 is the signal pin from the receiver and pin 3 is the transmit pin for the servo. The UNO cant supply enough juice for the receiver and is only 5V not 6V so I have 4 AA batteries in series to give me 6V. The servo seems to need to be powered from the UNO (otherwise strange things happen) and you must have a common ground or nothing works.

I’m going to split the parts of the loop into functions and get that working hopefully tomorrow or over the weekend.

A lot of the comments are from the original writers of the code that I have copy/pasted and modified so it works. I’ll compile a list of sources and add them so I can give credit where credit is due.

yes thats exactly what I’m thinking. I just got one of the modules and I’m researching vesc/ble for an android vesc app.

Once i have the data, i might make an online tool to upload directly/compare trouble shoot… This is all very early stage ideas tho. not sure when i’ll feel like coding…

1 Like

is this close enough? I think i used arduino for the wired version, so its still on topic :wink: http://www.electric-skateboard.builders/t/touchless-power-glove-control-working-interested/10718

I’ve been trying to get data from vesc via uart but still not receiving anything from the VESC. I have an arduino uno connected to a small lcd, which displays the voltage and rpm. The uno is hooked up to a lipo on the uno’s 5v vcc pin and GND pin. Only the vesc’s rx and TX pin are connected to the arduino.

Could that be that problem?

did you enable ppm+uart? also, im not sure about this since i haven’t done any vesc uart dev but i believe you have to query the vesc?

Also, its a good idea to have a common GND from the vesc to the arduino. And since the vesc can provide 5v you can just use 5v, GND, TX, RT from the vesc.

Yes, I have ppm+uart enabled; baud rate is also identical.

I should add that plugging in a Bluetooth module to the VESC’s uart works with the VSC Monitor app (by solarturtle?). Also, what’s “query the VESC”?(Im a noob)

you need a common ground forsure.

other then that I think the vesc only give data as a response. so you have to send a request code, and it will send back the data you want.

i’m not sure what the codes are yet tho… working on it.

Example code for.getting data from vesc and arduino library https://github.com/RollingGecko/VescUartControl?files=1

vedder’s blog is a good place to start too. http://vedder.se/2015/10/communicating-with-the-vesc-using-uart/

Are you using that? Where did you connect the VESC’s RX/TX on the arduino? I use 2 digital pins for RX/TX since the atmega uses rx/tx pins for usb

I am thinking of sticking an Arduino 101 on my board for a bit of throttle smoothing. Might go for a custom controller using a Trinket as well since they are so small

The 101 has bluetooth, a 3-Axis gyro and 3-Axis acceleromter all built in so could be perfect for data-logging, connecting to phone etc.

I use the serial pins on the arduino uno (pin 0/1) but I unplug the USB. If I don’t use the serial monitor on the pc and have the values output to the lcd, it should work…right? (I will test this later)

Do I really have to use Software Serial?

OK I just signed up for a github account and created my first repository here - https://github.com/EssEnn/esk8-Throttle-Control

I’m still trying to fully figure it all out but its a start. The name will probably change in the future and once I have something working a little more I’ll probably start a thread about it.

If anyone is able to give any advice or help, it would be greatly appreciated as I’m a total beginner at this.

Yeah, as long as you’re not using usb tx/rx pins should work fine, but its much easier to use software serial, that way you can use serial monitor for debugging and quicker code changes turnaround.

Have you tried this code out yet? Looks like a good basis to start.

You probably know this but interrupts can only be added to pins 2/3 on an uno so you might want to change the servo pin to 9/10 so you can add other interrupts in future :grin:

Should probably ditch the delay in your main loop for millis() compare or an interrupt. Should prevent any problems later on

If I use software serial (let’s say I set pin 2 as rx and pin 3 as tx and name it “mySerial”), in the “VescUart.h” file – I’ll have to change “#define SERIALIO Serial”. What do I replace it with?

@domw95 The code as it is works but yeah i have to remove the delay and time the tasks. I actually just found this - https://learn.adafruit.com/multi-tasking-the-arduino-part-1/using-millis-for-timing after reading your post as it got me thinking. I got a good few hours on Saturday to start getting my head around this and tinkering. You are totally right about the pins and those will change as well. I was thinking about using the second channel for something but I’ll focus on the core first, extras later.

Thanks for the input

#define SERIALIO mySerial

1 Like

Cheers @EssEnn … il power up the netbook later and have a look, see if I can understand any of it. Currently making a stand for my PC PSU and accucell. Bit chilly and cloudy here today though, not sure I should charge my lipos just in case I don’t make it out! Actually found an app for android which allows you to open .Ino file and edit etc which saves me copying stuff to a .txt to mess with on my phone on the go