Atur jumlah dan catatan
Stok Total: 20
Subtotal
Rp76.500
HMC5883L Triple-Axis Compass Magnetometer Sensor Module
Rp76.500
- Kondisi: Baru
- Min. Pemesanan: 1 Buah
- Etalase: SENSOR
Features
Power 3-5V
Chipset HMC5883L
Communication via I2C protocol
Dimensions 14.8 x 13.5 x 3.5mm
Reference Schematic
GY-271 Schematic
Arduino Example
When testing this unit, I found Arduino internal pull-ups are not that well working and I2C signal looked really bad and Wire library was hanging on endTransmission(), so I lowered I2C clock to 25kHz and that seems to help. The code below should be hot-pluggable, but Wire library may still hang. Upload the sketch and open Serial Monitor on 9600Bd.
/*
* HMC5883L Demo.
* dipmicro electronics, 2014
*
* Hardware Used:
*
* Arduino UNO or compatible
* GY271 module (dipmicro part DE4196
* Arduino GND -> GY271/HMC5883L GND
* Arduino 3.3V -> GY271/HMC5883L VCC
* Arduino A4 (SDA) -> GY271/HMC5883L SDA
* Arduino A5 (SCL) -> GY271/HMC5883L SCL
*/
#include //I2C Arduino Library
#define HMC5883L_ADDR 0x1E //0011110b, I2C 7bit address of HMC5883
bool haveHMC5883L = false;
bool detectHMC5883L ()
{
// read identification registers
Wire.beginTransmission(HMC5883L_ADDR); //open communication with HMC5883
Wire.write(10); //select Identification register A
Wire.endTransmission();
Wire.requestFrom(HMC5883L_ADDR, 3);
if(3 == Wire.available()) {
char a = Wire.read();
char b = Wire.read();
char c = Wire.read();
if(a == 'H' && b == '4' && c == '3')
return true;
Power 3-5V
Chipset HMC5883L
Communication via I2C protocol
Dimensions 14.8 x 13.5 x 3.5mm
Reference Schematic
GY-271 Schematic
Arduino Example
When testing this unit, I found Arduino internal pull-ups are not that well working and I2C signal looked really bad and Wire library was hanging on endTransmission(), so I lowered I2C clock to 25kHz and that seems to help. The code below should be hot-pluggable, but Wire library may still hang. Upload the sketch and open Serial Monitor on 9600Bd.
/*
* HMC5883L Demo.
* dipmicro electronics, 2014
*
* Hardware Used:
*
* Arduino UNO or compatible
* GY271 module (dipmicro part DE4196
* Arduino GND -> GY271/HMC5883L GND
* Arduino 3.3V -> GY271/HMC5883L VCC
* Arduino A4 (SDA) -> GY271/HMC5883L SDA
* Arduino A5 (SCL) -> GY271/HMC5883L SCL
*/
#include //I2C Arduino Library
#define HMC5883L_ADDR 0x1E //0011110b, I2C 7bit address of HMC5883
bool haveHMC5883L = false;
bool detectHMC5883L ()
{
// read identification registers
Wire.beginTransmission(HMC5883L_ADDR); //open communication with HMC5883
Wire.write(10); //select Identification register A
Wire.endTransmission();
Wire.requestFrom(HMC5883L_ADDR, 3);
if(3 == Wire.available()) {
char a = Wire.read();
char b = Wire.read();
char c = Wire.read();
if(a == 'H' && b == '4' && c == '3')
return true;
Ada masalah dengan produk ini?
ULASAN PEMBELI

Belum ada ulasan untuk produk ini
Beli produk ini dan jadilah yang pertama memberikan ulasan