Arduino microcontrollers are inexpensive, widely available, globally supported, open source computing platforms for controlling hardware. There are many environmental monitoring sensors that are easy to interface with Arduino boards. The goal for this project is to construct a basic weather station that:
The first step is to define the equipment needed to meet the project goals. Previous projects I have developed
use various sensors with Arduino UNOs. These boards are the most widely used for project development. Although
they don't require much
power to operate, they are not the most energy-efficient Arduino-compatible boards.
Power requirements are an issue for stand-alone applications you would like to run
outdoors away from a plug-in power source, unattended for long periods of time. For a power supply, my first
thought was a solar-charged battery system. There are Arduino-compatible solar controllers that will charge a battery when
there is sun, split off some power from the solar cell to power a device when there is sunlight, and automatically
switch to battery power when there is no sun.
I did, in fact, build such a system. Eventually, though, I found another approach that is very reliable and
will run unattended on a 9-V battery source for many months before requiring new batteries. This system uses an
Arduino Pro Mini board with a packet radio board that transmits data to an indoor Arduino UNO board with a packet
radio board to receive data. Although it might seem that two separate Arduino setups would be more expensive than
a single solar-charged battery-powered system with data collection and data logging all on one board, the overall
cost of a packet radio system is about the same as a solar-powered system with all the sensors and data on one board.
I was actually surprised at the reliability of this system, which transmits data regularly from an outside weather
station about 25 m from my indoor office, through a stucco over metal lath exterior wall and several interior walls.
For the weather station sensors, I chose a DHT22 temperature/relative humidity sensor and a BME280 temperature/
relative humidity/pressure sensor. With the packet radio system, the
transmitting station reads data from the sensors, encodes the values into a
text string (the "packet"), and sends the packet to the receiving station, which decodes the packet
and handles all the data logging.
If the transmitting station were continuously under power, it would not be very good choice for
a battery-powered system. However, Adafruit (www.adafruit.com) offers a low-power timer that
applies power to the Arduino system intermittently, based on adjusting the value of an on-board
resistor. When the system is turned off, the timer board draws only about 20 μA! When
the sensors have been read and the packet has been sent, the Arduino sends a signal back to the low-power
timer, which shuts down the board and restarts the timing cycle. For this project, I set the low-power timer to turn
the Arduino system on approximately once
every two minutes, with the "Delay" resistor is set to about 27 kΩ
The cycle time can't be set exactly by adjusting the resistor, but an approximate two-minute
cycle seems reasonable for this application. (The Adafruit tutorial for the timer
board gives a table of resistance and cycle time values if you wish to change it.)
This system has been running for several
months, through a cold winter and some very hot summer days, on a 6 alkaline D-cell battery pack;
that
is not a particularly small power supply,
but it lasts a long time because the power drain over time is very small.
This project assumes you have already installed the Arduino Integrated Development
Environment (IDE) on your computer and you know how to use it.
Here is a list of the hardware you will need for this project. Prices are approximate,
as of summer 2018.
Suggested sources for packet radio project (from www.adafruit.com except as noted) |
Arduino Pro Mini board, ID 2378, $10, plus stacking headers,ID 2830, $1.25, or
www.sparkfun.com DEV-11113, $10,
plus headers, PRT-00116, $1.50 |
SparkFun FTDI Basic Breakout - 5V,
https://www.sparkfun.com DEV-09716, $15,
plus A/miniB USB cable or FTDI Serial TTL-232 USB cable, ID 70, $18 |
Arduino UNO or compatible board: www.allelectronics.com UNO (includes USB A/B cable), #ARD-21, $14.00 www.adafruit.com ID 2488 METRO 320 with headers (doesn't include USB A/microB cable), $18 www.sparkfun.com RedBoard (doesn't include USB A/miniB cable), DEV-13975, or www.allelectronics.com #ARD-22, $20 |
TPL5110 low power timer board, ID 3435, $5 |
20×4 LCD with I2C interface, www.sunfounder.com TS0352, $15, plus 4-pin female connecting cable or M/F jumper wires (my preference) or LCD shield kit, ID 772, $20 (considerable soldering required) |
Packet radio transceivers (2), ID 3070, 2 × $10 = $20 |
Pololu adjustable step-up/step-down voltage regulator, www.pololu.com #2119 S7V8A, $6 |
data logging shield, ID 1141, $14, plus CR1220 coin cell battery for clock, ID 380, $1, SD card or microSD card with adapter, ID 1294, $10 |
half-size breadboard, www.allelectronics.com PB-400, $4 or www.adafruit.com ID 64, $5 |
BME280 T/RH/P sensor, ID 2652, $20 |
DHT22 T/RH sensor, ID 385, $10 |
batteries and battery holders, www.allelectronics.com, BH-141 (4 D cells), BH-142 (2 D cells), $2 each; alkaline D cell, PRC-1300, $1.75 each |
AC to 9-VDC power supply with 2.1 mm plug (for powering UNO board) ID 63, $7 (100-240 V input. U.S. plug) or www.allelectronics.com PS-914, $8 (100-240 V input with international plug set) |
(miscellaneous) www.allelectronics.com, 4-pin connecting cables, M/F and M/M jumper wires, USB cables, stackable headers, Arduino UNO and Pro Mini compatible boards, etc. |
(optional) Depending on what kinds of headers you have on your Arduino board and data logging shield, you may need a screw shield for connections on the receiving station: www.robotshop.com RB-lte-127, $4 |
packet radio --> Pro Mini 5V --> VCC GND --> GND CLK --> digital 13 MISO --> digital 12 MOSI --> digital 11 CS --> digital 4 G0 --> digital 3 RST --> digital 2For the power on/off timer:
timer --> Pro Mini VDD --> 5 V from external power supply, no more than 5.00 V! GND --> GND DRV --> VCC Done --> digital 5 Delay --> Measure resistance to ground (without power) to set on/off power cycle, about 27 kΩ for 2-minute cycleThe packet radio pin connections for the receiving system are the same as for the transmitting system except the 5 V pin power pin goes directly to the 5 V Arduino header pin. On the receiver, the LCD connections are ground, power, SDA to analog 4, and SCL to analog 5. For this system I used a screw shield to connect all the wires because that is a little more secure than just using the headers. Three of the wire colors on the four-pin female connector I attached to the LCD's I2C interface board pins didn't match the colors I wanted to use to attach to the UNO, so I spliced other wires with the colors I wanted: red for power, black for ground, yellow for SDA, and blue for SCL.
Packet radio transmitter | Packet radio receiver with LCD and data logger |
Insolation is the total incoming solar radiation measured on a horizontal plane at Earth's surface, in units of
watts per square meter (W/m2).
Instruments that measure insolation are called pyranometers. These instruments can also measure solar radiation
in other orientations, in the plane of solar photovoltaic or water heating panels, for example, to measure solar
input available to those devices.
Laboratory grade pyranometers can cost several thousands of dollars. Less expensive versions use silicon
photodiode detectors. These instruments might more accurately be called "surrogate pyranometers" because they do not respond
uniformly across the wavelength of incoming solar radiation. Nonetheless, they are widely used in research and agricultural
applications.
Silicon photodiode pyranometers are analog devices that don't require a power source and typically produce a few tenths of a volt in full summer sunlight. With an output in this range, the built-in 0-5 V, 10-bit analog-to-digital resolution available on Arduino analog input pins is inadequate for this measurement. It is true that the 0-5 V full scale range can be reduced somewhat by using a lower external reference voltage, but that doesn't really solve the problem of insufficient A/D resolution. Fortunately, there is a simple and not very expensive solution to this problem: the ADS1115 4-channel, 16-bit programmable gain board from Adafruit (ID 1085, $15). Connection to an Arduino is easy because it is an I2C device. Here is a breadboard layout using, like the previous layout, a Pro Mini, low-power timer, and packet radio, plus the ADS1115 board at the bottom of the breadboard. The inputs are labeled A0-A3, not to be confused with the analog pin numbers on an Arduino – the four channels are all available through the I2C connection to allow multiplication by a calibration constant specific for each pyranometer. The receiver layout is exactly the same as for the weather station project. You can find more information about high-resolution Arduino-based data loggers on IESRE's website, www.instesre.org. For this project, I have used two silicon photodiode pyranometers – an SP-Lite pyranometer from Kipp & Zonen (around $400) and an inexpensive pyranometer developed by IESRE ($75 assembled and calibrated or $25 in kit form). See http://www.instesre.org/construction/pyranometer/pyranometer.htm for information about building your own pyranometer from a kit supplied by IESRE. That web web page shows a special cable for connecting to a commercial data logger. For this project, you need only two-wire microphone (audio) cable with short pieces of solid hookup wire soldered on the ends for inserting into a breadboard. (Depending on the gauge, stranded wires may be difficult to use with breadboards even if the ends are twisted tightly and "tinned" with solder.) The code for this project is similar to the previous code for sending and receiving packets. The receiver code defines some strings using the Arduino's String object to allow operations such as string concatenation and extracting floating point numerical values from a character string. The transmitting code just sends as characters the voltage values read from channels A0 and A1 of the ADS1115 board, set for a range of 0–0.256 V. The conversion to an insolation value is done in the receiving code by multiplying voltage by a calibration constant for each pyranometer, which is why numerical values must be extracted from the string of characters in the packet string. Although I have used commercial data loggers for many years, the advantage of this Arduino-based packet radio project is the same as for the basic weather station described above: system performance can be monitored in real time and insolation data can be conveniently displayed indoors on an LCD while also being saved on an SD card. |
/* PowerTimerTest.ino, D. Brooks, August 2018 |