hacking wiiceiver: logging current

austindavid

100 W
Joined
Apr 15, 2014
Messages
204
I bought one of these: http://www.panucatt.com/Current_Sensor_for_Arduino_p/cs-100a.htm

I powered it from the ESC / BEC, using the JP2 hookup on wiiceiver, and attached the sensor to A1 on wiiceiver (soldered it to the leg on the bottom of the board). A bunch of code later, I have a record of the last up to 50 runs. In chronological order (first to most recent):

#0: peak discharge: 7.44A; peak regen: -2.52A; total Discharge: 20.12mAh; total Regen: 1.52mAh; net discharge: 18.60mAh in 60 seconds
#1: peak discharge: 31.18A; peak regen: -4.28A; total Discharge: 1418.29mAh; total Regen: 30.41mAh; net discharge: 1387.88mAh in 1807 seconds
#2: peak discharge: 38.89A; peak regen: -6.15A; total Discharge: 613.13mAh; total Regen: 19.33mAh; net discharge: 593.80mAh in 722 seconds
#3: peak discharge: 38.14A; peak regen: -6.54A; total Discharge: 1724.47mAh; total Regen: 29.53mAh; net discharge: 1694.94mAh in 2011 seconds

The 60-sec interval was me testing on a bench. The next 3 were a trip to get icecream, then a stop by to see ducklings on the way home -- I was riding with my 6-y-o, he had a bike. About 7 miles round trip. I restarted the board 3 times, so 3 records. I've previously tested the "total discharge" and "peak discharge" numbers with an external logger, I think they're within ~5%.

I've hit it pretty hard around the neighborhood, enough to slip my belts, and the ~38A peak is about where it maxes out -- two 280kv 5055s at 8S, but not at full throttle. On my setup that's probably ~1kW, or like 1.5HP.
 
I was just going to recommend posting it :).

That's pretty awesome. Hopefully, beto can respond as well as I know he tested it and I think he was getting around 80Amps but he was only running 1 motor, I think.

Are those stats from the peak discharge for both motors individually or together? 38.89A for both motors or one motor? If it is for one motor that's an awesome drop and two motors would be much more beneficial in the long run. Motors wouldn't be running at peak all the time.

About 1151 watts total in power. Pfff.. lol What's the point of a 6KW board? I wonder if an added rider that's about 250-300 lbs make much more of a difference. I would assume so since the amp draw from on the bench 8A vs riding it 39A.

I remember reading on LaGrange L1's site as well that their highest max amp was about 80 amps. https://www.redrockboardshop.com/resources/batteries/batteries-basics

From the data collected during my rides, the AVERAGE current is between 8-5 Amps and the PEAK discharge can be as high as 80 Amps (but only for a fraction of a second). I've got some reports on this data in case any nerds are interested.

Also just found this which seems a good lower end estimate.

The capacity of the battery packs are measured in Amp-hours (Ah). A good estimate for range on a LaGrange powered electric skateboard is 1 mile of range for every 1 Ah of battery capacity.
 
That's both motors, it's measured between the battery string and the ESC. I just finished charging the pack, it took 3936mAh reported from the charger. Between losses from charging and sitting overnight, I think it's earily within 5% -- and I know I'm discarding about 1A that the ESC consumes just sitting idle.

1Ah / mile is probably an OK guess, but 1Ah @ 4S is very different from 1Ah @ 8S. Today I did 7 miles on < 4Ah, because I was going slow. Riding home from work takes more like 6Ah for the same distance, but at higher speed / more dirty. Next week I'll have a few days doing 20mph upwind, that might be a better power draw. I'm still limited by my belts though.

750W/HP -- 6kW is 8HP, that's a *lot* for something without handles. I agree with those averages from LaGrange, mine is more like 5-10A average for a fast ride. I see 60A peak when the ESC kicks the motors to start, but only for a few milliseconds. iI don't think it counts :) The 38A peak is 50 samples averaged over 1s, and I've reproduced it on several rides (including two of the 3 from today)
 
If it was (1) motor would it still be 40amps and/or would it be double?

What would it actually take to hit that full recommend amps for the motor? Maximum full throttle in like 2 seconds and it would drop back down to about 10amps?

6KW I would think some MBS foot straps would be needed lol.
 
torqueboards said:
If it was (1) motor would it still be 40amps and/or would it be double?

What would it actually take to hit that full recommend amps for the motor? Maximum full throttle in like 2 seconds and it would drop back down to about 10amps?

6KW I would think some MBS foot straps would be needed lol.

I assume 1 motor would pull 40 amps to deliver the same amount of power. Ultimately power (watts) is power (HP) -- so full blast uphill / upwind, wide open throttle at top speed would require the same energy/power regardless of how many motors. I suspect the motors need to be at roughly max RPM as well.

When I get my chains I will try flying up a steep hill and see what happens. My 8S/9Ah battery string is about 250+Wh, so running at, say, 1200W would only last about 10-15 minutes on a huge battery.
 
This is very cool and looks like you're gonna get ahead of me on my efforts :)

http://endless-sphere.com/forums/viewtopic.php?f=35&t=55998

I have been using an Attopilot - same kind of thing but also measures voltage which is super handy.

I've not done much testing yet but I seem to a average about 7-9 amps on a single motor cruise at a slow 10mph

Looking forward to seeing more guys :)
 
benj said:
This is very cool and looks like you're gonna get ahead of me on my efforts :)

http://endless-sphere.com/forums/viewtopic.php?f=35&t=55998

I have been using an Attopilot - same kind of thing but also measures voltage which is super handy.

I've not done much testing yet but I seem to a average about 7-9 amps on a single motor cruise at a slow 10mph

Looking forward to seeing more guys :)

Attopilot looks pretty sweet. I would use the voltage sensor to detect when the pack was recharged, but I wouldn't use that to guess range -- the ammeter is a better representation of remaining charge.

7-10A at what voltage? I'm guessing 5-6S? Seems about right; have you calibrated that?

iPhone app is nice, but you know what's really cool? Android. :)
 
benj said:
Yep, that's a 5S setup. I wasn't aware that I had to calibrate anything... :?

Android support would be cool and if I get time, then I'll add this into the project. I have an iPhone, so that was my first platform to target.

How are you logging your data?

by "calibrated," I meant have you confirmed that power draw with another source besides the Attopilot? The numbers sound about right, but it's good to check against an idependent source to be sure.

Wiiceiver (the ATmega) has 1KB of flash, so I store the last 50 records (rides) in a circular array / queue, 20 bytes/record. Currently there is no display (CURRENTLY) so it just dumps to serial on startup. The complete startup sequence looks like:

Wiiceiver v 1.2 experimental (compiled Aug 11 2014 00:20:55)
Watchdog Resets: 0
Using 0A offset 3
This entry: block #10
History (oldest to newest):
#0: peak discharge: 7.44A; peak regen: -2.52A; total Discharge: 20.12mAh; total Regen: 1.52mAh; net discharge: 18.60mAh in 60 seconds
#1: peak discharge: 31.18A; peak regen: -4.28A; total Discharge: 1418.29mAh; total Regen: 30.41mAh; net discharge: 1387.88mAh in 1807 seconds
#2: peak discharge: 38.89A; peak regen: -6.15A; total Discharge: 613.13mAh; total Regen: 19.33mAh; net discharge: 593.80mAh in 722 seconds
#3: peak discharge: 38.14A; peak regen: -6.54A; total Discharge: 1724.47mAh; total Regen: 29.53mAh; net discharge: 1694.94mAh in 2011 seconds
#4: peak discharge: 2.49A; peak regen: -0.29A; total Discharge: 2.33mAh; total Regen: 0.18mAh; net discharge: 2.15mAh in 30 seconds
#5: peak discharge: 31.87A; peak regen: -4.82A; total Discharge: 522.02mAh; total Regen: 12.47mAh; net discharge: 509.55mAh in 873 seconds
#6: peak discharge: 39.70A; peak regen: -4.33A; total Discharge: 5128.52mAh; total Regen: 23.48mAh; net discharge: 5105.04mAh in 1784 seconds
#7: peak discharge: 28.32A; peak regen: -3.10A; total Discharge: 126.22mAh; total Regen: 1.89mAh; net discharge: 124.33mAh in 77 seconds
#8: peak discharge: 1.95A; peak regen: 0.00A; total Discharge: 3.26mAh; total Regen: 0.05mAh; net discharge: 3.21mAh in 30 seconds
#9: peak discharge: 6.96A; peak regen: -1.11A; total Discharge: 6.84mAh; total Regen: 0.82mAh; net discharge: 6.02mAh in 30 seconds

2 of those lines are debugging and will go away.
Lines #6-7 were my morning commute (30 mins to the bus and ~1min from bus -> office), taking 5229mAh, and I recharged @2A and fed back 5313 mAh. It's pretty close! Variation from charging at a higher rate, or ambient termperature, would make about that much difference.
 
benj said:
So cool. I especially love that you can log the regen :) I might have to see if I can get your Wiiceiver code running on my LightBlue Bean (it runs an ATmega 328p) - if you don't mind of course.

Do it! The code is all freely available on GitHub: https://github.com/jaustindavid/wiiceiver/tree/experimental

Schematics and hardware layouts are in there as well. Holler with questions
 
Hey Austindavid,

I've been digging through your schematic and code, and it looks the the Bean is not going to work out. It's only got 2 analog pins and those are needed for the USB dongle. That means I haven't got anymore analog pins for the Attopilot. Boo!

I could change course a little and look at digital output current sensor, maybe something like http://www.linear.com/product/LTC6101 - but I feel I'm getting out of my depth :lol: I expect I'll just continue on my path with the Bean and the app side, and probably won't try merging the two projects....at least for now.

BTW, great work on the Wiiceiver code, very nicely done 8)
 
Thanks benj! There are a lot of easy-to-use Arduino options out there if you want to give it a whirl. $20 gets a small unit with USB. I really recommend the Uno to start.

So check out this prototype: http://youtu.be/O97cj2Nj5vU. I'll post a proper writeup later, maybe today.
 
hi austindavid,
looking forward for some more details about the parts used and some more pics of the process needed to get it working.
amazing work! [GRINNING FACE WITH SMILING EYES]
 
viper said:
hi austindavid,
looking forward for some more details about the parts used and some more pics of the process needed to get it working.
amazing work!

It was actually pretty simple. I used an Adafruit 128x64 display: https://adafru.it/326 and an Arduino Pro Mini that I happened to have laying around. Same guts as wiiceiver, different package.

I first tried, with some-but-not-enough success, to run the display directly from a wiiceiver. Not enough memory, the display needs a huge internal buffer, and it takes about 40-50ms to update (wiiceiver needs to run every 20ms to update the ESC).

This iteration uses the 4 pins on the nunchuck adapter to power & communicate (1-way) with the pro mini display head. The pro mini gets power+GND from those pins, and A4/A5 (I2C data & clock). The display is connected via SPI to the pro mini.

The only components are the wiring, display, and pro mini, plus a header soldered onto a standard wiiceiver. I prototyped it on a pair of Unos, one with a wiiceiver shield, the other with a protoboard + that display. Anything based on the ATmega328 (2k RAM) or better would work.

The wiiceiver code is updated to send out a buffer over i2c once every 20ms loop. That buffer includes throttle level, current (from the 100A sensor) and the logging data, and the nunchuck state. The head just continuously reads that data and updates the display, which happens at about 20 FPS. The code is all up in an "experimental" branch. It'll work safely on any wiiceiver, but I want to get a lot more miles on it before I start installing it on the new ones.

I'm hitting memory limits in the 2k I get on the ATmega328p; I would need something heavier, like a Teensy, if I display graphs. I'll get some time on this one before I make any changes. The display itself is beautiful but doesn't stand up to direct sunlight. If I change it I'd go with http://adafru.it/1393 which should do better.

I've promised torqueboards a unit, I'll get some pics of the build process when the new minis arrive this week.
 
Need supplies:
- Arduino Pro Mini ($5) with separate headers.
- Adafruit 128x64 OLED display ($20)
- 6S balance extension, longer is better ($10 or less)
- 4 conductors (26-28ga wire, 1-2') + 4-pin male header, and 4-pin female header

equipment: FTDI breakout

I put the 6-pin breakout header on the bottom of the mini, facing inward; it's still accessible, but will be totally out of the way most of the time.

Solder the female header to the open 4 pins on the nunchucky. Solder the 4 conductors to the male header, and to the Arduino. CLK-A5, SDA-A4, 3.3-VCC, and GND-GND. These power the arduino from the wiiceiver's 3.3V supply, and are the I2C data signal. Leave room (or save the actual soldering) on the VCC and GND pins.

Looking at the top of the pro mini, reset button facing up and the text oriented so you can read it: A4 is above A2/A3, and A5 is to the right; they're not on the edge of the board.

Cut the balance extension in half. From one half, solder all 7 wires in order to the display, but skip the 3.3v pin.

Plug it back in, and be sure to line up the conductors correctly -- solder the other half to the Arduino. VCC and GND are shared with the 4-pin line (powered directly from the wiiceiver), the other 5 go to pins 9-13. Follow the Adafruit instructions for the layout.

Upload code to the display, and the updated Wiiceiver_master to wiiceiver.

Plug in the 4 conductor make side to your female connector now on the wiiceiver, don't get it backward -- watch GND-GND. Plug in the balance cable. Now you have the wiiceiver, pro mini, and display all hooked together.

That's it. PM me if you want to give it a shot and I'll help out. The few I'm making all have voltmeters and ammeters installed...

The voltmeter: I used a 5k and 33k voltage divider. The Panucatt has a Vsense, which is just the live battery voltage, and there's a ground onboard. Run these over the voltage divider, then run the middle back to pin A2. An analogRead() on A2 will give a value near 1000 (like 999, assuming ideal conditions and perfect resistors) at 8S. This must be calibrated, but will be pretty stable. I intend to use this to display the battery string state (but not individual cell state), and in the code I'll have it reset the fuel gauge when it thinks the string has been recharged. In lieu of a schematic, the 33k resistor goes toward +, then the line to A2 tied to both resistors, the 5k from that to ground.
 
austindavid said:
Wiiceiver display demo: http://youtu.be/x8y-PO58SlQ

I added a "power" screen. I hit 1250W earlier today. That's a lot of power. 23ish mph in the wind is about 1kW

Lol time to display the myth that 3kw/6kw is never rideable. Eboard would instantly leave the rider behind. Fighting to stay on the board. I do wonder what 50mph would pull amp wise.
 
torqueboards said:
Lol time to dispel the myth that 3kw/6kw is never rideable. Eboard would instantly leave the rider behind. Fighting to stay on the board. I do wonder what 50mph would pull amp wise.

It's a "2.5kW motor", which I think means 10S / 60A, but that's pretty hard to actually deliver -- certainly while standing. My puny belts can't take it, anyway. FWIW that 1250W is only at half throttle, and my motors are pulling less than half their rated current. Even so, accelerating uphill at 20mph is still under 1500W (which, for the record, is about 2HP)
 
http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?search_type=jamecoall&catalogId=10001&freeText=ss461a&langId=-1&productId=1915907&storeId=10001&ddkey=http:StoreCatalogDrillDownView

one of those + a magnet == RPM sensor. GND, +5 (use JP2), and the sensor wire to DIP4 (Arduino pin D3). I'm drilling motor brackets and stuff tonight, will hopefully get some testing in tomorrow. This will enable speed, mileage, distance-till-empty, and constant-speed cruise
 
more data -- I broke a belt on the way to work, so I rode home one just the front. There's enough power on the flats, but hills are tough -- but I couldn't deliver as much power as I wanted to the one belt, it starts slipping around 1000W.

Current and power delivery were about the same, as I expected -- 600-800W at cruising speed, depending on wind. I used more throttle to get there, so like 46-48% on both motors, and 55ish% on the single. Total power consumption was about the same, maybe a little less because I wasn't able to accelerate as hard.

The bigger difference is the HEAT -- two motors and ESCs are just warm after a hard ride. This one motor and one ESC could have fried an egg.

For the Talon guys -- that single motor setup certainly works (at 8S), but it generates a lot of heat.
 
After building your wiiceiver, i'm now interested in checking this out. As an arduino guy myself i'd be interested to see how accurate this setup can get.
 
TurboTwister said:
After building your wiiceiver, i'm now interested in checking this out. As an arduino guy myself i'd be interested to see how accurate this setup can get.

The wheel sensor is about 5-10% i think. It's recording speed OK but distance counts seem to vary too much. I am pretty sure it's having a hard time with interrupts, and possibly some interference from the ESC. I haven't done much else with the rpm counter because I'm hoping to pull it straight from the ESC.

Voltage / current are within 1% of other measures, they are super accurate.
 
Back
Top