Components Required –
Fig. 3: Block Diagram of Particle Photon and Blynk based IOT Weather Monitoring System
Circuit Connections –
Particle Photon – Photon is a popular IOT board available from the Particle platform. The board houses STM32F205 120Mhz ARM Cortex M3 microcontroller and has 1 MB flash memory, 128 Kb RAM and 18 mixed signal general purpose input output (GPIO) pins with advanced peripherals. The module has on-board Cypress BCM43362 Wi-Fi chip for Wi-Fi connectivity and Single band 2.4GHz IEEE 802.11b/g/n for Bluetooth. The board comes equipped with 2 SPI, one I2S, one I2C, one CAN and one USB interface. The particle Photon has the following pin configuration –
The data is displayed on the app in real-time and gets updated in every 2 seconds. Check out the program code to learn how Photon reads temperature and humidity from DHT-11 sensor and send it to the Blynk App.
You may also like:
Project Source Code
//Program to // This #include statement was automatically added by the Particle IDE. #include// This #include statement was automatically added by the Particle IDE. #include #define BLYNK_PRINT Serial // Set serial output for debug prints //#define BLYNK_DEBUG // Uncomment this to see detailed prints #include #define DHTTYPE DHT11 #define DHTPIN 4 #define DHT_SAMPLE_INTERVAL 60000 LiquidCrystal lcd(6, 5, 0, 1, 2, 3); void dht_wrapper(); // must be declared before the lib initialization // Lib instantiate PietteTech_DHT DHT(DHTPIN, DHTTYPE, dht_wrapper); // globals unsigned int DHTnextSampleTime; // Next time we want to start sample bool bDHTstarted; // flag to indicate we started acquisition int n; // counter //this is coming from http://www.instructables.com/id/Datalogging-with-Spark-Core-Google-Drive/?ALLSTEPS char resultstr[64]; //String to store the sensor data // You should get Auth Token in the Blynk App. // Go to the Project Settings (nut icon). char auth[] = "0395c08357fd480ba67b172ccdfa7039"; // Attach a Button widget (mode: Switch) to the Digital pin 7 - and control the built-in blue led. // Attach a Graph widget to Analog pin 1 // Attach a Gauge widget to Analog pin 2 char VERSION[64] = "0.04"; void setup() { Serial.begin(9600); lcd.begin(16,2); lcd.setCursor(0,0); lcd.print("IoT Weather"); lcd.setCursor(0,1); lcd.print(" Monitoring "); delay(2000); lcd.clear(); lcd.setCursor(0,0); lcd.print("ENGINEERS GARAGE"); delay(2000); lcd.clear(); delay(5000); // Allow board to settle DHTnextSampleTime = 0; // Start the first sample immediately Particle.variable("result", resultstr, STRING); Particle.publish("DHT11 - firmware version", VERSION, 60, PRIVATE); Blynk.begin(auth); } void dht_wrapper() { DHT.isrCallback(); } void loop() { Blynk.run(); if (millis() > DHTnextSampleTime) { if (!bDHTstarted) { // start the sample DHT.acquire(); bDHTstarted = true; } if (!DHT.acquiring()) { // has sample completed? float temp = (float)DHT.getCelsius(); int temp1 = (temp - (int)temp) * 100; lcd.clear(); lcd.setCursor(0,0); lcd.print("T:"); lcd.print((int)temp1); lcd.write(1); lcd.print("C"); char tempInChar[32]; sprintf(tempInChar,"%0d.%d", (int)temp, temp1); Particle.publish("The temperature from the dht11 is:", tempInChar, 60, PRIVATE); //virtual pin 1 will be the temperature Blynk.virtualWrite(V1, tempInChar); //google docs can get this variable sprintf(resultstr, "{"t":%s}", tempInChar); float humid = (float)DHT.getHumidity(); int humid1 = (humid - (int)humid) * 100; lcd.clear(); lcd.setCursor(0,0); lcd.print("Humidty:"); lcd.print((int)humid1); sprintf(tempInChar,"%0d.%d", (int)humid, humid1); Particle.publish("The humidity from the dht11 is:", tempInChar, 60, PRIVATE); //virtual pin 2 will be the humidity Blynk.virtualWrite(V2, tempInChar); n++; // increment counter bDHTstarted = false; // reset the sample flag so we can take another DHTnextSampleTime = millis() + DHT_SAMPLE_INTERVAL; // set the time for next sample } } delay(2000); }
Project Video
Filed Under: Arduino Projects, Electronic Projects
Filed Under: Arduino Projects, Electronic Projects
Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.