Robert MonacoNathan FreyerEthan Hoover
Published

Distributed Desktop Telemetry

Quick and cheap distributed in-case environmental sensor array for hardware monitoring, quality assurance, and general troubleshooting.

IntermediateShowcase (no instructions)115
Distributed Desktop Telemetry

Things used in this project

Hardware components

Photon 2
Particle Photon 2
×3
Elegoo KY-038 Sound Sensor Module (microphone)
Part of the ELEGOO Upgraded 37 in 1 Sensor Modules Kit
×3
Elegoo Photo Resistor
Part of the ELEGOO Upgraded 37 in 1 Sensor Modules Kit
×3
Elegoo Analog Thermistor
Part of the ELEGOO Upgraded 37 in 1 Sensor Modules Kit
×3
Breadboard (generic)
Breadboard (generic)
×3
Personal Computer
Any computers that can communicate with wired Micro-USB devices.
×3
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
Data-enabled Micro-USB Cables for the Photon 2.
×3
LED (generic)
LED (generic)
Low-voltage LED for alarm indication.
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE

Story

Read more

Schematics

Circuit diagram of an individual cluster

Circuit diagram for the sensor setup, using common circuit symbols.

Logic block diagram of an individual sensor cluster

Logic block diagram of the individual Photon/breadboard circuit. Under normal operating conditions, the program will bypass the LED. However, if any one sensor goes out of range, the Particle Photon will deliver power to the LED.

Code

Photon 2 Subscription and Event Logging Code

Arduino
Connect the sound output to pin A2, the temperature sensor to pin A1, and the photo resistor to pin A0.
int soundOut = A2;
int thermOut = A1;
int photoOut = A0;
int power = A5;
int num = 0;
int one = 1;
int LEDon = 1;

void setup() {
    pinMode(soundOut,INPUT);
    pinMode(photoOut,INPUT);
    pinMode(thermOut,INPUT);
    pinMode(power,OUTPUT);
    
    digitalWrite(power,LOW);
    Particle.subscribe("hook-response/Temperature", myHandler, MY_DEVICES);
    Particle.subscribe("hook-response/Sound", myHandler, MY_DEVICES);
    Particle.subscribe("hook-response/Light", myHandler, MY_DEVICES);
    Particle.subscribe("Alarm", myHandler, MY_DEVICES);
}

void loop() {
    delay(30000);
    int light = analogRead(photoOut);
    if (light != 0){
        Particle.publish("Light", String(light));
    } else {
        light = -1;
        Particle.publish("Light", String(light));
    }

    delay(30000);
    int temp = analogRead(thermOut);
    Particle.publish("Temperature", String(temp));
    
    delay(30000);
    int noise = analogRead(soundOut);
    Particle.publish("Sound", String(noise));
    
    if (light == 1 || temp >= 4000 || noise >= 3000 || light == 2) {
        Particle.publish("AlarmState", "1");
    } else {
        Particle.publish("AlarmState", "0");
    }
}

void myHandler(const char *event, const char *data)
{
    if (strcmp(data,"False")==0) {
   
    digitalWrite(power,LOW);
  }
  else if (strcmp(data,"True")==0) {

    digitalWrite(power,HIGH);
  }
  else {
  }
}

Alarm code

Arduino
int power = A2;

void setup() {
    pinMode(power,OUTPUT);
    digitalWrite(power,LOW);
      Particle.subscribe("AlarmState", myHandler, MY_DEVICES);
}

void loop() {
    delay(10000);
}

void myHandler(const char *event, const char *data)
{
    if (strcmp(data,"0")==0) {
   
    digitalWrite(power,LOW);
    Particle.publish("Alarm","False");
  }
  else if (strcmp(data,"1")==0) {

    digitalWrite(power,HIGH);
    Particle.publish("Alarm","True");
  }
  else {
  }
}

Credits

Robert Monaco

Robert Monaco

1 project • 1 follower
Nathan Freyer

Nathan Freyer

1 project • 1 follower
Ethan Hoover

Ethan Hoover

1 project • 2 followers

Comments