Attiny85 Wireless Weather Sensor




In this article is shown how to build your own wireless weather sensor compatible with Oregon weather station using compact attiny85 micro controller. You can buy spare Oregon sensor THGN123N for about $20 or you can build your own wireless sensor that implements Oregon protocol V2.1 for about $9 and have fun!

The main component of the sensor is an accurate temperature/humidity sensor that can report the weather condition with high precision (about 0.5 degree of centegrees). The si7021 sensor has shown perfect results, so I recommend this sensor one more time: it has great accuracy, small form-factor and low power consumption.

Also, we need mobile platform with low power requirements that can run on the batteries for a long time. The sensor firmware is small and can easily fit into attiny85 micro controller memory. The power consumption of the attiny85 running at 1MHz in sleep mode is about 4 micro Amps!

And the last, we need the software library for sending the signals using appropriate protocol. Happily, there is the software created by Domonique Pierre, emulated Oregon V2.1 protocol, that we can reuse.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Component List

To build own weather sensor you need the following components:

  • attiny85 micro controller - $1.2 (in bundle of 10)
  • temperature/humidity sensor si7021 - $2.6
  • wireless transmitter 433 MHz - $0.6 (in bundle of 5 pairs transmitter/receiver)
  • two AA battery case pack - $1
  • small components - about $0.5
    • resister 10k
    • resister 3.3k - 2 pcs

Step 2: Hardware

First, we need to build the hardware platform for our sensor. Here you can see the simple schematics, that can be easily implemented on general PCB or you can use custom PCB using my design. Two AA battery pack provides sufficient power for the sensor during six month or so. To evaluate the remaining battery capacity, internal reference voltage is used, which supplies stabilized 1.1 volt. The readings from this reference voltage source depends on battery voltage, so we can estimate the battery capacity. Here you can find detailed description of how to use this reference source.

Step 3: Attiny85 Challenges

attyny85 is small micro controller and has limited capabilities. It does not have hardware UART port helping debug the firmware nor hardware i2c bus. Hopefully, the sketch developed for the Arduino micro controller, required a cosmetic changes and there is good TinyWireM library that simulated i2c bus on the attiny85. pins 5 and 7 of the attiny85 used for i2c communication. The standard library for si7021 sensor should be modified slightly: you must remove #include line from the .cpp library file. The library header file has correct include statement in case of attiny85 controller.

To reduce the power requirements of our sensor, Attiny85 controller configured to use internal 1MHz clock. Also the sketch implementing watchdog timer that wakes-up the controller every 8 seconds. This aproach allows significantly reduce the power consumption of our sensor from 1mA to about 5 uA (micro Amps, at 3.3 volts).

At the beginning, I tried to use pure Oregon protocol library written by Domonique Pierre. Unfortunately, the controller speed was not sufficient to send the data in the time limits required by the protocol using digitalWrite() system call. To make the library faster, direct port manipulation was implemented in the sketch. In the attiny85 controller there is one output port only, D. So the direct port manipulation class is very simple. The constructor for OregonSensor class automatically selects appropriate port based on the transmission pin number. There are direct port manipulation functions in the class to send "one" and "zero" signal according by the Oregon protocol that allows to speed-up the signal transmission.

Step 4: How Does It Work?

The sketch code for the sensor is very simple. The main time the controller is in sleep mode. Every 8 seconds the controller is waked up by the watchdog timer. The internal counter skips 4 times ans activates the sensor every 40 seconds: the controller sends the readings from the temperature and humidity sensor si7021 to the weather station using Oregon 2.1 protocol.

The battery capacity evaluated every 100-th time by reading the voltage of internal reference source. As i mentioned before, the reference voltage is stabilized at 1.1 v and the reading of reference source depends on voltage on the vcc pin of the attiny85 micro controller.

Step 5: Conclusion

There are three interesting features in this project:

  • non-expensive, compact, simple-to-implement attiny85 based hardware platform.
  • power-efficient wireless sensor that can run over a half-year on two AA batteries.
  • the software that supports Oregon V2.1 protocol with advanced direct port manipulation functions.

I hope, you enjoy investigating all of the components or you can build your own sensor using this technology.

Sensors Contest 2017

Participated in the
Sensors Contest 2017

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    11 Discussions

    Giovanni A.M

    2 years ago

    ciao, your project is a real dream but I've some lack for coding on attiny.

    have you made some test on a sketch for the arduino one's board?

    it will help me a lot .

    thank's a lot anyway .

    1 reply
    sfrwmakerGiovanni A.M

    Reply 2 years ago

    you can build similar project on arduino, like thus one:

    Eric Brouwer

    2 years ago

    Hi again

    I have a big favor to ask. Can you please add the libraries that you used to compile this sketch with. I have tried several different versions of the following:

    #include <TinyWireM.h>

    #include <USI_TWI_Master.h>

    #include <SI7021.h>

    All without success.

    Thanks in advance.

    4 replies
    sfrwmakerEric Brouwer

    Reply 2 years ago

    Have you fixed the .cpp file of the SI7021 library? You had to commented out the include of <Wire.h> library like this:

    Copyright 2014 Marcus Sorensen <>

    This program is licensed, please check with the copyright holder for terms

    Updated: Jul 16, 2015: TomWS1:
    eliminated Byte constants,
    fixed 'sizeof' error in _command(),
    added getTempAndRH() function to simplify calls for C & RH only
    #include "Arduino.h"
    #include "SI7021.h"
    //#include <Wire.h>

    Anyway, you can download the libraries using this link:

    Adruino IDE version used - 1.6.12 for windows. Attiny support was recently added to my IDE.

    Eric Brouwersfrwmaker

    Reply 2 years ago

    Thanks for your help. But after building the circuit, my weather station did not pick up the new sensor.

    I later found out that my wireless protocol uses Oregon V3. But it was worth the build, as I never used the ATTiny85 before. Still learned a lot building the project.

    sfrwmakerEric Brouwer

    Reply 2 years ago

    Sorry for that. Domique Piere have realized some functions for Oregon protocol v3. It is a little bit more complicated than v.2 protocol, but you could implement it, if you have a time.

    Eric Brouwersfrwmaker

    Reply 2 years ago

    Thank you. Yes, I did NOT comment out the Wire.h in the cpp file.

    I was able to compile and upload the file afterwards.


    2 years ago

    Very interesting. I have built an attint85 weatherstation (and wrote an instructable on it) but that was just with a whip up 'protocol' with Manchestercode. Your Oregon protocol makes it a lot more interesting and more universal. I'll see if I can implement your code on my hardware.
    Other than that, yours looks great as well

    Eric Brouwer

    2 years ago

    Excellent project. I will definitely build one to add to my weather station.


    2 years ago

    Nice project. You could use the 1.1v internal voltage reference of the attiny for battery monitoring. That way you get 2 pins free and don't need the voltage reference of 1.24v.

    1 reply

    Reply 2 years ago

    Thank you very much. I will investigate this capability. This would make the sensor much simpler.