This project is an ATtiny85 based mini Weather Station that uses the BME-280 Sensor to measure and display temperature, humidity, and pressure via four 7-segment LED displays or using a TM1637 display module.
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: http://drazzy.com/package_drazzy.com_index.json
Set the board to the ATtiny85 chip at 1Mhz (internal).
Components:
- 74HC595 8-bit Shift Register (Qty 4) (DigiKey)
- 7-Segment LED Display (Qty 4) (DigiKey)
- 0.1uF Ceramic Capacitor (Qty 2)
- 100uF Electrolytic Capacitor
- TM1637 Display Module (Amazon)
- 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).
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.
[UPDATE] I created a minimized BME280 library to reduce the PROGMEM space required. You will need to clone/download and install the https://github.com/jasonacox/Tiny_BME280_Library library in your ~/Documents/Arduino/libraries/ directory and restart the Arduino IDE.
cd ~/Documents/Arduino/libraries
git clone https://github.com/jasonacox/Tiny_BME280_Library.git
[ 70'] - Temperature in degrees F (positive & negative)
[ 24r] - Relative Humidity
[_970] - Pressure in hPa with prefix for rising - or falling _ animation
[ 21c] - Temperature in degrees C (positive & negative)
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.
Both boards together and running:
I printed a simple cylinder case (Thingiverse) to mount the weather station and have it on the back patio:
Arduino Sketch Code: Here
+-------+
-|1 T 8|- V (5V)
TM1637 (CLKpin) PB3 -|2 i 7|- PB2 (SCLpin) BME280
TM1637 (DIOpin) PB4 -|3 n 6|- PB1
(GND) G -|5 y 5|- PN0 (SDApin) BME280
+-------+
Arduino Sketch Code: Here
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.