Jump to content

EUC Interface Arduino Library (T-vK)


euc

Recommended Posts

Very nice work! :)

If you want to make it work with older King Songs, here are the differences in protocol (namely, the KS board doesn't seem to send the second header & odometer data, plus the first byte of the header is 0x00 instead of 0x04):

 

Edited by esaj
  • Upvote 3
Link to comment
Share on other sites

4 minutes ago, euc said:

Let's see how small I can make it.

IMG-20160822-WA0013.jpg

I recognize the other stuff, but what is that board between the battery and Pro Mini? Buck/boost converter or small lithium BMS? Is that a 9V battery or lithium cell?

I ordered a bunch (like 10 or something) of those Pro Minis, only to find out that they're really not that handy in the end :D  The space saving vs. Nano is negligible, especially after soldering the row connectors on it, as well as the price difference, so I'll probably stick with Nanos. ;)

  • Upvote 1
Link to comment
Share on other sites

4 minutes ago, esaj said:

I recognize the other stuff, but what is that board between the battery and Pro Mini? Buck/boost converter or small lithium BMS? Is that a 9V battery or lithium cell?

I ordered a bunch (like 10 or something) of those Pro Minis, only to find out that they're really not that handy in the end :D  The space saving vs. Nano is negligible, especially after soldering the row connectors on it, as well as the price difference, so I'll probably stick with Nanos. ;)

Yes, it's a step up converter to go from ~3.7V to 5V. I'll add add one of these cheap charging boards some time in the future.
The lipo is  a simple 3.7V battery. 

And I totally agree that the pro minis really aren't very small. But I have a ton of them lying around and they operate at 5V.

For 3.3V projects I really recommend the ESP8266. They have much better specs than Arduinos, they are half the size, they have Wifi built it and they only cost like 2 bucks a piece. They can also be programmed with the Arduino IDE and you can also flash a custom firmware which allows you to write your whole code in Lua which makes coding like 10 times easier. It's even possible to upload your code OTA, which is ridiculously awesome. :D 
Downside is that they only operate at 3.3V. (Although if you get a logic level converter nothing would stop you from using it in a 5V project)

Atm I'm waiting for the ESP32 (which comes out in 10 days). It's basically like an ESP8266, but the specs are much higher and it also has Bluetooth built in. :D That thing will hopefully replace the bulky combination of a pro mini and an HC-05. :)

  • Upvote 1
Link to comment
Share on other sites

4 hours ago, esaj said:

Very nice work! :)

If you want to make it work with older King Songs, here are the differences in protocol (namely, the KS board doesn't seem to send the second header & odometer data, plus there's an extra 0x00 -byte in front of the header):

Ah thank you @esajand @euc, the lack of an odometer and IOS app for my older KingSong have always been a bit of a pain and I can't be bothered to carry an Android phone with me as well. You have, between you now got the cogs whirring in what passes for my brain........ Now can I tap the USB power supply in my KS-14, fit the electronics inside (no problem at all I've got an empty battery bay) and have both speed (or possibly Watt hours consumed) and total mileage displayed actually on the wheel, relying on the Arduino to keep the odometer running total. It has got to be worth trying hasn't it?

  • Upvote 1
Link to comment
Share on other sites

12 minutes ago, Keith said:

Ah thank you @esajand @euc, the lack of an odometer and IOS app for my older KingSong have always been a bit of a pain and I can't be bothered to carry an Android phone with me as well. You have, between you now got the cogs whirring in what passes for my brain........ Now can I tap the USB power supply in my KS-14, fit the electronics inside (no problem at all I've got an empty battery bay) and have both speed (or possibly Watt hours consumed) and total mileage displayed actually on the wheel, relying on the Arduino to keep the odometer running total. It has got to be worth trying hasn't it?

I'm not sure if it would be a good idea to draw power from the built in 12/5V supply. You might fry it if you draw too much current from it...
I found really cheap DC converters that can go from 24V-72V To 12V. They are like 7 US$. I'd get one of those and a 12V to 5V step down converter.

Edited by euc
  • Upvote 1
Link to comment
Share on other sites

16 hours ago, esaj said:

I got "back" to electronics only recently (well, actually since last November or so), but I did have some education in electricity / electronics over a decade ago. Still, I'd say I've learned more within these last 9-10 months or so than back then at school in a few years :D

I always really liked taking broken electronics apart and trying to fix them. But it was usually just fixing solder connections or replacing a capacitor. 
I think I really started getting into Arduinos, sensors and all that fun stuff maybe a year ago.  :D
And yeah the education about electronics that I received in school was pretty useless. :P

 

I soldered the parts together and added a switch between the lipo and the boost converter. I also used wires instead of PCB to reduce thickness.
But I'm not too happy with the results: 
IMG-20160823-WA0001.jpg

It looks like a mess... It's 17mm in thickness btw.
When I have some more time I will probably 3d print a nice enclosure for the thing and add straps to it, so that I can actually wear it without making everyone think I'm a terrorist.

  • Upvote 1
Link to comment
Share on other sites

17 minutes ago, electric_vehicle_lover said:

That's awesome! I'm a bit jealous that your motherboard sends updates every two milliseconds. :D Mine is only sending it every 200ms...

I see you're using current measurements instead of detecting negative acceleration for the break light. I wonder what the advantages are.

Edited by euc
  • Upvote 1
Link to comment
Share on other sites

My code is very simple because I did it fast as my focus is to make an OpenSource firmware for MicroWorks 30B4 boards, as that company sell for DIY every part of an EUC.

That's an error, is also 200ms, see here more details: https://github.com/EGG-electric-unicycle/documentation/wiki/MicroWorks-30B4---30km-h-controller-board-with-bluetooth

  • Upvote 2
Link to comment
Share on other sites

1 hour ago, electric_vehicle_lover said:

My code is very simple because I did it fast as my focus is to make an OpenSource firmware for MicroWorks 30B4 boards, as that company sell for DIY every part of an EUC.

That's an error, is also 200ms, see here more details: https://github.com/EGG-electric-unicycle/documentation/wiki/MicroWorks-30B4---30km-h-controller-board-with-bluetooth

Very interesting!

I have a question about the "Battery voltage and power" list. I was planning to create something similar, but I wasn't sure if it would make any sense.
What if the battery is very old and has been charged a few hundred times? Wouldn't the results differ quite a lot? And what if you have two battery packs in parallel? Would that make a difference? Or what if the li-ion cells are from a different manufacturer?

  • Upvote 1
Link to comment
Share on other sites

8 minutes ago, euc said:

Very interesting!

I have a question about the "Battery voltage and power" list. I was planning to create something similar, but I wasn't sure if it would make any sense.
What if the battery is very old and has been charged a few hundred times? Wouldn't the results differ quite a lot? And what if you have two battery packs in parallel? Would that make a difference? Or what if the li-ion cells are from a different manufacturer?

Personally, I'd prefer to simply see the voltage reading than any percentage-value, but that's just me... It's pretty much the "leading" health-indicator of the batteries, as well as charge-state, but for "pure layman", reading the values and dips in voltage might be a bit too much, and they prefer simple 0-100% display instead.

The difference between new and old batteries is mostly how much charge they store and how fast they get empty, ie. you just see the voltage/percentages dropping faster (and likely larger fluctuations in voltage/percentage between braking/acceleration, especially towards the end of the charge).

  • Upvote 1
Link to comment
Share on other sites

1 hour ago, electric_vehicle_lover said:

Go and tell all of that possibilities to the board firmware!! :-) " When the power available is 20% or less, the board will beep (even when the motor is stopped)."

We need to simplify and not get more possibilities.

I was just trying to say that I could imagine different batteries to have a different percentage left when outputting the same voltage.

1 hour ago, esaj said:

The difference between new and old batteries is mostly how much charge they store and how fast they get empty, ie. you just see the voltage/percentages dropping faster (and likely larger fluctuations in voltage/percentage between braking/acceleration, especially towards the end of the charge).

Okay that's good to know. But there would still be the manufacturer problem. According to these graphs, it's safe to say that you couldn't properly predict the available capacity in percent just by reading the voltage:http://www.candlepowerforums.com/vb/showthread.php?257543-LiIon-18650-battery-comparison

But I don't know if the same would happen with battery packs behind a bms.

1 hour ago, esaj said:

Personally, I'd prefer to simply see the voltage reading than any percentage-value, but that's just me... It's pretty much the "leading" health-indicator of the batteries, as well as charge-state, but for "pure layman", reading the values and dips in voltage might be a bit too much, and they prefer simple 0-100% display instead.

Personally, I'd prefer an estimate of how many kilometers I can ride until the battery is empty.

  • Upvote 1
Link to comment
Share on other sites

5 minutes ago, euc said:

Personally, I'd prefer an estimate of how many kilometers I can ride until the battery is empty.

Technology is not there yet. I think users, currently prefer actual technology state for the current relative cheap price of EUCs.

But seems that a raw estimation could be possible, since odometer value and battery state values are available. There is one thing, there is no persistent memory on the board which I think is need for implement such feature.

  • Upvote 1
Link to comment
Share on other sites

8 minutes ago, electric_vehicle_lover said:

Technology is not there yet. I think users, currently prefer actual technology state for the current relative cheap price of EUCs.

But seems that a raw estimation could be possible, since odometer value and battery state values are available. There is one thing, there is no persistent memory on the board which I think is need for implement such feature.

If using Arduino or such "in-between" (like @euc is), there's some EEPROM available. The estimation is a bit hard, as you get "less" charge out of the battery with different riding conditions (ie. higher currents), as more of it will burn off as heat in the packs themselves, and won't be "visible" to the mainboard & the Arduino reading the data.

UkodS.gif

Seemingly less capacity is got out from the pack with higher discharge (C) -rates, but when charging, you still end up finding out that the battery takes a full charge (more Wh/Ah than seemingly came out of the pack). Energy doesn't disappear, but the "outside" device measuring the capacity doesn't "see" the energy burned off by the pack (wasted power = current * internal voltage drop of the pack due to internal resistance).

  • Upvote 1
Link to comment
Share on other sites

16 minutes ago, electric_vehicle_lover said:

Technology is not there yet. I think users, currently prefer actual technology state for the current relative cheap price of EUCs.

But seems that a raw estimation could be possible, since odometer value and battery state values are available. There is one thing, there is no persistent memory on the board which I think is need for implement such feature.

Technically, you just need a valid "voltage"/"percent" list for the euc you are riding. Then you could simply time how long it takes to drop by one percent and how far you got during that period. Then it's just a matter of extrapolating. The downside would obviously be that you have drive a few meters before an estimate can be calculated. But the upside is that you don't need a persistent storage.

Edited by euc
  • Upvote 1
Link to comment
Share on other sites

3 minutes ago, euc said:

Technically, you just need a valid "voltage"/"percent" list for the euc you are riding. Then you could simply time how long it takes to drop by one percent and just calculate how far you could go at the same speed. The downside would obviously be that you have drive a few meters before an estimate can be calculated. But the upside is that you don't need a persistent storage.

Right, as as noted, since you are using Arduino (have internal persistent memory) maybe is possible to use the last history values. But I wonder if such feature don't need much more work/investment to have a good quality for final users.

  • Upvote 1
Link to comment
Share on other sites

10 minutes ago, euc said:

Technically, you just need a valid "voltage"/"percent" list for the euc you are riding. Then you could simply time how long it takes to drop by one percent and how far you got during that period. Then it's just a matter of extrapolating. The downside would obviously be that you have drive a few meters before an estimate can be calculated. But the upside is that you don't need a persistent storage.

Just of the top of my head, something like this could maybe work:

  • For the first few rides, measure the trip vs. watt-seconds (or something like that, fairly small time-range power usage) using the voltage & current reported by the wheel
    • If the update interval is 200ms, you could take 5 last samples and calculate the average power (voltage * current) vs. trip
    • Keep track of total trip vs. total watt seconds
  • Store the data for different powers vs. travel to get a larger set of averages and the total watt seconds got out from the pack vs. trip
  • Once the "calibration" rides are done, the software can (roughly) anticipate the remaining travel distance based on momentary power (kinda like how car computers estimate the remaining mileage for the remaining fuel using current consumption), probably should round it to nearest 1km or such, as the value can bounce up and down a lot (the power usage of the wheel is very spiky)

 

 

  • Upvote 1
Link to comment
Share on other sites

My watches battery lasts for about 40-50 minutes with the screen being on and the Bluetooth being connected all the time.

When I connect it, it draws about 40mA, when it is searching for the EUC it draws about 70mA. (@ 5V btw)

On the battery it says 0.37Wh, but I'm only getting maybe half of that. I think the battery has not been charged/discharged properly.

I'll definitely add another button to turn on/off the display. But the Bluetooth will still draw probably 90% of the power.
I think I can get the HC-05 to use less power. From what I remember, there is a power saving mode that can be enabled. And I could also adjust the scanning interval and duration.

All the parts for the watch combined cost about 8 US$ btw. HC-05, Arduino Pro Mini, 100mAh LiPo, I2C OLED display, Step up converter, Switch (To charge and protect the battery you might wanna add one of these Charging modules
For me it was more like 6US$, as I have ordered all those parts in larger quantities btw.

When the ESP-32 comes out it might even be a dollar cheaper. (In addition to being only a third the size. :))

Edited by euc
  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...