Specialized Demo 9 + BBSHD with VESC

Show off your E-bike creation here.
Post Reply
amund7   1 W

1 W
Posts: 54
Joined: Sep 06 2015 1:00pm
Location: Oslo, Norway

Specialized Demo 9 + BBSHD with VESC

Post by amund7 » Oct 17 2015 5:10pm

I never liked uphills much.

My first ebike:

Specialized Demo 9, Magic Pie 4 at 30A 1600W

Experimenting with several batteries, main battery & least problems = 48v 13ah 'fits bafang' bottle.
Lots of headache but light & small = 2x 6s 10ah multistar lipo.
Last edited by amund7 on Jun 28 2017 2:19am, edited 3 times in total.

amund7   1 W

1 W
Posts: 54
Joined: Sep 06 2015 1:00pm
Location: Oslo, Norway

Re: Always downhill

Post by amund7 » Oct 18 2015 4:22am

wow, I forgot how hard it was to get a jpeg to below 512 k...
Attachments
20151017_135820-002.jpg

amund7   1 W

1 W
Posts: 54
Joined: Sep 06 2015 1:00pm
Location: Oslo, Norway

Re: Always downhill

Post by amund7 » Oct 31 2015 12:25pm


amund7   1 W

1 W
Posts: 54
Joined: Sep 06 2015 1:00pm
Location: Oslo, Norway

Re: Always downhill

Post by amund7 » Mar 24 2016 4:22pm

Working on a BMS for the LIPO's. BMSBattery Smart BMS, arduino nano, wifi, QML app for android.
DSC00369.JPG
DSC00369.JPG (153.69 KiB) Viewed 556 times
Last edited by amund7 on Mar 24 2016 4:28pm, edited 1 time in total.

amund7   1 W

1 W
Posts: 54
Joined: Sep 06 2015 1:00pm
Location: Oslo, Norway

Re: Always downhill

Post by amund7 » Mar 24 2016 4:25pm


amund7   1 W

1 W
Posts: 54
Joined: Sep 06 2015 1:00pm
Location: Oslo, Norway

Re: Specialized Demo 9 + magic pie 4 (downhill)

Post by amund7 » May 06 2016 2:08pm


amund7   1 W

1 W
Posts: 54
Joined: Sep 06 2015 1:00pm
Location: Oslo, Norway

Re: Specialized Demo 9 + magic pie 4 (downhill)

Post by amund7 » May 06 2016 2:13pm

Gonna need a winch!
Attachments
DSC00611.JPG

1KW   1 kW

1 kW
Posts: 341
Joined: Jul 24 2013 10:23am

Re: Specialized Demo 9 + magic pie 4 (downhill)

Post by 1KW » May 08 2016 9:26am

nice! how do you like the integrated controller?

amund7   1 W

1 W
Posts: 54
Joined: Sep 06 2015 1:00pm
Location: Oslo, Norway

Re: Specialized Demo 9 + magic pie 4 (downhill)

Post by amund7 » May 20 2016 3:53am

1KW wrote:nice! how do you like the integrated controller?
No issues, but as it's my first ebike I have nothing to compare to. Wiring is very clean.

1KW   1 kW

1 kW
Posts: 341
Joined: Jul 24 2013 10:23am

Re: Specialized Demo 9 + magic pie 4 (downhill)

Post by 1KW » May 20 2016 7:47pm

what range with 10ah?

amund7   1 W

1 W
Posts: 54
Joined: Sep 06 2015 1:00pm
Location: Oslo, Norway

Re: Specialized Demo 9 + magic pie 4 (downhill)

Post by amund7 » May 23 2016 4:20pm

1KW wrote:what range with 10ah?
After calibrating my BMS's voltage measurements I was up to 12 km, mostly uphill. Turns out, a BMS that measures correctly, gives me a fuel gauge AND has a proper low voltage cutoff per each cell is really valuable.

Will rework the packaging, I think I will build 2 equial boxes, each containing 2x paralell 10Ah lipos and a BMS + arduino with wifi for logging and monitoring. That way I can quickly swap battery packs, charge one while using the other, or for longer trips: one extra pack in the backpack which is already proving to be the best fuel gauge ever:
1. Bike away from home until bike stops
2. Swap batteries and be guaranteed to reach back home (since I live at sea level in a hilly city)

The arduino is proving kinda cool, it streams to my home wifi so I can graph all cells while charging, also have a phone app that will show all cellls + amps while biking. Maybe the phone app could have logging as well, if I find the inspiration one day.


Finding code and/or programming explanations for the OZ890 BMS proved a lot harder than I expected, so I will share my projects in case anyone's interested:

https://github.com/amund7

It's far frome done, but it's updated now and then, and it's a few steps further along than the TWO other pieces of code that exists on the entire internet, which my code builds on.

amund7   1 W

1 W
Posts: 54
Joined: Sep 06 2015 1:00pm
Location: Oslo, Norway

Re: Specialized Demo 9 + magic pie 4 (downhill)

Post by amund7 » May 23 2016 4:27pm

oh and please don't read the cell voltages in this picture, this was before I got the calibration tool to work. Now they're calibrated, and my cells look pretty nicely balanced.
DSC00612.JPG
DSC00612.JPG (110.58 KiB) Viewed 543 times

amund7   1 W

1 W
Posts: 54
Joined: Sep 06 2015 1:00pm
Location: Oslo, Norway

Re: Specialized Demo 9 + magic pie 4 (downhill)

Post by amund7 » Jun 20 2016 4:26pm

Ditched the Pie, got the BBSHD instead.
DSC00879.JPG
Bought some bigger gears from Ebay. BBSHD 1 - gear 0
DSC01088.JPG
Anyways - suspension works again, bike climbs like a goat, lots of fun.

amund7   1 W

1 W
Posts: 54
Joined: Sep 06 2015 1:00pm
Location: Oslo, Norway

Re: Specialized Demo 9 + BBSHD (previously magic pie 4)

Post by amund7 » Jun 20 2016 4:46pm

My friend testing it


User avatar
cal3thousand   1.21 GW

1.21 GW
Posts: 3550
Joined: Mar 26 2012 4:47pm
Location: California

Re: Specialized Demo 9 + BBSHD (previously magic pie 4)

Post by cal3thousand » Jun 20 2016 5:44pm

Nice !!!

What kind of gearing are you running to pop those wheelie's so easy?
Get a Cycle Analyst and a Multimeter, you're still a noob if you don't have at least one of each.

Planning on posting questions or buying anything on this site? Put up your country (at minimum) on your profile. This is a worldwide forum and we haven't reached clairvoyance.

amund7   1 W

1 W
Posts: 54
Joined: Sep 06 2015 1:00pm
Location: Oslo, Norway

Re: Specialized Demo 9 + BBSHD (previously magic pie 4)

Post by amund7 » Jun 21 2016 4:14am

cal3thousand wrote:Nice !!!

What kind of gearing are you running to pop those wheelie's so easy?
That video was the original gears, 32 in the back and 42 front

New gears are 36 on the cassette + 40 black alu gear that broke. But the 36 (now 2nd gear) is still pretty awesome, a lot better than the 32.

amund7   1 W

1 W
Posts: 54
Joined: Sep 06 2015 1:00pm
Location: Oslo, Norway

Re: Specialized Demo 9 + BBSHD (previously magic pie 4)

Post by amund7 » Nov 04 2016 6:08am



Couldn't find a lightswitch that did the job, so I built one!

Arduino Nano
Bafang switch
Takes up to 100v, feeds the same voltage through to the lights.
PWM dimming, software adjustable frequency
Turns on/off with bike
Adjustable brightness for low beam. Stores that brightness, and also the on/off state


Source code here: https://github.com/amund7/EBikeLight

amund7   1 W

1 W
Posts: 54
Joined: Sep 06 2015 1:00pm
Location: Oslo, Norway

Re: Specialized Demo 9 + BBSHD (previously magic pie 4)

Post by amund7 » Jun 09 2017 5:14am

BBSHD controller died after exactly 1 year! Turns out it only had a 3 month warranty. That is BS for such an expensive item.

It's not short circuited when I ohm the battery wires, but it welded my XT90 plug when I plugged the battery in. Luckily the BMS cut off (but not quickly enough), because the plugs were actually welded together, I spent a while breaking them apart.

So I ordered a VESC. From vesc.co.uk. And it's been almost 2 weeks since they said they shipped it, no tracking number, no reply to my e-mails about a tracking number. Hope it arrives soon.


I realized I will need a display. There is an Android app called Vesc monitor, but I don't want to have to use the phone every time, I am now very spoiled with the Bafang color display hard mounted. My experience is LCDs for Arduinos are not usable in sunlight, and I also never found a waterproof case for it. Actually the bafang display is so good that I broke it apart to see if I could control it from an Arduino or Raspberry pi. And I found a number on the display driver, and it IS supported by one of the LCD libraries for Arduino.

But I decided to go another route. Arduinos are easy to get started with simple programs, but it gets difficult when you want graphics, comms, files. I have an Android app that reads and decodes canbus packets off Teslas (https://play.google.com/store/apps/deta ... nbus.tesla, and I realized that I could use that UI, logging and most of it, and just plug a VESC decoder in it. That way, much of the development time will benefit both apps, and I'd have twice the motivation to create cool gauges, customizations and other stuff. It already has customizable tabs and CSV logging.

Already ran the app on a Raspberry Pi 3 with Arduino Things. So the hardware will run on a RPI with alu casing and 3.5 inch LCD:
https://www.banggood.com/3_5-Inch-HD-Hi ... ds=myorder

amund7   1 W

1 W
Posts: 54
Joined: Sep 06 2015 1:00pm
Location: Oslo, Norway

Re: Specialized Demo 9 + BBSHD (previously magic pie 4)

Post by amund7 » Jun 13 2017 4:53pm

First VESC test passed!

https://goo.gl/photos/xSbyqmWuEZ9TW4Zk6

Running in FOC mode, sensorless. Currently hunting for the right connectors, funnily enough I can't find the type of sockets on the vesc listed anywhere. If my measurements are correct, the BBSHD needs a 6 pin JST XH (2.5mm pitch) male plug, and the VESC 6 pin JST PH 2.0mm pitch. Will need some crimping tools as well...

User avatar
cal3thousand   1.21 GW

1.21 GW
Posts: 3550
Joined: Mar 26 2012 4:47pm
Location: California

Re: Specialized Demo 9 + BBSHD (previously magic pie 4)

Post by cal3thousand » Jun 27 2017 4:52pm

I'm surprised that this thread is so quiet, but you're doing some really cool things in here.

Question about your light setup (totally awesome, BTW): I understand that it is mostly controlled by Arduino and that you have included the code in Github (thanks for that), but I don't see how it hooks up to the Bafang display and switch. Would you mind sharing the details of that part too?
Get a Cycle Analyst and a Multimeter, you're still a noob if you don't have at least one of each.

Planning on posting questions or buying anything on this site? Put up your country (at minimum) on your profile. This is a worldwide forum and we haven't reached clairvoyance.

amund7   1 W

1 W
Posts: 54
Joined: Sep 06 2015 1:00pm
Location: Oslo, Norway

Re: Specialized Demo 9 + BBSHD (previously magic pie 4)

Post by amund7 » Jun 27 2017 5:23pm

cal3thousand wrote:I'm surprised that this thread is so quiet, but you're doing some really cool things in here.

Question about your light setup (totally awesome, BTW): I understand that it is mostly controlled by Arduino and that you have included the code in Github (thanks for that), but I don't see how it hooks up to the Bafang display and switch. Would you mind sharing the details of that part too?
Thanks for the interest! Check the Wiki page in github, I added some pictures of the wiring. I just used an extra bafang switch I had, the wires are soldered directly to the arduino, each button has a DI pin (I forget the pin numbers, but should be obvious in the arduino program).

The display, I used the display USB charge port to power the arduino, a little strike of genious there if I dare to say it, makes the lights turn on and off with the bike :)
Funny lesson though, without a noise killer / ferrous core thingy around the usb wire, the bike would throttle itself when I turned the lights on! :shock:

amund7   1 W

1 W
Posts: 54
Joined: Sep 06 2015 1:00pm
Location: Oslo, Norway

Re: Specialized Demo 9 + BBSHD with VESC

Post by amund7 » Jun 28 2017 3:00am

First VESC died in less than 24 hours! For others to learn from my mistake, my mistake was to order a VESC without battery side external capacitors, and running a burned / poor connection XT90. XT90 lost contact while it was auto-detecting FOC parameters - there were welding sounds - and magic smoke. DRV chip has 2 big holes in it! Crash analysis is no caps - lost battery in the middle of a very oscillating cycle - voltage ripples over 60V which is the max for the DRV chip.
*Edit* I have later read that you should not do FOC detection with 12S battery, it is too close to the max limits of the chip, use a power supply with a lower voltage. (I tried that, bench power made some weird sounds and actually turned itself off! But that was without any battery side capacitors)

VESC 1 ran quite good the first day. 3,5 km uphill to work, full throttle the whole way, no sweat. Ran in sensorless FOC mode (because I didn't have the right connectors to hook up the halls). It did have startup issues though, half the starts would stutter and stop. But once it got running it ran strong.

VESC 1 from vesc.co.uk (which is in Vilnius)
VESC 2 from Ebay / Maytech (Hong Kong)

Vesc 2 does not like FOC mode at all! It would run (now I am in Hall sensor mode), but it would cut off at full throttle, throwing an ABS_OVER_CURRENT error. Every time, also, same error randomly at spin-up.
I should probably go back and test sensorless FOC to see if that makes any difference ?

Finally switched it to sensored BLDC mode, and it seems perfect. But maybe, a bit weak on very steep hills and standing starts, will test more.
I also noticed that after commuting to work, taking a horrably steep uphill (VESC went up to 90 C and was downramping), motor is not even body temperature! Feels ice cold! I am pretty sure I would burn my fingers on the motor if this was with the BBSHD controller.
So the good thing is that the BBSHD motor seems to have a lot of headroom. Bad news is that the VESC needs better cooling. And this morning was around 15 C outside, it will only get worse.

Picking inspiration from a raspberry pi aluminium cover that uses the whole cover as a heatsink, maybe I can glue/cooling-paste the FETs directly to the bike frame, to have the whole frame as a heatsink :) That would be awesome, but probably impossible because cables and plugs are on the same side. Anyone know a way to waterproof AND cool the vesc at the same time?

I also noticed, watching the VESC Monitor Android app, which is awesome, that battery amps very rarely reaches my limit of 30 amps, but quickly goes down as the rpms goes up. This probably makes sense, but the old Bafang display reported 30A all the time, as long as I was on the throttle, even at the RPM limit. That was probably not right though, probably just a stupid interpolation of throttle input and not a real measurement. I just never realized that the bike should be quite economical.

Finally, here is my REAL motivation to run a VESC, the data and the logs!
Attachments
2017-06-28 09_13_58-2017-06-28_08-03-41_Demo9_Vesc_Data.csv__Motor_Max=60.0,Motor_Min=0.0,Battery_Ma.png
Last edited by amund7 on Jul 14 2017 4:55am, edited 1 time in total.

amund7   1 W

1 W
Posts: 54
Joined: Sep 06 2015 1:00pm
Location: Oslo, Norway

Re: Specialized Demo 9 + BBSHD with VESC

Post by amund7 » Jul 03 2017 12:36am

After some strange behaviour I discovered that my RX & TX for the bluetooth were partially connected or just interfering with the analog input from the throttle. This led to all kinds of weird stuff I tried to tune away... firstly, the motor and chain would give a loud bang as it tightened, when I throttled up and the bike was already rolling. So I de-tuned some gain parameters etc to get a smoother engagement. Also the vesc would overheat quickly, quicker than my earlier tests, almost to the point of it not being usable.

Fixed the throttle/uart wiring, and tuned back a lot of the parameters. Now it's quite awesome, only thing missing is steep hill starts, if I stop on a steep hill I can't get going again, the motor is super weak, and I can't pedal hard enough.

I had been wondering what the 'min rpm' setting really did. After all this time I haven't found any good explanations about the different vesc parameters, so I decided to check the VESC source code. And lo and behold, it very clearly shows (in the ADC app file, current mode) that it regulates current DOWN when you go below the min RPM. Don't know why some would want that, maybe it makes sense in a skateboard, but not in my bike for sure.

206monkey32   10 W

10 W
Posts: 77
Joined: Mar 08 2015 12:11pm

Re: Specialized Demo 9 + BBSHD with VESC

Post by 206monkey32 » Jul 03 2017 3:03am

This is awesome. I just got a Vesc 6.0 and am thinking of trying it with BBSHD. Glad to see it's working out so well. I'm thinking of building a fat commuter.

amund7   1 W

1 W
Posts: 54
Joined: Sep 06 2015 1:00pm
Location: Oslo, Norway

Re: Specialized Demo 9 + BBSHD with VESC

Post by amund7 » Jul 14 2017 4:38am

206monkey32 wrote:Glad to see it's working out so well.
Not really sure what you're referring to? The first VESC that exploded, or the second that will not do FOC mode or pull steep hills? :wink: If you are looking at the videos they are old, and with the stock BBSHD controller. VESC still has a lot of tuning to do, but now I have a raspberry pi logging data at 50 Hz, so I can get some good graphs of what's going on.

I still have a bit of way to go before I'm at the same spot as the stock BBSHD controller. Currently, only missing cooling and hill start torque. Will get there soon. And then I can start increasing the amps, I am thinking 40 battery amps to compete with my friend's Cyclone.

Post Reply