Weather Logging with Arduino and RasPi (The Sensor Side)

In this post I will shortly present how I implemented the data taking sensor with an Arduino, a Bosch BME280 (humidity, pressure and temperature), a DS18B20 (temperature) and a cheap 433MHz OOK (on-off keying) transmitter.

The Arduino

As I do not need a lot of processing power, I use an Arduino Pro Mini clone with 8MHz clock and 3.3V. With the proper configuration (using the Low-Power library) and removal of the power LED, it can be run with less than 100µA in sleep mode. Actually, the Arduino itself needs less than 10µA but the additional circuit elements need the rest.

DS18B20

The DS18B20 is a One-Wire temperature sensor. There are ready-to-use libraries available and multiple descriptions on the web how to read data from this sensor.

BME280

The BME280 is a pressure and humidity sensor by Bosch that has an integrated temperature sensor for temperature compensation of the measurements. It can be read by SPI or I2C bus and there are multiple libraries available. I tested the ones from Adafruit and SparkFun. Currently I use the SparkFun library (Github link) because if offers a function for direct register level access. This is vital for using the “Forced Read” mode which is significantly more power efficient than the “Normal” mode. Currently the forced read mode is not in the library but there is already a pull request that implements it.

433MHz Communication

433MHz transmitters are available for little money. The ones I use have three input pins: 5V, GND and Data. Essentially, the transmitter is an oscillator that is switched on and off by the data signal. Because of that, all intelligence is inside the library. I use the discontinued Virtual Wire library because it has a Python receiver available I can use on the RasPi side. I also added AES encryption using this library.

The Power Supply

For the power supply I use an LTC3105 step-up converter. It has two outputs:

LTC3105 DC/DC converter

LTC3105 DC/DC converter

The main output and an auxillary LDO. The LDO delivers 6mA which is enough for the Arduino and the sensors running at 3.3V. The main output is configured for 5V and provides power for the 433MHz transmitter. With this setup, the current consumption at a 1.2V NiMH accumulator is about 300µA in sleep mode.

Weather Logging with Arduino and RasPi (Overview)

My current project is a small weather station with distributed sensors. The setup is shown in the block diagram below.

Block diagram of one weather sensor together with the receiver and the associated sensors and functions.

Block diagram of one weather sensor together with the receiver and the associated sensors and functions.

The general idea is quite simple. The Arduino takes measurements roughly every 30 seconds and transmits them to the RaspPi. There, the raw measurements together with the ID of the Arduino (there may be more than one sensor) are collected in a raw data table inside a SQL database. The measurements from the raw data table are read by a CRON job every five minutes to generate average values (5min, 1h and 24h) for each sensor. The results are again stored in different tables. These tables are used by the web pages to show the course of the weather over the last few days. I plan to write a short post on each part of the chain during the next weeks.