Back to Home

Arduino & Oregon or do-it-yourself weather station

diy or do it yourself · arduino · programming microcontrollers

Arduino & Oregon or do-it-yourself weather station

Not so long ago, a set of a young Arduino radio amateur fell into my hands and many different projects received a ticket to life (or “to the table”), but the bad head still gives peace of mind.
Thanks to a successful combination of circumstances, it so happened that in one place were:
  • Arduino - 1 pc.
  • Sensor for measuring temperature and humidity Oregon THGN132N - 2 pcs.
  • RF-kit (receiver and transmitter) at 433 MHz - 1 pc.

In addition to the above (exclusively for rapid prototyping), the Seeed Studio Starter Kit was used (it required a base shield, a 16x2 display with a serial interface, an LED module and connecting cables).

Photos for the most impatient:


The 433MHz range is widely used in various household appliances - car alarms, light control systems, weather stations, etc. communicate on this frequency. Receivers and transmitters for this range are widely available and are quite inexpensive.

Many Oregon weather stations are equipped with THGN132N sensors and can also be purchased separately. They allow you to measure temperature and relative humidity, operate in a wide temperature range (-40.0 ° C to + 70.0 ° C), while the accuracy of temperature measurement is 0.1 ° C. The cost is low and is determined to a greater extent by the greed of sellers.

Under the battery cover there is a “channel” switch - 3 options are available.


The sensor once in about 40 seconds transmits data about its status.
Transmission is carried out using on-off-keying (OOK) and Manchester coding at a carrier frequency of 433.92 MHz.

The protocol for Oregon sensors (and some others) was more widely understood by enthusiasts., which allowed to carry out the current project.

Enough theory, move on to practice. Putting a test bench:
  • We connect base shield to arduino,
  • We connect the RF receiver to D2 (we will use interrupts),
  • Display module - to D11 and D12 (TX and RX, respectively),
  • LED module - to D13.

I used the accessories of the Grove series - they are all equipped with identical connectors and are extremely easy to connect to the corresponding connectors on the shield.

The adapted sketch from the page from the previous link (the author used mega there, I had to tweak the code a bit for my hardware) for my sensors showed the following data:
OSV2 1A 2D 10 E3 20 07 88 04 3F 94
OSV2 1A 2D 20 08 8C 27 10 83 43 B6

It turned out that (sequentially):
1A 2D is the type of sensor (by the way, some inconsistency immediately got out protocol and sensor descriptions - a different set of sensors corresponds to this code, but this did not prevent further work),
10 (20 for another sensor) - the channel number is transmitted in the upper 4 bits (depends on the position of the switch on the sensor, takes values ​​1, 2, 4 , while 4 corresponds to 3 selected channel),
E3(08) - identifier of a specific sensor (?), But this value may change after replacing the battery in the sensor and pressing the Reset button (located next to the channel selector and recommended for mandatory pressing after replacing the battery).
The following contains information about the state of the battery (a flag that it is time to change it) and data specific to the sensor: information about the current temperature and relative humidity.

From this “analysis” for myself, I found out the following: for an arduino weather station, you can use significantly more sensors than the factory one (for example, use the combination of “sensor type - channel” rather than just “channel” for identification, etc.) , you can use not only the sensors that you purchased yourself, but also the "neighbors" (unfortunately, on my radio air there were data only from my sensors - the neighbors either do not have these, or simply "do not finish").

Now, the last preparations: for the first sensor, select 1 channel and send it out the window to frost, assign the second sensor 2 channel and leave it to live at room temperature for now. We will identify the sensors precisely by the channel - this is more than enough for the current case.

A bit of programming and done:
The first line of the display shows the current temperature, relative humidity and the battery status of the sensor outside the window, on the second - the same, but for a room sensor. The LED connected to the arduino blinks when data is received from a sensor (just for fun).



The display from the "starter kit" at the same time pleased and disappointed.
In the "pluses" - a minimum of digital outputs is involved, in the "minuses" - the lack of Cyrillic support and in the current version of the library there is no possibility of generating your own characters (I wanted to draw characters for a "full" and "empty" battery).
Due to the last restriction, I looked at the available characters and picked up two that are suitable for this case.
The result is visible in the photo (the first sensor has a fresh battery, and the second one has an almost discharged battery installed specifically for the test).

A small remark on the range: the Oregon sensors specification states that they work at a distance of up to 30 meters from the base unit.
In my case (apparently because the quality of the RF receiver or the “pollution” of the ether is high), the system works stably, provided that the sensor is at a distance of 5-7 meters (there are also obstacles in the form of 1-2 walls) . If possible, it will be necessary to purchase a receiver from another manufacturer and test with it.

Thus, in the "dry residue":
  • if you have a weather station (or Oregon sensors), you can simply include them in the home automation system without disrupting their regular operation as part of the factory weather station,
  • you can use not only your own, but also "neighborly" sensors,
  • several hours were spent with benefit and the desired result was achieved.


To-do:
  • Add more sensors (modules on DHT11, DHT22 (temperature and humidity), BMP085 (temperature and atmospheric pressure) are already ready to connect.
  • Connect an Ethernet shield with an SD card and, using Google Chart Tools, make a page with the current parameter values ​​and beautiful graphs (it is possible that the web server will have to be blocked somewhere on the NAS, and the arduino will only measure and transmit the values ​​to the server, but this is a completely different story).
  • Engage the RF transmitter to control the chandelier (for now, another arduina is connected to its original remote control using optocouplers and “presses” the buttons on it, but this is also not a topic for this topic).


Related links:

Read Next