For reading the temperature and humidity a SHT11 is used. Using https://github.com/practicalarduino/SHT1x reading data from the sensor is amazingly simple. The example code in the repository is all I needed.
The arduino has no time information. First I wanted to use NTP, but one HTTP client (the one sending the sensor data to the server) is enough difficulty for this problem. A friend of mine build a board similar to this setup: http://www.ladyada.net/learn/breakoutplus/ds1307rtc.html .
For initializing and reading the date/time information I use the code from http://www.glacialwanderer.com/hobbyrobotics/?p=12 .
Now I have date/time information for writing the sensor data to the SD card in the future.
The server side of my data logger is a very simple Flask site.
First version of the code:
from flask import Flask, request, abort app = Flask(__name__) import datetime @app.route('/') def index(): return "nothing to see here ..." @app.route('/input/', methods=['POST', 'GET']) def input(): if request.headers.get('X-ApiKey') != 'SECRET_API_KEY_SET_ON_ARDUINO': abort(403) if request.method == 'POST': log_to_file(request.data) return "OK" def log_to_file(data): f = open('/tmp/arduino.logger', 'a') f.write(str(datetime.datetime.now())) f.write(': ') f.write(data) f.write("\n") f.close()