Good morning Ricksville

 

One morning Farmer Hogg woke up, looked out the window and checked the colour of his field.He headed down to the kitchen and turned on his internet radio, Rick Astley was playing so he turned it off again.

Old Mother Hubbard turned on her computer to check her inventory management system. A Rick Astley video was playing, she liked Rick so left it playing and forgot what she was about to do.
At the top of the stairs, around the back of the town hall, the man from the Historical society was trying to find film footage of the old mine workings but every time he clicked on a link, Rick Astley appeared.
The inn keeper had Rick Astley playing on his jukebox and also on the POS system.

The woodcutter was normally a man of few words but after 30 minutes trying to rid his computer of Rick, he had managed to find a few extra ones that even the dwarves would have been shocked by.

The mayor turned on his TV to watch Lizzy the Lizard exercise video and also got Rick Astley. Enough was enough, a town meeting was called.


Mean whilst in the forest, Hans and Matilda were trying to connect up to the internet. "Strange?" said Hans, "the requests get past our firewall but timeout when reaching the town ISP, it is there because I can get a response by extending the timeout, but it just seems to be too busy to forward on our weather requests."

 

The old fashioned way


"We are going to have to do it the old fashioned way", said Hans. "Not the cat gut?!" cried Matilda. "Not quite that far back" he said. Hans rummaged in his spares box and brought out a tiny device that looked a bit like a cheese grater. "We can get the local temperature and humidity with this DHT22 and estimate the chance of precipitation from that" said Hans.

 

DHT22_bb.png   DHT22

 

// Based on the work of ladyada, public domain
#include "DHT.h"
#define DHTPIN 4     // what pin we're connected to
#define DHTTYPE DHT22   // DHT 22  (AM2302)
// Connect pin 1 (on the left) of the sensor to +5V
// NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1
// to 3.3V instead of 5V!
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor
// Initialize DHT sensor for normal 16mhz Arduino
DHT dht(DHTPIN, DHTTYPE);
// NOTE: For working with a faster chip, like an Arduino Due or Teensy, you
// might need to increase the threshold for cycle counts considered a 1 or 0.
// You can do this by passing a 3rd parameter for this threshold.  It's a bit
// of fiddling to find the right value, but in general the faster the CPU the
// higher the value.  The default for a 16mhz AVR is a value of 6.  For an
// Arduino Due that runs at 84mhz a value of 30 works.
// Example to initialize DHT sensor for Arduino Due:
//DHT dht(DHTPIN, DHTTYPE, 30);
void setup() {
  Serial.begin(9600); 
  Serial.println("DHTxx test!");
 
  dht.begin();
}
void loop() {
  // Wait a few seconds between measurements.
  delay(2000);
  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  // Read temperature as Celsius
  float t = dht.readTemperature();
  
  // Check if any reads failed and exit early (to try again).
  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
  Serial.print("Humidity: "); 
  Serial.print(h);
  Serial.print(" %\t");
  Serial.print("Temperature: "); 
  Serial.print(t);
  Serial.print(" *C ");
  Serial.println("");
}




 

Hans decided to pass the local temperature and humidity over to the Python script and if there is no network or an error it can still return a position reference for them. That way all the weather related algorithms are in one place. Hans could not find any algorithms that connected humidity to precipitation but he thought if he based it around the dew point that would give a very similar result to the old cat gut.

 

The boy who cried wolf

 

Mean while at the town meeting a small boy pointed to a logo in the corner of a screen playing Rick Astley videos and cried "wolf! wolf!", the townsfolk told him to be quiet and stop bothering them.

 

Next: Enchanted Objects Design Challenge - This is not the WiFi you are looking for

 

Reference

 

Adafruit Learning - Using a DHTxx sensor

Estimating air humidity from temperature and precipitation measures for modelling applications

How do I calculate dew point?

Precipitation Estimation in Canada using Archival Climate Data - William A. van Wijngaarden* - Physics Dept., York University, Toronto, Ontario

Lecture: Humidity as an Element of Weather, Dr. Rodrigue