My homebuilt VFD progress

AC, DC, amps, volts and kilowatt. It's all discussed in here
User avatar
BigMouse
Senior Member
Posts: 600
Joined: Thu, 28 Oct 2010, 02:39
Real Name: Vincent Tannahill
Location: Silicon Valley
Contact:

My homebuilt VFD progress

Post by BigMouse » Fri, 16 Nov 2012, 22:12

Thanks for the link Johny. If your problem was caused by a weak DC bus, I'm sure it's not the same as mine. I'm running on batteries, though they are "small" batteries. Only 4ah, but the battery current when this happens is only around 12a at the most, which is 3C. But these are A123 18650 cells, 3C is nothing to them.

This thread has some good information that seems on-topic. They seem to be suggesting that inductance is the culprit and that I may need external inductors. That is less than ideal, honestly. There is a local transformer fabrication shop whose owner is keen to help me out, so I may ask him about borrowing/buying some inductors to test that idea.

I wonder if it would be worth trying (or safe) to hook up the phases of my 11kw motor in series with the phases of my "big" motor. the wires in that motor are a lot thinner than the massive cables that my "big" motor is wound with though.

EDIT: I imagine putting my other motor's phases in series would cause a very large voltage drop, and not be an accurate method.

EDIT 2: Yeah, just tried it. No motion from the "big" motor. The 11kw one moved slightly at low frequency. Will see when I can get to the transformer place and ask about inductors I guess, unless anyone else has any ideas.
Last edited by BigMouse on Fri, 16 Nov 2012, 11:45, edited 1 time in total.

User avatar
BigMouse
Senior Member
Posts: 600
Joined: Thu, 28 Oct 2010, 02:39
Real Name: Vincent Tannahill
Location: Silicon Valley
Contact:

My homebuilt VFD progress

Post by BigMouse » Fri, 16 Nov 2012, 22:52

Just measured my "big" motor's phase inductance with the cheap little handheld LCR meter I got from China.

It shows 350uH between any two terminals, which means 525uH per winding. As a comparison, the Tritium Wavesculpter specifies 50uH minimum phase inductance, so the inductance of the motor shouldn't cause any problem with the controller, though is could still be causing the problem with the surging.

User avatar
jonescg
Senior Member
Posts: 3027
Joined: Thu, 21 Jan 2010, 23:05
Real Name: Chris Jones
Location: Perth, WA.

My homebuilt VFD progress

Post by jonescg » Fri, 16 Nov 2012, 23:10

I've seen some small outrunner motors with 12 uH! Tough to find a motor controller good enough to not blow up...
AEVA National Secretary, WA branch chair.

User avatar
BigMouse
Senior Member
Posts: 600
Joined: Thu, 28 Oct 2010, 02:39
Real Name: Vincent Tannahill
Location: Silicon Valley
Contact:

My homebuilt VFD progress

Post by BigMouse » Sat, 17 Nov 2012, 00:21

While playing around with my controller just now, fooling around with different settings, I had my first desaturation event! It was quite audible, I think the cables jumped a bit, but my little red LED on the circuit board came on, the controller shut down, and the contactor opened without any sparks, exactly as it was programmed to do.

This has happened to me before on previous versions of the controller, and always resulted in blown IGBT modules (and lots of money spent replacing them). This time though, the HCPL 316s did their job and performed a safe shut-off of the offending IGBT, while the FAULT signal caused the microcontroller to trip. I restarted everything and it ran again. While the desat event was not intended or welcomed, the fact that I'm not spending a few hundred dollars on new IGBTs is excellent news!

Who would have thought a code glitch could be so exciting ;-) (no pun intended)

I think it's time now to bring the laptop back inside and have a good sit and think about my code and what to do from here. Perhaps it's time for some more reading on FOC/SVM. I wonder if that's any easier to implement than V/Hz (doubtful)

Stiive
Groupie
Posts: 295
Joined: Wed, 31 Dec 2008, 08:26
Location: Melbourne

My homebuilt VFD progress

Post by Stiive » Sat, 17 Nov 2012, 01:25

BigMouse wrote:

This thread has some good information that seems on-topic. They seem to be suggesting that inductance is the culprit and that I may need external inductors. That is less than ideal, honestly. There is a local transformer fabrication shop whose owner is keen to help me out, so I may ask him about borrowing/buying some inductors to test that idea.


We had to do this on our SAE motor, its hard/expensive to find 200A rated inductors that are small/light enough to put on a car. We got some custom wound. In the end we ended up rewinding the motor cus it only had like 10uH and was hard to control even for tritium.

This isn't your problem though IMO, id say its something to do with code. (again)
Rgds,
Stiive

Stiive
Groupie
Posts: 295
Joined: Wed, 31 Dec 2008, 08:26
Location: Melbourne

My homebuilt VFD progress

Post by Stiive » Sat, 17 Nov 2012, 01:26

BigMouse wrote: While playing around with my controller just now, fooling around with different settings, I had my first desaturation event! It was quite audible, I think the cables jumped a bit, but my little red LED on the circuit board came on, the controller shut down, and the contactor opened without any sparks, exactly as it was programmed to do.


What makes this happen? Sounds like a glitch in the code to me....
Rgds,
Stiive

User avatar
BigMouse
Senior Member
Posts: 600
Joined: Thu, 28 Oct 2010, 02:39
Real Name: Vincent Tannahill
Location: Silicon Valley
Contact:

My homebuilt VFD progress

Post by BigMouse » Sat, 17 Nov 2012, 01:36

Stiive wrote:
BigMouse wrote: While playing around with my controller just now, fooling around with different settings, I had my first desaturation event! It was quite audible, I think the cables jumped a bit, but my little red LED on the circuit board came on, the controller shut down, and the contactor opened without any sparks, exactly as it was programmed to do.


What makes this happen? Sounds like a glitch in the code to me....


I agree. Tracking it down now.

Stiive
Groupie
Posts: 295
Joined: Wed, 31 Dec 2008, 08:26
Location: Melbourne

My homebuilt VFD progress

Post by Stiive » Mon, 19 Nov 2012, 16:01

Howd you go? I see you've been looking up FOC on youtube... good choice
Rgds,
Stiive

User avatar
coulomb
Site Admin
Posts: 3779
Joined: Thu, 22 Jan 2009, 20:32
Real Name: Mike Van Emmerik
Location: Brisbane
Contact:

My homebuilt VFD progress

Post by coulomb » Mon, 19 Nov 2012, 17:10

BigMouse wrote: I get a "pulsing" or "surging" of the motor speed.

I've verified that the phase voltage is oscillating with the same frequency as the motor pulsation (2-5Hz, depending on the running frequency). Whether this is causing the pulsation, or due to the pulsation, I can't tell.
Right. Surging speed will cause surging back EMF, which you need to follow to prevent even-more-surging current.
Any thoughts?

It sounds like a control problem to me. Do you have a PID or PI control for the current?

We can get surging in our MX-5 if we don't get the "vehicle mass" parameter right in the motor controller configuration. Obviously we need a vastly different setting for if the motor is loaded (driving the car) or not (on the bench, in neutral).

If your control software doesn't take into account the mass of the vehicle, then it possibly isn't sophisticated enough.

It sounds like your low level controls are working OK now, so you can set a modulation index and phase, but your higher level controls (including but not exclusively ramping the current sensibly) may need refining.

Think about it: you command a step increase in speed, so you need more torque and hence current. So you deduce you need a higher voltage and more slip, and apply those, but the current will increase depending on how fast the back EMF increases, which depends on how fast the speed increases, which depends on inertia from the load. If the current goes up too fast, you will overshoot your target speed (much more easily with no load), so then you have to reduce the current, and you may well undershoot the speed. The result is oscillation or surges, and the peak currents can be quite high.

If you are reacting to the back EMF rather than predicting it, it may not be fast enough, but I'm speculating here, as this is not my area of expertise. Something similar would happen with slip; it depends on the instantaneous speed of the rotor, and again measuring the speed after the fact may not be fast enough, especially with no load.

All I know is that this stuff is tricky, and involves a lot of tuning and compromises. Just getting our PID algorithm right for pack charging current was tricky enough for me. I was initially keen to attempt our own motor controller for the MX-5, say based on the New Zealand design, but Weber has had enough (indirect?) experience with high power controller design to want to leave it to the experts. I'm not saying that the several DIYers developing AC motor controllers should give up, just that they should expect to come across problems like this. And I'm sure you'll sort it out in time.
Nissan Leaf 2012 with new battery May 2019.
5650 W solar, 2xPIP-4048MS inverters, 16 kWh battery.
1.4 kW solar with 1.2 kW Latronics inverter and FIT.
160 W solar, 2.5 kWh 24 V battery for lights.
Patching PIP-4048/5048 inverter-chargers.

User avatar
BigMouse
Senior Member
Posts: 600
Joined: Thu, 28 Oct 2010, 02:39
Real Name: Vincent Tannahill
Location: Silicon Valley
Contact:

My homebuilt VFD progress

Post by BigMouse » Tue, 20 Nov 2012, 00:02

Stiive wrote: Howd you go? I see you've been looking up FOC on youtube... good choice


I have indeed been researching FOC. I think I'm getting my head around it. Spent several hours last night studying it, was thinking about it as I went to sleep, dreamt about it last night, and was still thinking about it this morning. That's a good sign (that I'm nuts) ;-)
coulomb wrote:
BigMouse wrote: I get a "pulsing" or "surging" of the motor speed.

I've verified that the phase voltage is oscillating with the same frequency as the motor pulsation (2-5Hz, depending on the running frequency). Whether this is causing the pulsation, or due to the pulsation, I can't tell.
Right. Surging speed will cause surging back EMF, which you need to follow to prevent even-more-surging current.
Any thoughts?

It sounds like a control problem to me. Do you have a PID or PI control for the current?

(snip)

If you are reacting to the back EMF rather than predicting it, it may not be fast enough, but I'm speculating here, as this is not my area of expertise. Something similar would happen with slip; it depends on the instantaneous speed of the rotor, and again measuring the speed after the fact may not be fast enough, especially with no load.


It does the same surging whether I attempt to compensate or not. As in, I set the output frequency and voltage to a set value using no feedback and it does the exact same thing. I'm not "controlling" the current, only the voltage in accordance with constant V/Hz. Current is measured and used to trip the controller if limits are exceeded.

Like I mentioned above, I'm studying up on FOC, and I'm confident that the XMEGA processor I'm using is capable of implementing it with no other changes in the hardware.

Unfortunately, today I started what will be my full-time job for the summer, and I won't have a lot of time available for this project until February. Still, I'll continue my research, build an algorithm (which seems like it will have to include motor identification/characterization algorithms in order to identify the motor parameters needed for FOC), and do some testing when I get the time.

User avatar
coulomb
Site Admin
Posts: 3779
Joined: Thu, 22 Jan 2009, 20:32
Real Name: Mike Van Emmerik
Location: Brisbane
Contact:

My homebuilt VFD progress

Post by coulomb » Tue, 20 Nov 2012, 03:27

BigMouse wrote: I'm not "controlling" the current, only the voltage in accordance with constant V/Hz.

Oh, right. I think constant V/Hz might be too unsophisticated for an unloaded motor, especially if you change the Hz (electrical) abruptly.
Nissan Leaf 2012 with new battery May 2019.
5650 W solar, 2xPIP-4048MS inverters, 16 kWh battery.
1.4 kW solar with 1.2 kW Latronics inverter and FIT.
160 W solar, 2.5 kWh 24 V battery for lights.
Patching PIP-4048/5048 inverter-chargers.

Stiive
Groupie
Posts: 295
Joined: Wed, 31 Dec 2008, 08:26
Location: Melbourne

My homebuilt VFD progress

Post by Stiive » Tue, 20 Nov 2012, 03:29

coulomb wrote: I think constant V/Hz might be too unsophisticated


QFT.

Image
Rgds,
Stiive

User avatar
BigMouse
Senior Member
Posts: 600
Joined: Thu, 28 Oct 2010, 02:39
Real Name: Vincent Tannahill
Location: Silicon Valley
Contact:

My homebuilt VFD progress

Post by BigMouse » Tue, 20 Nov 2012, 04:16

Yeah, I'm coming to that conclusion as well. At least I got my hardware side sorted, at least schematically. Need to play with the layout/packaging a bit on the next version, but it all seems to be working.

FOC is on the way!

Stiive
Groupie
Posts: 295
Joined: Wed, 31 Dec 2008, 08:26
Location: Melbourne

My homebuilt VFD progress

Post by Stiive » Wed, 21 Nov 2012, 00:26

BigMouse wrote: Yeah, I'm coming to that conclusion as well. At least I got my hardware side sorted, at least schematically. Need to play with the layout/packaging a bit on the next version, but it all seems to be working.

FOC is on the way!


You cant implement it on the current version? What revision is this?
Rgds,
Stiive

User avatar
BigMouse
Senior Member
Posts: 600
Joined: Thu, 28 Oct 2010, 02:39
Real Name: Vincent Tannahill
Location: Silicon Valley
Contact:

My homebuilt VFD progress

Post by BigMouse » Wed, 21 Nov 2012, 00:45

Stiive wrote:
BigMouse wrote: Yeah, I'm coming to that conclusion as well. At least I got my hardware side sorted, at least schematically. Need to play with the layout/packaging a bit on the next version, but it all seems to be working.

FOC is on the way!


You cant implement it on the current version? What revision is this?


I can! The hardware is good, just need to write new code for it. I'll revise the hardware layout just to improve packing (so it fits better in available extruded enclosures)

User avatar
BigMouse
Senior Member
Posts: 600
Joined: Thu, 28 Oct 2010, 02:39
Real Name: Vincent Tannahill
Location: Silicon Valley
Contact:

My homebuilt VFD progress

Post by BigMouse » Mon, 11 Feb 2013, 03:40

FOC is now running on my controller, and the BIG motor can finally be run at low and high speeds without shuddering and jerking. Very pleased!   Image

I've got some tuning of parameters to do now, but I'd very hard to do without a load on the motor.

Tuning parameters:
Motor constant "C" (from rotor time constant and period)
Proportional gain ("Kp" for PI controllers on Id (flux) and Iq (torque) currents)
Integral gain ("Ki", same as above)
Pedal map (Sets Iq setpoint based on accelerator position vs motor speed, 11x11 look-up table with interpolation between points)
Flux map (Sets Id setpoint based on Iq setpoint and motor speed, 5x5 look-up table with interpolation between points. This is to tune for efficinecy at low low and over fluxing at low speed if desired)

I've got it to the point where it will start and run unloaded, with relatively sluggish response at low rpm, but once it breaks about 60Hz it becomes unstable and just takes off, tripping on phase overcurrent at around 120Hz. It takes a small fraction of a second to spin up from 60-120Hz and it seems to happen at the same frequencies every time, without much variation as I play with parameters. My value for "C" was based on some numbers posted in the "chinese motor controller" thread. I can play with the value with varying effect, but it seems happiest around 3000. A bit higher or lower and it tends to trip easier. I've played with PI gains all over the place, from Kp of 0.05 up to around 3 or 4 and Ki from 0 up to 100. The effects of the changes I make are very obvious as far as how the torque comes on and how smoothly the motor runs. Too high a Kp causes unstable currents and very quick OC trips. Too high Ki is silky smooth, but the reaction time is very slow and it doesn't recover very well to fast changes in setpoints. The Id and Iq currents track well and with Kp set to about 0.7 and Ki set to 20, I get a rise time of around 20mS to a step input. I've filtered all the setpoints so that no step inputs will really occur though.

Any tips from my fellow controller tinkerers about a methodology to go for in setting these parameters? I think building a motor-ID algorithm is probably a bit beyond me at the moment. I haven't had a chance to really sit down and read through the many papers on the subject yet, and it's more fun to tinker with numbers in real time anyway ;-)

A lot of the information I used to build the code up from scratch I got from here: http://sourceforge.net/apps/mediawiki/t ... ed_Control and the Wikipedia article on FOC.

I imagine with a load on the motor, tuning will be much easier as I'll be able to try different settings with the motor in a steady state. I've started building a second controller and will use that to drive a similar motor coupled as a load. It'll be my poor-man's dyno. While I wait for the parts, I'll probably work on moving the tuning parameters in to the EEPROM rather than having them hard coded in the firmware. That'll let me change the parameters on the fly via the CAN bus rather than having to re-program the AVR each time I make a tweak.

Just thought I'd share the good news. I feel like I'm really on the home stretch now with this controller. At least in being able to use it to produce some usable torque! I've got big plans for it, and a long list of features I plan to include, but I have to get it running reliably and producing torque in a well-controlled manner before I start working on the bells and whistles ;-)

User avatar
BigMouse
Senior Member
Posts: 600
Joined: Thu, 28 Oct 2010, 02:39
Real Name: Vincent Tannahill
Location: Silicon Valley
Contact:

My homebuilt VFD progress

Post by BigMouse » Sun, 03 Mar 2013, 19:00

Youtube link

A quick demonstration of my motor controller. The video shows the built-in capacitor precharge, contactor control, and a brief spin up of the motor. Further motor parameter tuning is required, but this is the first video with Field Oriented Control (FOC) implemented.

Post Reply