Building A Digital Compass With An Arduino

The magnetic compass has been a crucial navigational tool for around a thousand years or so, perhaps longer. While classical versions still work perfectly well, you can now get digital magnetometers that work in much the same way. [mircemk] decided to whip up a digital compass to demonstrate the value of these parts.

The build uses a HMC5883L magnetometer. While this can detect magnetic fields in three axes, just one is necessary for building a device that operates akin to a traditional compass. The output of the device is read by an Arduino Nano, which is hooked up to a string of WS2812B LEDs and a small OLED display. The LEDs display the bearing of magnetic north, while the OLED screen shows the current angle between the compass’s arrow and magnetic north.

It’s a tidy build that would be a great educational resource for teaching both electronics and navigational skills. We’ve seen similar projects before, like the hilarious Pizza Compass. Video after the break.

Continue reading “Building A Digital Compass With An Arduino”

Build A DIY Space Mouse For A More Efficient CAD Workflow

When you find yourself doing a lot of work in 3D modelling, you occasionally wish for something more capable than the humble two-dimensional mouse. A space mouse is a great tool in this regard, and [Salim Benbouziyane] was inspired to build his own.

[Salim] started his work with research, by watching a teardown of a Connexion Space Navigator 3D mouse. This informed him of the basic functionality and the workings inside. The commercial product appears to use an optical sensor setup, but [Salim] decided to go with a magnetic sensor setup instead due to the parts he had on hand. Namely, a 3-axis magnetometer which seemed perfect for the task.

The build uses a motion platform mounted on six springs which translates and rotates in three dimensions as required. The magnetometer is mounted on the platform above a stationary set of neodymium magnets. Thus, when the platform, and thus sensor, moves, the magnetometer’s output can be used to determine the motion of the platform and translate that into useful viewport commands for CAD software. A RP2040 is charged with reading the magnetometer and acting as a USB HID device. It’s all wrapped up in a neat 3D-printed housing.

For now, it’s a little simpler in its operation than a full 6 DOF Spacemouse, but it nonetheless has helped [Salim]’s workflow improve. A good peripheral like this can be a real boon on the desktop; we’ve seen a few DIY projects in this realm for just that reason. Video after the break.

Continue reading “Build A DIY Space Mouse For A More Efficient CAD Workflow”

Pi Pico Calculates Water Usage

Modern WiFi-enabled microcontrollers have made it affordable and easy to monitor everything from local weather information to electricity usage with typically no more than a few dollars worth of hardware and a little bit of programming knowledge. Monitoring one’s own utility data can be a little bit more difficult without interfering with the metering equipment, but we have seen some clever ways of doing this over the years. The latest is this water meter monitoring device based on a Raspberry Pi Pico.

The clever thing here isn’t so much that it’s based on the tiniest of Raspberry Pis, but how it keeps track of the somewhat obscured water flow information coming from the meter. Using a magnetometer placed close to the meter, the device can sense the magnetic field created as water flows through the meter’s internal sensors. The magnetic field changes in a non-obvious way as water flows through it, so the program has to watch for specific peaks in the magnetic field. Each of these specific waveforms the magnetometer detects counts to 0.0657 liters of water, which is accurate for most purposes.

For interfacing with a utility meter, this is one of the more efficient and elegant hacks we’ve seen in a while. There have, of course, been other attempts to literally read the meter using web cams and computer vision software, but the configuration for these builds is much more complex than something like this. You can interface with plenty of utility meters other than water meters, too, regardless of age.

StarPointer Keeps Scope On Target With Stellarium

On astronomical telescopes of even middling power, a small “finderscope” is often mounted in parallel to the main optics to assist in getting the larger instrument on target. The low magnification of the finderscope offers a far wider field of view than the primary telescope, which makes it much easier to find small objects in the sky. Even if your target is too small or faint to see in the finderscope, just being able to get your primary telescope pointed at the right celestial neighborhood is a huge help.

But [Dilshan Jayakody] still thought he could improve on things a bit. Instead of a small optical scope, his StarPointer is an electronic device that can determine the orientation of the telescope it’s mounted to. As the ADXL345 accelerometer and HMC5883L magnetometer inside the STM32F103C8 powered gadget detect motion, the angle data is sent to Stellarium — an open source planetarium program. Combined with a known latitude and longitude, this allows the software to show where the telescope is currently pointed in the night sky.

As demonstrated in the video after the break, this provides real-time feedback which is easy to understand even for the absolute beginner: all you need to do is slew the scope around until the object you want to look at it under the crosshairs. While we wouldn’t recommend looking at a bright computer screen right before trying to pick out dim objects in your telescope’s eyepiece, we can certainly see the appeal of this “virtual” finderscope.

Then again…who said this technique had to be limited to optical observations? As the StarPointer is an open hardware project, you could always integrate the tech into that DIY radio telescope you’ve always dreamed of building in the backyard.

Continue reading “StarPointer Keeps Scope On Target With Stellarium

Hall Effect Module Knows Where Your Motor Is

If you have a motor and you’d like to know where the shaft position is, you are likely to turn to an optical encoder scheme. However, as [lingib] points out, you can also use a magnet and a magnetometer. You can see how it works in the video below.

The MLX90393 is a 3-axis hall effect device and, with a magnet on the shaft, the X and Y outputs of the spinning magnet will form a quadrature output that you can easily read.

Continue reading “Hall Effect Module Knows Where Your Motor Is”

Practical Sensors: The Hall Effect

Measuring a magnetic field can be very easy with some pretty low tech, or it can be very high tech. It just depends on what kind of measurement you need and how much effort you want to expend. The very simplest magnetic sensors are reed switches. These are basically relays with no coil. Instead of a coil, an external magnet gets close enough to make or break the contacts in the reed. You see these a lot in, for example, door alarm sensors.

Then again, there’s no real finesse to a reed. It changes state when it sees enough of a magnetic field and that’s about all. You could use a compass with some sort of detection on the needle to get some more information about the field, but not much more. That was, however, how early magnetometers worked. Today, you have lots of options, including the nearly ubiquitous Hall effect sensor.

You might use a Hall effect to measure the magnetic button on a keyboard key coming down when you press it or the open and closed state of a valve. A lot of Hall effects see service as current monitors. Since a coil generates a magnetic field proportional to the current through it, a magnetic sensor can estimate the current in a coil of wire without any physical contact. Hall effects can also watch a magnet go by in a linear motion system or a rotating system to get an idea of position or speed. For example, check out this brushless motor controller that uses three sensors to understand the motor’s position.

History

Edwin Hall identified the effect in 1879. The basic idea is simple: an electrical conductor carrying current will exhibit changes due to an external magnetic field nearby. These changes show up as voltage you measure across the conductor. Normally, the voltage across a conductor will be nearly zero, but with a magnetic field, you’ll get a non-zero reading in proportion to the magnetic field strength in a particular plane, as we’ll see shortly.

Hall effect sensors are just one type of modern magnetometer. There are many different kinds including those that use inductive pickup coils that may or may not rotate or a fluxgate, which is a special type of coil. Some use a scale or a spring to measure force against another magnet — sometimes microscopically. You can even detect a magnetic field using optical properties like the Kerr effect or Faraday rotation.

Continue reading “Practical Sensors: The Hall Effect”

Feel The Force With A Pocket Magnetometer

With the rise of affordable 3D printers, we just don’t see the projects in Tic Tac boxes that we used to. That’s kind of a shame. Not only are you upcycling existing plastic when you use one, they’re decently sized component vessels for pocket builds such as [rgco]’s portable magnetometer, especially if you can get the 100-count box. Best of all, they’re see-through!

Sure, you could get a magnetometer app for your phone to test out the strength of your Buckyballs, but this is more fun, and you can use it in more places. This build doesn’t take much — an Arduino Nano reads from a Hall effect sensor and outputs the magnetic flux density in militeslas (mT) on an OLED. Fortifying the sensor by mounting it inside the body of an old (also see-through!) ballpoint pen body is a nice touch.

In order to calibrate it, [rgco] made a solenoid by wrapping a length of PVC with magnet wire. The code for this very portable and low-cost magnetometer measures the magnetic field 2000 times in under three-tenths of a second, and outputs both the mean and the standard deviation of these measurements.

Magnetometers can ID all kinds of things from submarines to Suburbans. Here’s an ESP8266 magnetometer that opens a driveway gate when it detects the car.