ARDUINO - help and ideas thread

@Pimousse the magic smoke is never a welcome sight. I guess it went up quite nicely :wink: Would you be interested in assisting with this little project seeing as you have basically already done it? As we mentioned above the goal would be to log some basic info to an SD card to collect data for the database. If you don’t mind sharing your modified code with us I’m sure that would be a great start !

I’m so in love with open source and collaborative projects. So I’ll be so pleased to share everything.

I had datalogger working

http://img4.hostingpics.net/pics/729214IMG20160818131238.jpg

Here with random values. I wasn’t able to have I2C LCD, SD breakboard and VESC comm working simultaneously. (I didn’t find out why).

Honestly, I switched to the HC05 bluetooth module with VESC Monitor app for datalogging which is quiet more convenient. So I didn’t push the dev so far.

2 Likes

Brilliant, thanks so much! Would you be able to email it to me when you have a spare minute please, no rush at all - just when it is convenient for you! I’ll pm you my email address if this is ok :slight_smile: then i dont mind forwarding it to whoever else would like it.

@smudgeUK god I’ve had a lot of mentions in this thread. Sorry for the delay joining in, work has been intense.

My plan for the Arduino is to control the PWM signal so you can adjust top speed and apply a delayed throttle curve to the ESC. This will make some boards easier to ride and when friends want to ride you can limit the performance so they won’t get thrown off the board.

So far I can read the PWM signal from the receiver, apply some smoothing to the result (average over 10 inputs) and then relay that to a servo (will be an ESC in the future). There is a lot more to do and I’m a total beginner to Arduinos and coding so the code is a mess but I’ll be giving it a tidy and sort out the comments. I am getting the hang of it though and have an idea of what needs to be done. The only thing I might struggle with is scheduling the tasks so they don’t interrupt each other. Hopefully I’ll have time this week to tidy stuff up, add comments and give out the code I have so far.

@Pimousse the problem running a few things at the same time is you only can process one thing at a time so if a bit of code interrupts another task it will stop things from working. Have you tried adding delays between parts of the code to slow things down? The other option is to schedule the code but reading about that means you have to do a rewrite of it all.

As I said, I didn’t push the dev so far. Maybe adding some delays could help. I already have one at he end of the code. I’m not used to handle intterupts, and I read (IIRC from Vedder himself) that Arduino doesn’t manage it very well.

regarding arduino / SD Card data logger - we’ve been there already and @makevoid has done it already. See http://www.electric-skateboard.builders/t/recording-data-from-vesc-summary-of-tools/7020/9

I would love to see the microSD config.XML to VESC - with a slow and limited default config being loaded and then the ability to load the “hero mode”.

So @EssEnn how much progress have you made? It seems that you have had a discussion with @DWiskow already, he is the one who has already made such a ‘‘module’’.

Though I dont have the time and understanding to go into that now, so:

Can you just summarise how far have you gotten and is it easy to build such a device / module?

(for throttle ramping)


Original thread, where @DWiskow mentioned it, is here:


Would be great if he found the time and willingness to share this with others!

At least from the topic alone I dont get a clear idea on how to do this myself… unfortunately

I have to check up on our initial plans for the Data base!

We intended to collect energy use data, somer power requirements and such.

@whitepony went even further and advised on how it should look to make it somewhat meaningful (with charts etc)

If I reorganise all of that stuff in somewhat readable manner I will update the old thread or make a new one!


Basic things would be:

  • mah consumed
  • distance done
  • average speed
  • top speed
  • max amp draw
  • average amp draw

From this it would be way easier to calculate max achievable distance from battery based on average + top speed (and average / peak amps)

Also design suitable battery for your needs (EG only 15mph/25kmh top speed and so on)

It sounds really great !!

I was wondering about how build a database for collecting datalog from VESC Monitor app. I built a Excel sheets with macros to make the analysis fast and easy with lot’s of calculated parameters (like range). It’s still in beta since I need more .txt files from longer runs than mine (1km, 3min :smile: ). But anyway, it could be awesome so share the file directly from the app to the database and then see charts and average data etc.

The link of Excel sheet : https://dl.dropboxusercontent.com/u/47746996/VESC%20Monitor%20Analyser.xlsm

Wait… Are we building the eskate Google ? :smile:

1 Like

I have to send this to ‘‘our programmer’’. Unfortunately, at this stage I am more of a ‘‘coordinator’’ and ‘‘inspirer’’ than the one who does all the work!


@deathcookies is the one doing the hard work now (technical things).

I think, to make this even further he have to contact @makevoid and some of the high experts of this forum, to progress the project further.

As of right now we have only finished the platform, where to put all the info and text files / pictures etc… the next step with converting files and uploading them in an easy to look at result would probably take some extra effort… it is a question about human resources, now, I think :slight_smile:

Would it be possible for you to summarise what has been done so far?

(For reliabily recording and exporting data from vesc)


I opened the thread but it is way too intense and detailed for me to start readin it now… perhaps someone who has gone through all the thread can do the simple work of outlining:

  • How well does it work?
  • Is it easy to set it up?
  • What exactly is required besides Vesc, the app to make it working?

Answers to all of this would be great! So far the only ‘‘shortcut’’ and easiest way to see some live data from vesc and also export it is to use the bluetooth module. So I am not so sure how much easier it is to do it on a SD card.

I don’t have any skill in web or database coding, but I’ve another skill : I love to learn :slight_smile: So if I can join the dev process, let me know. I’m also beta-tester of VESC Monitor app and report issues to the dev. I could be a link between both platform if needed.

There are lot’s a talent guys here, but it seems that some of them work only on their own (sometimes with the hope of making money…). If only we could all put effort together, we should be able to ride our board just with our mind. :smile:

1 Like

ha ha :smiley: nice future concept and something to strive for! :smiley:

Dunno how fast this ‘‘brain impulse’’ technology will come in everyday use, though there are some applications where it is already happening, like with the paralyzed people and such…


I wrote a message to @deatchookies (our dev), will see what he tells us… though, we will probably need more than one person involved in this one… since it was a somewhat hard toll on @deatchookies to do it alone, partly of wrong initial planning, though, with more people in the team, this should be doable…

Though, I do hope that all of us (the interested parties) can come up with a plan and find a way to collaboate with each other… will be hard if everyone is coding and doing their own project alone…

Some ideas and suggestion for the first initiatives on what should be done, would be great!


So far, I’ve got to understand how much progress have been made so far…

As of now it looks like there is:

  • Working bluetooth module, with the option to make an app for android, too, not just iphone

  • Way to write vesc data to an SD Card (not 100% in tune, but that’s what I understand)

  • Somewhat finished Esk8 database for storing and displaying info with a few functions and design things still missing (should be updated&improved over time!)

Haha, the other thread is the summary already … :innocent: suppose there is so much information in this forum now … I only chimed in because I wanted to avoid that somebody develops code to store data on an SD card. It there already.

In short

Here the summary again: Hardware:

  • Arduino connected to VESC via UART
  • Standard SD Card shield

Code:

This code logs data in a JSON time series format.

Power the arduino off the VESC or use a common ground. The code runs on the Arduino device and pulls the data out of the VESC. The data is then stored on a standard SD card shield connected to the arduino. You need to set the VESC to ppm + uart mode and you only get the right data if the remote controller is on and connected. If you want to analyze the data, the SD card needs to be removed. You can then analyze the data either using the JSON data to GIF generator or the graph tool mentioned below or some other app that understands JSON. If there are enough requests, makevoid might add a CSV format as output.

@makevoid also made a program that takes the JSON time series and generates a text gif to embed in videos Code:

The program runs on Linux, opens the log file VESC_LOG.TXT and creates a GIF image based on the data in the log file. This image can be included in videos.

@makevoid JSON to graph app to make video overlays Software:

2 Likes

Suggestion (even though I’m not the OP or a moderator):

  • stick to ARDUINO help and ideas in this thread
  • Love the idea of VESC logging an ESK8 DB, however there are already a lot of threads covering this topic. Please use these threads

@Okami That’s who gave me the idea being honest, I was asking questions and not really getting much information back so I decided I’d just give it a go myself. Turns out it is not actually that difficult as Arduino’s are great for outputting a PWM signal for servos. All I did was buy a starter kit from Amazon for £40 which had solderless breadboards, wires, a servo, LED’s etc and get going. There are a few guides on the internet but I found a good sketch that uses interrupts to time the PWM signal from the receiver that turns out to be a lot more efficient than using the function available in Arduino (http://www.benripley.com/diy/arduino/three-ways-to-read-a-pwm-signal-with-arduino/) Writing to the servo is the easy part as there is a servo library already. The code to implement smoothing was also easy as that is available on the Arduino website.

So right now the sketch I have will read the signal from the RX, average out the last 10 results and output the PWM pulse to the servo. The smoothing is needed as the PWM pulse from the receiver does vary slightly +/- 5 microseconds. Took me about 2 hours to actually get working but I have watched a lot of youtube video’s and tons of reading (all stuff I don’t fully understand) to get this far. The hardware side is piss easy as long as you remember to use a common ground.

What needs to be done is the following - Setup a routine so the Arduino knows the neutral, max and min pulses from the RX (like you do with ESC’s) Write the throttle/brake ramping code (the hardest part of the project) Implement variable resistors to tune things like max throttle, throttle ramp speed, brake ramp speed.

Once that is working then it’s easy to create different ramping curves, preset modes etc. Only thing after that would be some kind of display.

I don’t mind giving people the code as it is but I have just been copy pasting chunks of code and the comments all need fixing as I have made changes. It also needs to be split into smaller functions as there is a lot going on in the loop() right now.

@Pimousse There is probably better platform to use other than Arduino but for the cost and ease of use I quite like it. Try adding a 1 to 10 millisecond delay between the routines and see if it solves the issue. I don’t think a delay that short is going to be noticeable or really affect the output.

2 Likes

@PB1 Yes i agree, threads for specific topics should be maintained. It makes it much easier to keep track of the discussions. @EssEnn you know im looking forward to seeing the ideas and possibilities your project could open up. Input from the community could make this idea the next best thing for the hobby since the vesc :slight_smile:

We are still only batting ideas around here so we can just keep this one a random arduino thread with no specific direction. Any direction you want to go is a good direction!

@Okami made a good suggestion to me about a sub category for arduino, would one of the mods be able to confirm if this is something that could be looked into (or if its even possible? im sure it is) as there seem to be quite a few arduino related threads popping up and it would make it easier to keep track of them in the electronics category.

Same here. Asked in private message for more details, never got any reply :confused:

I think we need to develop this into somewhat ‘‘diy kit’’ or a module you can buy and install… otherwise too many ppl dont get the chance to set their boards to ‘‘beginner’’, ‘‘intermediate’’ or ‘‘pro’’ mode…

Especially true for 10s and 12s boards, I believe, where it is quite easy to loose control and push too much of a throttle…

@Okami Once the code is done then anyone will be able to build one. It sounds difficult but the wiring to the UNO is well easy. If you can build a DIY esk8 then this is just as easy, just smaller. I have no idea about producing a shield for the uno for the project but looking what some people have done in this thread it can be worked out in time. First got to get the code working. I want it to work in a way that anyone can edit variables in the code so anyone can fine tune it and lastly optimise the code so it can have other functions added without affecting performance. The code is going to need to be robust as the last thing allowed is it to go haywire and hurt someone. This is the main reason all the code & designs are going to be freely available to anyone.

God I have been thinking about this WAY too much. 2 weeks ago I had never coded an Arduino and now my brain is going overdrive about it. Once things calm down at work I’ll be able to actually spend some time on this as I find i’m reading a lot, thinking a lot but not doing a lot. I will be meeting a friend in a few weeks who does code C++ and Arduino’s who said he would help so fingers crossed hey

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: