Project start: July 2016
Weatherstation
A few years ago I built myself a
temperature logger with DS1820 1-wire temperature sensors and hooked them directly up to my server to get indoor and outdoor temperatures once every minute. This worked flawlessly since then.
This summer (2016) I just wanted to get better outdoor temperature readings by protecting the sensor against direct sunlight, but because other sensors for things like air pressure and humidity don't cost that much I started building a whole new weatherstation.
For the sensors to give accurate measurements the station has to be set up as far away from any walls as possible. So I was left with the question, where to get power from and how to transmit the data.
At first I thought about using NRF24 2.4Ghz wireless modules and connect a receiver directly to the server. But because the server is standing behind a few walls the signal strength wasn't quite enough to get a reliable connection. But what about those ESP8266 things with WLan and stuff. My Wifi router would be closer to the garden than the server itself.
A cable could be installed from the basement window to the station. Finally I decided to rely on a solar cell and a 1S4P 18650 Li-Ion battery pack.
Also indoor datalogging would be nice and with this Wifi ESP setup there would be no additional expense.
The server is running a python script in a screen session, which opens a tcp socket and waits for a station to connect to it. Each station sends its data in my case every minute. Each day a new file will be created, named by year and day of the year (for example 2016311.txt).
Each sensor value is separated by ",". The formatting of the data is handled by the station itself, the python script blindly writed the received strings to one line until the connection is closed. At the beginning of each line the timestamp is being written.
Python script:
weatherESPserver_201608.py
Here an example:
1478390426,rssi0=-79,vbat0=3.82,tdht0=6.2,hum0=1.4,tbmp0=5.1,prs0=990.56,ldr0=60.2,uv0=1.05,tsky0=-12.44,rain0=0.000,wind0=49.0
1478390454,rssi1=-76,tdht1=21.2,hum1=46.8,tbmp1=20.9,prs1=990.38,ldr1=4.0,pir1=20
1478390491,rssi0=-78,vbat0=3.83,tdht0=6.1,hum0=1.4,tbmp0=5.1,prs0=990.64,ldr0=58.8,uv0=1.05,tsky0=-13.12,rain0=0.000,wind0=27.0
1478390514,rssi1=-75,tdht1=21.2,hum1=46.8,tbmp1=20.9,prs1=990.37,ldr1=1.9,pir1=80
1478390558,rssi0=-79,vbat0=3.82,tdht0=6.1,hum0=1.4,tbmp0=5.1,prs0=990.64,ldr0=57.1,uv0=1.05,tsky0=-13.02,rain0=0.000,wind0=27.0
1478390574,rssi1=-75,tdht1=21.2,hum1=46.9,tbmp1=20.9,prs1=990.43,ldr1=0.8,pir1=6
1478390622,rssi0=-78,vbat0=3.81,tdht0=6.1,hum0=1.4,tbmp0=5.1,prs0=990.63,ldr0=55.9,uv0=1.05,tsky0=-12.98,rain0=0.000,wind0=39.0
1478390635,rssi1=-76,tdht1=21.2,hum1=46.9,tbmp1=20.9,prs1=990.43,ldr1=0.7,pir1=0
1478390688,rssi0=-78,vbat0=3.83,tdht0=6.1,hum0=1.4,tbmp0=5.1,prs0=990.70,ldr0=57.7,uv0=1.04,tsky0=-12.62,rain0=0.000,wind0=37.0
1478390695,rssi1=-74,tdht1=21.2,hum1=46.9,tbmp1=20.9,prs1=990.43,ldr1=0.6,pir1=0
1478390753,rssi0=-77,vbat0=3.83,tdht0=6.1,hum0=1.4,tbmp0=5.1,prs0=990.71,ldr0=59.7,uv0=1.05,tsky0=-12.12,rain0=0.000,wind0=30.0
1478390755,rssi1=-73,tdht1=21.2,hum1=47.0,tbmp1=20.9,prs1=990.48,ldr1=0.6,pir1=0
1478390816,rssi1=-74,tdht1=21.2,hum1=46.9,tbmp1=20.9,prs1=990.56,ldr1=0.6,pir1=0
1478390818,rssi0=-79,vbat0=3.81,tdht0=6.1,hum0=1.4,tbmp0=5.1,prs0=990.67,ldr0=58.2,uv0=1.05,tsky0=-10.58,rain0=0.000,wind0=17.0
To display the data by means of a nice graph I tried using
Highcharts. This is what I came up with: