Jacob HerbertDerrick KingJustin Domingo
Published © GPL3+

Mesh Weather Data Network

Using multiple Particle-based devices, you can collect and compare weather data from across the city or even across the world.

BeginnerProtip2 hours601
Mesh Weather Data Network

Things used in this project

Hardware components

Argon
Particle Argon
×3
DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 Temperature & Humidity Sensor (4 pins)
×2
Breadboard (generic)
Breadboard (generic)
×3
Multi-Turn Precision Potentiometer- 10k ohms (25 Turn)
Multi-Turn Precision Potentiometer- 10k ohms (25 Turn)
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)
Soldering iron (generic)
Soldering iron (generic)
Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Custom parts and enclosures

Node Base

Printed at 0.2mm , 20% infill, no bed adhesion, and with supports.

Node Lid

Printed at 0.2mm, 20% infill, no bed adhesion, and with supports.

Hub Lid

Printed at 0.2mm, 20%infill, no bed adhesion, and with supports

Hub Base

Printed at 0.2mm, 20%infill, no bed adhesion, and with supports

Schematics

DHT Sensor Circuit Diagram

LCD Display Circuit Diagram

Code

Node Code

C/C++
This code is for the sensor nodes. For the second node, change the "t"'s to a "g"'s, and the "h"'s to "j"'s. This is simply just to ensure that there is no conflict in the data the LCD screen on the hub will output.
// This #include statement was automatically added by the Particle IDE.
#include <ThingSpeak.h>

// This #include statement was automatically added by the Particle IDE.
#include <Adafruit_DHT.h>

// This example assumes the sensor to be plugged into CONN2
#define DHTPIN D2 // what pin we're connected to

// Here we define the type of sensor used
#define DHTTYPE DHT11 // DHT 11

DHT dht(DHTPIN, DHTTYPE);

int f=0;
bool humid = false;

TCPClient client;

unsigned long myChannelNumber =897398;
const char * myWriteAPIKey = "ZSGLMB2IDWW4LGD4";

void setup() {

ThingSpeak.begin(client);

pinMode(D7, OUTPUT);
Serial.begin(9600);
dht.begin();
Particle.subscribe("pleaseWork_2", l, ALL_DEVICES);

}

void loop() {
// Wait a few seconds between measurements.
delay(2000);

delay(2000); //2 second delay

float t = dht.getTempCelcius(); //Takes temp data in celcius
float h = dht.getHumidity();
;

if (isnan(h) || isnan(t) ) {
Serial.println("Failed to read from DHT sensor!");
return;
}

Particle.publish("pleaseWork_t", String (t), PUBLIC);
Particle.publish("pleaseWork_h", String (h), PUBLIC);

ThingSpeak.setField(1,t);
ThingSpeak.setField(2,h);

Serial.print(dht.getHumidity());
Serial.println("h");
Serial.print(dht.getTempFarenheit());
Serial.println("t");


ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);

delay(15000); // ThingSpeak will only accept updates every 15 seconds.

}
void l(const char *event, const char *data) {

digitalWrite(D7, HIGH);
delay(2000);
digitalWrite(D7, LOW);
delay(1000);

}

Hub Code

C/C++
This code is for the hub argon. The code pulls data from Thing-speak and then displays onto the LCD screen.
// This #include statement was automatically added by the Particle IDE.
#include <LiquidCrystal.h>

// This #include statement was automatically added by the Particle IDE.
#include <Adafruit_DHT.h>


// This example assumes the sensor to be plugged into CONN2
#define DHTPIN D2 // what pin we're connected to

// Here we define the type of sensor used
#define DHTTYPE DHT11 // DHT 11

 

//Define RGB LED1 PINS note green collor is note used so not required


//API_KEY (WRITE)
const String key = "ZSGLMB2IDWW4LGD4";

//DHT dht(DHTPIN, DHTTYPE);
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);


void setup() {

lcd.clear();
lcd.begin(16, 2);
lcd.setCursor(0,0);
lcd.print("Sensor 1 T&H");
lcd.setCursor(0,1);
lcd.print("Sensor 2 T&H");
Particle.subscribe("pleaseWork_h", h, ALL_DEVICES);
delay(1000);
Particle.subscribe("pleaseWork_f", f, ALL_DEVICES);
delay(1000);
Particle.subscribe("pleaseWork_j", j, ALL_DEVICES);
delay(1000);
Particle.subscribe("pleaseWork_g", g, ALL_DEVICES);
delay(1000);
// We open up a serial port to monitor the sensor values
//Serial.begin(9600);
//Serial.println("DHT11 test!");

//dht.begin();

}
void loop() {
// Wait a few seconds between measurements.
delay(5000);

Particle.publish("pleaseWork_all", PUBLIC);

}
void f(const char *event, const char *data) {

// Print the data over serial
lcd.setCursor(2,0);
lcd.print(data);
lcd.setCursor(0,0);
lcd.print("A=");
}

void h(const char *event, const char *data) {

lcd.setCursor(10,0);
lcd.print(data);
lcd.setCursor(6,0);
lcd.print("C ");
lcd.setCursor(14,0);
lcd.print("% ");
}
void g(const char *event, const char *data) {

// Print the data over serial
lcd.setCursor(2,1);
lcd.print(data);
lcd.setCursor(0,1);
lcd.print("B=");
}

void j(const char *event, const char *data) {

lcd.setCursor(10,1);
lcd.print(data);
lcd.setCursor(6,1);
lcd.print("C ");
lcd.setCursor(14,1);
lcd.print("% ");


}

Credits

Jacob Herbert

Jacob Herbert

1 project • 0 followers
Derrick King

Derrick King

1 project • 1 follower
Justin Domingo

Justin Domingo

1 project • 0 followers

Comments