Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Robert Poser
Published

ePaper-Based Local Rain Forecast for Fair Weather Cyclists

See easily the probability of upcoming rain in the next 60mins to decide whether it's OK to take the bike or to better use an alternative.

IntermediateFull instructions provided30 minutes1,930
ePaper-Based Local Rain Forecast for Fair Weather Cyclists

Things used in this project

Hardware components

Photon
Particle Photon
or Particle Electron or Bluz.ui
×1
Paperino Epaper
×1

Software apps and online services

Webhook to forecast.io

Story

Read more

Schematics

Schematics and circuit diagrams

No wiring need for the Particle Shield. Using the Paperino breakoutboard pls follow the wiring below. More Fritzing files can be found here: https://robpo.github.io/Paperino/

Code

RainForecast.ino

Arduino
Example sketch to print the probability of rain within the next 60 minutes on an Epaper screen. You will need to add the libraries "Adafruit GFX" and "PL_microEPD" via the Library Manager prior compiling.
/* ****************************************************************************************
   Weather forecast project: Returns the propability to rain within the next hour for your
   specific location. This data is powered by Dark Sky and its API services - thanks!
   
   Please follow the instructions at https://www.hackster.io/robert-poser/epaper-based-
   local-rain-forecast-for-fair-weather-cyclists-cb168c
   
   Prior compiling you will need to add the following two libraries "Adafruit GFX" and 
   "PL_microEPD" by using the Library Manager.
   
   We invested time and resources providing this open source code. Please support Paperino 
   open source hardware by purchasing this product @Crowdsupply @Paperino @Plasticlogic 
   https://www.crowdsupply.com/robert-poser/paperino 
   Created by Robert Poser, Aug 19th 2017, Dresden/Germany
**************************************************************************************** */
#include "Adafruit_GFX.h"
#include "PL_microEPD.h"

#define EPD_RST     A0
#define EPD_BUSY    A1
#define EPD_CS      A2

PL_microEPD display(EPD_CS, EPD_RST, EPD_BUSY);  

void setup() {  
    Time.zone(+2);                  // Please adjust time zone according to your location
                                    // Subscription to a webhook event "WeatherForecast"
    Particle.subscribe("hook-response/WeatherForecast", myHandler, MY_DEVICES);
    
    SPI.begin();                    // SPI-Bus initialisation
    SPI.setBitOrder(MSBFIRST);                 
    SPI.setDataMode(SPI_MODE0); 
    SPI.setClockDivider(SPI_CLOCK_DIV4);
    
    display.begin();                // Paperino ePaper initialisation and refresh screen 
}


void myHandler(const char *event, const char *data) {
    String wh_result = data;
    String tempStr;
    float tempF;
    
    display.setTextSize(1);
    display.print("1hr-Forecast   ");
    display.print(Time.hour());
    display.print(":");
    display.print(Time.minute());
    display.println(" Uhr");
    wh_result = wh_result.substring(wh_result.indexOf("~")+1, wh_result.length());
    tempStr = wh_result.substring(0, wh_result.indexOf("~"));
    display.setTextSize(3);
    display.setCursor(0, 15);
    display.print(tempStr.substring(0, tempStr.indexOf(".")+2));
    display.drawCircle(77, 18, 3, EPD_BLACK);
    display.drawCircle(77, 18, 4, EPD_BLACK);
    display.drawCircle(77, 18, 2, EPD_BLACK);
    display.setCursor(83, 15);
    display.println("C");
    wh_result = wh_result.substring(wh_result.indexOf("~")+1, wh_result.length());
    tempStr = wh_result.substring(0, wh_result.indexOf("~"));
    display.print("Rain:");
    tempF = 100*tempStr.toFloat();
    display.print(int(tempF));
    display.println("%");
    display.update();
}

void loop() { 
    Particle.publish("WeatherForecast");
    delay(10000);              // Time to go to deep sleep
    System.sleep(SLEEP_MODE_DEEP,5*60);
}

Github repo

Software repo containing the Epaper library and some demo sketches

Credits

Robert Poser
4 projects • 5 followers

Comments