PDA

View Full Version : Arduino Based E-Bike Control Computer



Chri5
02 January 2018, 0845
Arduino Control information software

Abstract:

Develop a system that can display/influence drive train information for the E-bike and information required for public road use

Requirements

the system much be as none invasive to the higher power drive train circuit as possible and display information about it like power, RPM, averages in a visual way.

Must be able to be used by new Arduino coders and customisable for all the bikes on here! (except the AC bikes sorry guys but maybe... with some magic)

Be Cheap-ish

Minimum Information Requirements

Road lighting Control :
the arduinos system should control all aspects of the road lights so handle bar controls will be controlled via relay where required for higher voltage/ power

Dash board information
• Speedo RPM (WIP)
• Odometer (WIP)
• Motor Current Done
• Battery Current Done
• Battery Voltage Done (No Protection)
• Motor Temp Done
• Motor Controller Temp Done
• Battery Temp Done
• Automotive Warning Lights (Hi/Lo Beam / Indicators Etc) Done For FZ6 but not my Kawasaki yet

Over Voltage Charging Protection for 20+ Cells (WIP)
Voltage Reconfigurable (very basic mains shut off for dumb chargers )

Would be nice to have requirements
Gps Tracker (Early Planning)
Data Logger (Early planning)
Gyro, Accelerometer g-meter (Not Started)
Wifi Mobile communication (Needs Outsourcing most likely)
Touch screen Control (maybe, gloves might put a stop that)
Alarm
SMS Warning Alarm integration

The Plan

Have a Master MCU and Slave MCUs as intelligent sensors for Pre-calculation and uninterrupted calculation which is by far the biggest issue with recording the information (to my limited knowledge of Arduino coding) what I found is some things need to ideally run all the time and the Arduino cant do that like Speedo and odometer really should be running all the time to work with any kind of accuracy and only be interrupted for data transfer. which is pretty quick in I2C in real terms.

I plan to do a post on each aspect of the information what I want to know is how detailed people would like would people like it to be just the circuit and how I did it or a bit more in-depth like the things I tried, problems I had to over come and circuits I tried and what I like/dislike about them?

This System is NOT Finished there will be problems with some of the stuff I post im sure (in Code, Electronics and Physics) and I welcome peoples ideas and criticisms

I know there are a few who are really interested in this. my total cost is roughly 60 most of which is 2 sensors and the Arduino Mega and TFT Touch Display all the other components are inexpensive

So the Master MCU is the Mega with a satellites of ATTiny85 as the slaves
current sensors for the Motor and batteries are the LEM HTFS 400-P/SP2, Expensive but I had to rewrite my code for these puppies in a good way the signal needs no conditioning and is VERY accurate beat my clamp meter so I had to delete lots of code YAY

let me know how detailed you would like the information and ill have my first post on current sensing up in a week or so

Stevo
02 January 2018, 1106
If you start programming your BMS, let us know. I'm trying to learn Arduino now (so much to learn!) and just ordered an Uno and some shields (wifi and Bus to mini)... I made a 12v dc-5vdc from an old automotive cell phone charger. I'll see if that's enough to power on the Uno. My first goal is to be able turn my bike's main power on via an opto-isolated relay switch with my cell phone. Then I can use my cell phone's display for GPS maps and route planning, or as a speedometer.

Chri5
02 January 2018, 1454
Arduino is a great plaform I only came across it in my E bike research and have been learning it since. my super simple bms which is still in the work but looks promising is using a attiny85 (very similar to arduino but with 5/6 IO pins and uses 12mA) and a few multiplexer 74hc4051 ICs to increase the cells being read as Lipo batteries are under 5v when one analogue signal goes over the charge limit set in the program aka 4.19v the tiny will send a signal to a relay on the a.c. input for the charger and cut it. the multiplexers (mux) are stacked so attiny to mux1, mux1 to mux 2 and 3 but I'll have more details when I get to that bit I want to make this comprehensive as there's so many arduino ideas floating around on the interwebs for E bike control but I've found they don't give enough scope to easily change it to your needs or disregard as N/A or what limits it my have

That's quite a goal for a early sysyem steve I haven't tried gsm and GPS yet I've had some long thought experiments about them tho they are complex but once I pick up some modules I will have a play but if you crack it let me know maybe we can intergrate it into this system

furyphoto
02 January 2018, 2249
I have done some work on the 12v control side. I was starting with a system for wiring my ICE bike, and then planning to add battery monitoring and some other vehicle control. You can see it here: http://elmoto.net/showthread.php?t=4044

I was also looking at using the ATTiny voltage reference for cell voltage monitoring, I have a stack of them and opto-isolaters in a box waiting. One of my concerns with this layout is parasitic drain on the cells. While the Tiny uses almost no current ~1ma, they will always be on, and always running non-stop. I have considered another isolater for each cell that can connect the vcc to the tinys when the system is activated.

Also, I'm looking at using an Arduino Mega for my main board. It has lots of digital pins, (54, I will need 22) so I can skip the MUX ('s) and run direct to the main board.

I would be interested to see what you have going on if you are willing to share.

Chri5
03 January 2018, 0655
to aviod the parasitic drain try 2 opto coupers to isolate the battery circuit in opposite directions (LED side to a Digital output on the Tiny) and the other one LED side to the Cell Circuit. then when you turn on the Digital output on the tiny it switches the curcuit on. then read the other opto coupler with a voltage devider and a analogue input then turn off the digital output and put the tiny into sleep mode untill the next read and power the tiny from the Mega that way the cell circuit only activates on command (bar a very small leech (~nano volts/Amps) this is how im planning to do it but i may need an op amp to add gain to the difference as 4.15v and 4.2v wont have much difference. i hope that makes sence

Chri5
03 January 2018, 0658
everything i do is going to be shared i could maybe make it a poduct for sale but there is already the CA and all the information on this forum has helped me a great deal so i want to give back. my cell monitor is still in the Simulation stage and im not 100% sure its the right/cheapest way but once ive built and tested it ill post the results

Chri5
03 January 2018, 0703
74887489

sorry for the tiny image ignore the resistor values i was just throwing it together to shows what i mean

battery source V1 (4.2v) is the cell
battery source V2 would be a +5 from the tiny with the analogue input between the resistors
Battery Source V3 Would be a Digital Output from the tiny

Bernel
03 January 2018, 1516
Interesting, I have an Arduino based I2C system running on my motorcycle conversion. It is not connected to a BMS though. I have two Arduino Mega's, one running a 5 inch tft and the other running a speed sensor, a 4 channel ADC for battery voltage, battery current, and charger current. I have 4 I2C sensors for temperature measurments and a FRAM for storing battery capacity, odometer and trip miles. Everything works just need to calibrate speed and set up the odometer readings.

Your project is very similar to mine but you have gone the extra mile with bike controls, very nice I will monitor how you progress it.

Bernel.

Sent from my SM-T310 using Tapatalk

Chri5
03 January 2018, 1546
well the bike controls still go through the orginal controls and wires but are mostly non invasively monitored by the logic i dont have/want software running saftey controls like brake lights but can still display information in the arduino if they are active. is your speedo a Hall sensor if so where have you mounted it? im torn between the hall sensor-magnet or encoder wheel and Diode. i would like to do a laser diode just so the bikes got a laser

Skahle
07 January 2018, 2332
You might want to look at something like an Adafruit Feather M0 instead of the Arduino Nano. It has a much more capable processor (32-bit ARM Cortex M0) and can still be programmed in the Arduino IDE. You could probably set up interrupt based I/O with DMA transfers to keep streaming in data from peripherals while doing calculations and display updates. Sometimes the Arduino IDE doesn't let you get to all of the features of the parts so I usually use the Keil or IAR IDE, both are free up to 32K code size (or even mbed, the online IDE) but the learning curve is much steeper.

Chri5
11 January 2018, 0957
Learning curve is the put off for me i am new to coding and still learning electronics so the simpler the better at the moment i hear what you are are saying but its just above my pay grade the multitasking would be nice tho but more tasks more power consumption..? maybe? every mA counts

SLVRGHST
23 January 2018, 1108
@Bernel - Sounds like you are ahead of the curve on many areas of an integrated Arduino dash and instrumentation setup. Would you be willing to share your parts list and Arduino sketches so that others like myself could learn/understand and adapt your knowledge to our own? Perhaps start a specific thread on this forum if you haven't? Or point us to wherever you may have shared this already? It would be greatly appreciated. :)

Bernel
24 January 2018, 1018
Slvrghst, yes it is my intention to share and as soon as I find the time and patience I will make all my code and hardware available.

Sent from my SM-T310 using Tapatalk

SLVRGHST
24 January 2018, 1057
@Bernel - Thank you. And understood.

@ALL - I have been working on a homemade e-motorcycle build using an 81' CB750 and its ICE removed. I have the majority of the parts together to build it but I always had this idea of using something different than the basic display you can get for e-bikes. The display like the Cycle Analyst v2.3 seems too basic. I have been following Steveo's thread on elmoto with great interest and even downloaded the paper hi had linked there. Lot's of ideas there that others have offered. The whole integrating with CANBus is interesting... with CANOpen being almost like working with a MODBUS layer, ideas like those can get pretty deep AND expensive (right Stevo?). I have just started down the Arduino road - taking online courses, building labs - and it has been great fun! I believe that I should be able to integrate an Arduino board (ie. Mega2560)with a large display to show the insrtumentation I am looking for... or... my smartphone maybe? I enjoy the learning through the research and tinkering I am going through now. When I have something solid, I will share my project too.

Stevo
25 January 2018, 1314
Thank you for the interest. I have so much to learn and I will share everything here. I have found some very good educational links and its just gonna take time to figure it all out. I am making progress, just some annoying road blocks, such as using my Ubuntu based laptop to program Arduino (Linux is a outstanding but you have to make it work for you), configuring ESP8266 wifi module has been challenging and I'm still not there yet, HC-05 Bluetooth module connecting but still only halfway communicating...etcetcetc.

As far as hardware goes...What is the best way to independently monitor 25 cells? The ESP8266 has built in I think 14 or 15 digital pins that can be used for inputs. I thought I might be able to use this as a standalone, but I was wrong.

I have been trying to think of a way that I can monitor each cell independantly, then balance the highest cell with the lowest cell as a loop function for up to 5 seconds, then loop again. This way, I only need to make one balancing circuit. If I can get that working well, then I can add more balancing circuits and balance more cells per loop.

furyphoto
28 January 2018, 0013
I have two Arduino Mega's, one running a 5 inch tft

What type of Screen are you running? I have been looking for one for my project. How does it show in the sunlight, and can it handle getting wet if it rains a bit? I have been looking at some with dedicated micro-controller drivers and an i2c connection so you don't need a separate arduino to run the screen. Its tough to choose one from online specs though. I'm definitely interested in the opinion of someone who is using one for a similar purpose.

SLVRGHST
29 January 2018, 1046
@furyphoto - I am not that far along yet with my display project but I settled for this baby to work with:
7" TFT Screen Touch LCD Display Module w/SSD1963 Controller Board,MCU (http://www.buydisplay.com/default/7-tft-screen-touch-lcd-display-module-w-ssd1963-controller-board-mcu)

It's the largest one I would consider putting on my bike. With an enclosure and the resistive touch sensor cover (like your typical car navigation display), it is considered water resistant but I wouldn't say water proof. It would depend on what kind of seal you can give the display itself once it is inside the enclosure you pick/design/build. It will be fun tinkering with this one to see what I can learn, and make it do. By the way, if you're ordering from these guys, take heed... the Chinese New Year begins next week. Their factory is closed from Feb 8 to Feb 25. Anything that they don't already have in stock will have a lead time of about 4 to 6 weeks depending.

Stevo
30 January 2018, 1112
SLVRGHST,
I used to scuba many years ago. Seeing how things were waterproofed helps me understand. Components incorporate rubber o-rings lubed with Si grease, compressed either by a threaded cap or screwed down lid.
My suggestion for waterproofing the touch display would be by making a gasket with a uniform bead of silicone around the outer edge of the screen, then let it set. Maybe clean the display first before gluing with some acetone. The cover of the display will have the cut out so your finger can touch the screen, and then compress the glue bead gasket by using screws spaced around the display pcb. You could put a little Si grease on top of the set glue bead before you place the cover on to really give it a good seal.

I think I'm still going with a IP68 waterproof rugged Android tablet for my display.

Stevo
30 January 2018, 1127
OH BTW!!!
Someone was questioning whether or not the touch screen could be used while wearing riding gloves...
I can use nitrile exam gloves on the touch screen of my smartphone, so I'm thinking if there is a problem with wearing motorcycle gloves, you could maybe glue some nitrile fingertips onto the tip of the index finger on your riding gloves. It may not even have to be glued because it will be stretched on like a good fitting condom!

darksplat
26 February 2019, 1653
Hi,

This is a very good project and I am wondering how your progress is going?

Cheers

Bernel
07 March 2019, 1104
well the bike controls still go through the orginal controls and wires but are mostly non invasively monitored by the logic i dont have/want software running saftey controls like brake lights but can still display information in the arduino if they are active. is your speedo a Hall sensor if so where have you mounted it? im torn between the hall sensor-magnet or encoder wheel and Diode. i would like to do a laser diode just so the bikes got a laserI know this is a late reply to your speedo question but I have been a little busy with othet projects. My speedo set up is a magneyic hall sensor. I bastardised the analogue speedo gear wheel and fitted a small magnet to it. The hall sensor is mounted on the outside if the analogue speedo and the 5V, signal and ground are fed to an Arduino Mega, I will post photos when I next tear down the instriment cluster. I still have the analogue tacho on the bike, the rpm and temperature gauge were removed and I mounted a 5 inch tft in their place. I scaled the odometer by resetting the trip meter to zero, rotating the front wheel and counting the number of revolutions to get to one mile. I can go down to 2 decimal places. Just need to refine it and add filters to stop it spiking.

PM me if you want more information, I am happy to share.

Bernel

Sent from my SM-T310 using Tapatalk

Bernel
07 March 2019, 1110
What type of Screen are you running? I have been looking for one for my project. How does it show in the sunlight, and can it handle getting wet if it rains a bit? I have been looking at some with dedicated micro-controller drivers and an i2c connection so you don't need a separate arduino to run the screen. Its tough to choose one from online specs though. I'm definitely interested in the opinion of someone who is using one for a similar purpose.I bought mine from Sainsmart complete with tft shield. A word if warning though, these are not OEM grade, below 0 celsius and above 25 celsius they start to drift.

Bernel

Sent from my SM-T310 using Tapatalk

Bernel
07 March 2019, 1112
@furyphoto - I am not that far along yet with my display project but I settled for this baby to work with:
7" TFT Screen Touch LCD Display Module w/SSD1963 Controller Board,MCU (http://www.buydisplay.com/default/7-tft-screen-touch-lcd-display-module-w-ssd1963-controller-board-mcu)

It's the largest one I would consider putting on my bike. With an enclosure and the resistive touch sensor cover (like your typical car navigation display), it is considered water resistant but I wouldn't say water proof. It would depend on what kind of seal you can give the display itself once it is inside the enclosure you pick/design/build. It will be fun tinkering with this one to see what I can learn, and make it do. By the way, if you're ordering from these guys, take heed... the Chinese New Year begins next week. Their factory is closed from Feb 8 to Feb 25. Anything that they don't already have in stock will have a lead time of about 4 to 6 weeks depending.I bought a 7 inch and 5 inch from Sainsmart, these are the same tft's I believe.

Bernel.

Sent from my SM-T310 using Tapatalk