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 Ingo, well over 40 years and come from the middle of Germany. You can contact me in English or German.

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

Map Your Particles!
Easy
  • 499
  • 15

Protip

Locate your Particle Photons, P1s and Electrons on a map without needing extra hardware. Use Ubidots or an offline map alternative

Sending Photos and Video Over the Internet!
Easy
  • 1,964
  • 27

Full instructions

Record video, perform object and face recognition, take a time-lapse or whatever else with a Particle Photon and the 5-megapixel Arducam!

Text Machine, Get Gumball
Easy
  • 54
  • 1

This project describes how to build an Arduino-based, text-controlled gum dispenser

Power Supply Module 3.3V and 5V
Easy
  • 110
  • 0

Protip

First test of a separate Power Supply Module 3.3V and 5V

MyPIR-Sensor Informs Me Via IFTTT
Easy
  • 277
  • 1

Full instructions

Cheap & easy alarm-system.

Running Exercise Track
Easy
  • 79
  • 2

This is a device which can monitor running track via a GPS module and store data to a SD card. And then parse the data later from a app.

Add projectSign up / Login