Magnetic sensor

[Peter Jansen] is the creator of the Open Source Tricorder. He built a very small device meant to measure everything, much like the palm-sized science gadget in Star Trek. [Peter] has built an MRI machine that fits on a desktop, and a CT scanner made out of laser-

cut plywood. Needless to say, [Peter] is all about sensing and imaging.

[Peter] is currently working on a new version of his pocket sized science tricorder, and he figured visualizing magnetic fields would be cool. This led to what can only be described as a camera for magnetism instead of light. It’s a device that senses magnetic fields in two directions to produce an image. It’s cool, and oddly, electronically simple at the same time.

Visualizing magnetic fields sounds weird, but it’s actually something we’ve seen before. Last year, [Ted Yapo] built a magnetic imager from a single magnetometer placed on the head of a 3D printer. The idea of this device was to map magnetic field strength and direction by scanning over the build platform of the printer in three dimensions. Yes, it will create an image of field lines coming out of a magnet, but it’s a very slow process.

Instead of using just one magnetic sensor, [Peter] is building a two-dimensional array of magnetic sensors. Basically, it’s just a 12×12 grid of Hall effect sensors wired up to a bunch of analog multiplexers. It’s a complicated bit of routing, but building the device really isn’t hard; all the parts are easily hand-solderable.

While this isn’t technically a camera as [Peter] would need box or lens for that, it is a fantastic way to visualize magnetic fields. [Peter] can visualize magnets on his laptop screen, with red representing a North pole and green representing the South pole. Apparently, transformers and motors look really, really cool, and this is a perfect proof of concept for the next revision of [Peter]’s tricorder. You can check out a video of this ‘camera’ in action below.

I had a small project going on–never mind exactly what–and I needed to detect a magnet. Normally, that wouldn’t be a big problem. I have a huge hoard of components and gear to the point that it is a running joke among my friends that we can be talking about building something and I will have all the parts we need. However, lately a lot of my stuff is in… let’s say storage (again, never mind exactly why) and I didn’t have anything handy that would do the job.

Options

If I had time, there are plenty of options for detecting a magnet. Even if you ignore exotic things like SQUID (superconducting quantum interference device) there’s plenty of ways to detect a magnet. One of the oldest and the simplest is to use a reed switch. This is just a switch made with a thin piece of ferrous material. When a magnet is nearby, the thin piece of metal moves and makes or breaks the contact.

These used to be common in alarm systems to detect an open or closed door. However, a trip to Radio Shack revealed that they no longer carry things like that as–apparently–it cuts into floorspace for the cell phones.

I started to think about robbing a sensor from an old computer fan or some other consumer item with a magnetic sensor onboard. I also thought about making some graphene and rolling my own Hall effect sensor, but decided that was too much work.

Browsing

I was about to give up on Radio Shack, but decided to skim through the two cabinets of parts they still carry just to get an idea of what I could and could not expect to find in the future. Then something caught my eye. They still carry a wide selection of relays. (Well, perhaps wide is too kind of a word, but they had a fair number.) It hit me that a relay is a magnetic device, it just generates its own electromagnetic field to open and close the contacts.

I picked up a small 5 V reed relay. They don’t show it online, but they do have several similar ones, so you can probably pick up something comparable at your local location. I didn’t want to get a very large relay because I figured it would take more external magnetic field to operate the contacts. You have to wonder why they have so many relays, unless they just bought a lot and are still selling out of some warehouse. Not that relays don’t have their use, but there’s plenty of better alternatives for almost any application you can think of.

[Michelle Leonhart] has two Roborovski hamsters (which, despite the name, are organic animals and not mechanical). She discovered that they seem to run on the hamster wheel all the time. A little Wikipedia research turned up an interesting factoid: This particular breed of hamster is among the most active and runs the equivalent of four human marathons a night. Of course, we always believe everything we read on Wikipedia, but not [Michelle]. She set out to determine if this was an accurate statement.

She had already added a ball bearing to the critters’ wheel to silence it by cannibalizing an old VCR. What she needed was the equivalent of a hamster pedometer. A Raspberry Pi and a Hall effect sensor did the trick. At least for the raw measurement. But it still left the question: how much distance is a hamster marathon?

[Michelle] went all scientific method on the question. She determined that an average human female’s stride is 2.2 feet which works out to 2400 strides per mile. A marathon is 26.2 miles (based on the distance Pheidippides supposedly ran to inform Athens of victory after the battle of Marathon). This still left the question of the length of a hamster’s stride. Surprisingly, there was no definitive answer, and [Michelle] proposed letting them run through ink and then tracking their footsteps. Luckily, [Zed Shaw] heard about her plan on Twitter and suggested pointing a webcam up through the plastic bottom of the cage along with a scale. That did the trick and [Michelle] measured her hamster’s stride at about 0.166 feet (see right).

Now it was a simple matter of math to determine that a hamster marathon is just under 10,500 steps. Logging the data to SQLite via ThingSpeak for a month led [Michelle] to the conclusion: her hamsters didn’t run 4 marathon’s worth of steps in a night. In fact, they never really got much over 2 marathons.

Does [Michelle] have lazy hamsters, or did she just add to our body of scientific knowledge about rodents? We don’t know. But we couldn’t help but admire her methods and her open source data logging code would probably be useful for some non-hamster activities.

Many tablets come with some sort of triaxial magnetic sensor but as [Andrea] and [Ian]’s demo shows, they are only capable of passing along the aggregate vector of all magnetic forces. If one had multiple magnetic objects, the sensor is not able to provide much useful information.

Their solution is a mix of software and hardware. Each object is given a magnet that rotates at a different known speed. This creates complex sinusoidal magnetic fields that can be mathematically isolated with bandpass filters. This also gives them distance to each object. The team added an Arduino with a magnetometer for reasons unexplained, perhaps the ones built into tablets are not sufficient?

The demo video below shows off what is under the hood and some new input mechanics for simple games, sketching, and a logo turtle. Their hope is that this opens the door to all manner of tangible devices.