It's been a while since the last update, and much has happened. Good and bad.
To summarize the good, the motor control works well. There are still a couple of known bugs but on the bike test platform it's proven to be quite reliable, I was riding it to work for a few weeks, and did a couple of 50KM to test extended range with pedal power. In total it's probably done about 400KM. Average range with minimal pedaling is 20+KM riding with my undersized 5AH 12-cell pack.
Most of these k's were with the use of electrical tape for battery and wiring containment, and the whole assembly was far from waterproof so some 3d printing was definitely in order. The goal was to create a self contained power box including batteries and electronics with cables exiting for the motor and throttle/brake/head unit. The battery wires and connector loop outside the box for charging.
I made use of the enable line on the 10V SMPS to completely disable the system using a toggle switch, this means the connection to the battery doesn't really need to be removed as the circuit only draws a couple of mA in its disabled state.
The whole assembly mounts beside the motor on the same aluminium plate... which for some reason I didn't photograph :(
Then came a few dumb fails. First I shorted the 10V line to 3V3 when doing some testing. This killed the uC and logic gates. in hindsight it also seemed to damage the opamps, but not so much that I noticed at the time. So with the uC and gates replaced I took it for the first ride in new enclosure. It was a long ride as I was meeting friends for some mini golf (probably not the best way to test out new hardware configurations.) On my way I was noticing strange behavior above 1/4 throttle, the control scheme would become unstable and at a slightly higher throttle, the OC circuits would kill operation. That would be the zombie opamps. but it ran, and it made it to mini golf, kinda..
On to the next fail, it was a 40KM ride and the battery undervoltage protection involves my looking at the LCD display on the head unit and backing off on the throttle when it gets close to 36V. Lithium has a very sharp voltage/charge curve as it gets close to full discharge so I was happily riding along with reasonable voltage, look at the display a few minutes later and saw I was at ~30V. AHH lithiums don't like this one bit. This was particularly annoying because of how easy it would have been to prevent. Seriously, a line of code in the motor control software! But up til now I had basically ignored battery management.
And one more fail just to round things up and go out with a bang. Since the battery connector was glued into the printed enclosure, my hacked laptop charger which I use for charging the cells (constant current, constant voltage booster takes 19V from the laptop brick to 50.4V) I could no longer use the crocodile clips for battery connection (which lets face it, was never a great idea anyway) so I brought a 4mm banana connector with wires to which I clipped the charger. Of course I forgot that the connector would be reverse polarity:
I proceeded to connect negative to black, positive to red and connected the connectors. This lead to a significant arc (100V between the battery and charger, with 2A from the charger and a metric shit-tonne of current from the battery) which welded the connector and finished off the batteries. 1 week later:
All cells are inflated, the hard-case on that one couldn't take the pressure.
I think I have learned my lesson. the next battery pack will have a few improvements:
1) Undervoltage protection either by software on the motor control or with dedicated circuitry and an in-line switching device to disconnect the battery completely to prevent damage.
2) A dedicated charging connector and mating connector on the AC charger
3) Cell balancing to greatly extend battery lifetime over multiple charge-discharge cycles
4) More capacity so I don't have to run the cells to such a low state of charge for any reasonable bike ride length.
And I'll finish this post with some updates on the near future of this project. We want to move away from the modular design and go for a more integrated solution. Ie, have the android communication hardware built into the motor control PCB. This will likely involve a bluetooth module and USB host IC to provide some phone connectivity options. Any expansion can still be done by hooking up a secondary uC to the serial port. A uC for android coms may exist on board, we are still looking in to the feasibility of doing everything in the motor control uC.
Mechanically the bike used for testing will change significantly. I'm thinking of going towards hub motors just for practicality. They tend to be more reliable, quiet and less obvious. plus are already designed and tested for high power ebikes. So the motor control will have it's own printed enclosure. batteries will live on a panier rack. the battery management will be on it's own PCB(s?) and live with the batteries.