Wednesday, January 26, 2011

MechE Quails: More Field-Oriented Control

What is a quail? It's like a mixture of quals and fail.

What is a qual? It's like a mixture of...I'm not sure. It's the Mechanical Engineering (Course II) department's bi-annual doctoral qualifying examination. It's a three-day test consisting of:
  • Day 1: Up to three 1-hour written examinations in three subjects of your choosing. Examples: System Dynamics and Control, Machine Elements and System Design, Manufacturing, Thermodynamics and Heat Transfer, Optics. I chose the first three.
  • Day 2: Three 40-minute oral examinations in the same subjects. (20 minutes of reading, 20 minutes of Q&A.) The audience is 3-7 professors in that field.
  • Day 3: A 45 minute presentation on past or present research. (20 minutes of presenting, 25 minutes of Q&A.) Also 3-7 professors in the field of your choosing.
To pass, you must satisfy the professors on at least two of the three subjects, and the research presentation. And you win...well I'm not sure what you win. It's not a dissertation; no degree is awarded at the end of the process. It's more like a mid-term. If you lose, you get a second chance in a few months. If you lose twice, you get kicked out.

This is Try #1 for me. I figure now is the best time to give an honest reaction since I'm done with the testing but haven't yet gotten the results. One reason I thought I would burn a blog post on this is that people tend to Freak The Fuck Out (FTFO) about this test and maybe I can persuade future grad students that it's not really advantageous to do so. The other reason is to try to excuse myself for not doing any work on the snow scooter in the past few weeks. (Not that there hasn't been snow. Cambridge is expecting 8-12" more tonight...)

Anyway, my advice to future quals takers (besides don't FTFO) is to use Try #1 as a test probe. Part of the stress is the uncertainty and mystery of the quals process, which, by the way, is intentionally hyped by both the department and by past test-takers. But they do give you two chances, so you can map the process for yourself and that alone is worth the effort even if you don't pass on the first try. You might, for example, learn that you instantly become stupid on a topic you know well just by walking into a room full of seven controls profs, like I did on the orals. Now if I fail, I know I need to work on that. (Either not becoming instantly stupider, or having the transition still leave me enough phase margin to answer simple questions.)

According to the G.A.M.E. surveys (which were the only things that made me FTFO, briefly) from the past five years, survey responders spent on average 300 hours studying and had, on average, an 80% success rate on their first try. I've never studied 300 hours for anything in my life (including Quals Try #1...and my odds of passing are much lower than 80%) so I can't even really relate to what that means. I would much rather be doing something else. If necessary, would I suck it up and put in the hours on Try #2? Probably. But for Try #1...I don't think so. (Well, as experience shows, clearly not...) Too much other stuff to be working on. Like 2.007, which will have the best game in a loooong time, I promise.

One thing I was mildly excited about was the research presentation. I've been wanting to get feedback from professors (or experts) on my field-oriented control stuff. (Yes, I'm writing about motor control again.) So, against the advice of pretty much everybody, I presented to the controls group. These profs are infamous for tearing people apart, which they did on my oral subject test, and most would not be familiar with me or my work. Kind-of a high-risk strategy, for quals, but I really wanted feedback from that group, even if the feedback is: "Go away." 

So, we'll see how that went. My initial reaction is positive - I didn't get torn apart (that I was aware prof insisted that this has all been done already in the 80's) and I nailed some Technical Triva. In some sense, though, I got very lucky with who was on my panel, but I won't name any specific names. I would say 75% odds of passing, which is much better than my subject tests. I'd put those at about 40%. Any takers? (Is gambling on quals unethical?)

Anyway, the other outcome of all this is that you get yet another exceedingly technical PowerPoint presentation on the modified Synchronous Current Regulator!

Yaaaaay. 70 more where that came from.

(I assume there is no harm in posting a quals presentation...)

This one supersedes my previous PowerPoint on the topic, which is apparently a big hit on Google. It's got more data, this time from Pneu Scooter, better analysis and simulation, and most importantly, much shinier figures. It's all theory, though. If you're interested more in the implementation details, including the controller hardware development, this massive, unedited, neglected, out-dated document is the best I've managed. I promise I will bring it up to date with v3.1 some day soon.

If you're like I was not long ago and have some idea about motor control but not quite enough to jump right in to Field Oriented Control, then you should first check out James Mevey's Awesome Thesis of Awesomeness. Pretty much everything I know about modeling brushless motors and controllers came from that. It's also a review of basically every reference on the topic.

Anyway, that's it for quals...for now. I'll post the results in a comment tomorrow when I find out, for anyone who took me up on those odds... In the meantime I'm going to go design a motor controller.

Monday, January 10, 2011

Victor 883107-7

Okay, so I know I said that one of the best things about building a brushed DC motor-based snow scooter was that for just this once I do not have to design a motor controller for the project...

...well I did anyway.

Honestly, if I had two Victor 883's lying around, I would use those. But I don't, and I'm not spending $300 on something I can make from scratch for less than that. I am done being a slave to IFI/Vex absurd pricing because they have no competition in their power-to-volume ratio. I can stuff MOSFETs into a small space too. In fact, it's what I do in my spare time anyway. The challenge:
  1. Using the same footprint as a Victor 883, make a MOSFET H-bridge controller that can handle 48V and 75A continuous.
  2. Run either on standard RC input or 0-5V analog throttle. Retain isolation between logic and power ground. (The Victors are optically isolated at the signal input.) 
  3. Be less than $140, including board printing and components.
I took my inspiration from this:

The last time I wanted to directly rip off the footprint of an existing MOSFET and make my own cheaper, more easily serviced version was on the Cap Kart. The kart had just finished a week of blowing up giant MOSFET bricks from IXYS and I decided that if it were going to blow things up, they might as well be cheap and user-serviceable. It never blew this one up.

Here is the smaller H-bridge version, which I call the Victor 883107-7:

What's that blue thing?

The name comes from the monster IRFS3107-7 MOSFETs. In the world of MOSFETs, the IRFS3107-7 reigns supreme. If the IRF1405 is a high-end sports car, the IRFS3107-7 is the supercar that shouldn't rightfully exist. It has such massive current handling capability that the D2Pak surface mount package sprouted four extra legs to handle the  source current. Let me put this another way: 0-gauge copper wire, which is the same diameter as this MOSFET, isn't rated for as much current.

Of course the 260A current rating is if you put the drain tab on an infinite heatsink held at a constant 25ºC blah blah blah. It can switch 75A no problem. With two FETs conducting in the H-bridge at any given time, the power dissipation from FET conduction at 75A is: 2*(75A)²*(2.1mΩ)=24W. There are also switching losses, but if I do the gate drive right, the power loss should be dominated by the conduction.

That's still a considerable amount of heat to get off the board. With only one square inch of on-board copper plane for sinking and natural convection, AN-994 suggests a thermal resistance of about 20ºC/W for a D2Pak. Since I'd have two sharing the load and have almost two square inches of copper, this gets split in half. But, my FETs would still be toast at anything above about 50A. (Still, 50A with no external heat sink...)

This is why I opted for bare boards with no soldermask. The heat transfer path is from the MOSFET drain tab to the board top copper layer, through a crapload of vias to the bottom copper layer, through thin silicone padding for isolation, and into an aluminum heat sink.

Heat transfer zone.

Normally, I would then need to worry about keeping the aluminum heat sink cool with some kind of fan. But for the most part my heat sinks are semi-infinite blocks of scooter/go-kart/robot chassis. And, as an added bonus, this one will employ direct 0ºC phase-change cooling (by virtue of being totally covered in snow). Hell, if the road's been salted, I might even try out eutectic cooling...

So I'm confident the 3107-7 won't fail under load, but unlike the Cap Kart's controller, this one has to have on-board logic. And the finally-resolved electrical noise issues of the 3ph 3.1 brushless controller are still fresh in my nightmares. I decided to take the safe way out, importing the completely isolated gate drive solution from the Cap Kart onto this board.

I do still love the IRS21844 gate drivers, but I just don't trust them quite as much as the optically-coupled HCPL-3120 when very high currents are required. It just gives me peace-of-mind to know that my microcontroller and logic are driving the equivalent of four LEDs, and are not in any way electrically connnected to the power circuit.

The original modular, isolated half-bridge from the Cap Kart went a step further by using floating 15V supplies everywhere. The benefit here was that both the gate drive supply and the logic supply were isolated from the power circuit, and from each other. Also, by providing a floating 15V supply for the high side drive, it could be held on at 100% throttle. But, the floating supplies are really freaking expensive. In this newer version, I've opted to use just one floating supply (DCR021205) to isolate the logic's 5V, a trick a stole from the latest 3ph 3.1 upgrade. As for the gate drive, for the first time, I'm trying out bootstrapping with the optocoupled gate drivers:

Diode D4 charges the high side's bootstrap capacitor C6 while the low side is on. Then, when the high side needs to turn on, C6 charges the MOSFET gate while D4 blocks the reverse voltage. This is a pretty common trick for gate drive, and I'm really not sure why I never considered it for the optocoupled gate drivers. The only downside is that you can't get 100% throttle. The low side must be switched on in order for the bootstrap capacitor to recharge. But 95% throttle should be possible.

There's also a bit of a game to play to make sure that the high side gate driver does not go into under voltage lock-out (UVLO). The HCPL's will shut down at 11V. There's a bit of a voltage drop between the high side supply and the bootstrap capacitor because of the Schottky diode. There's also a bit of a drop on the other side because of the voltage drop across the low-side FET. Then, the capacitor loses some voltage as it charges up the MOSFET gate. And finally, it loses some more as it slowly drains through the gate's pull-down resistor. So, forget about using a 12V gate drive supply. 15V is a much better bet. Unfortunately, this means the controller won't run on a 12V battery...oh well.

My favorite thing about the optocoupled gate drive solution is how PWM dead-time is generated. Dead-time is required between turning off one FET and turning on the other. This ensures that two adjacent FETs are not on at the same time, which would short the power supply and cause instant destruction. Here, the optocoupler LEDs are wired in anti-parallel, so that they can't physically be on at the same time. Additionally, an RC filter on the input ensures that it takes some time to switch from 1.5V to -1.5V, turning one LED off and then the other on. The details of how to size the passives for a given dead-time are in the original write-up. Here's what the dead-time looks like in action:

Because these are such massive FETs, they take a good microsecond to turn on and off with 30-ohm gate resistors. I could push harder, since the gate drivers themselves can source/sink as much as 2A peak. But, as I found out in one of my many other controller troubleshooting sessions, slowing down the gate drive a little can sometimes help clean up noise. I chose a capacitor (C10 above) to set the dead-time to 1.5μs, which is what you see above. 

Aside from the fact that I soldered four out of six diodes in backwards the first time, the controller so far seems to work. I've only tested on the bench supply, but it was able to drive about 25A before alligator clips started melting. Once I get it hooked up properly to a battery, I'll be able to really load test it. 

Here's what it looks like side-by-side with a Victor 883:

"But, you said you made yet another controller because you didn't have any Victor 883s."

This one's not mine, okay? I borrowed it for the photo. Hopefully, it will just work and I can plop two of them into the snow scooter to run at 18V-ish. But in general, I'd be glad to have a Victor alternative for other projects as well. If it survives some more abuse testing, I'll post the design files so you can try it out yourself. For now, here's the full schematic:

(Click for full resolution image.)

Oh, and it runs on an Arduino. Did I forget to mention that? My bad.

Wednesday, January 5, 2011

MEMS / Snow Scooter / Panzerkitten / Thing

Cambridge got its first dumping of snow, about two feet of it. And even though it's already mostly melted or trucked away, the pressure's on to create what I call the Micro Electrical-Maniacal Snowmachine, or MEMS for short. (Just so I bait and switch more common search hits like "MIT MEMS"?) Or maybe, as I was thinking yesterday, I should call it Panzerkitten. After all, it is a small, cute, harmless tank tread vehicle.

Thank you, Charles, for the illustration... You can go back to building unnecessarily dangerous and impractical competing vehicles now.

But then again, the seed for this name, "Panzerketten," seems to refer to jewelery that resembles tank tracks, not tank tracks themselves as the literal translation offered by Google would suggest? So it might not actually make any sense. I'll probably just keep calling it "snow scooter" or "the thing" anyway, so it doesn't really matter. If you have a strong opinion, let me know...

Anyway, I got the first batch of waterjet-cut parts for the thing from Big Blue Saw. (I've grown out of the phase where I try to negotiate with the on-campus shop staff about waterjet fees. Plus this way, anyone can make a snow scooter!) For budgetary reasons, I started with just the center plates, which are where all the action happens:

The front (swordfish) plate is like the spine of the scooter, giving the deck some rigidity as well as supporting the front drive module. The drive modules are probably the most interesting part of this build, and I'm trying some new tricks with them to mount the gearmotors inside the track pulleys. To facilitate this, I start with four stainless steel bearings on each side of the center plate:

Pictured: about $40 of stainless hardware. :(

These four bearings form a metabearing on which the pulley itself rides. The pulley is just an aluminum tube with a lip and a metabearing race machined in it on one side. The pulleys are hollow so that the motor and gearbox fit inside them.

Metabearing race.

Copy-paste three more times.

You can really see how the metabearing works in this last picture. The four small bearings ride around in the race cut out on the inside of the pulley, and the result is a lot more space efficient than one giant ring bearing. It only works because the loads are low: the treads get maybe 2/3 of the gross vehicle weight, so maybe 100lbs, and that's spread out across four metabearings on the center plate, four regular bearings on the side plates, and the bogie wheels. The last picture also shows the exit strategy for the two motor leads. The only way to get them out is through slots in the center plate, since there will be spinning pulley and tank tread everywhere else.

The pulleys also get end caps. So far, I've only managed to work out the details of the drive end caps, the ones on the gearbox side. The idler end caps will need to be redesigned to accommodate the longer 550 motors I have planned. As it is, there is virtually no room for wiring. In the mean time, I made two drive caps, complete with 1/2" keyed bore:

They're pressed into the pulleys with Loctite 609, since they transmit torque to the tracks. The small raised edge around the bore is for spacing the pulley out a bit from the side plate's bearing. Both the pulley and the end cap are tapered a little to help keep the track from snagging or trying to jump off. Speaking of tracks, here's where it starts to look real:

What do you normally use 2" wide timing belt for?

I made all these parts while waiting for my Beanbots gearmotors. Beanbots gearboxes occupy a very special place in my mind. On the one hand, they used to make some pretty crappy gearboxes. They lacked proper alignment features, had miserable axial tolerances, tore the shit out of their brass gearteeth, and stripped out the low-carbon output carriers. But this was like...back in 2007. I spent so much time reverse-engineering these gearboxes that I have a spare carrier plate I made out of tool steel on my key chain.

My bad luck charm.

Now, though, they are very well-made. Steel gears, hardened carrier plates, axial spacers, and alignment features other than through-bolts are all standard. Everything is tight, the backlash is minimal, and they run smooth, all for a fraction of what you'd pay for precision planetary gearboxes. Totally legit. It's almost like a totally different company...


After I geased my grearboxes, I popped one into the rear center plate to check the fit:

I spec'ed 8-32 bolts to attach the gearbox to the center plate, when in fact the regular gearbox screws are 6-32. But since I had to drill out the tapped holes in the gearbox anyway, that was no big deal. The 8-32s clear everything just fine. With the two pulleys in place, it disappears:

Except for the motor length, there were no clearance issues and it runs smoothly. With the stock RS550 motor, 12V gives 1,000rpm no load at the pulley. That's 9mph at the ground. At 18V, 13mph. The next test will probably be to see how much torque this drive puts out. If it's more than adequate, I can trade back for a little more speed by going to 16:1 gearboxes, changing to a faster 550 motor, or both. If the torque is merely adequate, I'll probably have to live with the 10mph top speed. If the torque is inadequate, well then I'm screwed.

Before I make that call, though, there are more non-trivial tasks to accomplish. The idler pulley end caps need to be redesigned to handle the longer motor. I need a way to join the belt and to make sure I can get it on and off easily. I need the side plates, the ski, and another Razor A3 to sacrifice. And I need controllers. Speaking of which......well this post is too long already so I'll hold off on that.