The fun stuff begins, motor is spinning but to make software changes we need a bench test setup, this will make it easier to profile the controller and add/verify new features. As opposed to duct-taping multimeters all over a pushbike!
To actually provide a load for the motor on the bench, it is directly coupled to a DC treadmill motor, 180V 6.5A 1HP rated. This acts in reverse as a generator. An electronic load for this generator is required for its use as a variable mechanical load. I figured constant current loading would make it easy to ramp up the mechanical load (since torque is proportional to motor/generator current) but after playing around I think constant power might be more useful, I might use a microcontroller to simply vary the load current depending on generator voltage, or even use the encoder on the generator to implement some sort of torque/speed curve.
The electronic load is simply a MOSFET operating in it's linear region. It's cooled by a PC heatsink. An opamp drives the gate, it compares the voltage across a current shunt and a reference voltage to control the current. I'm using a potentiometer to set the reference voltage but it could just as easily be a microcontroller.
Anyway, video below shows the constant current load getting destroyed by the sheer power of Everywhere Electric ;-) More load FET's needed, as it fails short circuit at around 500W which is actually a very good test, hitting a large load under throttle is what blew up the last revision. This one survived with grace.
Note to self: set up an LCD to show motor controller statistics in real time.