Marcus NeacsuBen Ziegler
Published © GPL3+

Grilled Cheese Telemetry System MEGR 3171 IOT Project

Have you ever wanted to track your Grilled Cheese sandwich? This solves all of your problems!

IntermediateFull instructions providedOver 2 days327
Grilled Cheese Telemetry System MEGR 3171 IOT Project

Things used in this project

Hardware components

Argon
Particle Argon
×2
Breadboard (generic)
Breadboard (generic)
×2
DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 Temperature & Humidity Sensor (4 pins)
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×7

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
ThingSpeak API
ThingSpeak API

Hand tools and fabrication machines

Grilled Cheese

Story

Read more

Schematics

Circuit Diagram

Particle Communication Diagram

The two Argons communicate using Particle Publish and Subscribe functions. When Argon 1 is active the D7 LED on Argon 2 lights up. When Argon 2 is active the D7 LED on Argon 1 lights up.

Argon 1 with Ultrasonic Sensor

Argon 2 with Temperature and Humidity Sensor

Inserting the DHT-11 Sensor into the Grilled Cheese

Full System with Grilled Cheese

Code

Ultrasonic Sensor Code

C/C++
This is the program to control The first Argon along with the Ultrasonic Sensor
// This #include statement was automatically added by the Particle IDE.
#include <HC_SR04.h>
//the class we use to control the HC_SRO4 Ultrasonic Sensor
const String key = "2GUWASGKP5Y75M2F"; 
//the API key
double cm = 0.0;
double inches = 0.0;
//declaring the variables "cm" and "inches"
int trigPin = D4;
int echoPin = D5;
//setting up the pins as varibles
HC_SR04 rangefinder = HC_SR04(trigPin, echoPin, 5.0 , 300.0);
//this sets up the range of measurable distance for the HC_SRO4 rangefider
void myHandler(const char *event, const char *data) {
// Handle the integration response
}
void setup() 
{
    Spark.variable("cm", &cm, DOUBLE);
    Spark.variable("inches", &inches, DOUBLE);
    
    Particle.subscribe("hook-response/UltraSonicData", myHandler, MY_DEVICES);
    //subscribing the argon to hook response
    pinMode(D7, OUTPUT);
     pinMode(D2, OUTPUT);
    //use D7 LED as a measurable output
    Particle.subscribe ("TempFarenheight", cba);
}
void loop() 
{
    cm = rangefinder.getDistanceCM();
    inches = rangefinder.getDistanceInch();
    Particle.publish("UltraSonicData", +
            "{ \"1\": \"" + String(cm) + "\"," +
            "\"k\": \"" + key + "\" }", 60, PRIVATE, WITH_ACK);
    if (cm>10){
        digitalWrite(D2, HIGH);
    }
    else{
        digitalWrite(D2, LOW);
    }
    delay(20000);
    
    Serial.print("Distance: "); 
	Serial.print(cm);
	
	Particle.publish("Distance", String(cm));

}

void cba(const char *eventName, const char *data)
{ 
	digitalWrite(D7, HIGH);
 } 

Temperature and Humidity Sensor Code

C/C++
This is the program to control the second Argon along with the DHT11 Sensor
#include "Adafruit_DHT.h"

#define DHTPIN 3     // what pin we're connected to

#define DHTTYPE DHT11		// DHT 1

const String key = "5T0VR9511HQG5F5J"; 

DHT dht(DHTPIN, DHTTYPE);

void setup() {
    pinMode(D7, OUTPUT); 
    pinMode(D2, OUTPUT);
	Serial.begin(9600); 
	Serial.println("DHTxx test!");

	dht.begin();
	
 Particle.subscribe ("Distance", abc);

}

void loop() {

	delay(5000);

	float h = dht.getHumidity();
// Read temperature as Celsius
	delay(5000);
	float t = dht.getTempCelcius();
// Read temperature as Farenheit
	float f = dht.getTempFarenheit();

	Serial.print("Humid: "); 
	Serial.print(h);
	Serial.print("% - ");
	Serial.print("Temp: "); 
	Serial.print(t);
	Serial.print("*C ");
	Serial.print(f);
	Serial.print("*F ");

	
	
	Serial.print("*C - ");

	Serial.println("*C");
	Serial.println(Time.timeStr());
	
	Particle.publish("TempFarenheight", String(f));
	

	
	Particle.publish("HumidPercent", String(h));
	
    if (f<75.)
	{ digitalWrite(D2, HIGH);
	}
	else
	{ digitalWrite(D2, LOW);
	}

	
	 // Get some data

Particle.publish("thingSpeakWrite_All", +
     "{ \"1\": \"" + String(f) + "\"," +
       "\"2\": \"" + String(h) + "\"," +
       "\"k\": \"" + key + "\" }", 60, PRIVATE, WITH_ACK);
}

void abc(const char *eventName, const char *data)
{ 
	digitalWrite(D7, HIGH);



 } 

Credits

Marcus Neacsu
1 project • 0 followers
Contact
Ben Ziegler
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.