08 December, 2016

Improving the Ebike with Arduino to monitorize battery and other info 1/2


It is the second time it happens; I pick up the bike, and after the trip to work, the ebike left me without power in the middle of a slope... with the hassle of having to carry their 30 kgs. on a slopes over 14% (and the damage it does to the battery the depth discharge, fortunately are pretty well LiFePo that support this). 

I have no charging indicator (the handle that provided me is to 48V) to calculate if you have enough power for 4 km I have to do, and also the LiFePo4 have a very small voltage variation between 20% and 80% of capacity (between 3,15V and 3,35V), which is easily neglected. And make it load every day is not practical or the best for the battery (ideally recharge when you reach the 20% to maximize battery life). And the battery charge indicators seem to me too "greedy" energy. So...

A solution for every need ...



01/09/17: In the end I finished using a Nano and MPU-6050 accelerometer for burglar alarm functions and voltage indicator, in the 2/2 post from january 2017 you can see the details.
I thought it would be nice monitor the status of the battery with an Arduino, and indicate with an RGB LED (green to red to yellow, orange ...) the need to recharge the battery. But I do not want to stay there alone; the advantage of the Arduino is that we can make this task intelligently, and turns red when it is considered that given the historical average consumption of travel (if for work usually similar), not reach us by the next trip , and we can charge it last night time (takes about 5 to 10 hours to fully charge a 2Ah charger, depending on what they are desigualadas cells). Or at least, not complicate both, we can tell our taste the percentage of battery with which we want to be marked in red (with 20% for example, as if it were the reserve indicator). 

And not only that; once I forgot the light connected, and the next day I found her without battery. We may automatically turn off the power switchboard and accessories  (with a solid state relay) if we detect that the voltage variation during the last half hour has been less than 0.10V (I figure that my battery capacity and minimum consumption, covers all cases), and prevent this from happening.
You could put a Hall ammeter to make accurate but the goal is to do something as simple as possible by measuring only the changes of voltages (Lithium batteries usually have curves similar discharge during its lifetime) and that can indicate parameters type battery. The problem I see is going to be whether the voltage is under load or not, to avoid false alarms by large fluctuations  during high loads, one option is to average values every 5 min. eg. not to influence both.
You could even use the EEPROM to store the necessary historical data, and go calculating load point according to the latest consumption. The program could do the following:
  • After turning on the Attiny a switch, connect the main relay
  • We charge the EEPROM historical and see the average consumption per trip based on the voltage drop occurred,
  • and taking into account the capacity ratio / a LiFePo voltage (shown with A123 26650),
  • We started to monitor the battery voltage with a voltage divider and take data every minute, and every 5 minutes RGB color update.
  • If the voltage does not vary by more than half an hour 0.10V (must take into account the consumption equipment such as LED light bulb crossing), we consider that we have forgotten the connected and disconnected the main relay.
  • He had thought put to sleep the ATtiny ( consumption is the order of 5 microamperes  (uA) in sleep mode ) while doing nothing, but its consumption is so small that not worth it, because it complicates the measurement of time elapsed. I will feed battery with a resistance of 100 ohms to protect the regulator.
All this we'll adjust according to the result, but I would like the program to "learn" to use, and it is not necessary shove values ​​as battery capacity, etc. Simply be based on what is lacking to approach the minimum voltage and medium capacity was used in the last 10 trips, I guess.

Capacity curve as voltage LiFePo I monitored, by connecting the computer the iCharger 1010b +, downloading a LiFePo ANR26650A A123  9 years but with little use ( logview Studio 1 ), and a few mAh for the voltage / actual charge ratio (vary depending on the age of the battery and model) to adjust everything possible RGB LED indicator, but basically the general discharge curve in LiFePo4 is:




All the energy is stored between 3.1 and 3.3V  Source
As shown, the load percentage is practically linear between 3.3 and 3,1V (at rest) , so between those voltages 80% of the cargo handled, which will charge indicator sufficiently reliable (the voltage divider has to be as accurate as possible). As I said, the problem will be whether we are accelerating or not (can lower the voltage enough in times of high engine stress, and never know if we accelerate unless we get this info on the other hand, as sensor hall engine or unit ...) but we can ignore this, and knowing that only rest well indicate the charging status, simplify the calculation .
Discharge curve at 40 mAh of a ANR26650A from A123 with 9 years ( Datasheet )

After this brainstorming and possibilities to implement an Arduino control in the next post I hope and have something functional and tell you the details.

Update 6/10: As usual, another came the same before me , even using the same RGB colors! However with the Digispark plate and connection process it is much simpler, and also serve to Li-ion batteries.

No comments :

Post a Comment