Day 1 :

Resources :

https://create.arduino.cc/projecthub/electropeak/determining-the-pressure-and-altitude-using-gy-68-bmp180-and-93fd6f

https://create.arduino.cc/projecthub/Infineon_Team/magnetic-based-3d-position-sensing-c1e2ff?ref=part&ref_id=10116&offset=0

https://github.com/adafruit/Adafruit_MMC56x3

https://www.adafruit.com/product/5579

https://www.youtube.com/watch?v=yvrpIYc9Ll8

https://www.meccanismocomplesso.org/en/arduino-measuring-the-earths-magnetic-field-with-the-magnetometer-hmc5883l/


Wiring the MMC56 to breadboard and arduino nano IOT 33

Image 2

Image 2

https://thesolaruniverse.files.wordpress.com/2020/08/076_bare_gy21p_fig_01_96_dpi.png?w=736

Code :

#include <Adafruit_MMC56x3.h>

/* Assign a unique ID to this sensor at the same time */
Adafruit_MMC5603 mmc = Adafruit_MMC5603(12345);

void setup(void) {
  Serial.begin(115200);
  while (!Serial)
    delay(10); // will pause Zero, Leonardo, etc until serial console opens

  Serial.println("Adafruit_MMC5603 Continuous Mode Magnetometer Test");
  Serial.println("");

  /* Initialise the sensor */
  if (!mmc.begin(MMC56X3_DEFAULT_ADDRESS, &Wire)) {  // I2C mode
    /* There was a problem detecting the MMC5603 ... check your connections */
    Serial.println("Ooops, no MMC5603 detected ... Check your wiring!");
    while (1) delay(10);
  }

  /* Display some basic information on this sensor */
  mmc.printSensorDetails();

  mmc.setDataRate(100); // in Hz, from 1-255 or 1000
  mmc.setContinuousMode(true);
}

void loop(void) {
  // Get a new sensor event 
  sensors_event_t event;
  mmc.getEvent(&event);

  // Display the results (magnetic vector values are in micro-Tesla (uT))
  Serial.print("X: ");
  Serial.print(event.magnetic.x);
  Serial.print("  ");
  Serial.print("Y: ");
  Serial.print(event.magnetic.y);
  Serial.print("  ");
  Serial.print("Z: ");
  Serial.print(event.magnetic.z);
  Serial.print("  ");
  Serial.println("uT");

  // Delay before the next sample
  delay(10);
}