Since long time ago I have been looking for inexpensive ways to measure environment parameters such as temperature, humidity, pressure and wind speed. I found many projects to inspire me, so I upgraded mine ;-) . Click here to the old one.
Step 1 - Thinking...
Looking for a precise solution, we had chosen to use the BME280 sensor. It is a great sensor that can provide precise measurements of temperature (+-1C), humidity (+-1%) and pressure (+-1). The communication between sensor and micro controller occurs using I2C protocol allowing to get from sensors, the measurement values, compensated, in digital mode.
To measure the wind speed/position was choosed a analog anemometer, using a hall effect sensor to digitalize the output signal according the rpm. So, for each turn of the anemometer, a digital pulse will be emitted by sensor. To read these rpm pulse, configure a interrupt routine to read the pulses and time period. With these you can compute the wind speed.
Here, the main ideia is get the values from btoh sensors and provide it using serial port (UART) in string format. So, the choice has been Arduino Nano as a micro controller that will read the measurement from sensor, will format in a knowleged string and send to serial port connected on PC or Raspberry Pi. (click to zoom)
Here, the output expected:
After that, the Arduino has been connected to a Raspberry Pi using USB Port.
So, we developed a Python script to open the Raspberry serial port and read the data coming from arduino. Remember, the response is a text string with the measurement values.
To store these values, a ThingSpeak.com account has been created. The ThingSpeak.com is a IoT website that provide a RRD (round-robin database) to customers. After stored our information, the ThingSpeak will show the graphics with mesuared values.
Thinking in Python scripts, the measured values has been cuted, isolated and sent to ThingSpeak.com using URL Post method + urllib . The entire script can be see bellow: (click to zoom)
After that, just run this script in your Linux, in background mode. Leave couple of minutes and you will can see your enviroment measurement at Thingspeak.com
Another feature that we implemented was the broadcast the measurement values over air, using FM. For that, we used PiStation, a application coded in Python that allow us to transmit any information using frequency modulation (FM Radio). The broadcast range is too short, like 100 meters. This range is enough to our purpose and don´t break any communications laws in some countries. Bellow, a example how to convert text to .wav files, using espeak (linux binary) and send to Pi Station.
More details about how to use PiStation and transmite FM signals:
https://github.com/CodyJHeiser/PiStation
One time that you understand how to use Fm PiStation, the main ideia is: get the measurement values, convert these values to .wav audio file and broadcast this audio file (with measurement values) over FM. In our case 107.5 Mhz. So, every time that we have a new measurement, a new broadcast will play too, see example: (click to zoom)
Step 4 - Hardware assembly
For mechanical construction, it was necessary to protect the electronic components from rainwater. For the raspberry pi , was used a aluminium case (used in security cameras).
To protect the Arduino and BME280, we did a sensor shelter using 100mm PVC pipes (sewage pipe), 1 cap (100mm) and 1 ventilation terminal (100mm) built as bellow:
When, everything is done, attach them all to a photo tripod.
Step 5 - Operating
Localhost: To access the measurement data over local network, was developed a HTML + JavaScript page hosted on Raspberry Pi Apache Server. So, to see the data, just type http://Sation_IP_Addr/ in your webbrowser.
External Network/Internet: In anothers network, you can see the measurement data on Wunderweather.com or Thingspeak.com. If you want, you can redirect your TCP port 80 to your Raspberry Pi (WAN:80 --> Raspberry pi: 80) in your router and access it from anywhere with help of a dynamic dns (like noip.org)
And, of course, if you have an old iphone that no longer works for nothing, use it as your screen. (Gauges powered by Google Gauges Java Script)
I hope you enjoyed, have a nice day ;-)