Sunday, October 18, 2009

Last-In, First-Out: Charger / Balancer

I normally don't wrap-up projects in reverse order from when I start them, but the charger/balancer is going to be an exception for a few reasons. One: It works okay as-designed, since it's really simple. Two: It is still annoying to use and in all honestly I probably won't.

The point was to solve two problems with charging a medium-sized lithium iron phosphate battery pack. The biggest problem is the lack of small, inexpensive constant-current/constant-voltage power supplies that also plug into the wall. (Think laptop adapter size.) Thanks to the wonderfully cheap Meanwell PLC-series LED supplies, this was easy to solve. I got a 100W version, which can put out 2.65A (regulated to this current at anywhere from 30-36V), or about 0.6C for my battery pack. This means a < 2-hour charge, which is pretty good for a very portable charger that plugs straight into the wall. There's just one small problem:

Why are my ears ringing at night?

For whatever reason (cheap electronics) the Meanwell LED supply goes into a very noisy switching routine in constant-current mode, and the frequency of switching happens to be about 1,700Hz. Fun fact: The human ear is most sensitive to frequencies around 2kHz and three times more sensitive to this frequency than to middle C (262Hz). Basically, if I wanted to torture someone with a particular tone, this would be it. The good news is that you can tell when it switches over to constant-voltage mode, because the 1,700Hz fades away leaving only a faint and relatively pleasant high-frequency voltage regulation circuit.

The second part of this project was the balancer. The balancer was a very cool idea. It used the LTC-1440, a comparator with a built in voltage reference, to detect overvoltage and trigger a power draining transistor. Said power transistors were 44H11s, which are very solid NPN transistors with h of well over 100. The base circuit is described in more detail in my last post. And, well, it works just fine:

What would I do without MATLAB?

The current starts to flow through the transistor at about 3.55V and reaches a peak value (set by a resistor) at about 3.60V. The peak value in this case was set to just about 2.2A, which is what the Meanwell supply was to be set to. At such a current, the transitor would be required to dissipaye 2.2A*3.6V=7.9W. That's a lot, but not unreasonable with a heat sink and fan:

Baby heat sinks.

The boards stack nicely and a modestly powerful 120mm case fan blows air across them. Tested at 2.2A for over 30 minutes, the steady-state temperature of the transistor's tab settled at about 55ÂșC. That suggests it could be pushed a bit harder, probably all the way to the 2.65A limit on the Meanwell supply. This would just require changing the 220-ohm base resistor to something a bit smaller.

So what's the problem? (There must be one.) Well for one, something is killing the LTC-1440s. My best guess is it's the fan or the 12V switching regulator that powers the fan, or some combination of the two. With the fan disconnected or running from a separate 12V supply, the problem does not present itself, even after multiple connect-disconnect cycles. The symptoms are: only the circuits connected to the top three or bottom two cells fail, and they stop producing a reference voltage or an output after some small number of connect-disconnects. Could be momentary overvoltage, made possible somehow by the switching regulator connected across the whole cell stack and depending on which side (high or low) makes contact first.

I really don't know. Normally that would bother me, but as I was testing this thing I realized that I also don't care. The biggest problem is that it's too damn big. The whole portability aspect is gone, and forget about taking it through an airport (or out in public in Boston) with all the circuitry and wires. Not much I can do about that...a cell balancer needs as many wires as there are cells (plus one). And the transistors definitely need heat sinks and a fan to balance at any reasonable current. So forget it! For now anyway, I can live without it.

"But how do you keep the cells balanced?" I don't. Every once in a while I might drain or charge ones that are way off with a power supply.

"But how do you keep the cells from overcharging?" I feel like if I explain the method, somebody will try it and blow up their cells... It involves setting the charger CV so that, worst-case, no single cell can exceed a certain voltage. For example, if the pack is at 33.50V, and the highest cell is at 3.37V (measured), I set the charger to 33.50 + (4.20V - 3.37V) = 34.33V. This is more than enough voltage overhead to put it into CC mode, where it sits happily for a long time before I have to readjust the CV based on a new worst-case measurement. If none of that made sense to you, you should probably invest in a user-friendly charger/balancer. :)

Anyway, back to other things:

Going to the SMMA 2009 Fall Technical Conference in two weeks. Mildly frightening, but I am looking forward to the immersive motor experience. Definitely a post in the works after that.

The 3ph Duo controller is DONE and WORKING and I am starting the long process of writing it up. An extensive post will follow.

The Epic Axial Motor is...in progress.

Thursday, October 1, 2009

What's Next: Charger / Balancer

Not ideal.

Charging LiXX batteries is an annoying, time-consuming process and can easily result in a dead battery pack, or in the case of Lithium Polymer batteries, massive destruction. There are two main problems:
  1. They need a constant-current, constant-voltage (CC/CV) supply. You can't just hook them up to an AC adaptor or a variable-voltage power supply. The internal resistance is so low that even a small difference in voltage between the supply and the pack will cause a large current to flow.
  2. Cells need to be protected from overcharging on an individual basis. Unlike lead-acid, they will not self-balance and are not tolerant of temporary overcharing. The voltage of every cell should be kept below a certain value at all times.
There are plenty of solutions to Problem 1. Most lead-acid battery chargers have a CC/CV strategy of some sort. Unfortunately, they only make them in increments of 12V (14V cutoff). So for my target application of a 33V pack with a 36V cutoff, I'm out of luck.

The more expensive option is an adjustable charger such as the Astroflight 109. This is basically a lab-style power supply in a small package. It will automatically monitor and adjust voltage and current, taking whichever hits a limit first as its operating point. So for a fully dischaged, 30V pack, it may only need to put out 31-32V to supply 5A. But as the pack voltage rises, it will adjust its own voltage to maintain 5A until the upper limit of 36V is reached. Fancy. But it also has problems. The biggest of which is that it runs on a 12V supply with no provisions for plugging into the wall. So for $120, you still need an AC adaptor. And it still doesn't do balancing.

Under ordinary circumstances this frustrating lack of good options would be the cue for me to build something from scratch. One idea I had was to use a Dell notebook adaptor as the front-end, since I carry one (or two) of those around on a regular basis anyway. But that still means I would have the build the CC/CV stage AND the balancer. And I don't want to make a big project out of this...I just need something convenient. So I started looking for hybrid off-the-shelf/custom solution and stubled upon this:

It means well.

The Mean Well PLC-100 is a 100W power supply module "suitable for LED lighting and moving sign applications." Clearly, exactly what you need for charging batteries... But actually LED drivers tend to be current-controlled devices, and in fact this power supply does have a constant-current output from 75% to 100% of its voltage rating. So the 36V version can provide a stable, adjustable current of about 2-2.65A from 27-36V. Perfect for a 33V battery pack, which should rarely drop below 27V anyway. 100W will charge the pack in under two hours. The cut-off voltage is also adjustable to between 85-100% of the rating. So the 36V version can be adjusted from 30.6-36V. For different-sized packs, there are versions for 12, 15, 20, 24, 27, 36, and 48V, all with a similar 85-100% trim range.

That takes care of the front-end supply. Now all that's left is the monitoring and balancing part. It would be excellent if this part didn't require a microcontroller or any programming. It would be even more excellent if each cell had its own, independent, floating circuit that handled balancing. Turns out this isn't actually that hard:

The monomer, if you will. (Click for a clearer picture.)

This circuit runs entirely off the voltage of a single battery cell. The core is a voltage comparator, the LTC1440, which has a built-in 1.182V reference and optional hysteresis setting (not used in the circuit above). The comparator check the voltage of the cell, through a 1% resistor divider. When the cell voltage reaches 3.6, it will turn on its output. The output drives an indicator LED and a transistor which bleeds away power. If the transistor can bleed away more current than the charger can supply, it can even be used to balance and the end of a charge. In this case, that would mean a transistor that can sink 3.6V*2A=7.2W. That's a pretty beefy heat sink, but not unheard of.

The boards will look something like this:

Don't ask why it only has five cells.

You can chain them together indefinitely, or use only a fraction of a board. No programming. No extra power supplies. Very simple.

When combined with the Meanwell front-end, the whole thing will be small enough to fit in a backpack and comparable in price to a Li+ charger/balancer/AC adapter combo. I'm doing it more for the convenience of not having to look around for power supplies, but I never can pass up the opportunity to use things for other-than-their-intended purposes.

Sunday, September 20, 2009

What's Next: Epic Axial Motor

Nothing good can start this way...

It was only a matter of time.

The axial-gap motor has been haunting my dreams for some time now. At least since I found $4 wedge magnets (see above for proper shipping and handling procedures). There has to be an easy way to make motors with these! But there are some problems to solve:

Most importantly, how do you make the stator? On the one hand, motors are forgiving and will let you get away with almost any ridiculous configuration of magnets, iron, and coils that you want. Think about it. Nothing inherent in the geometry creates power. You put in voltage and current, you get out torque and speed, and you lose some heat.

That said, if you're going to build a motor in-house you probably want your power in the form of more torque, lest your unbalanced mess of a rotor disintegrate at 20,000RPM. The key to getting torque is to "link as much flux" as possible. In other words, get as many turns of wire under as many magnet poles as you can. And then pass an absurd amount of current through them. But you just can't put as much of it where you'd want it (right under the magnets), so a good, high-torque motor will use steel to help funnel and carry magnetic flux from right near the magnets to the windings. It follows, then, that it would be nice to get as much steel surface area as possible near the magnets, leaving just tiny gaps for wires to fit through. (Take a look at most real motors, axial or radial. At the air gap, it's mostly steel adjacent to magnets.)

The steel is laminated to minimize the circular eddy currents that result from changing magnetic flux. This presents a big problem for axial motors, though. They have features in all three dimensions, so each lamination would have to be a different shape. Expensive to buy. Hard to make. This is about where my though process stopped....

Until I met the YASA motor. This Oxford creation solves so many practical problems that it almost makes you forget about the "trivial benefit" of higher power density resulting from an inherently minimalistic stator design. Originally, the EVT TTXGP crew was going to partner with these guys to produce a motor for the racing motorcycle. But now that partnership looks to be impossible and I'm left wondering: Can we make a version of this cheaply, quickly, and efficiently? I believe the answer is yes:

Just my take on it...

1) The stator problem is solved. Well, Oxford solved it by making the individual stator segments out of iron power core. But pretend for a second that the goal was to make a motor that didn't want to return to a powerdery state when dropped on the ground. If the pole count is high enough, each segment can be made from a stack of progressive H-shaped laminations:

I probably overuse powerpoint.

If you are running on a tight budget, you can even make every lamination the same shape, and then just (gently) grind down the flanges later.

2) The next obvious practical benefit not really highlighted in the technical paper: You can wind each segment independently. No feeding of tiny wires through tiny slots. No finger blisters. No trying to clamp the stator without destroying the existing windings. Once they're all wound, you can just bolt them to the hub and make the interconnections. Speaking of windings, with these magnets and 16 poles, the flux rate at any significant RPM is going to be quite high. I'm not really interested in making a high voltage motor, so the number of windings will be pretty low and the current pretty high. Which begs the question: why use wire at all? How about copper sheet!

Copper sheet conductor.

If each segment only needs less than a handful of windings, why not wrap some sheet around them concentrically? And the insulation? How about Kapton tape! Now you've got a motor that has a pretty good fill factor due to the rectangular conductors, a way to hold them together, and a temperature rating that has got to be higher than that of magnet wire enamel.

3) Another problem with axial motors is high thrust loading due to the fact that the lowest energy state of the motor is a collapsed, stationary pancake, hopefully without finger remnants inside of it. The bearings take a lot of axial load and the rotor especially has a significant bending moment acting on it at the radius of the magnets. This design provides a nice clean way to deal with this: connect the two disks together with a rotating outer can that can go into compression (not pictured in the paper or my little drawing, but I guess it's implied). Good bearings are still a must, but this will make life easier.

4) The segments are more-or-less independent of each other. Flux goes in one end, comes out the other. There is no steel path in between. The practical implication of this is that you can test the motor without a full set of segments (less development investment). How? Build the rotor. Wind one segment. Spin the motor up externally. Measure the back EMF. By virtue of geometry, superposition, and power conservation this can give you most of the important specifications about the motor....I think.

So it begins. We've got laminations inbound and a significant amount of design and testing to do. Could be a big project. Whether it winds up on a motorcycle or not, I don't know. But I am a believer in component-driven design. That is, if it's too cool not to have (like an 8" neodymium wedge magnet set), buy it now and figure out how to use it later...

Now what?

Check back for more axial motor updates and the inevitable design and fabrication of a controller for it when all the off-the-shelf options fail yet again.


Thursday, September 10, 2009

What's Next: 3ph Duo Controller

Fall '09 is under way with an interesting set of old and new projects on the horizon. The most immediate is yet another motor controller - version 2.0 of the 3-phase brushless series and version 7.2? or something of the modular half-bridge design. A brief history:

Version 5, oddly enough not pictured, is the only one that has never blown up on the go-kart.


Version 1.0 of the 3ph brushless controller, after a bit of troubleshooting, works just fine. It's actually overkill for the application, namely driving a 500W in-wheel motor for the B.W.D. Scooter. The motors can handle a peak current of about 20A. The v1.0 controllers, fans enabled, were tested to handle 75A for 45 seconds on a single phase before the MOSFETs started to desolder themselves. Divide that up between three phases and you get something that would probably handle 75A continuously. Combine that with 48V-compatible MOSFETs (75V rated) and you get a 3.6kW controller...for 500W motors. However, overkill alone would never make me design a new controller. The biggest problem is this:

No Step.

Despite my best efforts to make this more compact than any controller I've designed before, there just isn't enough room for two of them on the scooter. The only solution was to have them stick out through the deck. This is bad for a few reasons: One, it takes up foot space and is going to get has gotten stepped on. Two, it just looks bad. The whole point of putting the motors in the wheels and the batteries under the deck is to make it look as compact and normal as possible. Also, stacking two controllers on top of each other makes one of the fans completely useless. (The fans, along with almost every other component that wasn't soldered down, get beaten up pretty badly due to vibration, too.)

So, the challenge for v2.0:
  1. Run both motors in current/torque control mode with a single controller.
  2. Maintain at least 40A continuous current capability on each motor, at up to 48V. Two 1.9kW controllers on one board will make it actually more powerful than a single v1.0 controller.
  3. Maintain the same x-y footprint as v1.0, if not smaller. This was easy: Eagle doesn't allow you to make boards larger than 80mm x 100mm.
  4. Shrink the maximum height so that everything fits within the scooter deck. This means the entire controller must occupy less than about 1.3" (35mm).
  5. Maintain the existing modular half-bridge driver design. It's optically isolated and I know it works. There are smaller, cheaper ICs that will do half-bridge drive, but now is not the time for radical design change.
  6. Maintain the ability to record and transmit data.
Notice that cost is not an objective? That could be bad... But here are the commercially available alternatives:

The Turnigy Sentilon 100A HV. Ok, I will admit this is impressive. It is one of the most beastly high-voltage hobby RC controllers out there: 100A @ 50V. That's a 5kW controller in a 60mm x 60mm x 11mm package. And it actually wouldn't be that hard or space-consuming to add a current-controlled feedback loop around this. (As-is, it only does voltage/speed control.) But it's not sensor-commutated. Meaning, startup torque will suffer. How much, I don't know. And keep in mind that despite the massive power, it still only runs one motor. Cost for two: $232.

The Kelly KBS48051. This is the cheapest serious-business EV brushless controller you can find for 48V. It can handle 20A continuous, 50A peak for one minute, so about 1-2kW. It is fully current/torque controlled with hallf-effect sensors and regen. You can program it, although getting real-time data off is a different story. The down sides: It's the same size as my v1.0 controller. And still, only one motor. Cost for two: $200.

Okay, down to business. The first step was to find a new MOSFET solution. As much as I love the IRFB3077, there is just no way 12 of them will fit. The key discovery was an inexpensive, integrated three-phase bridge module: The IXYS GWM series, specifically the GWM100-01X1-SL, which is the only one in stock anywhere (Arrow Electronics).

IXYS GWM100-01X1-SL


At $21 each, these replace six IRFB3077s at $2.79ea. I consider that a fair trade. Specifications-wise, they have about twice the resistance per FET (7.5mOhm), but also a higher voltage rating (100V). They are rated at 1.3K/W with a proper heat sink, which is about the same as the IRFB3077, except that these share a heat sink tab. I doubt they will match the performance of the 3077s, but 40A continuous per chip should be achievable.

The other key discovery was that I only need one MSP430F2274 microcontroller to generate all six channels. It has four output-compatible timers, but each timer is mulitplexed to two pins, so really there are eight available output pins that can do high-speed PWM. And there are only really two independent PWMs required (one for each motor). It should have no trouble handling the extra hall-effect encoder interrupts, too. The only real worry I have is the 4kB code limit imposed by my free version of IAR Embedded Workbench. Here's why:

Not a lot of space left.

If the code to control one motor costs 3,255 bytes...and I need to control two motors... Well, I tend to just assume that all software problems can be solved. Realistically, most of the code is overhead that doesn't need to be repeated. But let's just hope that they know that 4kB is 4,096 bytes, not 4,000 bytes. I will probably need those extra 96.

Ugh, why am I such an EE? New MOSFETs...software constaints.... WHAT ABOUT FITTING THE WHOLE THING INTO THE DECK? Which, I believe, was the original point of all this. Here:

It..

..fits..

..in..

..the..

..deck.

The IXYS FET modules get thermal pasted to the aluminum deck, which should make an excellent heat sink. Wires get soldered in directly like in the Turnigy - no more bus bars. The single MSP430F2274 controller board gets a new home dead-center. All the gate-drive circuits have been made surface mount and take up both sides of the board now. The 15V switching regulator and associated inductor are surface mount. The only thing that can't really be made smaller are the current sensors...but they are in the right place now, at least. The result: the board occupies only 1.2" of vertical space.

And the final cost of components? Let's see... $42 for the FETs + $23 for the MSP430 board + $32 for the radio + $73.50!!! for six isolated high-side supplies + $31.62 for twelve optically-isolated gate drivers + $32.74 for two current sensors + $8 for the 15V supply + $25 for misc passive components and connectors. $270. No, I didn't count the cost of circuit boards. But I'm only building one. Extrapolate to high quantities and the total cost here isn't that bad.

I'm sort-of hoping it just works. The only major hardware changes are the MOSFETs and the placement of the current sensors. The most likely failures are actually on the software side, since I changed so many of the pins. I tried my best to think through the pin assignments, but there's always the chance that I missed something that will result in a disappointing, smokeless failure. If so, there will have to be a version 2.1...

I'll post the new schematic after testing.

Sunday, August 23, 2009

It Coexists.


I guess I'm not very good at this whole "documentation of incremental progress" thing, but anyway the B.W.D. Scooter is done and it's probably time to write up my build report. (The official documentation is now on the web, in our usual single-obnoxiously-long-page format.) This is merely my personal take on the project.

If you remember, this is round three of the Edgerton Center Summer Engineering Workshop, a unique educational program in which I get told what we are to build by a group of insane high school students. (To be fair, most of them aren't really in high school anymore, they're all off to college now to actually learn.) So maybe it's not an educational program; maybe it's more of an ad-hoc group with similar interests in things that move. Either way, good luck finding a better project team anywhere.

Oh, right, the scooter. Well, I wanted to build The Magscooter, a scooter that uses the Magmotor S28-150, a three horsepower motor famous for its utter combat-robot-propelling power in a light-weight package. Imagine that belt-driving a Razor scooter wheel. It would be the definition of overkill, and we could have built it in a matter of weeks. Except I was told that not only is that a lame idea, but also that I am unimaginative, boring, and risk-averse. So the idea for the B.W.D. scooter was born. The Summer Engineering Workshop crew decided to rip off Charles Guan and create a scooter with not one but two integrated wheel-hub-motor-things.

Wheel-hub-motor-thing. (Charles Guan's Project RazEr)

It turns out that it isn't all that hard to build a motor. To get it inside the wheel, the name of the game is brushless. The stator, with coils of copper magnet wire, sits stationary inside the wheel. The rotor, with permanent magnets, spins around it, held in place by side plates with bearings. This "outrunner" configuration is common in computer fans, hard drives, and model airplane propeller drives. There is also a lot of online documentation on how to re-wind or otherwise build custom BLDC motors.

Except...what do fans, hard-drives, and airplane props have in common? They see their highest load at high speed. Direct-drive BLDC motors that spin up to N,000 RPM make total sense for these applications. A scooter (or other electric vehicle), on the other hand, needs low-end torque, and a lot of it. And with hub motors, there is no gear reduction.

Turns out there are two keys to getting low-end torque from a motor. One is good control, which I already spent some time ranting about. The other is squeezing as much Lorentz force (F=ILB) as possible out of the motor geometry. (Ok, it's not really Lorentz force when you have steel carrying flux...but whatever.) It boils down to a good deal of current (I), a relatively wide motor (L), and many large, strong magnets (B). We started with the magnets, opting for the 12-slot/14-pole "LRK" style that Charles used. That gives plenty of surface area for mangetic interaction, and has the added benefit of reduced cogging torque because of the fractional slot:pole ratio, something we might have learned if we had paid more attention in Monaco. (Seriously...there was actually a keynote presentation about it.) Armed with the basic idea, we generated a design:

Don't you wish your CAD software could do that? (Render credit: Max H.)

Wow that looks really hard to make...even with six abrasive waterjets. But what we lack in Charles' extreme fabrication skillz, we make up for in the ability to get other people to give us nice things for free. Like, for example, laser-cut M19 steel laminations:

Stators not to be used as ninja stars.

These parts were generously donated by Proto Laminations, a company that specializes in producting low-quantity prototype motor laminations from electrical steel. The purpose for lamination is to reduce the circular eddy current that can flow in the steel as a result of the changing magnetic field. For us, the added benefit was the ability to design the motor exactly as we wanted. The biggest design feature this allowed were the small indents on the rotor for placing rectangular magnets. This saved us countless hours of aligning and gluing them in place.

That's not to say we didn't get to use the waterjet at all. Turns out winding magnet wire around sharp steel corners is not the ideal way to make a motor. Covering said corners with electrical tape also doesn't help much when you have to keep a lot of tension on the wire just to keep it wound tightly. Red fiberglass and abrasive waterjet to the rescue:

Who says you can't cut fiberglass on the waterjet?

These slightly oversized stator replicas prevent the wire from digging into the steel corners. They also look sick, and match our color scheme. But wait, they're inside the motor, right? So nobody will see them. Unless of course we already had planned to make the motor sides transparent. Seems stupid, right? Why waste all that flux out the sides and risk the entire structural integrity of the wheel for the ability to see inside? You'll see...

But first, the windings. How did we know how many windings to put? Too few and your torque will suffer...too many and the back EMF generated will limit your top speed. Too thin and the motor won't be able to carry enough current. Too thick and winding them will be very difficult. There are four ways to deal with this question, and we did all four:

  1. Copy someone else. Charles put 25 turns per tooth. We decided to wind every other tooth...so we should have a bit more.
  2. Try to do math. Well, we tried.
  3. Simulate. FEMM to the rescue. Pretty...
  4. Just freaking build one. The only real unknown is the "geometry factor" that is defined by the shape of the motor and the placement of the magnets. Motors are forgiving. The chance of making one that just completely doesn't work at all is very slim. So we built one with a low number of turns, 30, and then measured its performance. Turns out it was not far from where we predicted, but we wanted a bit more torque and less speed. So, with the geometry factor solved for, all we had to do was adjust the number of turns accordingly and we would know exactly the specs of the second motor. Single iteration; the high torque motor got 45 turns.
So now we have these two motors that are identical except for the number of turns per phase. Lots of interesting possibilities now. Do you run both at the same time? One for acceleration and one for top speed? How do you manage the transition? What's more efficient? Well...questions for later. For now, we put the high torque one in the back and the high speed one in the front and just send the same throttle signal to both. The torque adds and the speed averages out.

We made these?


Here's where anyone familiar with motors will criticize: Wow, even the high torque motor (left) isn't even half-full of windings. That could get so much more power with every tooth wound or with thicker wire. You try hand-winding a motor. But otherwise, I agree, it just looks weird. Most motors are packed full of copper wire. These could probably be two-horsepower motors if the winding density was better. But the math, simulation, and actual real-life test drives all confirm that these have plenty of torque for a scooter and they operate fairly efficiently, so the battery will last a good ways. Remember, more windings = more power, but the power still has to come from the batteries.

As for the efficiency hit, well I though this would be a problem too but it turns out that at low current (and by low I mean 20A), copper losses are small and interesting things start to happen to the efficiency curves. The benefits of brushless, low-speed, low-friction operation start to make even these hand-built motors seem like good alternatives to things like the Magmotor.

Well now that doesn't seem bad at all.

Okay, so the sparse windings don't really hurt much. What about the flux that leaks out those plastic sides? That must not be good. Well...since the stator is only 1" wide, centered in the rotor, I'd guess that the flux that counts is in that 1" band, where it is still quite straight. The flux leaking out the sides wouldn't be doing much other than short-circuiting to the other side of the magnet, even if the sides were steel. Not convinced? Still think something is being wasted? Okay, let's capture it and use it as a signal for the motor controller.

External hall-effect sensors!?!???


Yes, I wish we could say we planned this the whole way. Actually, we were originally going to use an optical encoder track. (Because the motor is brushless, the controller needs some way of knowing where the rotor is to control which coils are active.) But after noticing that the wheels had a tendency to pick up loose hardware off the floor, we though that perhaps there might be enough of a field coming through the sides to use hall-effect sensors. Many brushless motor have embedded sensors, but having them on the outside is actually extremely useful. You can find the right position very easily by rotating them with respect to the stator while testing the motor. You can also make minor tweaks to the torque/speed characteristic by rotating them.

So with the motors taken care of, we had to actually build the scooter itself in just about three weeks. Not a problem. Since there's no gearing or anything, it's really just a matter of making a frame with some forks to hold the two wheels. The deck is some folded 1/16" sheet aluminum. The rear fork is pretty straightforward:

Bandsaw clamp forks.


The front was a bit trickier, since we decided to work with the existing Razor scooter handlebar. Since the wheel is significantly wider and larger in diameter than the original wheel, we had to add an offset fork:


Front fork and steamroller wheel.


That's it right? Oh wait the batteries! We acquired a pack of A123 26650 cells, totaling 33V and 4.4Ah. Interestingly, when laid flat, they have only about 30% more energy by volume than a lead-acid pack. But they weigh a good deal less and most importantly they can source immense amounts of power for their size thanks to extremely low internal resistance. Cramming them in the deck was interesting...

Batteries in all the available space under the deck.


One thing we do pretty well is make things look good. That's where the carbon fiber deck and red LED trim lights come in:

And there you have it...

So that's it. It's not without its flaws. The urethane is being held on by "Plastic Steel Steel Weld Epoxy," which didn't last long. (The rear wheel tread came off once already.) The front of the deck needs reinforcement. And the whole thing is in serious need of some more nylon lock nuts. The vibrations are killer, especially in the ongoing roadwork nightmare that is Cambridge. But overall, it is functional and fun to ride. It's lightest and most compact of our fleet (yes, it's a fleet now), so it will probably see the light of day a lot more.

What have I learned? Motors are forgiving. Controllers are not, but if you overdesign them they might survive. Vibration sucks. Vehicles that carry seven times their own weight are awesome. Scooters are fun to ride. Make two of everything. Most importantly, probably, do something fun with a good team and you really can't go wrong.

Sunday, July 26, 2009

Silence of the Cows

I was just thinking about how boring it would be to have a website that just exhibits a bunch of working projects, no matter how cool those projects are. Not very many of my projects make it to a working state in one shot, but one that came frighteningly close is my 3-phase motor controller. Version 0.0 was built as a term project for 6.690/6.061 (Intro. to Electric Power Systems). It was built in a week and worked with no problems on a small (200W is small around these parts...) induction motor, running a simple V/f control. I commented then that it was only a matter of time before it got scaled up...


So I made it smaller. Scaling up doesn't always mean it has to be bigger. What I call v1.0 is just a tad over 80mm x 100mm x 40mm. (This is the maximum board size in the free version of Eagle...) It's got six IRFreakingBig3207 MOSFETs on board right underneath a tiny (60mm x 10mm) but strong fan. As usual, I have already gotten my fingers owned by said fan. The heat sinks are not that great, just slivers of aluminum soldered to the circuit board. (Yes, you can solder aluminum.) But based on my previous experience with these FETs, I sort-of expected that they could do the job.

The job.

The job, by the way, is full torque control of a brushless DC motor built into the hub of a Razor scooter wheel, a la Charles Guan. It's the Summer Engineering Workshop '09 project, which means two things: 1) It will be cool. and 2) I will spend a lot of time making electronics for it. Sigh. Although unlike last year, we could actually buy a controller that does exactly what we want. Granted, this is pretty much the only one in existence and the manual refers to a color called "Reddle", which I suspect probably means orange, but it is still cheaper than making one. But when has that ever stopped me?

But wait, what about all those tiny RC plane controllers that can handle 100A? Well, first of all there aren't many that can run higher than 24V, and with these insane neodymium magnets the backEMF is going to be huge. But more importantly, they are not torque controlled. You set the throttle and they adjust the PWM to give you a proportion of the full voltage. This works fine for airplane propellors, which see increasing torque with increasing speed in a nice drag-based relationship. Electric vehicles, on the other hand, see max torque when they are sitting still. This means no forced-air cooling of the controller, and quite possibly if it is completely stalled two phases will take all of the load, so the current ratings would be much lower.

The key to torque control is the ability to measure and control current, which means putting a current sensor on the controller. In fact, it should mean putting TWO current sensors on the controller, since only two of three phases are active at any given time and you need at least two sensors to be guaranteed a measurement of an active phase. I manage with only one. I wish I could say it was clever design that allowed this, but instead it was just stupidity. I put the current sensor on the DC link...before the power gets inverted and sent to the motor.

Oops.

So there is mistake #1. I'm glad there was at least one...because otherwise I'd just have to write about how it works. The fix for mistake #1 is somewhat of a hack. In software, I can estimate the current going to the motor based on the PWM and the DC link current. There is a horrible divide-by-zero condition inherent in this, though. (Imagine the motor is spinning full speed and then the PWM goes to zero, shorting all the phases together.) So, something to think about for v2.0 is repositioning the current sensors to a place that makes sense.

But does that mean that v1.0 actually works without any wire hacks, any desoldering, any exploded FETs, any melted Zener diodes?! I think I would actually be sad if it did. Only load testing can tell. At 20A, no problems:


Even on a huge Etek motor, it effectively regulates the current in both directions. (Yes, it can do controlled regenerative braking.) This is actually a great demonstration of the torque control, because if you hooked up an RC controller to an Etek and went full throttle, there's a good chance it wouldn't survive, since it would apply the full voltage regardless of the N-hundred amps the Etek wants to draw. And 20A is about what we can put through the scooter motor before the windings start to heat up too much. But come on! I need to at least be competitive with the Kelly controller current ratings. Bring on the CIM-battle load test:

Mmmmm...ex-FIRST equipment.

These are wonderful 1/2-horsepower CIM motors from an old FIRST Robotics kit, in a nice cast-aluminum gearbox. They are meant to turn with each other for double the torque, but I prefer to make them fight each other by hooking red to black, black to red, and driving them with a single phase of the 3ph controller. If a single phase can handle the load, three phases sharing it should have no problem. So this should make a great worst-case scenario test. Let's try 50A!


Uh oh! At anything above 30A, it seems the controller has a tendency to produce a sound that I can only describe as "mooing." Yes, like a cow. It still works, but some low-frequency noise is coming in somewhere that makes the motors sound like they are ready to be milked. I originally thought it was some digital instability introduced by my current sensor hack, but after changing the gains and seeing no difference, I concluded that it was a real hardware problem! Hooray! There is something wrong with the design that isn't just a "no big deal I'll fix it in version 2.0." I actually get to troubleshoot something significant and fix it!


Well, that was easy. The 15V DC/DC converter which powers...everything on the board...needs an input capacitor closer to its...input. I thought the main caps would be sufficient but since they are on the opposite side of the high-side bus bar, all their effort goes into keeping the MOSFETs happy and they can't really help the DC/DC all that much. In power electronics, where you put things is almost more important than what you put. I should probably know that by now. But at least I have something to write about now.

The rest of the load testing went as expected. 50A for 60 seconds no problem. 75A for 45 seconds and then a shower of sparks as the heat sink melted through the high side input line which happened to be resting on it.

Not good.

A repeat of the 75A test almost made it to 60 seeconds, but then the MOSFETs started desoldering themselves. (They do that before they fail...amazingly.) So that's about the upper limit...for one phase. Call it 100A peak, 65A for one minute, 40A continuous. (I just made that up.) With all three phases running, I suspect this goes up at least by a factor of 1.5 or 2. Although at that point our scooter motor would be quite destroyed and our batteries would be dead.

So, the mooing has stopped, the controller works, and things look good for motor testing in the next week or so. But it wasn't easy. It shouldn't be. I hope it never is. Here is the v1.0 schematic and design files for anyone who might find it useful.