Moritz Strube
Published © MIT

Analyze I2C Sensor Data with an Inexpensive Logic Analyzer

Use a Scanalogic-2 EDU Kit to analyze I2C sensor data, calculate the measured humidity from the data frames and validate the result.

IntermediateProtip30 minutes2,384
Analyze I2C Sensor Data with an Inexpensive Logic Analyzer

Things used in this project

Hardware components

Photon
Particle Photon
×1
Scanalogic-2 EDU KIT
×1
Adafruit Si7021
×1

Software apps and online services

Scanastudio
Free
ThingSpeak API
ThingSpeak API
Optional, only for convenient validation.

Story

Read more

Schematics

Breadboard with Photon, Si 7021 and connections to the logic analyzer

The breadboard with the Particle Photon, the Adafruit Si7021 sensor and the connections to the Scanalogic-2 EDU KIT. For details see my project Measuring temperature and humidity with Particle Photon.

Code

Code

C/C++
The code for the project. For details see my project Measuring temperature and humidity with Particle Photon.
// Connect Vin to 3-5VDC
// Connect GND to ground
// Connect SCL to I2C clock pin (D1 on Photon/Electron)
// Connect SDA to I2C data pin  (D0 on Photon/Electron)


#include "Adafruit_Si7021.h"   // Use for Build IDE
// #include "Adafruit_Si7021.h"               // Use for local build

Adafruit_Si7021 sensor = Adafruit_Si7021();
double h;
double t;

void setup() {
    sensor.begin();
    
    // Variable for IFTTT
    Particle.variable("t", &t, DOUBLE);
    Particle.variable("h", &h, DOUBLE);
}

void loop() {
    
    h = sensor.readHumidity();
    t = sensor.readTemperature();
    
    // Publish data
    String temperature = String(t);
    String humidity = String(h);
    
    temperature = temperature.format("%1.2f", t);

    Particle.publish("temperature", temperature, PRIVATE);
    delay(30000);
     
    Particle.publish("humidity", humidity, PRIVATE);
    delay(30000);
}

Credits

Moritz Strube

Moritz Strube

4 projects • 7 followers
I’m an experienced technology manager with deep interest in technology, innovation and science.

Comments