Things used in this project

Code

full code from MyWeatherstation-project inclusive beam example C/C++
#include "application.h"
// This #include statement was automatically added by the Particle IDE.
#include <Adafruit_DHT.h>
// This #include statement was automatically added by the Particle IDE.
#include <blynk.h>
#define BLYNK_DEBUG       // Uncomment this to see debug prints
#define BLYNK_PRINT Serial
// This #include statement was automatically added by the Particle IDE.
#include "beam.h"
/* pin definitions for Beam */
#define RSTPIN 2        //use any digital pin
#define IRQPIN 9        //currently not used - leave unconnected
#define BEAMCOUNT 1     //number of beams daisy chained together

/* Iniitialize an instance of Beam */
Beam b = Beam(RSTPIN, IRQPIN, BEAMCOUNT);

//Put your blynk token here
//DANGER - DO NOT SHARE!!!!
char auth[] = "<< your auth token here >>"; // photon1
//char auth[] = "<< your auth token here >>"; // photon3 - Auth token of bridged device
//DANGER - DO NOT SHARE!!!!

int led = D7;  // The on-board LED


// DHT parameters
    #define DHTPIN 5 // what pin we´re connected to
    #define DHTTYPE DHT22 // DHT 22 (AM2302)
    // Variables
    float temperature;
    int humidity;
    int light;
    // Pins
    int light_sensor_pin = A0;
    // DHT sensor
    DHT dht(DHTPIN, DHTTYPE);
    unsigned long lastmillis = 0;
    
    // Configure bridge on LOCAL_BRIDGE virtual pin
//    WidgetBridge bridge(BRIDGE);
    
    
    void setup() {
        Serial.begin(115200);
        delay(5000); // Allow board to settle
        // Start Blynk
        Blynk.begin(auth);

        Wire.begin();
        Serial.println("Starting Beam to show temp & hum");
        b.begin();

        // Start DHT sensor
        dht.begin();
        // Start LED
        pinMode(led, OUTPUT);
        // Start Webhooks
        Particle.subscribe("hook-response/temp", myHandler, MY_DEVICES);
        Particle.subscribe("hook-response/humidity", myHandler, MY_DEVICES);
        Particle.subscribe("hook-response/light", myHandler, MY_DEVICES);
    }
    
    void myHandler(const char *event, const char *data) {
      // Handle the integration response
    }
    
    void readData()
        {
        digitalWrite(led, HIGH);   // Turn ON the LED
        // Humidity measurement
        temperature = dht.getTempCelcius();
        // Humidity measurement
        humidity = dht.getHumidity();
        // Light level measurement
        float light_measurement = analogRead(light_sensor_pin);
        light = (int)(light_measurement/4096*100);
        
        // Publish data to Webhook -> thingspeak.com
        Particle.publish("temp", String(temperature), PRIVATE);
        Particle.publish("humidity", String(humidity), PRIVATE);
        Particle.publish("light", String(light), PRIVATE);
        
        // Publish data to Blynk
        // virtual pin 1 will be the temperature
        Blynk.virtualWrite(V1, String(temperature)); // photon1 gauge
        
        // virtual pin 2 will be the temperature
//        Blynk.virtualWrite(V2, String(temperature)); // photon3 gauge
        
        // virtual pin 3 will be the humidity
        Blynk.virtualWrite(V3, String(humidity)); // photon1 gauge
        
        // virtual pin 4 will be the humidity
//        Blynk.virtualWrite(V4, String(humidity)); // photon3 gauge
        
        // virtual pin 5 will be the humidity
        Blynk.virtualWrite(V5, String(humidity)); // photon1 history graph
        
        // virtual pin 6 will be the light
        Blynk.virtualWrite(V6, String(light)); // photon1 history graph
        
        // virtual pin 7 will be the light
        Blynk.virtualWrite(V7, String(temperature)); // photon1 history graph
        
        // virtual pin 8 will be the humidity
//        Blynk.virtualWrite(V8, String(humidity)); // photon3 history graph
        
        // virtual pin 9 will be the light
//        Blynk.virtualWrite(V9, String(light)); // photon3 history graph
        
        // virtual pin 10 will be the light
//        Blynk.virtualWrite(V10, String(temperature)); // photon3 history graph

        //  Beam can begin scrolling text with just print() and play()
        b.print(String(temperature).substring(0, 5) + " C");
        //b.play();
        b.display();
        delay(3000);  
        
        //  Beam can begin scrolling text with just print() and play()
        b.print(String(humidity).substring(0, 5) + " %");
        //b.play();
        b.display();
        delay(3000);  
      
        //Time.format(time, TIME_FORMAT_DEFAULT); // Sat Jan 10 08:22:04 2004 , same as Time.timeStr()
        //b.print(Time.format(time, TIME_FORMAT_DEFAULT));
        Time.zone(+2.00);  // setup a time zone, which is part of the ISO6801 format 
        //b.print(Time.format(Time.now(), "%I:%M%p.")); // = 12h = hh:mmPM. check here for a good format list: http://php.net/manual/en/function.strftime.php
        b.print(Time.format(Time.now(), "%H:%M h")); // = 24h = hh:mm
        b.display();
        delay(3000);   
        
        digitalWrite(led, LOW);    // Turn OFF the LED
        //delay(15000);              // Wait for 15 seconds - thingspeak.com refresh time
        }
    
    void loop() {
        
        Blynk.run(); // all the Blynk magic happens here
        
            if ((millis() - lastmillis) > 20000) {
                lastmillis = millis();
                readData();
                
            }
    }
Original Libary from Hoverlabs

Credits

Img 6554 3ywwumwxbh
Ingo Lohs

I am well over 40 years and come from the middle of Germany. You can contact me also in German. Donation for add sensors: paypal.me/ingolohs

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Control Adafruit NeoPixels using Python and JQWidgets
Easy
  • 933
  • 8

Full instructions

In this tutorial, we'll see how to control an Adafruit NeoPixel ring via mobile using Python and JQWidgets.

What's My I2C Address?
Easy
  • 244
  • 4

The story of how to make a clock through using a LCD 1602 or LCD 2004 over I2C.

I Keep My Cucumber Growing Conditions Moist - Part 3
Easy
  • 268
  • 3

Full instructions

This is the next step with an Particle Photon and softAP integration: cucumbers go online.

MyHumidity Controlled by BME280 and Photon
Easy
  • 521
  • 6

Full instructions

Checks if humidity threshold is reached and informs the user by using Blynk/IFTTT-services with softAP integration.

Study Buddy
Easy
  • 2,850
  • 141

Full instructions

Know when an assignment is coming up!

Study Buddy

Team Alexa and Shannon

MyLCD20x4 clock with value-added information
Easy
  • 41
  • 0

Full instructions

Use a Particle Photon, a BME280 sensor and a cheap LCD20x4 to start your own clock-project.

Add projectSign up / Login