Introduction: Is It Raining There? Practicing IoT With Arduino (TfCD Project)
An Arduino system that uses real-time weather condition information of Delft derived from the internet to decide the status of an origami umbrella: closed for sunny, open and blink slowly for sprinkle, open and fast blink for heavy rain (an LED light and a servo motor are connected to the umbrella). It is made for people in long distance relationship with one of them in Delft, so that the other one can know "is it raining there" in a simple and fun way. The city can also be changed to other ones by changing the WOEID code.
Arduino is an incredibly flexible micro-controller and development environment. Its simplicity and extensibility, in addition to its great success and adoption by users, has led to the development of a variety of hardware extensions and software libraries that enable wired and wireless communication with the Internet. Arduino is the ideal open hardware platform for experimenting with the world of the IoT.
Step 1: Preparation
Electronics
Arduino Uno
ESP8266 WiFi module
LED light
Servo motor
Wire
Temboo.com account
Origami
Basic handcrafting tools
Origami paper
Cardboard
Step 2: Electronics
Connect the LED light, servo motor, and ESP8266 to Arduino Uno as shown in the diagram.
Note that the mini servo motor works under 5V and ESP8266 works under 3.3V.
(The diagram is drawn using tinkercad.com)
Step 3: Origami
The form is inspired by the iconic Dutch storm umbrella senz°.
For the making of a normal origami umbrella, you may refer to https://youtu.be/RVedgiY0pwc
Apart from the umbrella cover, a paper pully is connected to the top of the stick
Step 4: Weather Information
Temboo https://temboo.com makes it easy for Arduino boards to connect to any web-based resource. In this project, we query the weather information from Yahoo Weather API. Although Yahoo Weather API doesn't provide precipitation information, the weather condition is indicated in code and text from their response. For example, "39" for "scattered thunderstorms" and "45" for "thundershowers", which contain enough information for this project. For a full list of all the codes, you may refer to: https://developer.yahoo.com/weather/documentation....
To get started, we need to get the WOEID (Where On Earth ID) for Delft (or any other city): 728612. You can look it up here: http://woeid.rosselliot.co.nz/
Then Tamboo helps generate the query codes with simple input. Here we only need the WOEID.
#include
#include #include "TembooAccount.h" // contains Temboo account information, as described below
int calls = 1; // Execution count, so this doesn't run forever int maxCalls = 10; // Maximum number of times the Choreo should be executed
void setup() { Bridge.begin(); Console.begin(); }
void loop() { if (calls <= maxCalls) { Console.println("Running GetWeather - Run #" + String(calls++)); TembooYunShieldChoreo GetWeatherChoreo;
// Invoke the Temboo client GetWeatherChoreo.begin();
// Set Temboo account credentials GetWeatherChoreo.setAccountName(TEMBOO_ACCOUNT); GetWeatherChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME); GetWeatherChoreo.setAppKey(TEMBOO_APP_KEY); GetWeatherChoreo.setDeviceType(TEMBOO_DEVICE_TYPE); // Set Choreo inputs GetWeatherChoreo.addInput("WOEID", "728612"); // Identify the Choreo to run GetWeatherChoreo.setChoreo("/Library/Yahoo/Weather/GetWeather"); // Run the Choreo; when results are available, print them to Console GetWeatherChoreo.run(); while(GetWeatherChoreo.available()) { char c = GetWeatherChoreo.read(); Console.print(c); } GetWeatherChoreo.close(); }
Console.println("Waiting..."); delay(30000); // wait 30 seconds between GetWeather calls }
A header file needed for Arduino is also provided by Tamboo.
Step 5: Output
A sample of the XML information returned by the Choreo would look like:
yweather:condition text="scattered thunderstorms" code="39" temp="50" date="Fri, 22 Dec 2017 8:56 am PDT"
Initializer
//led light
const int LED = 13;
//servo motor
#include Servo umbrella;
void setup() {
// initialize the LED pin as an output
pinMode(LED, OUTPUT);
// initialize the servo motor
umbrella.attach(7); }
For "heavy rain" condition: 3 severe thunderstorms; 4 thunderstorms; 5 mixed rain and snow; 6 mixed rain and sleet; 7 mixed snow and sleet; 11 showers; 12 showers; 17 hail; 18 sleet; 35 mixed rain and hail; 37 isolated thunderstorms; 38 scattered thunderstorms; 39 scattered thunderstorms; 40 scattered showers; 42 scattered snow showers; 45 thundershowers; 47 isolated thundershowers
Umbrella open, LED fast blink:
umbrella.write(0);
digitalWrite(LED, HIGH);
delay(200);
digitalWrite(LED, LOW);
delay(200);
...
For "sprinkle" condition: 8 freezing drizzle; 9 drizzle; 10 freezing rain
Umbrella open, LED slow blink:
umbrella.write(0);
digitalWrite(LED, HIGH);
delay(500);
digitalWrite(LED, LOW);
delay(500);
...
For "sunny" condition: All other codes
Umbrella closed, LED off:
umbrella.write(90);
...