Friday, December 21, 2012

Motor Controller Part 4: More Testing

On the forum where the control board I'm using was developed, there are quite a few stories of people doing very bad things to their car because they didn't properly test their controller before hooking it up.  One guy even instantly destroyed 1000's of dollars worth of batteries because things weren't set up right.  I'm trying to avoid that with a lot of small steps as I test it.

Of course, that doesn't mean I don't have a touch of redneck to my setup.  I've gotta make sure this isn't what it looks like when it's hooked up in the car.

I started off hooking up a very small 12v lead acid battery and a small motor used for starting RC plane engines.  After getting the motor hooked up the right way it works!  Next step, a 120v DC treadmill motor and a car battery.  Still no smoke!  Now that I'm confident things are working it's time to boost the voltage.  I have a bunch of 3 cell lithium batteries for electric RC planes, so Joe and I string them together to boost the voltage.  One at a time we raise it up until we're out of alligator clips and reach 70 volts.  Still working well!

We also checked a few other things along the way.  First, I want to see if all three drivers are turning on and off at the same time.  If one turns on or off before the others, that means for a certain amount of time all the current has to flow through 2 IGBTs instead of just one, or worse, all through one IGBT.  If that happens when I'm commanding 800 amps, something is bound to blow up.  The oscilloscope tells us that all three are synchronized to within about 20 nanoseconds (0.00000002 sec).  I'm going to assume that's good enough.

Next, I want to see how long it takes for the IGBTs to turn on and off.  This is important because the time between the on and off state creates heat. You can adjust this time by changing the gate resistor.  Right now I have 5 ohm resistors for both on and off directions.  If you reduce the resistance, it will draw more current and switch faster, of course, that has its limitations.  The driver can only provide so much current, so you are limited there.  Also, the faster you turn off, the higher the voltage spikes you will see (that's bad).   If memory serves, they currently turn on in 80 ns and turn off in about 150 ns.  The driver provides 15v to turn on and -8 volts to turn off, so that makes sense with the same resistance. 

So that brings us to the next thing to look at: how high are the voltage spikes?  All my parts are rated for 600v.  That means the highest battery pack voltage plus any voltage spikes need to be well clear of 600v.  My battery pack will be about 235 volts and I'm seeing 10-15v spikes so far.  Sounds good except I'm only able to drive about 20 amps so far.  The voltage spikes go up with more current and I want to eventually get to 800+ amps.  Unfortunately, I forgot to take some o-scope pictures of this.  We had a fun time trying to get the current higher.  Joe held a block on the output shaft of the motor to try and slow it down.  Almost immediately we smell something burning and freak out.  Luckily (after about 5 minutes of sniffing around) it turned out to be the wood block!

Next step...hook it up to Joe's 150v battery pack in his electric car and try and spin a Warp 9 motor!  But that'll be another day.

All the testing I listed was actually done over two different days.  After the 12 volt tests I was happy enough that I decided to "finalize" the build of the controller a bit more.  I tore it down completely and tin plated the copper parts to keep them from corroding.  Here are some pictures as I put it all back together again.

Here's my awesome water plate.  You can see I've epoxied the thermal sensor in the milled out channel.

Here's the other side with the thermal probe wire coming out.  Notice all the heat shrink for strain relief.


Flipped back over, now I've added some RTV gasket maker.  Please, please, please keep the coolant on the inside!

After 20 minutes with a screwdriver I've got 22 screws holding it down.  That's 22 of the over 50 tapped (threaded) holes I put in this thing!

Flipped back over, now we've got thermal grease to keep the IGBTs in good contact with the water plate so it can take the heat away.  (Apologies to my thermodynamics teacher who is crying right now due to the wording of that last statement.)

IGBTs are screwed on.  One screw in the upper left corner actually penetrates into the liquid passages because I didn't realize how deep the pipe thread hole would have to be.  To seal that off, I just filled the hole with RTV before putting the screw in.  Hopefully that holds or this puppy will fill with antifreeze!

Now I've got the bus bars attached.  See those vertical plates?  Those attach to the capacitors.  Making them flat and close to each other like that's supposed to reduce "stray inductance" which make more (bad) voltage spikes.  Bad voltage spikes!  Now you can see how crappy the tin plating came out.  I think the claims that it covers 600 sq inches was super optimistic.  As a result I've got really splotchy coverage, but I think it'll be fine.

Now I've got those huge capacitors hooked up.  All the bolts, washers, and nuts I used to hook this stuff up was stainless to reduce the risk of corrosion.  To make it worse, they're all metric, so there's probably $20 of fasteners right there!  I didn't keep track, and don't even want to know how much I spent on screws and washers on this controller...

 Alright, now we have the IGBT driver board mounted and all the clips hooked up.

Almost there, but it's time to play Settlers of Catan over Skype with Todd and Amy in Seattle...

Too much pumpkin porter while playing Settlers, so picking things up the next morning.  Here we've got the Paul and Sabrina control board mounted to the outer wall of the controller.  I omitted the MOSFET driver parts and just tapped into the inverted PWM signal.  Split that three ways and that goes into the IGBT drivers.  Everything plugged in?  Doh, forgot the thermal sensor.

Woo hoo!  All hooked up and screwed together.  Lost of wires in there...hope it all still works!

I've already tested it and it does work, so you can rest easy tonight.  And it's done!  I put some nifty labels on the bus bars so I don't hook up the battery wrong and melt down my battery pack.  Thanks dad-in-law for lending me this label maker!

Whew, that's it for today.  Hopefully I'll get a lot done over the Christmas break.  And that reminds me, Merry Christmas!!!

Sunday, November 25, 2012

Motor Controller Part 3: Building and Testing

I've been really busy lately working on the motor controller.  Here's what I've been up to.  I need a way to mount the IGBT drivers so I cut out some holes in a sheet of aluminum.  It's very important that nothing on these driver boards touch anything metal or you run the possibility of having the battery pack connecting to the chassis of the car.  My solution was these complex holes.


Joe drew up these PCB designs and had half a dozen of them made.  Here you can see one fitted onto its mount.  I put some rubber grommets in the holes as an extra measure of precaution even though the holes shouldn't conduct.


Here you can see the driver mount attached in the controller along with the control board.


And another side view of how everything is going to line up.


Next I had to make the bus bars.  The bus bars are 3/4 x 3/8 bars of solid copper with a couple holes drilled in them.  Two of these bars need to be connected to the capacitors, so there are thin sheets of copper that are soldered to the sides of them, then bolted to the caps.  You can see all that assembled in this next picture.  You can also see I've soldered in the parts for one of the IGBT drivers, and I've drilled and tapped a pair of pipe thread holes to pump water through the cooling plate.


Today was an exciting day for me.  I got the controller together enough to actually get to test it!  Joe came over to help out and we started the afternoon by hooking the laptop up to the control board to program the microcontroller.  Here's a look at the mess I made of the dining room table.


To do that you have to give it power, so I cross my fingers and plug in the 12 volt supply.  And to my delight, the green power LED turns on and no smoke comes out.  The programmer identifies the microcontroller, so that's a good indication I didn't damage it while soldering it in place.  There is one more yellow "status" LED that turns on after the controller is programmed.  This one blinks to tell you something is wrong or stays steady if everything is ready.  I got a cheap potentiometer to mimic the throttle pot and hooked that up and I get the steady "system ready" signal!  Joe has an oscilloscope that he brought over and we hooked it up to the output signal.  We should expect a signal between 0 and 5 volts and it should look like a square wave form if the potentiometer is in the right spot.  Amazingly that works too!  Here's a shot of the 15.6 kHz square wave as the controller tries to drive the commanded current.


There's also a serial port connection on the controller that you can hook up to a computer.  There's a program you can run to monitor certain parameters of the controller and all seems to be working.  I can turn the potentiometer and see the throttle position go up and down and the current command cycle back and forth from 0 to 511, and the thermistor reads a constant 73 °F.  I'm a bit amazed that out of hundreds of solder connections I haven't screwed anything up (yet).

My next task is to hook up the IGBT drivers and see if I can get a 0-15v PWM signal out of there.  If that goes well I can hook that output to a single IGBT and see if I can drive a load into a resistor or small motor. We've run out of time for the day, but it's been a satisfying holiday weekend.

Sunday, October 28, 2012

Motor Controller Part 2

If you like to look at pictures more than hear me ramble on and on about "science" then this is your lucky day!  (Edit: I lied, there's always going to be some amount of rambling)  I'm playing a little catch up from the last few weeks of work on the controller, but here it is.  The motor controller has two basic parts to it.  There is a control board, which is like the brain, and there is a power section that does the real work.  The brain comes from the printed circuit board below that I bought from a guy online named Paul.  He conceived of the idea to get a community of people online to help design and develop a low cost do it yourself motor controller that costs a fraction of what a commercially made one does, and had the drive to make it a reality.  My friend, Joe, has one of the beta controllers in his electric car and it's been running great for about three years now.  There is a wiki with a list of all the parts you need to buy to put it together, and I've got all those parts now.  Let's condense a 2 cubic foot box full of parts into an 8 x 3 x 0.7 inch circuit board!


Here's my setup.  I decided to splurge on a nice temp controlled soldering station to put it all together.  Way better than the cheap pencil iron I've been using for the last decade.  I apparently never took a picture of the board done, but trust me.  Okay, may you shouldn't trust me.  I never took a picture of it completed because it turns out I was missing two pieces that I'll have to order later!  I also soldered one of the parts in the wrong orientation, and two pieces I put in the wrong place.  Luckily I know someone who knows how to fix this all too well who brought their desoldering iron over.



Ok, control board is done (mostly).  Next up is the power section.  The official DIY controller uses 10 MOSFETS rated for 50 amps and 200 volts a piece to get up to 500 amps of continuous output safe with a battery pack about 150 volts nominal.  In order to get more torque, I want to pump more current through it, and to get more power I want to put a higher voltage in there.  To do that I've traded the MOSFETS for 3 IGBTs that are rated for 400 amps and 600 volts a piece.  By changing out the current sensor I can trick the controller into delivering 833 amps without reprogramming it.  If I do reprogram it, I'll be limited by how well I can balance the load on the IGBTs, but let's not get ahead of ourselves...  The control board basically tells the IGBTs to turn on and off, and the percentage of time spent on determines how much power gets to the motor.  Each time the IGBTs turn on or off, there is some waste heat generated, and if you don't get rid of it they'll eventually burn up.  To take care of this, I'll be mounting them directly to a liquid cooled water plate.  Lucky for me, I have a super nice friend at work who offered to make me one on his CNC mill (actually a router).  All I had to do was model it and get him a block of aluminum.  A couple weeks ago he brought this test run machined in foam!  Pretty cool huh?  Water flows in on the left and out on the right.


Last week I he came in to work with a present for me!  Here's the real thing after about 3 hours on his CNC router.  I just had to finish it up by drilling and tapping about 50 holes.  Oh, and see that funny little groove in the middle (in the yellowish light reflection)?  That's a channel to let me route the wires for a temperature probe.  It tells the controller how hot things are getting and it'll pull back on the power if it's getting out of hand.


After a few hours of making holes, I started mounting stuff to it to see how it fits.  Here you can see  the three IGBTs on bottom and three really big capacitors mounted on a plate above them.  Soon I'll put the bus bars across the IGBTs and link them to the capacitor using some parallel sheets of copper.  Looking good!  I'm excited, are you?


In the above picture, you can see a couple sharpie lines.  I won't get into why, but I have more machining to do to help mount other stuff and make it lighter.  My first friend's CNC router is relatively small and takes a fair amount of time to remove material, so taking out a lot, like I'm planning, would take him a long time.  Lucky for me, I have ANOTHER great friend with a mill!  This one is a lot bigger.  I took the water plate over to his place and made it even lighter.  While I was working on it, my buddy snapped a few photos.  I look a little manic in this one.


Now I'm really working.  You can tell cause I'm using both hands.  You can see the blue tub of Bo Lube, which is some kind of paste that Boeing developed.  A lot nicer and cleaner than spraying WD-40 or cutting oil all over the place.


There, 5 or 6 cubic inches of aluminum turned to sawdust...er, aluminum dust.


Since then I've been working on the enclosure for the controller and mounting the control board, but no pics so far.  I also have some bad news regarding the car.  Apparently I did NOT win the war with the spiders...


AAAAAAHHHHHHHHHHHHH!!!!!!!


Monday, October 8, 2012

Where's it all gonna go?

This post is mostly about me looking at piles of parts wondering how it's all gonna go together, but we're gonna get started with the latest news on the war...

I'm making major progress in the war with the black widows but I'm not sure if it's over.  I killed 12  of them and one egg sac with brake cleaner a stick and one brick, but that was getting me nowhere.  So two days ago I cleared out all the webs and soaked the car with Suspend SC (designed to kill scorpions - yeah, been there).  The next morning, no new webs, though this evening I was taking a closer look and found a few hidden ones.  I'm hoping I just missed those during the initial sweep, but if they're back tomorrow it's time for another round of spray.  Enough with the critters, let's see some pictures!

I finished the duct that feeds air from the blower fan into the motor and it looks sweet!  Check out that rivet job!  The motor will be keeping cool just in time for the cool weather...

Ok, now I've hit a major decision point.  I have a massive and growing pile of boxes of stuff that's gonna go in the car, but just about all of it can fit in the left over nooks and crannies.  It's time to decide where to put the batteries.  I mentioned it before, but there is a new variant of the CALB cell that came on the market a few months back.  Supposed to be better efficiency, lower voltage sag, more cycle life, more more more better.  It's all perfect except they don't come in the cell size I was planning on.  But they have one close, so I think I'm going to opt for the higher pack voltage.  The components in the power section are rated for 600 volts and my pack should have a max charge of 3.65 x 70 = 255 volts.  Should be plenty of headroom for any spikes.  The only thing I have to keep an eye on is to make sure the voltage at the motor is less than 170 volts at all times.  I've got a plan for that, so let's do it!

Ok, so where are they gonna go?  Let's start with weight.  Each cell is about 2 kg, so the full pack will weigh 140 kg or 309 lb.  Interesting enough, the "equivalent" pack of the other cells was supposed to be 340 lb, so maybe these cells are lighter per kWh that the others?  Way back when I took everything out, I weighed it all so I'd know how much needed to go back in to get the distribution right.  It turns out I need about 120-130 lb of batteries under the hood to match the old weight.  That comes out to 40% of the pack, or 28 cells.  Yikes, that's a lot to fit in there!  Time to see where they're gonna fit.  After a LOT of measuring, I think I have an answer.  I made some cardboard boxes that are as close as possible to the actual size of the motor controller and the batteries and dropped them in place.  I should just be able to close the hood with these 9 inch tall batteries above the motor.


I think there's actually enough room for another row here, so I can probably fit a block of 16 on top.  Then if I take the end row (on the left in the upper picture or closest to you in the lower picture) I can fit another 4 toward the front of the car for a total of 20.  If I move the motor controller somewhere else, I can fit at least 24 batteries above the motor, but then where does the controller go?  It can go on the driver's side of the blower fan, but it doesn't fit that well over there.  It could also go where the battery currently is (upper left in the upper picture).


Another potential spot for the batteries is between the motor and A/C condenser, but then you have even hotter air blowing on those cells in the summer.  Gah!!! so many options!  I think I'm gonna need more cardboard!

My head hurts, let's talk about something else.  I've compiled a huge pile of stuff to build the motor controller, and here they are!


In the front you can see the 6 x 10 x 1 inch block of aluminum that my friend, Steve, will hopefully mill into a water plate in the next week.  On top of that are the three 400 amp IGBTs.  Behind them you can see the 3/4 x 3/8 x 42 inch bar of copper for the bus bars.  Next is the printed circuit board (PCB) that I bought from Paul and Sabrina's store.  Behind that are the three whopping 150 uF film capacitors (most expensive parts in this picture).  Then all around you can see scattered the over 100 parts that will be soldered to the PCB and the IGBT driver boards (not shown).  My goal is to have all these pieces 90% assembled by two weeks from now.  Wish me luck!

Tuesday, September 25, 2012

Starting to fill the engine compartment

The motor is in the car and I actually spun the rear wheels with a 12 volt battery!  The other good news is I think I'm winning the war with black widows since I took out 4 females and 2 males last night (shudder).  It's amazing I didn't have nightmares last night considering they're the basis for all my childhood fears.  

With the motor in, it's time to start filling the extra space under the hood.  The A/C compressor basically only has one place it can go unless I get all new hoses.  It needs to go to the right of the motor if you're looking from the front of the car.  I got a 1/4 inch plate of aluminum to mount to the front of the motor.  While I'm at it I was figuring out how to mount the blower fan.  Since I plan to run the A/C off the main motor, when I idle at a stop light it'll be going about 700 rpm.  The motor wants to go 1500-2500 rpm to properly cool, so it'll need some help.  I got this 12 volt blower fan and mounted it to the aluminum plate blowing through a hole in it.  

You can see the hole here.  I just have to make an angled duct to turn the airflow down into the motor and cover up all the extra inlet holes.

Here's the bracket I'm working on for the compressor.  I took the old compressor mount and chopped off a bunch of features I don't need.  Then I welded some angle iron to it so it can mount flush to the aluminum plate.  There's an extra "foot" that you can see on the right side.  That'll attach to the motor mount to stiffen the whole thing up a bit.


Fits perfectly!  And even better, the A/C hoses still reach the fittings.  


Pulleys line up? Check
For future reference, I'm thinking of a row of 8-9 batteries in front of the motor and behind the AC condenser, which is kind of below the fan in this pic.  Gotta clear the sway bar too.  So many things to think about!


Belt going to clear the fan?  Check


Next up I've made some cardboard boxes the shape of what I think my batteries will look like.  The original plan was to use 60 of the 70 Ah Calb cells (SE70) and put about 26 of them in the front for weight distribution.  Well, they just a few months ago came out with the CA line of batteries that are supposed to be superior.  Only down side is they don't come in the 70 Ah size!  Well maybe 192 volts wasn't enough and I should go for 70 of the 60 Ah SE cells for a nominal pack voltage of 224.

Either way, I'd like to fit 140 lb of batteries up front, and that will take a surprising about of space.  I'm starting to think I can only get about 20-21 cells in there (~100 lb) without really cluttering things up, but that'll probably be okay.

Next up I'll be making the inlet duct to route the fan air into the motor.  I'm also preparing to buy about 400 parts from mouser and digikey to build the controller board and IGBT drivers.  More on that later...

Thursday, September 20, 2012

Motor Controller Part 1: Design

In order to get power from the batteries to the motor without using a big on-off switch, you need a motor controller.  Since I'm using a higher than "average" battery pack voltage, I need a high voltage controller.  I could just buy one, but what's the fun in that?  Plus I get the chance to save a few bucks since the HV controllers start around $2500.  The concept of building your own controller comes from my friend Joe who's already built his car and controller.  Actually, it goes back earlier than that.  There's a couple called Paul and Sabrina who sell a kit that they've developed over a number of years, and that'll be be backbone for my controller.  "Unfortunately," I've taken the high voltage path, so the kit won't work for me as is.  It needs to be modified with high voltage parts and while I'm at it, might as well throw in some higher current capability, right?  I'm not sure who to give the credit to, but Joe started on this path a while back and already figured out a combination of IGBTs and capacitors that should do the trick.  I'm going to use these high power parts with the control board that Paul and Sabrina have developed to make a higher power version.  (If you want to skip the boring lecture of the day, this is a good spot to skip down to the pretty pictures...)

So what is an IGBT you ask?  It's a high power switch, kind of like a transistor if you know what that is.  To control the power going to the motor, the IGBTs are turned on and off really fast so the motor only sees some fraction of the voltage available from the batteries.  The pulses are sent at a specific frequency, and the time on and time off are varied to change the apparent voltage to the motor.  For example, if it takes 1 millisecond to turn on and off and it spends 70% of the time on, the motor will see an apparent DC voltage of about 70% of the battery pack voltage.

These IGBTs are rated for 400 amps a piece and I'm using three of them.  The IGBTs don't share the load perfectly, so I wouldn't be able to drive 1200 amps without blowing something up.  The reason for this is that the resistance of each IGBT isn't exactly the same and they're run in parallel.  So if you ask for 1200 amps, you might get 350 amps through one, 400 amps through the second, and the third blows up with 450 amps.  There are a few other factors that affect how well they share the load that I won't get into, and my design is going to be far from perfect, so I'm tentatively planning to limit the max current to 833 amps.  There's another reason for that odd number.  The controller is designed to do 500 amps max, and it has a current sensor that it uses to narrow in on the current you are commanding.  By changing the sensor with another part number, the controller will think it's driving 500 amps when it's really driving 833.  That way I don't have to reprogram the microcontroller.

Okay, enough of the boring stuff.  Here are some pictures!  This is basically what it'll look like when it's done.  The big green things are huge capacitors.  The yellow things are the IGBTs.  The orange bars are copper bus bars that the big cables will connect to from the motor and battery pack.  The dark blue thing is a the current sensor.  The light blue block is the main controller board.  The red things are the IGBT drivers.
The capacitors connect to the bus bars using some sheets of copper.  The sheets need to be parallel to each other like that to reduce "stray inductance" (bad).  Having the posts of the capacitors up and down, and having an array of capacitors (instead of one big one) further reduces stray inductance.  The reason you don't want high inductance is that this causes voltage spikes.  Voltage spikes (if too large) will fry the electronics.  These capacitors and IGBTs are rated for 600 volts, so I'm hoping ~200 volts plus spikes are okay.

The IGBT drivers (red) have to be really close to the IGBTs.  If they have mismatched lengths, the IGBTs could turn on and off out of sync, which is really bad.  If one of them stays on longer than the others, it will sink the entire commanded current!  That's bad.


The plate on the bottom that the IGBTs are mounted to is a custom water plate.  The IGBTs aren't 100% efficient, so they create heat while they work.  I'm going to plumb liquid coolant through this block of aluminum to take that heat away.  A friend from work has a CNC mill who is going to help me machine it.  He's already got it coded, so I just need to get some time to go over there.  You can see a funny slot in the middle.  There's a temperature sensor that will fit in there and feed a signal back to the control board.  If, for some reason, it gets too hot, the microcontroller will back off on the power until it cools down.


The guy helping me mill out this water plate keeps telling me I'm going way overkill on the liquid cooling.  He happens to have built an electric car himself about 15 years ago out of an old Ford Fiesta.  His was significantly lower power/voltage than mine, so his controller was passively cooled (no fans).  All of the controllers on the market with this kind of power rating are liquid cooled, so that's what I'm going with.

I've got a lot of the pieces, so I'm hopefully going to start on the fabrication of all that structure you see in the pictures really soon.  I still need to order a control board kit and learn to solder, but that's for a post another day.

Wednesday, September 19, 2012

Dashboard Repair Part 2

We were treated to an unseasonably cool day a week ago (high of 80°) so I took the opportunity to work on my dashboard.  I hadn't finished this because it involves epoxying the edges of the vinyl cloth down to the dashboard and it smells too bad to do it inside and it's been way to hot to do outside (epoxy cures really fast).  But today was perfect.  I started on the windshield side that's hard to notice if I screw up.  I've got 4 small clamps, so I'm limited to about a foot at a time.


That worked out well so I started on the front side.  I'm using small balsa sticks to help distribute the load.


It's 8 minute epoxy so after 2 hours or so of going in and out, this is the final product!  Looks pretty good huh?  I'm not sure you can see, but there are two patches that need to be spliced in that I'll do another day.  I also have to cut out the defrost holes.  Soon I can put the interior back together!