License

Category: Weather

After the sleet at the beginning of this year, satellite imagery shows large brown patches of the land, where last year they were green and covered in vegetation. To assess the extent of the damage, we went to the most affected area.

From the images bellow it is clearly visible that the only things still standing are bare tree trunks without any canopy. It is slowly starting to regrow where the branches were broken off, but it will take at least 5-10 years for canopy to grow to its previous state. Many man hours were and will still be spent on cleaning the undergrowth to prevent the European spruce bark beetle from destroying the remaining coniferous trees.

In the beginning of February heavy sleet covered majority of the forest. Freezing cold held almost half of the country in a tight grip for days and caused thousands of the trees to be crushed under the weight of snow and ice. About 40 % of woodlands have been damaged in natural disaster. Damage was not caused only to the woods. Fallen trees disconnected many telephone and power lines, cutting off the electrical supply for entire villages.

In my location, conditions fortunately were not catastrophic. Branches have accumulated less than 2 cm of sleet in contrast to the the worst locations where the accumulated sleet was approximately 10 cm thick. Nevertheless, walking in the woods was scary as you could hear loud sounds of breaking branches all around you.

Recently acquired USB TV tuner and antennae that I built for it had to be put into use. For some time it is fun just to listen to nearby radio and aircraft communications. In addition, I wanted to do something useful. I thought of an old weather station that is constantly (every 30 seconds) sending data to an indoor unit on a 433MHz frequency.

Indoor and outdoor weather station unit
The 433 – 434MHz ISM band is full of various short messages from different commercial gadgets. To figure out the exact frequency of my wireless sensor I put it close to the receiving 400MHz discone antenna (for ensuring the strongest signal), and observed the spectrum of the band using SDR# software.

Spectrum of the signal observed in SDR#

After obtaining the frequency it was time to record signals at different sensor temperatures and settings (audio sample 1, audio sample 2). The channel switch does not really change the working frequency but only changes a few bits in data stream as will be shown below.

Entire signal sent by outdoor sensor

Recorded audio was imported and processed by Matlab’s function wavread and then plotted using plot function. The received signal consists of wake up pulse followed by a pause and eight or nine data bursts. The last data burst varies in length for a reason that the entire signal is always the same length.

One of the data bursts

The picture above shows one of those data bursts. While watching this picture I started thinking about the way how to decode the signal. The first thought was to read signal peaks as ones and wider gaps between them as zeros. Processing few different temperature readings gave me following bits:

18.7°C 1110101101110101111111011010101101010101011

12.6°C 111011101110101111111101010101010110101011

7.0°C 11010101101110101111111101111010110101011

-1.9°C 110101011011101011101010101010101101011010101011

It looks like the message is not decoded as simply as I hoped. Something else must be behind because the messages have different numbers of bits. After some time and mapping options I found the correct one. Bits with value 1 are mapped to 0 and set of bits 10 as 1. This gave me much better results, messages that have the same bit lengths:

18.7°C 00110100110000001011101111100

12.6°C 00100100110000000111111011100

7.0°C 01110100110000000100011011100

-1.9°C 01110100110011111110110111100

That way I was able to group bits into meaningful groups. Detailed process of the decryption will be shown for the temperature values 18.7°C and -1.9°C. For better visibility message must be first broken into seven groups.

Graphical representation of the protocol with digits representing a number of the bits.

0011 01001100 000010111011 11 1 0 0 equals to 18.7°C

0011 this part changes for every different temperature reading, probably some kind of CRC/checksum code, have not yet manage to decipher it

01001100 random sensor serial number, it changes every time your restart the sensor

000010111011 converted from binary to decimal gives us 187, divided by 10 returns the correct value of 18.7

11 channel number, possible variants are 01 for CH1, 10 for CH2 and 11 for CH3

1 battery indicator, 1 battery OK, 0 low battery

0 indicates the sensor normal working mode. You can force it to send data by pressing TX button on it. At that time this bit will change to 1, telling the indoor unit that you forced the sensor to send data and maybe changed the channel setting.

0 tail constant every time

0111 01001100 111111101101 11 1 0 0 equals to -1.9°C

111111101101 is the two’s complement of the sensor reading, first -1 must be subtracted returning 111111101100, this is then inverted to 000000010011 and converted to decimal values giving 19. Taking into account the sign and the division factor 10, the result is -1.9

All the calculations were done by hand. Next possible step is to write a Matlab program that would automatically convert recorded audio to sensor readings. Few more images can be found in gallery.Circuit board inside outdoor sensor unit

Sometimes I just do not have time to connect to the internet and check current weather conditions. This is the reason why I made this indoor LCD weather display based on Atmega328 Arduino MCU. The circuit board consists of two LP2950 voltage regulators, MCU, four buttons, ENC28J60 Ethernet module and LCD12864 graphic display module.The Ethernet module is used to connect to this website and to download current data. With it I am not limited to use only at home, but it can be used in any place with internet access. The input voltage is 3V3 so this is the reason why I have two voltage regulators. The connection to MCU is established using SCK, MISO, MIMO and SS digital pins.
Indoor weather station display disassembled.

The LCD12864 display uses ST7920 controller that has the option of parallel and serial communication. Serial communication is preferred because it uses only three digital pins (3, 8 and 9) instead of ten or more for parallel. Another advantage with this display is that it can be used in graphic mode. With it you can control individual pixels on screen. I used this to draw the sun or clouds depending on a outside conditions.Display showing the current data.
LCD display in action. On the first screen you can see the current weather data (temperature, humidity, wind pressure, cloud coverage and sky temperature), the time when they were recorded and if the change from earlier time is positive, negative or constant. On the second picture the display is showing maximum and minimum within certain period and they can even be reset. All the captions are in Slovene language. More pictures can be found in gallery.Display showing the limiting data.

The original library was meant to be used with Arduino Mega that has 4 times as much SRAM as ATmega328 I have been using. The screen buffer alone needs 1KB (128×64/8 = 1024 bytes) of memory that is half of the total memory one could use. Beside this in graphic mode you have to store every individual pixel of any character used, leading to overflown memory, leading to broken code and unexpected errors. If you do not want to change the look of the character while the program is running you can store them in FLASH memory along with the source code. Any variable the contents of which will be constant and not changed after initialization can be stored in FLASH using avr/pgmspace library. Doing so updated library can be successfully used on UNO an Duemilanove Arduino broads. Here you can download my updated version of the library I have been using for LCD 128×64.