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

Electric Motors and Controllers
Njay   10 kW

10 kW
Posts: 835
Joined: Sep 09 2010 10:43am
Location: Portugal

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

Post by Njay » May 16 2018 2:14pm

Some micros (even 8bit ones like AVRs) have an optional differential amplifier before the ADC.

lizardmech   100 mW

100 mW
Posts: 45
Joined: May 19 2017 4:16am

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

Post by lizardmech » May 17 2018 12:17pm

Lebowski wrote:
May 16 2018 1:32pm
I actually want to sense changes in phase inductances (to deduce position) while powered, i do not want something where i have to alternate between powering and sensing. The video a few posts back was sensing and powering at the same time.
Lizardmech comment about enough resolution ('Dynamic Range') is correct and is the reason for the analog pre-processing.
How do you find the performance of the allegro ACS sensors in general? I have only used resistive current sense in the past but allegro now have some nice 100V high current SMD models and their existing models were upgraded with more bandwidth. It's almost impossible to find any performance comparison between the different current sensing options around or information about if you should prioritize bandwidth, rise time or other characteristics when selecting them for motor control.

User avatar
Lebowski   1 GW

1 GW
Posts: 3171
Joined: Jun 28 2011 1:38am
Location: beautiful Zurich, Switzerland

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

Post by Lebowski » May 18 2018 9:00am

I prefer proper current (magnetic field based) over resistive ones for the simple reason that if you want to keep the power dissipation the same, the higher the current rating of the resistor the lower the effective voltage you'll get.
A 1W sense resistor for 1A can deliver 1V signal, a 1W for 1000A will only deliver 1mV signal, with only 1uV per A.

I would say phase delay through the sensor is most important, as this delay translates to an offset between motor voltage and current

User avatar
fechter   100 GW

100 GW
Posts: 12885
Joined: Dec 31 2006 3:23pm
Location: California Bay Area, USA

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

Post by fechter » May 18 2018 9:18am

The specification on the Allergro ACS states a response time of 4us and bandwidth of 120 kHz. Seems just barely fast enough.
"One test is worth a thousand opinions"

lizardmech   100 mW

100 mW
Posts: 45
Joined: May 19 2017 4:16am

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

Post by lizardmech » May 18 2018 12:56pm

Response time seems to be the biggest weakness on the ACS, at least on the high current versions. They have 1mhz versions with sub 1us propagation but they never release them in the high current versions for some reason. The INA240 I have been using recently is faster but they are limited to 80V and shunt resistor heat is an issue, you gain a few watts worth of heat at 100A+ and accuracy theoretically suffers as resistance changes. An isolated current shunt amplifier I tried is faster than high current ACS but still had the down sides of resistive sense. I'm not sure how fast is fast enough for motor control, considering a worst case scenario of a motor with 200,000 ERPM you still have around 300us per electrical cycle?

lizardmech   100 mW

100 mW
Posts: 45
Joined: May 19 2017 4:16am

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

Post by lizardmech » May 22 2018 4:09pm

While researching giant magnetoresistance I discovered these isolated current sensors today, a little more expensive than ACS but sub 1us response time and high bandwidth.
https://www.sensitec.com/products-solut ... 000-family

User avatar
Lebowski   1 GW

1 GW
Posts: 3171
Joined: Jun 28 2011 1:38am
Location: beautiful Zurich, Switzerland

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

Post by Lebowski » May 23 2018 6:08am

Hm I don't know, 120kHz bandwitdth for the ACS parts seem good enough to me. 100k-erpm translates to 1.6 kHz, a pole at 120kHz would give a phase rotation of less than 1 degree. Cycle time of the algorithm is in the order of 30usec, so 4 usec delay in the current sensor doesn't seem relevant.

User avatar
Lebowski   1 GW

1 GW
Posts: 3171
Joined: Jun 28 2011 1:38am
Location: beautiful Zurich, Switzerland

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

Post by Lebowski » Jun 04 2018 11:38am

Been very busy here with the saliency (?) based position detection, want to detect the rotor phase at standstill by measuring the differences between the motor inductances.

And I want it good, just dividing the rotor position in 60 degree portions (like what you get with hall sensors) will not be good enough, I want like 8 bits or so. Basically the goal is to get phase info as if there was a resolver, but then without the resolver but based on the motor inductance info.

The level of processing this needs is staggering. To get 8 bit info is actually quite simple (but needs a trick that took me 5 days to figure out), the MSB though (the bit saying we're between 0-179 or 180-359 degrees) is a real #@$%#^*$&*. Been playing with sending out a bit pattern in the Field weakening dimension (Id or Iq, don't know what it is called officially, I call it I_imag), using matched filters etc to detect it back in the saliency and then based on inversion or not decide the MSB. This kinda worked but was horribly unreliable and audible noisy to boot (oh yeah, another thing is I don't want a loud tone or anything like that).

Also had to start using the DSP as simple first order lowpass filtering is no longer good enough. Have now switched over to FIR filtering and doing stuff like sample rate conversion.

I do now have something that works for deciding the MSB, but it does not work always. I already figured out why this is and also how to fix it, but it will again put an extra layer of complexity on top. Luckely at the moment I am nowhere near the limit of the processor, the one I have now does 70 M instructions per second versus 30 for the 30F.

Good thing it is so complex though, with me being out of a job at the moment it is a fun project to keep me busy (though with the summer going on here there is also lots of cycling and motorbiking to be done :D )

Altair   100 W

100 W
Posts: 267
Joined: May 03 2014 10:35am
Location: Quebec, Canada

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

Post by Altair » Jun 04 2018 12:19pm

Well we can say that you, being out of a job, has been a godsend for the e-bike community. :lol:

skycurve   1 µW

1 µW
Posts: 3
Joined: Jun 04 2018 12:59pm

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

Post by skycurve » Jun 04 2018 1:10pm

That sounds very interesting.
This kinda worked but was horribly unreliable and audible noisy to boot
So you calculate the rotor position without injecting any pwm pattern and without injecting any "I_imag" (Id) currents?
Do you measure the Ld and Lq inductance (anisotropy) while the deadtime and turn-on time of the mosfets?

User avatar
Lebowski   1 GW

1 GW
Posts: 3171
Joined: Jun 28 2011 1:38am
Location: beautiful Zurich, Switzerland

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

Post by Lebowski » Jun 04 2018 2:19pm

I think the deatime is too short (set for 500nsec) to get anything useful out... plus there is phase current flowing to make the motor turn, effectively forcing what happens during deadtime...

Putting a pattern on the I_imag was like the neutral light on my old Moto Guzzi, it was right about 80% of the time... the 20% when it is wrong can be really dangerous though...

skycurve   1 µW

1 µW
Posts: 3
Joined: Jun 04 2018 12:59pm

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

Post by skycurve » Jun 04 2018 2:43pm

I have read a paper where they used an FPGA to measure the currents @20MHz, but I also think
that deadtime is too short and full of noise because of the switching FETs.

Than you inject some kind of short pwm pattern like INFORM method and calculate the current derivative, right?
Do you have two different algorithms for low and high speed?

User avatar
Lebowski   1 GW

1 GW
Posts: 3171
Joined: Jun 28 2011 1:38am
Location: beautiful Zurich, Switzerland

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

Post by Lebowski » Jun 04 2018 3:14pm

INFORM method ? I dont follow the literature and like to do everything myself, is more fun... at high speed I will switch over to backemf based sensorless of course.

skycurve   1 µW

1 µW
Posts: 3
Joined: Jun 04 2018 12:59pm

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

Post by skycurve » Jun 04 2018 3:49pm

In INFORM (indirect flux detection using online reactance measurement) some pwm patterns are applied "out of order" of field oriented control and measure the current derivative depending on voltage.
This method is much quieter than injecting current waves on imaginary axis (I_imag).

Requires your algorithm measurement of phase voltages or do you measure only the currents?

User avatar
Lebowski   1 GW

1 GW
Posts: 3171
Joined: Jun 28 2011 1:38am
Location: beautiful Zurich, Switzerland

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

Post by Lebowski » Jun 05 2018 1:51am

Is this the method where they measure inductance using the rise time of the current ? Don't you get only a 1 out of 6 info from this (so only 60 degrees resolution) ?

User avatar
tecnologic   1 mW

1 mW
Posts: 15
Joined: Mar 24 2015 12:41pm

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

Post by tecnologic » Jun 05 2018 2:24am

No u get only a position every 6th pwm cycle. But this depends on the implementation. Prof. Schrödl located in Wien proposed this method.

I would expect because of the analog circuitry u have to increase current resolution. u will sample the current at lets say 40% and 60% of pwm cycle with PWM switiching at around 50% und build the current deravative?

User avatar
Lebowski   1 GW

1 GW
Posts: 3171
Joined: Jun 28 2011 1:38am
Location: beautiful Zurich, Switzerland

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

Post by Lebowski » Jun 08 2018 2:53pm

Just spent 2 days programming, but ran into a problem with the 33EV I'm using... some obscure mistake in the silicon explained in the errata (but who reads those ?). Luckely there's other ways to skin a cat...

User avatar
Lebowski   1 GW

1 GW
Posts: 3171
Joined: Jun 28 2011 1:38am
Location: beautiful Zurich, Switzerland

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

Post by Lebowski » Jun 12 2018 10:41am

:D my idea for getting full 360 info has worked, now I get reliable info about whether the phase is 0-179 or 180-359. So all combined I now get full 360 degree info (smooth, not just 6 levels) about the rotor position, sensorless at standstill. Processing time is around 10 to 20 msec for the first reliable output after a cold start, after that it should be able to keep up until it shifts to backemf based sensorless. The short processing time makes that the controller can switch off the output stage while waiting for the traffic lights, and switch on only at throttle up. And independent of whether you rolled backwards or forwards, and without needing to accurately sample motor voltages (doesn't need motor voltages...)

There is still a big mistery in there somewhere that I need to look at... a case of a polarity being different from what I expected. If I just dumbly take this into its stride it will work, I'm just curious why it is different and I want to understand this.

Next step is to add phase current.... I have kept this in mind and it should be OK, but you never know...
Last edited by Lebowski on Jun 12 2018 11:03am, edited 1 time in total.

User avatar
emmgee   10 W

10 W
Posts: 68
Joined: Jun 16 2010 6:34am
Location: CH

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

Post by emmgee » Jun 12 2018 10:46am

Thats real world science fiction, better than ..?.!... (fill in whatever you like :mrgreen: )
Modified Scott Nitrous, 74V, MagicPieV2, waiting for Lebowski-Controller by whereswally
Quantya Evo1 and eScooter vRone, each with Lynch motor, 74V 40Ah, Alltrax AXE 7245
Dream: Quantya with Lebowski-Controller and brushless motor (Revolt RV-160, Colossus, Emrax 207, ...)

kiwifiat   100 W

100 W
Posts: 107
Joined: Mar 16 2013 5:49pm
Location: Vancouver, Canada

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

Post by kiwifiat » Jun 12 2018 2:04pm

Lebowski wrote:
Jun 12 2018 10:41am
:D my idea for getting full 360 info has worked, now I get reliable info about whether the phase is 0-179 or 180-359. So all combined I now get full 360 degree info (smooth, not just 6 levels) about the rotor position, sensorless at standstill. Processing time is around 10 to 20 msec for the first reliable output after a cold start, after that it should be able to keep up until it shifts to backemf based sensorless. The short processing time makes that the controller can switch off the output stage while waiting for the traffic lights, and switch on only at throttle up. And independent of whether you rolled backwards or forwards, and without needing to accurately sample motor voltages (doesn't need motor voltages...)

There is still a big mistery in there somewhere that I need to look at... a case of a polarity being different from what I expected. If I just dumbly take this into its stride it will work, I'm just curious why it is different and I want to understand this.

Next step is to add phase current.... I have kept this in mind and it should be OK, but you never know...
Great work Lebowski, any chance this will be back ported to the 30F4011?
The only source of knowledge is experience.
Albert Einstein

User avatar
Lebowski   1 GW

1 GW
Posts: 3171
Joined: Jun 28 2011 1:38am
Location: beautiful Zurich, Switzerland

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

Post by Lebowski » Jun 13 2018 1:39am

No chance... the hardware is just not there

whereswally606   100 kW

100 kW
Posts: 1098
Joined: Jun 19 2011 2:11pm
Location: Cheshire, UK

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

Post by whereswally606 » Jun 13 2018 4:16am

Great Work Bas, looking forward to this. Maybe its time your new chip and software had a thread of its own. Stop people getting confused. :D
Distributing "Lebowski" FOC Controller PCB (Through hole) since 2016
Moped: Emax 110s 2009

arber333   1 mW

1 mW
Posts: 17
Joined: Mar 29 2013 4:13pm

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

Post by arber333 » Jun 15 2018 2:02am

Hi Bas, good job!

Is there a possibility to make a schematic like for 30F? I am in the middle of multi inverter project where i am committed to your design, but pinout is very general. I could just make a new brain board with same pinout if i had new chip schematic. Would it be powered from 5V or is it 3V3? In that case i would have to adapt signalling... :(.
Does your sensorles start require any outside elements?

tnx

Arber

User avatar
Lebowski   1 GW

1 GW
Posts: 3171
Joined: Jun 28 2011 1:38am
Location: beautiful Zurich, Switzerland

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

Post by Lebowski » Jun 15 2018 1:50pm

Its a 5V chip (a 33EV from microchip), but for now it is all very early stages. Main thing to see is how it holds up under high throttle...

I have some opamp circuits, mainly to help the ADCs...

Tomdb   10 W

10 W
Posts: 97
Joined: Apr 03 2014 7:47am
Location: Warwickshire

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

Post by Tomdb » Jun 30 2018 2:23pm

having been dusting off the controller.

However now it wont even spin the motor. All calibrations run without an issue.

However it sometimes will not go out of drive 1 or keep flashing the led and not power the stage up.

The hex is below.

Code: Select all

version:293_
0x0133	0xFFFF	0xFFFF	0x0503	0x03C2	0x0001	0x0001	0x0000
0x0400	0xFFFF	0xFFFF	0xFFFF	0xFFFF	0x0370	0x25DB	0x7FBC
0x7D2E	0x0030	0x070E	0x050E	0x2324	0x000B	0xFFFF	0xFFFF
0xFFFF	0xFFFF	0x795E	0x0400	0xB76C	0x000A	0x0000	0x07AE
0x0018	0x0000	0x01E0	0xFFFF	0xF852	0xFFE8	0x0000	0xFE20
0x0000	0x4CCD	0x0018	0x0000	0x01E0	0xFFFF	0xB333	0xFFE8
0x0000	0xFE20	0xF965	0xFF07	0xFFFF	0xFFFF	0x2141	0xFFFF
0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF
0xFFFF	0xFFFF	0x000F	0xF71A	0x0812	0x0060	0x0033	0x0000
0xFFFF	0x0000	0x01AB	0x00D5	0x03F7	0x03F0	0x03F0	0x0EA5
0x0581	0x002D	0x06E2	0x0005	0x0C99	0xFFF8	0x036F	0x1000
0x0000	0x0000	0x1000	0x0000	0x0000	0x0188	0x01D8	0x003B
0x0000	0x06AD	0x0055	0x0473	0x0590	0x0350	0x0258	0x0064
0xFFFF	0xFFFF	0xFFFF	0xFFFF	0x0003	0x0000	0x0078	0x0000
0x0000	0xFFFD	0x0000	0xFF88	0x0000	0x0000	0x0005	0x0000
0x0064	0xFFFB	0x0000	0xFF9C	0x000C	0x0000	0x00F0	0xFFF4
0x0000	0xFF10	0x05CC	0x014C	0x0183	0x0301	0x0356	0x0080
0x0226	0x0301	0x0013	0x0010	0x0E10	0x03E8	0x03B6	0x6000
0x0200	0x00C0	0x4000	0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF
0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF
0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF
0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF
0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF
0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF	0xFFFF
0xFFFF	0xFFFF	0xFFFF	0x0000	0x0000	0x0000	0x0005	0x0000
0x0000	0x0000	0x0000	0x0000	0x0000	0x0000	0x0000	0x0000
0x0000	0x0000	0x0000	0x0000	0x0000	0x0000	0x0000	0x0000
0x0000	0x0000	0x0000	0x0000	0x0000	0x0000	0x0000	0x0000
0x0000	0x0000	0x0000	0x0000	0x0000	0x0000	0x0000	0x0000
0x0000	0x0000	0x0000	0x0000	0x0000	0x0000	0x0000	0x0000
0x0000	0x0000	0x0000	0x0000	0x0000	0x0000	0x0000	0x0000
0x0000	0x0000	0x0000	0x0000	0x0000	0x0000	0x0000	0x0000
0x0000	0x0000	0x0000	0x0000	0x0000	0x0000	0x0000	0xFFFF
0xAAAA	0x6666	0x4924	0x38E3	0x2E8B	0x2762	0x2222	0x1E1E
0x1AF2	0x1861	0x1642	0x147A	0x12F6	0x11A7	0x1084	0x0F83
0x0EA0	0x0DD6	0x0D20	0x0C7C	0x0BE8	0x0B60	0x0AE4	0x0A72
0x0A0A	0x09A9	0x094F	0x08FB	0x08AD	0x0864	0x0820	*

Post Reply