Volt Inverter with Lebowski Brain

Post Reply
slow67
Posts: 151
Joined: Thu Jan 30, 2020 6:52 pm
Location: Texas
Been thanked: 1 time

Volt Inverter with Lebowski Brain

Post by slow67 »

Hello, I'm sharing my inverter project. It uses the Lebowski brain (I really want the sensorless control) and it uses the power stage from a Volt/Amp era. I have based somewhat it on Bas' original design, but I have added components from Arber's design, Damien's designs, and some of Johnannes designs as well. I'm about to order a few of them. Here are some features I added:

I am using hardware overcurrent that doesn't shutdown PWM, instead it only turns off that IGBT (using comparators and logic gates). I plan on using it for drag racing, so I don't want 1 IGBT to cause me to lose a race. Also the logic gates invert the signal from active low to active high.

I'm using a Teensy 4.1 to convert the resolver into a UVW signal for low RPM. With IPM motors, the advance angle isn't static (research MTPA if you don't understand). Lebowski's brain compensates in sensorless mode, but not sensored.

Im using Teensy for all external interfaces (since I have it anyway). This way I can use its killer 600Mhz processor (and the awesome math hardware) for all the extra IOs Im adding.

The Teensy is also communicating with the Leb chip for throttles, reverse, temps, and monitoring its Reset pin (in case of desat, as well as holding it in reset until the contractors are on. Eventually I want it to send the throttles and reverse over CAN, but Bas said its not standard CAN, so for now I have CAN and analog signals between them.

Teensy will also be monitoring the UART from Leb, and send data out over the external CANbus. Also will send out the same data to the esp8266 for wifi (it will be basic, pretty much the same as the Lexus GS450h wifi).

Any comments on the schematic/PCB layout are welcome! I'm still laying out the hardware (so you can ignore them for now). I'm hoping for some feedback to make sure I haven't made any bonehead mistakes in the schematic.

I haven't used the TXS0102DCUR before (for 3.3V to 5V translations). I'm hoping it can sink enough current to drive the RC filter for the analog throttle signals and overcurrent RC filter (I think it should?).


https://oshwlab.com/john.thomas.wade/le ... rter_whole
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Volt Inverter with Lebowski Brain

Post by arber333 »

Really good!

Lebowski rulez in sensorless drive!
For now i run my car on Lebowski directly. I have no outside interface because Volt inverter can trip desat all by itself and i wired another transistor to pull reset line to GND. I even dont use precharge circuit because Volt inverter can raise voltage really fast. Remember drivers are fed directly from DC power lines. I just wait 2s after i turn the key and then i start the inverter. In future I intend to just add one simple Pic12F chip and use it as a timer to start DC contactor.

Also i use UVW RLS encoder with my Leaf motor and it works really good. No additional circuit needed. Not that i wouldnt use it if it is available...

I also noticed you intend to use Teensy on the left side of the board. There is enough space onboard to put it in the middle and use another dspic to drive your A/C compressor. Just saying...
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Volt Inverter with Lebowski Brain

Post by arber333 »

Another question. How do you intend to tell the brain you advanced the current angle. As i remember this is changed by applying more id into the mix and this changes your reluctance torque. But you are correct. Lebowski does not correct start for IPM motors.
IPM should see best torque angle on start at 120deg instead of 90deg as other motors. See pic.
Theory says reluctance torque component with IPM is more dominant with large amp loads, such as on start. I should be able to apply more amps to armature here, but system wont let me.

With this i get really lame torque on start. To offset that i reduced FOC stator resistance by factor of 3. So i use like 48mR value where system should have 180mR. Then motor really shows power, but consumption goes up too!
Attachments
image.png
slow67
Posts: 151
Joined: Thu Jan 30, 2020 6:52 pm
Location: Texas
Been thanked: 1 time

Re: Volt Inverter with Lebowski Brain

Post by slow67 »

arber333 wrote: Fri Jan 08, 2021 11:11 pm Really good!

Lebowski rulez in sensorless drive!
For now i run my car on Lebowski directly. I have no outside interface because Volt inverter can trip desat all by itself and i wired another transistor to pull reset line to GND. I even dont use precharge circuit because Volt inverter can raise voltage really fast. Remember drivers are fed directly from DC power lines. I just wait 2s after i turn the key and then i start the inverter. In future I intend to just add one simple Pic12F chip and use it as a timer to start DC contactor.

Also i use UVW RLS encoder with my Leaf motor and it works really good. No additional circuit needed. Not that i wouldnt use it if it is available...

I also noticed you intend to use Teensy on the left side of the board. There is enough space onboard to put it in the middle and use another dspic to drive your A/C compressor. Just saying...
I have desat tripping the reset pin (using a logic NOR gate for inputs from both power stages). It also happens to invert the signal, so perfect. I meant to say I am also tied into the reset with the Teensy (to hold in reset until precharge is complete, and monitor desat status).

Once Ive proven to myself this board works correctly, I'll switch to an SMD chip for Lebowski and add a stage for the compressor. Also not a high priority since race cars don't need A/C....
slow67
Posts: 151
Joined: Thu Jan 30, 2020 6:52 pm
Location: Texas
Been thanked: 1 time

Re: Volt Inverter with Lebowski Brain

Post by slow67 »

arber333 wrote: Fri Jan 08, 2021 11:34 pm Another question. How do you intend to tell the brain you advanced the current angle. As i remember this is changed by applying more id into the mix and this changes your reluctance torque. But you are correct. Lebowski does not correct start for IPM motors.
IPM should see best torque angle on start at 120deg instead of 90deg as other motors. See pic.
Theory says reluctance torque component with IPM is more dominant with large amp loads, such as on start. I should be able to apply more amps to armature here, but system wont let me.

With this i get really lame torque on start. To offset that i reduced FOC stator resistance by factor of 3. So i use like 48mR value where system should have 180mR. Then motor really shows power, but consumption goes up too!
So the teensy constantly will track the motor position from the resolver. To calculate the advance angle, you need to know 2 constants, Rotor Flux (IE RPM per Volt), and the difference between the inductance from Ld to Lq. In traditional surface mounted BLDCs there is no difference, hence no additional advance needed. IPM motors there is some. The rotor flux is in volt–seconds per radian (V⋅s/rad). For example, a Nissan Leaf motor should be around ~0.00712 for the rotor flux, and the difference between Ld and Lq should be around 30 micro Henries. You then find the needed Id current with the top formula (I have it in spreadsheet form):
Image

Then use the bottom formula to find the Iq current. Then your total advance is the arctan (atan) of id/iq.

For my example above, 50 amps of commanded current is ~101.25 degrees advance, 500 amps is ~126.75 degrees advance, and 1000 amps is ~130.5 degrees advance.

See this post on ES for more details (and where I got the corrected formula from):
https://endless-sphere.com/forums/viewt ... a#p1564821


The beauty of it is, you can figure out the rotor flux very easily. Set Lebowski to 0 field weakening current, and max out the RPMs on whatever size battery you are using. Then the amount of tuning needed is adjusted by only changing the Ld-Lq difference until the best results are achieved. I'll be starting with the Lexus GS450H trans, so there are 2 motors. I can set 1 to Regen and the other to motoring and it acts as a dyno!
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Volt Inverter with Lebowski Brain

Post by arber333 »

I see your theory and it is sound. But what I want to know how to convince DSpic30 to switch transistors early.
How do you intend to change lebowski closed loop? Will you step up resolver position count? How will you get it back down without a hickup?

Edit: don't think I am negative about this. I want to know to increase takoff torque on my motor.
I remember now Arlo was telling he just advanced sensors a bit in menu "Hall sensors" and got faster takeoff.

A
slow67
Posts: 151
Joined: Thu Jan 30, 2020 6:52 pm
Location: Texas
Been thanked: 1 time

Re: Volt Inverter with Lebowski Brain

Post by slow67 »

arber333 wrote: Sat Jan 09, 2021 9:51 am I see your theory and it is sound. But what I want to know how to convince DSpic30 to switch transistors early.
How do you intend to change lebowski closed loop? Will you step up resolver position count? How will you get it back down without a hickup?

Edit: don't think I am negative about this. I want to know to increase takoff torque on my motor.
I remember now Arlo was telling he just advanced sensors a bit in menu "Hall sensors" and got faster takeoff.

A
Im am translating the resolver to uvw signals, and advancing them by the calculated amount (it has the throttle input, so it knows the commanded torque, so it can calculate how much advance to add).

Also I asked Bas, and it will accept all 8 positions instead of 6 for the uvw signals for smoother operation too.
slow67
Posts: 151
Joined: Thu Jan 30, 2020 6:52 pm
Location: Texas
Been thanked: 1 time

Re: Volt Inverter with Lebowski Brain

Post by slow67 »

I am sending the throttle signal to the teensy. It has a pwm port with an RC filter for throttle signal to the lebowski chip. I also have a CANbus, but need to figure out the CAN signalling hes using (he did say it was wasn’t off the shelf CANbus).
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Volt Inverter with Lebowski Brain

Post by arber333 »

slow67 wrote: Sun Jan 10, 2021 3:27 am I am sending the throttle signal to the teensy. It has a pwm port with an RC filter for throttle signal to the lebowski chip. I also have a CANbus, but need to figure out the CAN signalling hes using (he did say it was wasn’t off the shelf CANbus).
It's inside the code. Bas said it's only tx and rx from CAN output spitting out throttle position. He said other Lebowski inverters can listen online and follow throttle signals for tandem drive etc... NO it is not CAN bus and any attempt to use this on the same line caused major issues.
slow67
Posts: 151
Joined: Thu Jan 30, 2020 6:52 pm
Location: Texas
Been thanked: 1 time

Re: Volt Inverter with Lebowski Brain

Post by slow67 »

Ok, got my PCB layout done. Its called Lebowski_Resolver_PCB_Final (the one on the bottom of the link).
slow67
Posts: 151
Joined: Thu Jan 30, 2020 6:52 pm
Location: Texas
Been thanked: 1 time

Re: Volt Inverter with Lebowski Brain

Post by slow67 »

Ha. I just re-read the data sheet again for the logic level translators. They have a built in pull up of 4k, so have to recalculate my RC filter for a 4K resistor (but I don't have to have an external resistor now). I also found an 8 port one in stock at JLC, updating it for that too.
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Volt Inverter with Lebowski Brain

Post by arber333 »

slow67 wrote: Mon Jan 11, 2021 5:11 am Ok, got my PCB layout done. Its called Lebowski_Resolver_PCB_Final (the one on the bottom of the link).
This week i went on and made some tests on my Pug with RLS encoder and software offset on the position.
My best center position for RLS is 27.75deg for forward and -28.20deg for reverse. This are the best settings where i get little vibrations and somewhat smooth takeoff (no real power behind it though) performance. This made my fallback setting.

1. I increased forward offset in steps of 5deg. At first there was more pronounced shaking and overall instability when trying to driveoff. But motor was controllable still well up to 60deg.
2. I got brave and increased offset to 140deg! Motor became undrivable. It would just bang away and not move. I had to select reverse so i was able to move the car off the road. I lowered setting to 85deg and result was still the same.

At that point i decided to remove 3rd motor mount and fill it with rubber because gas engine mount wouldnt alleviate PM motor surges and metal on metal contact was quite frequent.

Hate to rain on your idea, but it doesnt seem Lebowski code would accept encoder offset. And i go as low with transition from drive 2 as 300eRPM!
Maybe it would be best if we rather adapt the code for IPM motors. Its available free now...

Also on other note i discovered a quirk while operating my car. When at highways speed sometimes code fails from sync and if you are in FW regon (upwards of 7000rpm) code is unable to sync back. I had to lower the speed down to 70km/h where code synced back and everything went to normal. I annoyed a couple of fellow drivers though...
I really appreciated the Lebowski code, because when sync went out motor was freewheeling and i could see no regen! That was at 120km/h!
Car felt really in control too. No surges, just gentle tugs when code wanted to sync back.
slow67
Posts: 151
Joined: Thu Jan 30, 2020 6:52 pm
Location: Texas
Been thanked: 1 time

Re: Volt Inverter with Lebowski Brain

Post by slow67 »

140 degrees? Thats wayyy too much! 40 degrees should be about the most it can offset. And thats with upwards of 1200 phase amps. 130 degrees total advance is including the 90 degrees that FOC code already adds.

But either way the Added chip has to convert the resolver signal into UVW signals anyway. Plus I will get 8 positions instead of just 6.

I would love to translate the code into C, but I have to learn ASM first, which is not easy.
slow67
Posts: 151
Joined: Thu Jan 30, 2020 6:52 pm
Location: Texas
Been thanked: 1 time

Re: Volt Inverter with Lebowski Brain

Post by slow67 »

I got my boards from JLCPCB! Took longer than last time I ordered some, but they are more complex too.
Attachments
6600A3D1-CA6D-4AC6-A3BE-854BD5473081.jpeg
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Volt Inverter with Lebowski Brain

Post by arber333 »

I dont know if this falls into the correct category as it is firmware related, but since i use Volt inverter with Lebowski brain i will post it here.

Since my Lebowski drive is shaking on start i went to play with control parameters for its hyperbolic governor. Idea is to have as short as possible mode 2 range where control runs on hall sensors alone. Those create a lot of spikes in control.
Also i noticed at higher speeds Lebowski should recover but for some reason it cant untill speed falls to 70km/h. I tried to get to at least 110km/h because of traffic on both lanes of highway can deal with that speed. If you need to play with settings do read Lebowski user manual.
I also managed to get an OTG USB C cable and connected RS232 serial gizmo to my phone. Together with Android terminal app it is easier than ever to tune up my car on the road. I only could do it easier if i had Wifi connection like Openinverter :).

First i played with option h) pulse width. I found out best for my system was 165
Then i tried to change the b) and c) filters. Together with lowering i) and raising time for the pulse l) i managed to bring the recovery up to 110km/h. Now it is much safer if motor goes out of sync on highway. I can safely lower the speed to 110km/h and motor recovers every time. My settings are in the screenshot.

Next emboldened i went on to menu g) and tried to change parameters for drive 2. I noticed with recovery if i lower the gains function gets sharper but also smoother. So i changed option e) to 150 and instantly i got better start... not a whole better, but i could tell it made a difference. So i went and lowered the f) option to 10 and then to 5.

I also noticed in menu h) there is a b) filter option for drive 2. I tried to increase it to dampen the vibrations and it did help. I have it set to 220.

I still have some twiching at very low speeds, but i can now overcome them by give it more throttle and motor takes off directly.
Attachments
s-l500.jpg
Screenshot_2021-02-27-14-32-28-971_de.kai_morich.serial_usb_terminal.png
Screenshot_2021-02-27-14-32-00-214_de.kai_morich.serial_usb_terminal.png
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Volt Inverter with Lebowski Brain

Post by arber333 »

Ok, now i need to add some additional comments to summarize my use of Lebowski brain.

This weekend i went through the RLS RMF44U, commutation encoder manual here: https://www.rls.si/fileuploader/downloa ... utions.pdf

Because i just couldnt capture encoder 0° I decided i need to take apart the encoder and inspect magnet mounting and rest of assembly. Because i needed to do lots of steps quickly and by myself i wasnt able to take pictures.

What i found out...
1. I found my encoder mount had only 2 bolts fixing it to the motor case. What an error! It seems i was in a hurry and put only 2 bolts in to test the assembly and then forgot to close everything for sure.
2. I found that my magnet mount was rubbing on the encoder mount/plate on the inside. Probably because of the incorrect fitting.

I also discovered when i tightened the fittings that magnet mount protrudes just a tiny bit over encoder fitting. I couldnt torqued it more because it came to its stop on the motor shaft, So i took it off and put it in my lathe and shaved about 1mm off of the rear side. I deburred edges and tried to install it. I could set it in ok with a little play.
Sergio Fabris from RLS explained to me that magnet itself is not susceptible to high temperature and can withstand some 600°C before it looses its magnetic properties. But he also explained the optimal gap under the encoder plate is 0.5mm to 1mm. If encoder is too close or too far it would not capture correct sensor position.

Then i went on to calibrate hall sensors and i got good 0° capture with some 3° of deviation. I will need to work on that still.
But now i get really good driveoff in reverse. But i still got quite some jolt in the forward direction. That got me thinking my motor mount is to be blamed... It has large holes in its rubber to alleviate vibrations from diesel engine. Electric motor does not oscillate, but rather moves through the whole amplitude. This might move the sealant block center to its edge where it hit the metal edge... bang! Also that move is detrimental to motor position readback.
I took the mount down and filled the holes with some Sika window sealant that is elastic after drying and can withstand a lot of force. After drying off i put the mount back in the car and went for a test run.

Vibration have lessened substantially but that 3rd mount is still too soft for my liking. I think i will order replacement sealant block and push it in the mount.
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Re: Volt Inverter with Lebowski Brain

Post by Jack Bauer »

Do you have a schematic or bom for the resolver to uvw board by any chance?
I'm going to need a hacksaw
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Volt Inverter with Lebowski Brain

Post by arber333 »

Jack Bauer wrote: Mon May 03, 2021 9:50 am Do you have a schematic or bom for the resolver to uvw board by any chance?
Not directly. I will get one encoder board from kiwifiat someday now and test it on my application.
Other than that i would recommend to go by mechanical route with RLS board and magnet because it really works and is a repeatable solution for various brain options.

You would still have to machine a mount for RLS encoder PCB to go in place of resolver, but once there it is really easy to replace just the PCB and you can have sin/cos, UVW or just ABZ signal.
kiwifiat
Posts: 99
Joined: Sat Dec 22, 2018 9:39 pm
Location: Vancouver, Canada
Been thanked: 10 times

Re: Volt Inverter with Lebowski Brain

Post by kiwifiat »

Jack Bauer wrote: Mon May 03, 2021 9:50 am Do you have a schematic or bom for the resolver to uvw board by any chance?
The design files will be up on Github in the coming weeks. I''ll post here when it is done. Currently tested on the Nissan Leaf and Hyundai HSG motors that both have a 1:1 relationship of pole pairs to resolver lobes.
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Re: Volt Inverter with Lebowski Brain

Post by Jack Bauer »

Many thanks.
I'm going to need a hacksaw
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Volt Inverter with Lebowski Brain

Post by arber333 »

OK that is strange... i found another inverter that is exhibiting the same Fault output behaviour that is plaging mine. A friend asked me for my opinion.
When i connect my PCB board to Volt inverter and i apply HV i get intermittent fault signal. reset LED is blinking very fast and so inverter drops in and out of the Fault condition.

I tried to reduce signal resistor and increase pullup resistor, but the signal derives from fault transistor on the driver board. Anyone seen anything similar? Usually when IGBT is damaged i only get floating pin. Maybe only signal transistor is damaged?
I will investigate this further with my scope.
slow67
Posts: 151
Joined: Thu Jan 30, 2020 6:52 pm
Location: Texas
Been thanked: 1 time

Re: Volt Inverter with Lebowski Brain

Post by slow67 »

Sorry for the delay, life got in the way of personal projects.
Jack Bauer wrote: Wed May 05, 2021 11:11 am Many thanks.

If you're asking me, I can share my design no problem, but I'm just using a Teensy and generating the UVW signals with it. I'm calculating the angle, applying the MTPA formula and then outputting that to the UVW signals (the complex math it can do in hardware, so no calculation delays). My plan also taking in the temps from the Volt inverter and motor, and sending them to the Big L also.

Basically Im using the Teensy 4.1 as a gateway to the entire outside world (I have analog inputs, but eventually migrate to CANbus).
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Volt Inverter with Lebowski Brain

Post by arber333 »

TheRealJohnnyB
Posts: 3
Joined: Wed Nov 03, 2021 7:28 pm

Re: Volt Inverter with Lebowski Brain

Post by TheRealJohnnyB »

slow67 wrote: Tue Jun 29, 2021 11:48 pm Sorry for the delay, life got in the way of personal projects.
Jack Bauer wrote: Wed May 05, 2021 11:11 am Many thanks.

If you're asking me, I can share my design no problem, but I'm just using a Teensy and generating the UVW signals with it. I'm calculating the angle, applying the MTPA formula and then outputting that to the UVW signals (the complex math it can do in hardware, so no calculation delays). My plan also taking in the temps from the Volt inverter and motor, and sending them to the Big L also.

Basically Im using the Teensy 4.1 as a gateway to the entire outside world (I have analog inputs, but eventually migrate to CANbus).
Any updates with your project? Send me a message.
Post Reply