LCD-LED DisplaySensors - Tranducers Circuits

Tiny Compass Schematic Circuit Diagram

Navigational Aid: A Crucial Tool for Travelers

When you’re on foot or bicycle, having a reliable orientation tool like a compass is indispensable. Surprisingly, some smartphones and navigation systems lack built-in compasses, meaning they can only determine direction accurately when you move swiftly. Traditional hiking or cycling maps still hold value as they offer a more comprehensive view compared to any digital display.

The Quest for a Personalized Electronic Compass

In search of a dependable compasses, the author embarked on a journey. It swiftly became apparent that an electronic model, designed according to personal preferences, was the ideal choice. Fortunately, the task was made easier by the availability of commercially accessible compass models with straightforward interfaces. The author opted for the HDMM01 module, conveniently sourced from Pollin Electronic [1].

Tiny Compass Schematic Circuit Diagram

Incorporating the MMC2120MG Sensor: Building the Compass Circuit

The core of the compass circuit utilizes the MMC2120MG two-axis magnetic field sensor from Memsic. Supplying the module with a 5 V voltage allows the compass data to be read from a two-pin I²C port, typically done with a microcontroller. An ATtiny84 microcontroller is the central component, communicating with the compass module through the I²C bus. Pull-up resistors R5 and R6, with standard values, are essential. The circuit can be powered by a 9 V battery, with the voltage regulator reducing the input to 5 V. The compass direction is visually represented by 16 LEDs organized into four groups of four LEDs each. Through clever circuitry, only one LED at a time is illuminated, requiring just eight port pins instead of sixteen.

Microcontroller Intelligence: I²C Emulation and Compass Calibration

The microcontroller firmware holds the intelligence of the circuit, starting with the emulation of the I²C interface using the Universal Serial Interface (USI) of the ATtiny84. The compass module provides X and Y components of the magnetic field, which are used to determine the corresponding quadrant and angle. The firmware calculates average X and Y values from eight samples, continuously computing the angle. This information guides the specific LED pointing north. To ensure precision, the LEDs must be arranged evenly in a circle, aligned with the schematic diagram. Calibration, aided by another compass, helps adjust the module’s orientation. Once calibrated, secure the module on the PCB using heat-melt glue.

Programming and Configuration: Making the Compass Functional

Programming the microcontroller directly on the PCB is facilitated through connector K1. Correct fuse bit configurations (EXT = 0xFF, HIGH = 0xDF, LOW = 0xE2) are vital. The firmware, including source code for WinAVR and hex code, is available for download from the Elektor website. The main routine resides in the file tiny_compass.c, with USI_TWI_Master.c managing I²C communication and led_driver.c controlling the LEDs. Alternatively, pre-programmed microcontrollers can be purchased from the Elektor Shop, ensuring a functional and calibrated compass assembly [4].

Internet Links


Related Articles

Leave a Reply

Your email address will not be published.

Back to top button