EngorioEngorio.in

Digital Compass

Electronics Intermediate ESP32 Arduino C++
Digital Compass project banner

About this project

PoleStar turns an ESP32 and an HMC5883L 3-axis magnetometer into a precision digital compass — with zero sensor libraries. Every register is written manually over raw I2C: Config Register A is programmed for 8-sample averaging at 15 Hz, Config Register B selects the ±1.3 Gauss gain stage (1090 LSB/Gauss), and the Mode register switches the chip into continuous-measurement mode. On every read cycle the firmware performs a 6-byte burst read from address 0x03, reassembles three signed 16-bit integers (honouring the chip's unusual X–Z–Y byte order), and applies a hard-iron calibration offset computed by the built-in min/max method — the user rotates the board 360° for 60 seconds once to capture magnetic circle extremes, and the firmware stores the offsets in RAM for all future measurements. Calibrated X and Y field vectors feed atan2f to produce a heading angle, a user-configurable magnetic declination correction is added, and the result is mapped to eight compass points. A live animated SVG-style compass rose, six field-strength cards, and a one-click calibration button are served from the ESP32's Wi-Fi Access Point to any browser at 192.168.4.1. An SSD1306 OLED on the shared I2C bus shows heading, direction label, total field magnitude in µT, X/Y/Z in milli-Gauss, and live calibration countdown.

What you get

  • Complete, commented source code
  • Full components list with quantities
  • Pin-by-pin wiring guide and connection table
  • Step-by-step upload and testing guide
  • Project report (.docx, IEEE style)
  • Presentation slides (.pptx)

More Electronics projects

9V Battery Health Tester project banner

9V Battery Health Tester

Beginner₹109
Automatic Plant Watering project banner

Automatic Plant Watering

Beginner₹109
Capacitance Meter project banner

Capacitance Meter

Beginner₹109
DC Motor Speed Controller project banner

DC Motor Speed Controller

Beginner₹109
Digital Light Meter project banner

Digital Light Meter

Beginner₹109
Frequency and Duty Cycle Meter project banner

Frequency and Duty Cycle Meter

Beginner₹109