Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino Mega 2560 Multi-Sensor Data Logger with I2C Multiplexer

View and Edit Project In Cirkit DesignerImage of Arduino Mega 2560 Multi-Sensor Data Logger with I2C Multiplexer

Circuit Documentation

Summary

This circuit interfaces an Arduino Mega 2560 with multiple sensors, including an Adafruit ADXL326 accelerometer, a pressure transducer, and two MLX90614 IR temperature sensors via an Adafruit TCA9548A I2C multiplexer. The Arduino reads data from all sensors in parallel and prints the values to the Serial Monitor.

Component List

  1. Arduino Mega 2560

    • Description: Microcontroller board based on the ATmega2560.
    • Pins: IOREF, RESET, 3V3, 5V, GND, VIN, A0-A15, D0-D53, AREF, SDA, SCL
  2. MLX90614

    • Description: Infrared temperature sensor.
    • Pins: SDA, SCL, GND, VIN
  3. Adafruit TCA9548A

    • Description: I2C multiplexer.
    • Pins: 2SDA, 2SCL, 3SDA, 3SCL, 4SDA, 4SCL, 5SDA, 5SCL, 6SDA, 6SCL, 7SDA, 7SCL, VCC, GND, INPUTSDA, INPUTSCL, RESET, A0, A1, A2, 0SDA, 0SCL, 1SDA, 1SCL
  4. Pressure Transducer

    • Description: Sensor to measure pressure.
    • Pins: GND-, 0.5-4.5 Signal, 5VDC+
  5. Adafruit ADXL326

    • Description: 3-axis accelerometer.
    • Pins: VIN, +3V3, GND, ZOUT, YOUT, XOUT, TEST
  6. Micro SD Card Module

    • Description: Module for interfacing with a micro SD card.
    • Pins: cs, sck, mosi, miso, vcc, gnd

Wiring Details

Arduino Mega 2560

Adafruit TCA9548A

Adafruit ADXL326

Pressure Transducer

MLX90614 (First Sensor)

MLX90614 (Second Sensor)

Code Documentation

/*
 * Arduino Mega 2560 Sketch
 * This sketch interfaces with multiple sensors connected to the Arduino Mega 2560.
 * Sensors include:
 * - Adafruit ADXL326 (Accelerometer)
 * - Pressure Transducer
 * - Two MLX90614 (IR Temperature Sensors) via Adafruit TCA9548A (I2C Multiplexer)
 * The code reads data from all sensors in parallel and prints the values to the Serial Monitor.
 */

#include <Wire.h>
#include <Adafruit_MLX90614.h>

// Define pin connections
const int adxl326XPin = A0;
const int adxl326YPin = A1;
const int adxl326ZPin = A2;
const int pressureTransducerPin = A8;

// Create instances for MLX90614 sensors
Adafruit_MLX90614 mlx1 = Adafruit_MLX90614();
Adafruit_MLX90614 mlx2 = Adafruit_MLX90614();

void setup() {
  Serial.begin(9600);
  Wire.begin();

  // Initialize MLX90614 sensors
  mlx1.begin(0x5A); // Address for first sensor
  mlx2.begin(0x5B); // Address for second sensor
}

void loop() {
  // Read ADXL326 accelerometer values
  int xValue = analogRead(adxl326XPin);
  int yValue = analogRead(adxl326YPin);
  int zValue = analogRead(adxl326ZPin);

  // Read Pressure Transducer value
  int pressureValue = analogRead(pressureTransducerPin);

  // Read MLX90614 temperature values
  double temp1 = mlx1.readObjectTempC();
  double temp2 = mlx2.readObjectTempC();

  // Print sensor values to Serial Monitor
  Serial.print("ADXL326 X: ");
  Serial.print(xValue);
  Serial.print(" Y: ");
  Serial.print(yValue);
  Serial.print(" Z: ");
  Serial.println(zValue);

  Serial.print("Pressure: ");
  Serial.println(pressureValue);

  Serial.print("MLX90614 Temp1: ");
  Serial.print(temp1);
  Serial.print(" C, Temp2: ");
  Serial.print(temp2);
  Serial.println(" C");

  delay(1000); // Delay for 1 second before next read
}

This code initializes the sensors and reads their values in the loop function, printing the results to the Serial Monitor every second.