Panteltje's mag_pic page
Panteltje's mag_pic page
Some asm code, this displays angle in .1 degrees, distance (as related to x and y, so hypotenuse), x, y, and CORDIC radians (0-65535 for 0-360 degrees),
note that CORDIC radians counts counter clockwise and 0 is east.
The program has a help menu, RS232 interface, and a rotation calibration that can go full circle and is saved in EEPROM.
There is also a real time clock.
I used CORDIC atan code by Pat Fairbank.
This is version 0.4, and displays on my desk, needs some more work.
5000 lines of asm, my part released under the GPL:
mag-0.4.asm
Here is a Linux C program, based on the auto calibration procedure for other sensors from www.fatquarterssoftware.com,
It should be studied with the fatquarterssoftware.com auto calibration pdf.
Current version is 0.3, this is working, but still test code, it does auto calibration and displays the corrected output.
Usage:
mag_pic log_mag_pic_vectors -t 1
Rotate compass until it starts outputting angles (HEADING) to stdout, you can redirect the output to a file or via the 'tee' program.
You can download it here: log_mag_pic_vectors-0.3.c
Compile with gcc -Wall -O2 -o log_mag_pic_vectors log_mag_pic_vectors.c -lm
There is now also a Linux GUI version:
Current version is 0.2
xmag_pic-0.2.tgz
xmag_pic-0.2.lsm
It looks like this is the one that will be further developed, if at all.
Circuit diagram
In the latest version the wires to the oscillator that drives the fluxgate are locally decoupled with 220 uF, and then separately go to the 7805, to avoid interference with the rest.
This can be done because the primary is almost 100 % isolated, except for the 1k of the PNP to ground, that impedance is too high to cause a problem.
So the 220 uf is not as drawn here, but between A and B.
Also I added 2 1k resistors parallel to the sense coils, this reduces temperature effects.
the coils
digital board with PIC, 7805 regulator, and LCD
analog board side view
analog board bottom view
mag_pic on table facing north,
LCD top line from left to right: angle from north, distance, time.
LCD botom line from left to right: ADC X input, ADC Y input, CORDIC calculated angle (0-65535 for 0-360 degrees).
fluxgatesecond test circuit diagram
fluxgate second test setup
fluxgate test
fluxgate out no magnet
fluxgate out magnet north
fluxgate out magnet south
fluxgate test magnet flat side is pole
fluxgate out versus vce driver
Click here for some programs I make available under the GPL.