1 - Beginnings
3 - Hello World
4 - More On GPIO
5 - Interrupts
7 - Timers
10 - Buttons and Bouncing
Would you like to be notified by email when Tim Wescott publishes a new blog?
I've been kicking some ideas around for a long time for a simple and inexpensive platform I could use for control systems experimentation for the beginner. I want something that can be controlled easily in a basic fashion, yet that provides some depth: I want to be able to present ever-more challenging goals to the student, that can be attained by fancier control algorithms all on the same device.
I'm currently looking at magnetic levitation. It's fun, it has the potential to be cheap, it's a challenging control problem, and depending on how you approach it, there are layers and layers of performance improvements to be had, using ever more sophisticated control techniques.
I tried to make my own magnetic levication demonstrator. It was fun, but I could only levitate a 14mm Christmas bell about 3mm below my magnetic pole piece. There are "floating globe" executive desk toys that levitate a 100mm diameter globe well over 15mm below their pole pieces -- so I know that I'm doing something wrong.
One of the principles of engineering that they don't teach you in school, is that if you can't figure out how a product works, you should go buy one and rip off its technology. That's exactly what I'm going to do here. My starting point for this is a floating globe desk toy that I purchased from Amazon for around US$30.
This article presents my initial impressions of the device, some guesses about its construction, and a critique of the control system that it uses.
The first picture is of the box that the floating globe comes in. The packaging comes with no indication of the manufacturer or country of origin, and the instruction manual is both scant and written in poor English. From these clues we can deduce that we may not be working with the highest quality of merchandise.
These two pictures show the floating globe at rest, and in operation. There is a strong magnet at the 'north pole' of the floating globe, and something ferrous (presumably the pole piece of an electromagnet) in the head piece of the arm that extends overhead. In the picture at the left you see the globe stuck to the head piece. When you turn the device on the globe remains stuck, but it can be pulled down about 15mm or so, whereupon it will hang in midair.
The physical principal of a device like this is that the downward acceleration due to gravity is countered by an upward force due to the magnet. If magnetism were easy you could stop there -- unfortunately, magnetic devices like this are inherently unstable: the farther that the magnet gets from the head the less force it exerts, while the closer it gets the more force it exerts. So when the control system is unpowered, the globe will tend to either fall away from the head, or to spring toward it and stick.
The control systems principal of these devices is that the position of the globe is sensed, and the strength of the electromagnet in the head is constantly varied to keep the globe floating in a stable fashion. Thus, as the globe approaches the head the electromagnetic force of the head is made to aid the permanent magnet less, or even to oppose it; similarly, when the globe moves away from the head the electromagnet is made to aid the permanent magnet more. Done right, this action stabilizes the globe and keeps it hanging in one spot.
It turns out that without using exotic materials such as superconductors or diamagnetic materials, one cannot make a stable magnetic levitation device -- see Wikipedia's discussion of Earnshaw's Theorem for more detail.
These floating globe devices appeal to my geeky control-engineer side, because it is an example of an inherently unstable system made stable through closed-loop control. Indeed, they are a simple example of magnetic levitation, which gets some attention in the applied control literature in the fields of transportation (maglev trains) and machinery (in the form of active magnetic bearings).
In the initial investigation of the performance of the control system, I must say that I am disappointed. Yes, I know this is a cheap toy -- but still, couldn't they have done better? Here is the behavior that I observed in my floating globe device:
Since I am trying to figure out how to copy this thing, I then went on to do some experiments with some strong magnets of my own and the existing device.
If you take a small cubical rare-earth magnet, one that is about 6mm on a side, and bring it up to the bottom of the head in the correct direction, you can feel when the control system takes hold. This happens when the magnet is about 8mm from the bottom of the head (contrast this with the 15mm or so that the device achieves). The levitation is not stable, however: the magnet is close enough to the head that it immediately jumps up and attaches itself.
Experimenting further, if you take that same magnet and stick it on a nail, you can almost make it hang. Taping two 16-penny nails together gives enough weight that the assembly appears to be stable in the vertical direction -- however, when you let go of the nails the whole thing jumps sideways and sticks to the head. This makes me believe that the pole piece is cup shaped -- in the next installment I'll take things apart and we'll see.
Probing around the surface of the globe with a magnet tells me that there's an area about 30mm in diameter that's all got the same magnetic polarity, with (I think) a stronger field right in the middle. I'm pretty sure that there's a clue in here for me, if I just know what to do with it.
Going on the "big magnetic area" idea, I tried sticking a slightly bigger magnet -- a 13mm disk, 3mm thick, onto a steel ruler. With that I can get the thing to hang almost stably. In this case what trips the system up is that the steel ruler that I chose is very "whippy" -- the control system cannot stabilize around the resonance of the ruler, and so the thing vibrates more and more, then falls.
I'm an engineer, though, and a stubborn one, so I can fix this: that same magnet, and the same ruler, can be made to work if I stretch a strip of tape across the open ends of the ruler. This brings the resonance frequency of the ruler far higher than the bandwidth of the control system, and kills the Q of the resonance. Now I have a system that is half purchased and half my own, that hangs stablily. The picture shows the ruler (and my messy workbench). If you look closely you can see the magnet at the center of the ruler, the tape, and the bow created by the tape.
There are other games that you can play with this if you have some magnets: you can stick magnets onto the globe and make it hang at different distances from the base, or you can levitate other objects than a ruler. But we're into the land of diminishing returns at this point.
In the next installment of this teardown, I'll actually start tearing this thing down! I'm curious to see how large the magnet in the globe is, what shape it is, and whether it has any pole pieces. I'm also curious to see how the electromagnet in the head is shaped. Finally, I suspect that the electronics that make this whole thing work are rather primative, but I'm curious to see just what a manufacturer makes his executive toys out of, when he's obviously cutting costs at every turn.
Add a Comment