Futterama's power stage for Lebowski's controller IC

Futterama said:
Lebowski, I did autocomplete most of it since I still don't understand every setting. But I also did go through the whole menu structure right after I got the brainboard working, so there should not be any unconfigured entries in there except maybe for those that are not user-accessible. But I just got it running last night, and I was happy, posted it and went to bed. I will have more time tonight to play with the settings.
Regarding the current sensor settings, I did set option a-d in menu b and autocompleted option f-m along with autocomplete in menu f.
Regarding option d in menu i (perform FOC measurement) why would it need the battery voltage entered when it can measure it from pin 6? Pin 6 measurement is perhaps not the actual voltage but a change in voltage or how does that work?
I will post a closeup of the brainboard tonight. Yes, it's a Lebowski style low inductance output stage using 0.04mm kapton tape as busbar seperator. I did not try more than have the motor running so I don't know the phase currents during the test. The brain was set to 10A phase current limit. The motor ran kind of unstable with varying RPM, and the voltage would have depended a lot on current draw since I used a current limiting resistor from lab supply to output stage. I tried to remove the resistor as everything seemed to be connected right, but something would trigger the overcurrent/overload protection on the lab supply when I applied throttle.

Yep, pin 6 only measures the change in voltage. The chip doesn't know the voltage as it doesn't know the resistor (voltage divide) ratio at pin 6. It doesn''t need to know
this to run correctly in FOC, the entered battery voltage is only used to calculate the inductance from the measurement data.

Maybe the lab supply tripped because the max battery current (menu b opt c) was set too high ? I would stay here a bit below the actual capability of the supply
as the calculation is not 100% accurate (it can be a few % off) and also depends on how the actual spec of the current sensors (these can also be a few % off). And,
the conductive foam won't help either... Njay is right about regen. When you close the throttle on a fast spinning motor a tiny bit of regen is unavoidable, this due
to current sensor mismatch and offset. I've seen my 65V supply displaying 100V on it's output meters, very scary. An appropriate (car)lightbulb across the lab supply will fix this. Not an issue with battery supply but the reason why I would NEVER put a diode in the battery line.

About running at varying rpm, the throttle is a torque throttle, so if motor friction goes up for whatever reason (grain of sand in bearing) rpm's go down and vica versa. This
is especially noticable in an unloaded RC motor not running at full speed.
 
Lebowski, max battery current was also set to 10A as far as I remember. The lab supply will overload at around 22A. I don't think the small motor would be able to draw that much current when it's unloaded, and if it was some kind of peak current, the 1800µF DC link capacitor should be plenty capable to supply that peak without the lab supply overloading - depending on peak duration of course.

I need to do some scope shots of the gate driver to make sure it works as it should. Also I'll isolate the whole setup using battery supplies and disconnecting the PC so I can do some scope shots of the highside gate driver and MOSFETs to confirm they work as they should. After that, I can post my brain setup for you to see, maybe I missed an option that could result in excessive power use or even short circuit?
 
Futterama said:
Lebowski, max battery current was also set to 10A as far as I remember. The lab supply will overload at around 22A. I don't think the small motor would be able to draw that much current when it's unloaded, and if it was some kind of peak current, the 1800µF DC link capacitor should be plenty capable to supply that peak without the lab supply overloading - depending on peak duration of course.

I need to do some scope shots of the gate driver to make sure it works as it should. Also I'll isolate the whole setup using battery supplies and disconnecting the PC so I can do some scope shots of the highside gate driver and MOSFETs to confirm they work as they should. After that, I can post my brain setup for you to see, maybe I missed an option that could result in excessive power use or even short circuit?

Ah, then there's definately something not OK. Definitely check out the gate drivers and make sure you've no shoot-through. And yes, please post the brain setup, and run the FOC setup ! One last thing (though this is probably not it), make the 3rd order coeff in the amplitude control loop 0 (option j in menu g) (this is the new autocomplete value starting from v2.30).
 
I also fly medium size electric RC planes and it's funny how I imagine myself building a Lebowski controller for planes too. Those controllers are dirt cheap (I'm using a $6 controller rated 35A in my plane right now) and it would cost way more to build one using Lebowski's chip due to the cost of the chip itself and the current sensors. And would the plane fly any better? The controller will definitely add extra weight compared to a $6 Hobbyking controller. So the advantages are so small I cannot even see them, but still it's appealing to me :shock:

This hobby is like love - it makes you blind :lol:
 
Futterama said:
I also fly medium size electric RC planes and it's funny how I imagine myself building a Lebowski controller for planes too. Those controllers are dirt cheap (I'm using a $6 controller rated 35A in my plane right now) and it would cost way more to build one using Lebowski's chip due to the cost of the chip itself and the current sensors. And would the plane fly any better? The controller will definitely add extra weight compared to a $6 Hobbyking controller. So the advantages are so small I cannot even see them, but still it's appealing to me :shock:

This hobby is like love - it makes you blind :lol:

maybe it would be more fun to try something like this (you should have all the parts):

http://endless-sphere.com/forums/viewtopic.php?f=6&t=61459&p=926746&hilit=grit#p918165
 
Lebowski said:
maybe it would be more fun to try something like this (you should have all the parts):

http://endless-sphere.com/forums/viewtopic.php?f=6&t=61459&p=926746&hilit=grit#p918165
Well, I use my bike for exercise, so that's not really compatible, also my motor is an inrunner. But I have been thinking to get another bike, just a cheap old rusty one, and mount my RC car motor on there and then use that as a stress test platform for my finished controller. That should be fun too :D
 
I scoped the output from the gate drivers, and one of the drivers are not working right, so I'll try to replace it.

In the meantime, here are the my chip settings:

Code:
########################################
#   (c)opyright 2014, B.M. Putter      #
#   Adliswil, Switzerland              #
#   bmp72@hotmail.com                  #
#                                      #
#  version 2.21                        #
#  experimental, use at your own risk  #
########################################


0) mode: Toneless, with recovery
a) PWM parameters
b) current settings
c) throttle setup
d) erpm limits
e) battery
f) current sensor calibration
g) control loop coefficients
h) filter bandwidths
i) FOC motor impedance
j) CAN setup
k) recovery only
l) miscellaneous
z) store parameters in ROM for motor use


------> a

a) PWM frequency: 21kHz
b) deadtime: 1999ns
c) dutycycle testsignal: 50%
d) toggle high side polarity, now active HIGH
e) toggle low side polarity, now active HIGH
f) test PWM signals

g) autocomplete

h) loop sample frequency: 41.03 kHz

z) return to main menu


------> b

a) current sensor transimpedance: 12.50 mV/A
b) maximum motor phase current: 9.9 A
c) maximum battery current, motor use: 9.9 A
d) maximum battery current, regen: 0.0 A

e) autocomplete

f) HF current, base level (HF only): 0.4 A
g) HF current, proportional factor (HF only): 1.0000
h) maximum phase current in drive 2 (HF only): 4.7 A
i) phase current for forcing motor position: 1.9 A
j) maximum shutdown error current, fixed: 1.2 A
k) maximum shutdown error current, proportional: 1.2 A
l) applied braking current (phase) on direction change: 0.0 A
m) offset filtering (phase) current limit: 0.0 A

z) return to main menu


------> c

a) calibrate throttle 1
b) calibrate throttle 2
c) polynomial coefficients throttle 1 (x, x^2, x^3): 1.0000, 0.0000, 0.0000
d) polynomial coefficients throttle 2 (x, x^2, x^3): 1.0000, 0.0000, 0.0000
e) use analog throttle 1: YES
f) use analog throttle 2: NO
   receive throttle over CAN: NO
g) TX throttle over CAN: YES
h) test throttle

z) return to main menu


------> d

a) erpm limit, forward: 99.97 k-erpm
b) erpm limit, reverse: 19.98 k-erpm
c) accept direction change below: 75 erpm
d) transition erpm drive 2 -> 3: 976 erpm
e) transition erpm drive 3 -> 2: 488 erpm

z) return to main menu


------> e

a) battery voltage: 20.0 V

z) return to main menu


------> f

a) restore calibration, autocomplete
b) perform offset measurement
   sensor a: 0.0 mV
   sensor b: 0.0 mV
   sensor c: 0.0 mV
c) perform gain measurement
   channel a: 99.99 %
   channel b: 99.99 %
   channel c: 99.99 %
d) online gain calibration update rate: 0.302 %

z) return to main menu


------> g

a) autocomplete

  phase control loop, drive 3
b) 1st order: 240
c) 2nd order: 12.0000
d) 3rd order: 0.2999
  phase control loop, drive 2
e) 1st order: 480
f) 2nd order: 24.0000
g) 3rd order: 0.0299
  amplitude control loop
h) 1st order: 60
i) 2nd order: 3.0000
j) 3rd order: 0.0000
k) maximum amplitude: 100 %

z) return to main menu


------> h

a) autocomplete

b) throttle current filter -3dB freq: 100 Hz
c) error current 50% step response time: 5.005 msec
d) induction position filter 45 degree delay speed: 3.95 k-erpm
e) drive 2 speed filter 50% step response time: 228.4 msec

z) return to main menu


------> i

a) autocomplete

b) FOC measurement current: 4.9 A
c) FOC measurement erpm: 56.35 k-erpm
d) perform impedance measurement

 measured inductance: 25.4 uH

z) return to main menu


------> j

a) CAN 'address': 1
b) CAN CFG1 as per Microchip 30F manual: 14
c) CAN CFG2 as per Microchip 30F manual: 664
   RS232 output rate: 3730 Hz
z) return to main menu


------> k

a) autocomplete

  phase control loop, recovery
b) 1st order: 0
c) 2nd order: 120.0000
d) 3rd order: 3.0000
  amplitude control loop, recovery
e) 1st order: 240
f) 2nd order: 12.0000
g) 3rd order: 0.0000
h) pulse when current drops below: 19.9 A
i) pulse width: 19 usec
j) pulse % for exit: 95
k) pulse % filter 50% step response time: 30.1 msec
l) speed filter 50% step response time: 7.0 msec
m) try restart for: 499 msec
n) check for spinning motor, drive_0: disabled
o) check for throttle closed, drive_0: enabled
  exit from startup to recovery at current
p) current to check: total current
q) fixed part: 79.9 A
r) proportional to throttle current, factor: 150 %
s) current filter 50% step response time: 5.0 msec

z) return to main menu


------> l

a) autocomplete

b) motor standstill voltage threshold: 0.00 V
c) low side pulsing in drive 0: enabled
d) low side pulsing rate: 20 Hz
e) low side pulsing width: 20 usec
f) wiggle range: 19 deg
g) wiggle rate: 10 Hz
h) minimum # of cycles going from drive 2 to 3: 1000
i) number of cycles going from drive 3 to 2, HF only: 200

z) return to main menu
 
oh man 12.5mV/A current sensors, those are for like 160 A.... are you sure this is correct ?

another thing, deadtime is way long at 2000 nsec, more typical is around 500 or less...

the amp numbers in recovery are really high, did you autocomplete this with a much higher phase current ? the numbers here are autocompleted using a % of the allowed max phase current...
 
I replaced the faulty gate driver IC and all FETs gets their gate drive now.

I'm using the ACS758ECB-200B current sensor which is a 200A device, but it does say 10mV/A in the datasheet, but I just calculated from 2.5V divided by 200A = 12.5mV.

Deadtime was set high so I was sure this did not cause shoot through, but yeah, maybe it is too high, I'll set it down.

Yes, the recovery settings are off, I'll go through all the autocomplete again with a lower phase current value.

I'll report back in a sec :D
 
Current settings here. Now the controller is just sitting in drive_0 and does not respond to throttle input.

Will the controller fail if pin 6 is not connected to the battery voltage and hence the voltage on the pin is 0V?

Code:
########################################
#   (c)opyright 2014, B.M. Putter      #
#   Adliswil, Switzerland              #
#   bmp72@hotmail.com                  #
#                                      #
#  version 2.21                        #
#  experimental, use at your own risk  #
########################################


0) mode: Toneless, with recovery
a) PWM parameters
b) current settings
c) throttle setup
d) erpm limits
e) battery
f) current sensor calibration
g) control loop coefficients
h) filter bandwidths
i) FOC motor impedance
j) CAN setup
k) recovery only
l) miscellaneous
z) store parameters in ROM for motor use


------> a

a) PWM frequency: 21kHz
b) deadtime: 699ns
c) dutycycle testsignal: 50%
d) toggle high side polarity, now active HIGH
e) toggle low side polarity, now active HIGH
f) test PWM signals

g) autocomplete

h) loop sample frequency: 41.03 kHz

z) return to main menu


------> b

a) current sensor transimpedance: 10.00 mV/A
b) maximum motor phase current: 9.9 A
c) maximum battery current, motor use: 9.9 A
d) maximum battery current, regen: 0.0 A

e) autocomplete

f) HF current, base level (HF only): 0.4 A
g) HF current, proportional factor (HF only): 1.0000
h) maximum phase current in drive 2 (HF only): 4.7 A
i) phase current for forcing motor position: 1.9 A
j) maximum shutdown error current, fixed: 1.2 A
k) maximum shutdown error current, proportional: 1.2 A
l) applied braking current (phase) on direction change: 0.0 A
m) offset filtering (phase) current limit: 0.0 A

z) return to main menu


------> c

a) calibrate throttle 1
b) calibrate throttle 2
c) polynomial coefficients throttle 1 (x, x^2, x^3): 1.0000, 0.0000, 0.0000
d) polynomial coefficients throttle 2 (x, x^2, x^3): 1.0000, 0.0000, 0.0000
e) use analog throttle 1: YES
f) use analog throttle 2: NO
   receive throttle over CAN: NO
g) TX throttle over CAN: YES
h) test throttle

z) return to main menu


------> d

a) erpm limit, forward: 99.97 k-erpm
b) erpm limit, reverse: 19.98 k-erpm
c) accept direction change below: 75 erpm
d) transition erpm drive 2 -> 3: 976 erpm
e) transition erpm drive 3 -> 2: 488 erpm

z) return to main menu


------> e

a) battery voltage: 12.0 V

z) return to main menu


------> f

a) restore calibration, autocomplete
b) perform offset measurement
   sensor a: 0.0 mV
   sensor b: 0.0 mV
   sensor c: 0.0 mV
c) perform gain measurement
   channel a: 99.99 %
   channel b: 99.99 %
   channel c: 99.99 %
d) online gain calibration update rate: 0.302 %

z) return to main menu


------> g

a) autocomplete

  phase control loop, drive 3
b) 1st order: 240
c) 2nd order: 12.0000
d) 3rd order: 0.3000
  phase control loop, drive 2
e) 1st order: 480
f) 2nd order: 24.0000
g) 3rd order: 0.0299
  amplitude control loop
h) 1st order: 60
i) 2nd order: 3.0000
j) 3rd order: 0.0000
k) maximum amplitude: 100 %

z) return to main menu


------> h

a) autocomplete

b) throttle current filter -3dB freq: 100 Hz
c) error current 50% step response time: 5.005 msec
d) induction position filter 45 degree delay speed: 3.95 k-erpm
e) drive 2 speed filter 50% step response time: 228.4 msec

z) return to main menu


------> i

a) autocomplete

b) FOC measurement current: 4.9 A
c) FOC measurement erpm: 56.35 k-erpm
d) perform impedance measurement

 measured inductance: 4.8 uH

z) return to main menu


------> j

a) CAN 'address': 1
b) CAN CFG1 as per Microchip 30F manual: 14
c) CAN CFG2 as per Microchip 30F manual: 664
   RS232 output rate: 3730 Hz
z) return to main menu


------> k

a) autocomplete

  phase control loop, recovery
b) 1st order: 0
c) 2nd order: 120.0000
d) 3rd order: 3.0000
  amplitude control loop, recovery
e) 1st order: 240
f) 2nd order: 12.0000
g) 3rd order: 0.0000
h) pulse when current drops below: 0.4 A
i) pulse width: 19 usec
j) pulse % for exit: 95
k) pulse % filter 50% step response time: 30.1 msec
l) speed filter 50% step response time: 7.0 msec
m) try restart for: 499 msec
n) check for spinning motor, drive_0: enabled
o) check for throttle closed, drive_0: enabled
  exit from startup to recovery at current
p) current to check: total current
q) fixed part: 1.9 A
r) proportional to throttle current, factor: 150 %
s) current filter 50% step response time: 5.0 msec

z) return to main menu


------> l

a) autocomplete

b) motor standstill voltage threshold: 0.00 V
c) low side pulsing in drive 0: enabled
d) low side pulsing rate: 20 Hz
e) low side pulsing width: 20 usec
f) wiggle range: 19 deg
g) wiggle rate: 10 Hz
h) minimum # of cycles going from drive 2 to 3: 1000
i) number of cycles going from drive 3 to 2, HF only: 200

z) return to main menu
 
you have both throttle closed check and motor standstill check enabled, it must pass both checks before it will exit drive_0. The throttle closed check speaks for itslef. The motor standstill check also implicitly checks that none of the FETs is conducting, are you sure your repair went ok ?

pin 6 has no impact on this, it will go to default value when no valid voltage (bteween 50 and 100% of the supply) is detected.

another thing i just noticed, the motor standstill voltage in the misc menu should not be set to 0.00, this makes it wait in drive_0 indefinetely for a backemf voltage
lower than 0 which is not possible. (this is how it judges motor standstill). It worked before because in the old settings of a few posts ago the motor standstill check was disabled.
 
Haha, I didn't get the motor standstill disabled after I re-did the autocomplete, I left out the motor standstill components from the PCB design, so with motor standstill check disabled, things are starting to work again :D

Thanks Lebowski! Mr. Dude :mrgreen:
 
Futterama said:
Haha, I didn't get the motor standstill disabled after I re-did the autocomplete, I left out the motor standstill components from the PCB design, so with motor standstill check disabled, things are starting to work again :D

Thanks Lebowski! Mr. Dude :mrgreen:
it autocompletes with this check enabled as it is the safest option....
 
Lebowski said:
Futterama said:
Haha, I didn't get the motor standstill disabled after I re-did the autocomplete, I left out the motor standstill components from the PCB design, so with motor standstill check disabled, things are starting to work again :D

Thanks Lebowski! Mr. Dude :mrgreen:
it autocompletes with this check enabled as it is the safest option....
That's OK, I did notice that earlier, I just have to remember to disable it :lol:

So the motor I'm targeting has an inductance of 7.3µH. This is quite low, right?
 
Are those capacitors at the (digital) inputs of the gate drivers ? If yes I would take them out as they can be too high a load for the controller IC.

It seems to start the motor pretty good, considering its sensorless. The current meter, this is the supply current ? From 10 V ? So around 40 to 50 W ?
Did you measure erpms ? Did you try reverse ? I assume the big 4Ohm resistor is no longer in the supply ? Did you try starting it while manually putting a
load on the motor ?
 
Lebowski said:
Are those capacitors at the (digital) inputs of the gate drivers ? If yes I would take them out as they can be too high a load for the controller IC.
Yes, 6.8nF between input and VCC. They are recommended in the gate driver datasheet if noise is an issue, and I put then in there just to be on the safe side. Reading the datasheet again, I can see they are not needed:
UCC27211 datasheet said:
HI or LI input is assumed to connect to a low impedance source signal. The source output impedance is assumed less than 100 Ω. If the source impedance is greater than 100 Ω, add a bypassing capacitor, each, between HI and VSS and between LI and VSS. The added capacitor value depends on the noise levels presented on the pins, typically from 1 nF to 10 nF should be effective to eliminate the possible noise effect. When noise is present on two pins, HI or LI, the effect is to cause HO and LO malfunctions to have wrong logic outputs.

Lebowski said:
It seems to start the motor pretty good, considering its sensorless.
Yeah, but it does take some throttle to get it going. At least I have to turn the pot a lot before things happen, but I think this is due to the pot, because I had to turn it a lot before the throttle calibration would read more than 0mV.

Lebowski said:
The current meter, this is the supply current ? From 10 V ? So around 40 to 50 W ?
Yes, from the 3S LiPo, it's around 11V under load I think.

Lebowski said:
Did you measure erpms ?
No. I'm not quite sure how to do this. Putting the scope to the PWM output from the dsPIC?

Lebowski said:
Did you try reverse ?
Not yet. It got late quite fast last night :lol:

Lebowski said:
I assume the big 4Ohm resistor is no longer in the supply ?
Yes, the safety resistor is bypassed, you can actually see it if you can look through my mess, it's gold colored at the right side of my Fluke meter with the red wires attached to only one terminal = resistor not in circuit.

Lebowski said:
Did you try starting it while manually putting a load on the motor ?
I think so, yes, I think that was why it took a lot of throttle to get it going (along with the pot behavior).

One thing I noticed was that around 1/4 throttle, the motor was at full speed and more throttle would not increase motor speed, but that's how a torque based throttle works, right?
 
Oh, and if you look at the brainboard picture, maybe you can see that I only have 1 big ceramic capacitor (22µF, 16V) and that I have room for 2 more around the chip. I have 4 100nF ceramic capacitors on the board, closest to the VDD/VSS pin pairs, GND is distributed under the chip, VSS is distributed through short wires on the back of the PCB. It seems to work fine with just this one 22µF capacitor. I will add more capacitance though, just to be sure and also to get lower voltage ripple from the switching regulator (I'm using a 7805 linear regulator for test right now), but at least now I know the chip works with less capacitance, and this will keep me comfortable when I add more, I will know I have added enough when the voltage ripple is low enough (I am allergic to voltage ripple, I'm still thinking of adding a fast response linear regulator between the switching regulator and the chip, just to get rid of the last few mV ripple :shock: )
 
Yes, with a torque throttle you get max rpm's long before you give full throttle. Once the torque is high enough it will accellerate until either the max erpm setting, the max amplitude setting or the battery voltage.
 
I tried reverse, it works perfect, really cool :D just pushing the reverse button, the motor spins down and reverses and keeps going reverse until I release the button. No need to lower the throttle.

I also tried holding the motor while it tried to wiggle-start, and I had to give it quite some throttle before the wiggle became powerful enough to overcome my fingers.

And then I tried measuring the erpms, but I don't know how to calculate it from the PWM output.
I have 3.84ms between 2 "sines", see the scope shot. This is one of the highside PWM outputs from the dsPIC.
 

Attachments

  • erpm_measure.png
    erpm_measure.png
    29.8 KB · Views: 1,969
So, I tried to attach the motor to my mini lathe as a rotating load, and would let the motor turn the chuck only, all gears were disconnected in the lathe. The motor could not wiggle-start with that much load and as I turned up the throttle, the motor suddenly gave a whine, like if an axle turned inside a press fit seat or something. But I think it was the controller that made the sound because now it acts all weird and jumping random between drive modes and skipping out of the setup mode and it seems like the controller want to turn the motor even with zero throttle :shock:

I'll recharge my LiPo's to make sure they are good before giving it another try.
 
Fresh charged LiPos and we are good to go again.

I changed the wiggle settings to 10 deg and 100Hz, this helped get the lathe chuck moving. I'm still powering the motor from a 3S 1600mAh 20C LiPo, perhaps the current limit should be lower than the 100A I have set now :lol:
The lathe chuck inertia and bearing drag must be a good load since the wires get quite hot, but the FETs stay cool. I'll have to change the wiring and also set the current limit to 50A since this is what I'm aiming for per 6-FET. And I think I'll switch to a 3S 5000mAh 20C LiPo for motor power so I don't puff a LiPo :roll:
 
Lebowski said:
Did you measure erpms ?
Ok, I tried this:

Readout of phi_int at motor standstill gives 0x7FFF or 0x8000. I guess 0x8000 is the correct value for at non-rotating motor (-32767 decimal).
Readout of phi_int at full motor speed with 3S LiPo gives 0x81C1 (-32319 decimal). That's a difference of 448 so I assume this is the value to use.
So, according to the example in slide 16 of the manual, with a f_sample of 41.03kHz (taken from the PWM menu of the chip), the erpm is: (448 * 41030) / 65536 * 60 = 16828 erpms. With a 4-pole rotor, that must be 8414 mechanical rpm (half of the erpms).
 
Back
Top