This device is a simple but practical way to visualize and measure various small magnetic fields, as well as roughly measuring the current flow through wires. 

Typically current is measured using "Shunt Resistor's" in series with the desired PCB trace or “Split Clamp” device, or a typical multimeter in ammeter mode. Whereas this is suitable for individual wires, it can be a pain to implement on a PCB, as both methods involve physically breaking the circuit in order in order to perform these measurements. Physically altering the circuit introduces unwanted circuit impedance when a Shunt Resistor or jumper wire is added in series with the existing trace.

Using the DRV425 IC by Texas Instruments we can probe a PCB track and the current flowing through the copper trace can be observed and measured.  Using Ampere's Law, which states that a current carrying wire produces a magnetic field being proportional to the current flow. 

The field sensor must maintain the shortest possible distance from the PCB trace as possible; as Ampere's Law states this Magnetic Field exponentially decreases with the square of distance (to a first order approximation) as described by Ampere’s law for current carrying wires. The integrated fluxgate magnetometer sensor is manufactured into the silicon dye, along with all necessary amplifiers and circuitry.

Figure 1: Diagram of DRV425 measuring the magnetic field of PCB trace.

Figure 2: Table of DRV425 measuring the magnetic field of PCB trace at variable distances in millimeters.

As you can see from the above table. If the probe tip is 1mm away from the trace being measured we can see that there is a roughly 50% loss in the measured field strength.

Fluxgates operate on Faraday's principle of electromagnetic induction. Current is induced by the primary and secondary coil(s) being driven in and out of saturation in order to achieve an equilibrium. When an outside magnetic field is introduced to this system in equilibrium, the net change in flux will cause the inductive coils to produce current due to Faraday’s law. This current, while small, can be amplified and measured in order to extrapolate external field strengths. 

Figure 3: DRV425 Integrated Circuit showing internal fluxgate

Figure 4: Simplified Block Diagram for DRV425 Integrated Circuit

Texas instruments supplies a formula that allows the user to extrapolate the output of the sensor in Volts, to a readable magnetic field value in Tesla. The first element is the gain of the compensation coil which is defined as “The compensation current is proportional to the external magnetic field and its value is 12.2 .” [1] This compensation current generates a voltage drop across an external shunt resistor, , shown in figure 1. “An integrated difference amplifier with a fixed gain of 4  measures this voltage and generates an output voltage that is referenced to REFIN and is proportional to the magnetic field.” [1] The value of the output voltage at the  pin (VOUT) is calculated using Equation 1:

The Arduino Due is the best choice of micro-controller over the UNO, Leonardo or other cost comparative devices as we can achieve the best possible sampling rate and resolution. The Arduino DUE has a 12-bit integrated ADC (Analog to Digital Converter). This eliminates the need for an external ADC, and increases measurement accuracy. Typical cheap ADC's found on Amazon, Ebay, ADAfruit ect. use I2C serial communication which unnecessarily slows the rate at which we can sample. The fastest external ADC I found could sample at 188.9K Samples per Second at 12-bit resolution, which is almost the same price as the DUE with less than 1/5th of the possible sampling rate.

By setting the Arduino DUE to "free-running" mode we can achieve a sampling rate of nearly 1 Mega Samples per second using one channel. Although this 1MHz sampling rate is only achieve-able using DMA (digital memory addressing) or disabling all (other) interrupt
handlers (which otherwise may cause lost samples by delaying the ADC code or ISR). For simplicities sake I have chosen to avoid this and opted for 667kHz sampling rate with 1 channel.

Our code uses two channels which cuts the sampling rate in half yielding 336kHz for channels 1 and 2. The below figure is a block diagram of the code which helps to explain its flow.

The results of the code shown in the serial plotter and serial monitor are shown below.

To get a rough value of the current flowing through the PCB trace please refer to below chart.

Current [A] Vout [V] B-Field Value [T]
0 1.6 0.00E+00
0.05 1.65 1.02E-05
0.1 1.7 2.05E-05
0.15 1.75 3.07E-05
0.2 1.8 4.10E-05
0.25 1.85 5.12E-05
0.3 1.9 6.15E-05
0.35 1.95 7.17E-05
0.4 2 8.20E-05
0.45 2.05 9.22E-05
0.5 2.1 1.02E-04

The first Value is whatever voltage value read by the Arduino with no external magnetic field applied. The table illustrates that for each 50 millivolt rise in output voltage, we can assume current in the wire has increased by 50 milliAmps.