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:
To display the data by means of a nice graph I tried using Highcharts
. This is what I came up with: