A libre Arduino Library for the HMC5843 and HMC5883L Honeywell magnetometers

Registered 2011-01-22 by Fabio Varesano

IMPORTANT: The HMC58X3 library is now part of the FreeIMU library. Please refer to the FreeIMU library page for newer code. See http://www.varesano.net/projects/hardware/FreeIMU#library

This is a libre Arduino Library for the HMC5843 and HMC5883L Honeywell magnetometers.

Both the HMC5843 and HMC5883L are supported by the library.

By default the library assumes you are using the HMC5883L. In order to use the library with the HMC5843 you have to edit the file HMC58X3.h and uncomment the line "#define ISHMC5843".

IMPORTANT: note that this library doesn't disable the internal pullups of the Arduino (which the Wire library enable by default). Using a logic level converter is required to avoid burning your chip. In case you don't have an LLC you can modify your twi.c file which you find in your Arduino IDE install and then you'll find it in the folder
libraries/Wire/utility/ .. Change the following lines:

 #if defined(__AVR_ATmega168__) || defined(__AVR_ATmega8__) ||
defined(__AVR_ATmega328P__)
    // activate internal pull-ups for twi
    // as per note from atmega8 manual pg167
    sbi(PORTC, 4);
    sbi(PORTC, 5);
  #else
    // activate internal pull-ups for twi
    // as per note from atmega128 manual pg204
    sbi(PORTD, 0);
    sbi(PORTD, 1);
  #endif

into:
// #if defined(__AVR_ATmega168__) || defined(__AVR_ATmega8__) || defined(__AVR_ATmega328P__)
// // activate internal pull-ups for twi
// // as per note from atmega8 manual pg167
// sbi(PORTC, 4);
// sbi(PORTC, 5);
// #else
// // activate internal pull-ups for twi
// // as per note from atmega128 manual pg204
// sbi(PORTD, 0);
// sbi(PORTD, 1);
// #endif

Project information

Maintainer:
Fabio Varesano
Driver:
Fabio Varesano
Development focus:

trunk series 

lp:hmc58x3 
Browse the code

Programming Languages:
C, C++
Licences:
GNU GPL v3
()

RDF metadata

View full history Series and milestones

HMC58X3 Arduino Library trunk series is the current focus of development

Get Involved

Downloads

Latest version is v0.4
released on 2011-12-05

All downloads