Main Content

ATtiny85 Weather Station

This is a weather station based on an ATtiny85 and an Adafruit Bosch BME280 sensor breakout. It displays the atmospheric temperature, pressure, and humidity on a 96x64 SD1331 colour OLED display.

It uses my Widget Dashboard to display the values on the display.

Introduction
To display the readings the Weather Station uses a low-cost 96x64 OLED display with 64K colours, and an SPI interface. It’s available from a number of suppliers including Adafruit [1] or Banggood [2].

The Weather Station is based on a Bosch BME280; it’s is the perfect sensor for a home weather station as it provides temperature, pressure, and humidity in a single device [3]. It’s available on a breakout board from Adafruit [4], Sparkfun [5], or Chinese suppliers such as AliExpress and Banggood. Some boards, such as Adafruit’s, support either 5V or 3.3V operation, so check before buying if this is important to you.

The downside with this sensor is that you have to do quite a bit of calculation to get the final readings; it’s not just a case of reading the values from the device via I2C or SPI, as with some other sensors. Both Adafruit and Sparkfun provide a library to interface to the sensor, but unfortunately these don’t seem to work on ATtiny processors, such as the ATtiny85, so I set about writing my own Tiny BME280 library.

Tiny BME280
My Tiny BME280 library supports the BME280 sensor on the ATtiny85 and other ATtiny processors. I’ve only supported the I2C interface as it is the most useful one on ATtiny devices with a limited number of pins.

To use it:

Download Tiny BME280 from my repository on GitHub: Tiny BME280.
Put the tiny-bme280-master folder in the library folder in your Arduino folder.
Add #include <TinyBME280.h> at the top of your program.
As with the other BME280 libraries my library uses the calculations from the BME280 datasheet, and I checked that it gives identical readings to the Sparkfun one. The only difference was with the pressure reading; Bosch gives two versions of the calculation, one using 64-bit integers and one using 32-bit integers. Sparkfun use the 64-bit version and I used the 32-bit version, but this resulted in a difference of under 1 part in 104. I haven’t provided altitude or dew point calculations.

This library is also compatible with the Bosch BMP280, a similar sensor that provides just temperature and pressure. If you use this sensor you’ll get zero humidity readings.”

Link to article