my (current based) power controller, v1

Lebowski

10 MW
Joined
Jun 27, 2011
Messages
3,412
Location
beautiful Zurich, Switzerland
hi :D
After strugling for a week I finally got my power controller working. Before I show the schematic, a bit of background. I build my own motor (see other thread)
and my own motor controller. My motor controller does not use the typical PWM to control the output power of the motor. Its a sensorless controller that
turns the 3-wire motor into a 2-wire motor in the same way mechanical commutation would do. The now 2-wire motor is then supplied by the power controller.

The power controller is a boost converter (see wikipedia) which takes the battery voltage and turns it into a higher voltage. It uses one power transistor, the dutycycle
of its gate signal can be used to control the amount of output powerblock_schematic.JPG
On the top, left to right, first the battery, then the boost converter followed by the motor (600uH, 1.3 Ohm, 40V back EMF) and the current measurement
resistor (0.11 Ohm). This controller controls the motor current, therefore a measurement amplifier (X5) measures the voltage across the current measurement
resistor. The bottom row is a modelled version of the algorithm running in a PIC16F88 processor. It consists of a 10 bit ADC (X1), a voltage source to set the
wanted motor current (V2, 0.07 corresponds to 1 Amp), a 40 Hz loopfilter (X3), a noise-shaper (X4) and the PWM generator (X2). The PWM signal is then
connected to the gate of the power transistor to close the loop.inductor.JPG
This shows the setup on the workbench. On the breadboard is PIC16F88 with the emergency shutdown circuit (more about that later), the boost converter is
to the right of this with on the far right the inductor (about 10 meters of 6 mm^2 loudspeaker wire, 100uH 30milli-Ohm). The sensorless motor controller is on the
bottom.amplifier.JPG
This shows the amplifier that amplifies the voltage from the current measurement resistor. Its a small opamp in feedback, since I didn't have any 5V opamps
lying around I built it with transistors. The gain is 3.3 with a 100 kHz bandwidth. The output is passed through a 100 Hz RC filter (thats somehow missing in the
schematic, sorry :oops: ) and is AD converted before ending up at the loopfilter.loopfilter.JPG
The loopfilter is a simple digital integrator running at 2 kHz clock frequency with a 41Hz unity gain frequency. It has an interesting feature (implemented in X4)
which compensates for the gain dependency of the boost converter. The response of the boost converter to a 1% change in dutycycle is dependent on the dutycycle
it's running at by an amount of 1/(1-duty)^2 with duty from 0 to 1 (for 0 - 100%). So at 50% dutycycle the gain of the boost converter is 4 times what it would
be at 0% dutycycle. Since this can lead to instability this gain dependency is compensated for in X4 by multiplying with (1-duty)^2 (and I can tell you this
is a real b!tch to implement in 16bits when you only have a 8 bits processor :evil: )
The PIC is running at 8 MHz with a PWM signal at 50 kHz. This means there's only 160 settings of PWM to choose from (8e6/50e3). Since this 'grid' is so coarse simulations
showed the motor current varies by an unacceptable amount when the PWM slowly toggles between 2 values. Therefore the loopfilter is followed by a 1st order
noise-shaper.noise_shaper.JPG
The job of the noise shaper is to toggle the PWM setting at a much higher rate than what the 30Hz loop would be capable of. The noise shaper runs at a 10 kHz clock
(so faster than the 2 kHz clock of the loopfilter) so every 100 usec the PWM setting is changed. The noise shaper is run by an interrupt routine on the 16F88 and
'interrupts' the normal loopfilter routine.
Since the boost converter is a rather dangerous beast an emergency shutdown circuit has been added. When somehow (due to loose connection or something) the
motor would become disconnected the output voltage shoots up to basically unlimited values (the spark plugs in you car are operated by a boost converter) which
would blow up the capacitor and lots of other stuff.emergency_shutdown.JPG
The emergency shutdown uses a zener diode (top left) to detect a voltage higher than about 85 V at which point it trips the Set-Reset flipflop. This then disables
the output stage via the NOR gate at the bottom right. This is then reported back to the PIC (top right bit) which can reset the shutdown circuit (bottom left).
Note that the circuit is configured such that the output transistor is off when the LED's in the optocouplers are off (I did this wrong in the beginning which cost me
a few fuses :oops: ).
http://www.youtube.com/watch?v=9vGszOvMkeA
I made a youtube video of the actual PWM signal during operation of the controller. The motor (on the bike, the noise is the wheel in the chain-tensioner) is running
and I am varying the amount of braking by putting my foot against the wheel (very scientific, I know :) ). The power controller is doing its business an tries
to keep the current through the motor at 1 Amp. As the wheel accellerates / decellerates the PWM dutycycle is changed to keep the current at 1 Amp (this also
means the motor voltage changes as a higher motor speed needs more voltage etc).
Since the PIC16F88 has an RS232 module I used this to, while I was recording the scope image, capture the PWM dutycycle.youtube_dutycycle.JPG
It's a bit 'rough' as I only record the top 8-bits of the 16-bits internal signal. You can see how the dutycycle increases, as the motor speed rises the boost converter needs
a higher dutycycle in order to supply a higher and higher motor voltage (in order to keep current at 1 Amp). As I put my foot in it (to slow the motor down) the dutycycle
decreases again since now less voltage is necessary to maintain 1 Amp motor current.

I know my whole system is different from what's used in the China controllers but for me the fun in this hobby is to try out the more exotic stuff :D I hope this post
will give you guys some inspiration for your own projects.

P.S. to the moderators: I have no clue why most of the pictures need a click to download while the last one doesn't ? Also no clue how to put the youtube
vid in other than posting the URL ? :oops: Can you change this for me please ?
 
Dunno about anywhere else, but it's a big holiday weekend in the USA, and lots of poeple go on trips/etc., for the week, (or like me have to work lots of wierd or overly long hours) so you might not hear back on it for a while. :)
 
A current-based controller is a great idea. There was some discussion about a current based throttle using a common controller, but its good to have several options. Don't be surprised if very few posters have anything to contribute (I certainly can't help you with any part of this, I don't know any electronics). I suspect there will be very many people interested in this, but very few postings...
 
Lebowski said:
P.S. to the moderators: I have no clue why most of the pictures need a click to download while the last one doesn't ? Also no clue how to put the youtube vid in other than posting the URL ? :oops: Can you change this for me please ?
You need to reduce them to 800 pixels, or less, in width. If they are more than 250kb in size, they will display as a thumbnail.

To embed a YouTube vid, post the YouTube reference for it within YouTube tags: [youtube]UTR101EZ[/youtube ]
 
I like it, but I don't understand how it can actually be starting up the motor.

The current control stage is a boost converter. The voltage across the motor coils will be based on the difference between the DC link voltage (the rails immediately following the boost converter), and the motor's BEMF. But a boost converter fundamentally cannot produce an output voltage that is less than the input voltage. The high-side diode just conducts current without limit if the link voltage is less than the battery voltage. Try running the simulation with V3 set to 10V :) At low speeds, the current wouldn't be controlled by the boost converter, it will just be limited by the winding resistance. 1.3 whole Ohms? Really?

Flipping the stage around backwards will make it a buck converter, and that will allow you full control of the output voltage and current.
 
jdb said:
I like it, but I don't understand how it can actually be starting up the motor.

The current control stage is a boost converter. The voltage across the motor coils will be based on the difference between the DC link voltage (the rails immediately following the boost converter), and the motor's BEMF. But a boost converter fundamentally cannot produce an output voltage that is less than the input voltage. The high-side diode just conducts current without limit if the link voltage is less than the battery voltage. Try running the simulation with V3 set to 10V :) At low speeds, the current wouldn't be controlled by the boost converter, it will just be limited by the winding resistance. 1.3 whole Ohms? Really?

Flipping the stage around backwards will make it a buck converter, and that will allow you full control of the output voltage and current.

True, there's a lower limit but this was ignored on purpose. I did some motor calculations and found out efficiency goes with motor rpm (among
other things). Therefore I decided that I wouldn't use the motor below around 5 to 10 mph and that what you mention is not an issue. I'm
a strong cyclist and have no problem getting a bike upto a few mph :D If it gets to be a problem (like a big hill or old age or something :) ) I can
use PWM in the motor controller (it already has this to facitilate gentle start-up).
The winding resistance is 1.3 Ohm which I find OK as the motor's back EMF is around 60 Volts at 25-30 kmh (16-19 mph). So for an effective 250 Watt
at this speed I need to put in 273 Watts, efficiency is 92% which I think is not bad...
Plus, this is v1.... v2 will be sensorless with sinusoidal currents :twisted:
 
Just found this. And it is very cool to see your out of the box thinking!
 
It took me sometime to understand what was really going on here :?, and once I did I also wonder as jdb why a boost instead of a buck, which seemed to make more sense, unless you actually want to achieve a higher speed than possible with the battery voltage. Starting is one of the 2 situations that demand more torque and where a motor is specially useful in my opinion; you sure are a strong cyclist :). 92% efficiency seems very good, well above, I think, typical bicycle brushless hub motors.
Good work!
 
Why not a buck-boost converter? The output polarity is reversed, but that doesn't matter for the motor except to reverse the rotation. There are non-inverting topologies that can produce voltages both above and below the input, but they're generally more complicated.
 
Well, I didn't know about buck-boost yet when I started out with this project :oops:
I'm an electronics engineer but in analog signal processing stuff, not in power electronics.
This is also a new field for me.
But I would not have used it as one of the reasons for choosing the boost converter
was that I wanted to draw a more or less constant current from the batter (as I once
read somewhere this increases the useable capacity) Second reason
was that for a batter I'm thinking about 6 headway cells as this is about 200Wh, this should
be enough for my daily commute (35 km both ways, flat). And, like metioned earlier,
efficiency is very bad at low speeds so I want to avoid engine support below around 10-15kmh....
 
Back
Top