- Raspberry pi 2 with raspbian installed
- DHT22 sensor
- 10k resistor
- Male to female jumper wires
- Wires for making breadboard connections
I was stuck with the resistor piece as I did not have a 10K resistor. So I added two 6k resistors in series, taking the total resistance to 12k (6k+6k).
Here is how my setup looks
W.r.t the software, I tried using the Adafruit code, but it felt more comfortable using the pigpio code after running the pigpiod daemon. I am still getting some errors when i call the s.cancel() and pi.stop() functions. But the rest of the code works.
To get the external temperature and humidity, I signed up with openweather and got their api. There is a python library pyowm which provides an implementation for openweather. So, I got the humidity and temperature of my city from openweather. And i pushed the data - external humidity & temperature and internal humidity & temperature into elasticsearch which I was running on my raspberry pi.
Looking at the limited resources available on the pi, both in terms of disk and memory, I did some tweaking in elasticsearch, so that It did not hog down my raspberry pi.
I restricted the heap size of elasticsearch to 256MB by adding the following options in the ./bin/elasticsearch script.
Since, I had to access my elasicsearch via the raspberry pi's ip address, i changed the host to bind to the ip address instead of localhost. Also, looking at the disk constraints, I limited the number of shards & replicas to 1. Here are the configuration lines in ./config/elasticsearch.yml
Here is the script which pulls data from openweather and gets data from my DHT22 sensor and pushes it into elasticsearch.
The interesting thing to note in the graph is that though there is change in the external temperature and humidity, the internal temperature and humidity does not change much.