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.
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.
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.
The Fridge Test
I got home and pulled a rare earth magnet off the refrigerator and grabbed an ohm meter. Sure enough, I could reliably operate the relay contacts with the strong magnet. My project was in business!
Of course, your mileage may vary. The construction of any particular relay may or may not be conducive to external activation. You may have to experiment with the exact magnet, but those are easy to find in lots of local outlets, including home improvement and hobby stores.
The Mother of Invention
When you are cooking, sometimes it helps to know that you can substitute one thing for another. The same is true of electronic components. Need a bridge rectifier? Make one out of diodes. You can probably substitute an op amp for most comparator applications. LEDs can detect light and speakers can act as microphones although in both cases the results are not as good as parts that are supposed to do those functions.
I do think it is interesting, though, that Radio Shack has such a blend of odd things. You can get a lot of Arduino shields, for example. You can also get a lot of relays. However, I noticed there was only one MOSFET in the cabinet and it wasn’t a “logic level” FET. Seems like it would be like going into an office supply store and finding PCs and carbon paper, but no LCD screen wipes.
Regardless of Radio Shack’s ability to keep up with the times or not, I was glad they had relays. When you are looking to scrounge something in a hurry, don’t forget to think about auto supply places, home improvement stores, craft stores, and even dollar stores — I’ve seen a one-dollar, open-door detector before, but I knew from a previous attempt they have the sensor integrated with the electronics and are hard to scrounge.
Postscript: After I completed my little project, while looking for something totally unrelated, I ran across this homebrew reed switch. Certainly another option.