Lebowski's motor controller IC, schematic & setup, new v2.A1

i here have two videos. first one showing the motor running in hallsensor mode. very smooth. it had this hickup once or twice at the very beginning, but it didn't happen later, and i wasn't able to reproduce it.
second shows a little issue i can see: i guess it's a rough transition when switching to FOC? there is a little second kick when giving throttle. when you hit the throttle the motor case of course moves into the opposite direction of the motor rotation. but there is a little second kick shortly after.
is this normal? and how would i avoid it.
i will also update animalector's thread with some pictures and the first video, if someone wants to see pics of the finished controller.
http://endless-sphere.com/forums/viewtopic.php?f=30&t=65297&p=1027278#p1027278

[youtube]N-9hVHyHYbQ[/youtube]

[youtube]qNfGEB1qljw[/youtube]
 
the only thing i can think of is that the second kick comes from the transition from drive_2 to drive_3. In sensorless (drive 3) the motor runs
much free-er and smoother than in hall sensored (drive 2), so I can imagine you get a (noticable) second kick especially when the
transition erpm is a bit high. What you can try is reducing the drive 2 -> 3 and drive 3 -> 2 erpm's.... The hall sensored drive 2 is really only
for starting the motor...
 
Lebowski said:
the only thing i can think of is that the second kick comes from the transition from drive_2 to drive_3. In sensorless (drive 3) the motor runs
much free-er and smoother than in hall sensored (drive 2), so I can imagine you get a (noticable) second kick especially when the
transition erpm is a bit high. What you can try is reducing the drive 2 -> 3 and drive 3 -> 2 erpm's.... The hall sensored drive 2 is really only
for starting the motor...
thanks. i upped the values as per your recommendation to 150/700/300, before it was:
Code:
c) accept direction change below: 71 erpm
d) transition erpm drive 2 -> 3: 428 erpm
e) transition erpm drive 3 -> 2: 142 erpm
i will change back and try again.
do you have an idea what this switching back to drive_1 was in the very beginning [0:20]? can't be too high current error, as i set phase current to 80a now.
 
have you updated the settings for p, q, r and s in the recovery menu ? These are the error current settings for drive_2. Did you autocomplete the recovery menu after increasing the phase current ?
 
Lebowski said:
have you updated the settings for p, q, r and s in the recovery menu ? These are the error current settings for drive_2. Did you autocomplete the recovery menu after increasing the phase current ?

this is m) miscellaneous

Code:
a) autocomplete

b) motor standstill voltage threshold: 0.48 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: 39 deg
g) wiggle rate: 4 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

this is k) recovery

Code:
p) current to check: total current
q) fixed part: 15.9 A
r) proportional to throttle current, factor: 150 %
s) current filter 50% step response time: 5.0 msec

this is from my termite log. i'm quite sure those are the lastest values. i can only check in the evening when back home.
miscellaneous was posted to show the settings for wiggle that work well for my motor. just in case someone else looks for MAC values.
 
I think the current under q of the recovery menu is about good, if it really jumps from drive 2 to drive 1, increase the filtering (option s)...

When will you do the first trials on the bike, under power ?
 
small preview of the contents of the new temperature sensor menu, as found in the new version 2.40 (almost ready):

Code:
a) use temp sensors: yes
b) identify temp sensors
c) temperature readings
z) return to main menu

 0: 5E00 0802 BBD6 1010 
 1: 8F00 0802 BBF8 6E10 
 2: 5400 0802 A8C4 E110 

0) reduce max phase current above 50.0 degC by 2.9 A/degC
1) reduce max phase current above 60.0 degC by 1.9 A/degC
2) reduce max phase current above 70.0 degC by 0.9 A/degC

------> c 
22.0	21.5	21.5	4.9 A
22.0	21.5	21.5	4.9 A
22.0	21.5	21.5	4.9 A
22.0	21.5	21.5	4.9 A
22.0	21.5	21.5	4.9 A
22.0	22.0	21.5	4.9 A
22.0	22.0	21.5	4.9 A

Because there are tons of temperature dependent resistors out there I've decided to go with digital temperature sensors. From v2.40 on you can connect upto
eight DS18S20 temperature sensors in parallel to the controller IC. To distinguish between the sensors, each is identifiable with a unique 64 bit code. Option B will search for all
the sensors connected to the controller IC and display the 64 bit code. Then for each of the sensors you can specify in degC above which temperature
the max phase current should be reduced, and by how many Amps per degC. Finally option C (if you scroll down in the bit above) will give you a running
count of the sensed temperatures (here the first 3 columns) and the effective max phase current (5A in this case).

Why 8 sensors ? I imagine someone like Arlin or Jeremy would want to have 1 sensor for each IGBT / FET bank, with then 2 left for the motor.

The signalling to the temp sensors for robustness is quite low speed, around 10 kbaud. Also, each reading is checked with a CRC (a checking algorithm which
tells you whether the data received is correct or whether you messed up somewhere). A CRC violation puts the respective sensor at 0 degC for that one reading.

The current limiting from the temperature sensors is not accumulative. Basically what it does is for each sensor it calculates the max phase amps that temperature
allows. Then it takes the lowest of the calculated currents. So if one temperature sensor reduces current by 1A (from 5A to 4A), and the other by 2A (so 3A max phase current)
then the allowed max phase current is 3A.

Both power and regen are limited in phase current based on the temperature, so take care that you always have mechanical brakes ! Because when the
motor gets so hot that the max phase amps are reduced to 0A, also the regen current is limited to 0A !!!

All temp sensor readings will be available over RS232 when the motor is running, so if you're into building fancy displays you can display all temperatures
while riding around.
 
this is the setup right now:

Code:
0x03D3	0x03D3	0x0628	0x000C	0x0004	0x0002	0x7FBC	0x0623
0x0000	0x018B	0x8000	0x07AD	0x03D6	0x0E92	0x03F5	0x03F0
0x03F0	0xAAAA	0xAAAA	0xAAAA	0x02EE	0x0267	0x001E	0x0301
0x000A	0xF74C	0x0309	0x1000	0x1000	0x1000	0xFFFF	0xFFFF
0xFFFF	0x00B3	0x02B6	0xFFFF	0xFFFF	0x1EB6	0x0189	0x1146
0x0000	0x079C	0x0258	0x0064	0xFFFF	0xFFFF	0xFFFF	0xFFFF
0x0000	0x4CCD	0x000C	0x0000	0x00F0	0xFFFF	0xB333	0xFFF4
0x0000	0xFF10	0x0000	0x07AE	0x0018	0x0000	0x01E0	0xFFFF
0xF852	0xFFE8	0x0000	0xFE20	0x0003	0x0000	0x0078	0x0000
0x0000	0xFFFD	0x0000	0xFF88	0x0000	0x0000	0x003C	0x0003
0x0000	0x0000	0x0000	0xFFC4	0xFFFD	0x0000	0x0000	0x0000
0x00F0	0x000C	0x0000	0x0000	0x0000	0xFF10	0xFFF4	0x0000
0x0000	0x0000	0x120A	0x1400	0x05FD	0x05DC	0x02E1	0x0038
0x00F0	0x02EB	0x014F	0x0008	0x0156	0x0042	0x0008	0x1C70
0x0000	0x03E8	0x00C8	0x4C31	0x03B6	0x6000	0x0623	0x00D2
0xFF00	0x4341	0xEC3F	0x193F	0x983F	0x6B3F	0xC341	0xFF00
0xFFFF	0xC519	0x764B	0x5482	0x41B3	0x35C3	0x2D7A	0x276B
0x22C9	0x1F1E	0x1C28	0x19B5	0x17A6	0x15E6	0x1463	0x1312
0x11EB	0x10E4	0x0FFB	0x0F28	0x0E6B	0x0DC0	0x0D23	0x0C94
0x0C10	0x0B97	0x0B27	0x0ABF	0x0A5F	0x0A05	0x09B1	0x0962
*

and there still is something wrong with the settings. under load (and the wheel is off the floor, so load is not really high) it jumps to drive_1 during WOT.

[youtube]70UZECu7TPI[/youtube]
 
izeman said:
this is the setup right now:

Code:
0x03D3	0x03D3	0x0628	0x000C	0x0004	0x0002	0x7FBC	0x0623
0x0000	0x018B	0x8000	0x07AD	0x03D6	0x0E92	0x03F5	0x03F0
0x03F0	0xAAAA	0xAAAA	0xAAAA	0x02EE	0x0267	0x001E	0x0301
0x000A	0xF74C	0x0309	0x1000	0x1000	0x1000	0xFFFF	0xFFFF
0xFFFF	0x00B3	0x02B6	0xFFFF	0xFFFF	0x1EB6	0x0189	0x1146
0x0000	0x079C	0x0258	0x0064	0xFFFF	0xFFFF	0xFFFF	0xFFFF
0x0000	0x4CCD	0x000C	0x0000	0x00F0	0xFFFF	0xB333	0xFFF4
0x0000	0xFF10	0x0000	0x07AE	0x0018	0x0000	0x01E0	0xFFFF
0xF852	0xFFE8	0x0000	0xFE20	0x0003	0x0000	0x0078	0x0000
0x0000	0xFFFD	0x0000	0xFF88	0x0000	0x0000	0x003C	0x0003
0x0000	0x0000	0x0000	0xFFC4	0xFFFD	0x0000	0x0000	0x0000
0x00F0	0x000C	0x0000	0x0000	0x0000	0xFF10	0xFFF4	0x0000
0x0000	0x0000	0x120A	0x1400	0x05FD	0x05DC	0x02E1	0x0038
0x00F0	0x02EB	0x014F	0x0008	0x0156	0x0042	0x0008	0x1C70
0x0000	0x03E8	0x00C8	0x4C31	0x03B6	0x6000	0x0623	0x00D2
0xFF00	0x4341	0xEC3F	0x193F	0x983F	0x6B3F	0xC341	0xFF00
0xFFFF	0xC519	0x764B	0x5482	0x41B3	0x35C3	0x2D7A	0x276B
0x22C9	0x1F1E	0x1C28	0x19B5	0x17A6	0x15E6	0x1463	0x1312
0x11EB	0x10E4	0x0FFB	0x0F28	0x0E6B	0x0DC0	0x0D23	0x0C94
0x0C10	0x0B97	0x0B27	0x0ABF	0x0A5F	0x0A05	0x09B1	0x0962
*

and there still is something wrong with the settings. under load (and the wheel is off the floor, so load is not really high) it jumps to drive_1 during WOT.

Looking at the settings,
- try increasing the error current filtering in the filtering menu (option c), it's at 5 msec, try 10 msec
- try increasing the amount of cycles for the transition from drive_2 to 3, (misc menu, option h), try 2000 or maybe even 4000

Last thing, did you make a significant change in the supply voltage (maybe from lab supply to actual battery) without re-doing the FOC
measurement ?
 
no change in battery voltage. i always powered from the very same battery.
i tried ALL your suggestion, but nothing helped. it seems increasing amount of cycles for transition made it worse. but this can be wrong. it's hard to say.
i guess i will go through ALL config from the very beginning and will review the manual once again now that i know the menu structure better. maybe this can help.
i think that DD motors differ a lot from geared ones, so setup will be different. but your controller was used with much higher rpm motors like RC motors as well, right?
i hope it's no hardware issue that makes it run nicely on low power, but has some problems with high power. maybe andy can comment on that - i'm not sure what testing he had made.
 
I don't think there's anything wrong... I think you should hex dump the settings you have now and keep them as a 'known good'.

First off, Zombiess and Arlo1 have run with 100's of Amps, so nothing special there. Your case however is special in a sense
that you pump 80A into an unloaded motor. This will make the motor accellerate extremely fast, so fast in fact that the controller
cannot keep up. It starts lagging, it sees this (as an error current) and goes to drive_1.

Whether or not the controller can keep up with a fast accellerating motor has to do with the control loop coefficients.

Basically there are two control loops at work. One keeps track of the (electrical) phase of the motor, the other deals with the amplitude
of the sine waves. The amplitude of the sine waves is controlled such that the current sensors see the wanted phase currents. As the
motor accellerates the back-emf amplitude of the motor increases, meaning that in order to maintain the current the controller output
waves also have to increase in amplitude.

In your unloaded motor case, is seems as though the amplitude loop is very fast and can keep pumping in the current. At the same
time the phase control loop is not fast enough, it lags and loses track.

So, two ways to fix this: slow down the amplitude control loop or speed up the phase control loop.

To slow down the amplitude control loop, in the control loop coefficient menu g reduce (all by the same factor such that the ratios
between them stays the same) options h, i and j . Try reducing by 2, or 4, or 8 etc etc. Later on when riding around, when you've reduced
these coefficients too much the throttle response will feel a tad sluggish. Just to give an idea of how fast it ramps up: from 0 Volt to full
voltage takes 32768 / (menu g, option i) samples, and the rate of sampling is (menu a, option h). So with option i being 3 and a sampling
rate of 39000 Hz, the ramp up time from 0 to full is 280 miili-sec. To ramp from 0 current to full current takes a fraction of this time.

To speed up the phase control loop, increase menu g, options b, c and d. Again, keep ratios between them the same, so increase all 3
by an equal factor. Disadvantage of going too high is more noise in the system and the controller conking out to drive_1 due to too much noise (spikes
tripping the error current)...
 
makes sense. never had this "problem" with any of the other controllers. but of course your's is much more sophisticated. and it HAS error current handling and a lot of other stuff.
so only a "real life" test can show if it works. i will try with brakes applies (a bit to simulate load).
 
izeman said:
makes sense. never had this "problem" with any of the other controllers. but of course your's is much more sophisticated. and it HAS error current handling and a lot of other stuff.
so only a "real life" test can show if it works. i will try with brakes applies (a bit to simulate load).

I typically strap the motor to a bike and haul an 85kg man around as a load test :mrgreen:
 
Lebowski said:
izeman said:
makes sense. never had this "problem" with any of the other controllers. but of course your's is much more sophisticated. and it HAS error current handling and a lot of other stuff.
so only a "real life" test can show if it works. i will try with brakes applies (a bit to simulate load).

I typically strap the motor to a bike and haul an 85kg man around as a load test :mrgreen:

if it wasn't raining frozen cats it'd do the same with a 90kg man :)
 
what motor are you running? izeman.

I have been working with Ben on my controller for his duty cycle on Mac motor, Mac use delta winding, which has 30 degree shift than Y type of connection.
It is hard to get sensorless working and also field weakening up on delta winding.

Good luck
 
Shenta said:
what motor are you running? izeman.

I have been working with Ben on my controller for his duty cycle on Mac motor, Mac use delta winding, which has 30 degree shift than Y type of connection.
It is hard to get sensorless working and also field weakening up on delta winding.

Good luck

mac. can't tell winding count. i have three of them. 8,10, and 12t. i guess at the moment i'm running the 12t. have you got it running well? if so, could you please post your settings? hex or screenshot?

thanks
 
Can you make a movie and post the hex dump ? Did you increase error current filtering in the filtering menu to 10 or 20 millisec ?

Can you check all connections between current sensors and brainboard ? Can you run a current sensor offset calibration before posting the hex ?

Are the type numbers on all 3 current sensors the same ? Are all hand wired connections between the brainboard and powerboard correct ?
 
to my best knowing all connections are ok. i didn't install the current sensors but i'm 99% sure that andy installed 3 of the same type.
i already posted a video, some post ago. this is how it behaves. but i will make a new one asap.

current sensor are calibrated.

this is what the settings look like right now. is there a way to RESET to defaults? maybe it helps ;)

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


0) mode: Hall sensored, 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) hall sensored only
m) miscellaneous
z) store parameters in ROM for motor use

------> a 

a) PWM frequency: 20kHz
b) deadtime: 999ns
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: 39.00 kHz

z) return to main menu

------> b 

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

e) autocomplete

f) HF current, base level (HF only): 4.0 A
g) HF current, proportional factor (HF only): 1.0000
h) maximum phase current in drive 2 (HF only): 37.9 A
i) phase current for forcing motor position: 15.9 A
j) maximum shutdown error current, fixed: 19.9 A
k) maximum shutdown error current, proportional: 9.9 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, 1.0000, 1.0000
d) polynomial coefficients throttle 2 (x, x^2, x^3): -0.0002, -0.0002, -0.0002
e) use analog throttle 1: YES
f) use analog throttle 2: NO
   receive throttle over CAN: NO
g) TX throttle over CAN: NO
h) test throttle

z) return to main menu

------> d 

a) erpm limit, forward: 34.96 k-erpm
b) erpm limit, reverse: 34.96 k-erpm
c) accept direction change below: 71 erpm
d) transition erpm drive 2 -> 3: 785 erpm
e) transition erpm drive 3 -> 2: 392 erpm

z) return to main menu

------> f 

a) restore calibration, autocomplete
b) perform offset measurement
   sensor a: -30.0 mV
   sensor b: -42.5 mV
   sensor c: -35.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: 20.239 msec
d) induction position filter 45 degree delay speed: 3.18 k-erpm
e) drive 2 speed filter 50% step response time: 210.2 msec

z) return to main menu

------> i 

a) autocomplete

b) FOC measurement current: 39.9 A
c) FOC measurement erpm: 53.57 k-erpm
d) perform impedance measurement

 measured inductance: 85.5 uH

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: 3.9 A
i) pulse width: 20 usec
j) pulse % for exit: 95
k) pulse % filter 50% step response time: 30.0 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: 15.9 A
r) proportional to throttle current, factor: 150 %
s) current filter 50% step response time: 20.0 msec

z) return to main menu

------> l 

 code: 0, angle: 358 deg, confidence: 0, used: no
 code: 1, angle: 94 deg, confidence: 8, used: yes
 code: 2, angle: 331 deg, confidence: 7, used: yes
 code: 3, angle: 35 deg, confidence: 7, used: yes
 code: 4, angle: 213 deg, confidence: 7, used: yes
 code: 5, angle: 150 deg, confidence: 7, used: yes
 code: 6, angle: 274 deg, confidence: 8, used: yes
 code: 7, angle: 358 deg, confidence: 0, used: no

a) toggle hall usage
b) calibrate hall positions: no

z) return to main menu

------> m 

a) autocomplete

b) motor standstill voltage threshold: 0.48 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: 9 Hz
h) minimum # of cycles going from drive 2 to 3: 4000
i) number of cycles going from drive 3 to 2, HF only: 200

z) return to main menu
 
Pretty sure the current sensors are all the same. Unless utsource stuffed up and put a random one in there. but I doubt that. The pcb layout had them all the same orientation connections etc.

I decided to get the interface pcb made up. To remove the necessity to run wires. There will still be interconnects. But the will be straight down and straight up between the two boards.

I'm going to get my controller running as soon as this interface pcb comes in. So then we can have two running and see if I can get the same behaviour
 
Im starting to wonder if the hall calibration is done correctly. Something to try:

-set max erpm to 10k
-set it up for hall calibration (dont forget to activate online store)
-in motor mode, floor it so it spins at 10kerpm in drive 3
-count to 5
-while floored in drive 3 like this, press setup to store settings

Hall calibration is not something to be done carefully at low erpm...
 
Had another look through your settings:

- in the current menu, make the fixed error current 10A and the proportional one 20A . Maybe also try 5A and 25A respectively
- in the throttle menu, 1, 1, 1, for option c doesnt make sense, for linear throttle try 1, 0, 0

How does the controller respond to your full throttle tests when running sensorless only ?
 
Back
Top