This project is an ATtiny85 based mini Weather Station that displays temperature, humidity, and pressure via four 7-segment LED displays.
This sketch requires a version of the Wire library that is compatible with the ATtiny85 for the I2C communication to work with the BME-280 sensor. I used the ATTinyCore arduino core by Spence Konde which has a version of the Wire library that works with the ATtiny85 and was able to use the standard Adafruit_BME280 library to pull data from the BME-280. You can install ATTinyCore putting the board manager URL in the Arduino IDE preferences:
Set the board to the ATtiny85 chip at 1Mhz (internal).
- ATiny85 Microcontroller (DigiKey)
- BME-280 Sensor (Temperature, Pressure, Humidity) (Amazon)
- 74HC595 8-bit Shift Register (Qty 4) (DigiKey)
- 7-Segment LED Display (Qty 4) (DigiKey)
- 0.1uF Ceramic Capacitor (Qty 2)
- 100uF Electrolytic Capacitor
- 5V Power Supply (Alternatively you can use a 5V Solar cell, 3.7V lithium ion battery and a TP4056 constant-current/constant-voltage linear charger to charge the battery during the day).
The Code is located on Github: https://github.com/jasonacox/ATtiny85-Weather-Station
I2C communication with BME-280 uses pins PB0/SDA and PB2/SCL. If you use the Tiny AVR Programmer from Sparkfun or something similar it drives an LED on PB0 which will interfere with I2C communication. You will need to remove the chip from the programmer after uploading to get it to work in the circuit.
This sketch uses nearly all of the ATtiny85 program storage space (8K) so you may get an overflow error if the libraries change or you add any code.
[ 70'] - Temperature in degree (positive & negative) [ 24r] - Relative Humidity [_970] - Pressure in hPa with prefix for rising - or falling _
I used two circuit boards: Display and Logic board. The Display board holds the 4 LED 7-segment displays with the array of resistors. On the back are header pins that plug in to the logic board. The Logic board holds the 4 register chips and the ATtiny85. On the back are headers for the Display board to plug in.
The Logic and Display boards:
I printed a simple cylinder case (Thingiverse) to mount the weather station and have it on the back patio:
The circuit will run on 5V or 3.3V. I used an existing solar panel, battery and TP4056 charger circuit to power this project with a 3.3V regulator.