Magnetometer

By monitoring the earths magnetic field you can detect the effects of the impact of the solar wind and use as a guide to the visibility of the aurora.

Below is a description of the iteration 3 magnetometer.

Updates

2023-01-01

Iteration 3 of the hardware now working on the bench.

2022-01-10

Another power cut this morning – so implemented the real time clock module. Was straightforward to install and configure using the instructions on the Hobby Electrons site (note, use the instructions given, using ds1307 rather than ds3231 which is the part actually used).

A ‘Simple’ Magnetometer

Code can be found on GitHub – currently the V0 software, the operational system has a number of changes. V2 (iteration 3) will be posted soon.

Why a ‘Simple’ magnetometer? – the goal was to minimise the number of components required to create a simple design, with any complexities to be dealt with in software.

This design uses a Fluxgate sensor – this is basically a device that generates a varying frequency signal depending on the strength of the magnetic field the sensor is sitting in.

Conventional magnetometers convert the frequency to a voltage and then this voltage is measured or digitised. Changes to the earths magnetic field are quite small though, and frequency changes of a few Hertz so the voltage signal can be quite small. To alleviate this sometimes a heterodyne oscillator is used to make the small signal relatively larger. All this circuitry is complex, and needs to be pretty stable to avoid bias or interference to the signal.

My idea (patent pending 😉 was rather than converting the signal to a voltage, to just measure the frequency directly. I thought that maybe a Raspberry Pi (RPi) could do this directly, but the designs I found could not handle the frequency retried (around 60khz) and used additional components to divide the signal down to more manageable rates. I then came across a forum posting about using the Raspberry Pi Pico as a frequency counter, all I would then need to do is to feed the measurements into a Raspberry Pi for logging.

Fluxgate sensors are notoriously temperature sensitive, so I also want to place a thermal sensor near the fluxgate to see what temperature variations were being encountered. A cheap and cheerful solution to this is a 1-wire sensor, the DS 18B20, which could be connected directly to the RPi.

So here is a block diagram of the design:

‘Simple’ magnetometer block diagram

‘Simple’ magnetometer block diagram

Software on the RPi is written in Python. There are two applications to log the magnetic signal and temperature. The data is presented to the viewer using a web browser – the web application also written in Python uses Flask. The code here plots the magnetic and temperature signals In the V1 software, the effects of the temperature changes is compensated for by subtracting from the signal. The Python libraries AstroPy, Numpy, and Pandas are used for the processing with visualisation done by Matplotlib.

Here is a typical plot of the magnetic signal and temperature change, and the compensated signal from a day with a notable large swing caused by a glancing CME impact.

Magnetic signal variation and temperature plot

Magnetic signal variation and temperature plot

Compensated signal plott

Compensated signal plott