This is only a preview of the December 2004 issue of Silicon Chip. You can view 20 of the 96 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Items relevant to "Schoolies 20W Amplifier Module":
Items relevant to "A Charger For Deep-Cycle 12V Batteries, Pt.2":
Items relevant to "Solar-Powered Wireless Weather Station":
Articles in this series:
Purchase a printed copy of this issue for $10.00. |
Solar-powered
wireless
weather station
Based on the popular PICAXE processor,
this simple weather station will “wirelessly”
transmit temperature and humidity data to a
receiver up to 200m away. Build one for your
backyard.
By NENAD STOJADINOVIC
T
HE RADIO MODEMS presented
in the November 2003 and May
2004 issues have proved to be
very popular and it’s been an education to see some of the uses they have
been put to. One of the most common
FAQs concerned the monitoring of
weather, so in response to what is
clearly a widespread fascination, I’ve
decided to produce a simple weather
station design.
Educational value was a major
consideration, so I decided that the
best arrangement would be to have
a PICAXE-18A handling all of the
smarts. This would be followed by a
serial data modem (from the November
2003 issue) that simply relayed the
56 Silicon Chip
various readings to a receiving station,
where they could be displayed. The
avid experimenter or student would
then be able to poke around the sample
code to their heart’s content, secure in
the knowledge that they don’t have to
worry about messing up a complex RF
data link.
A computer is one of the easiest
ways to present the readings, so the
results go into the COM port of an old
IBM-compatible running Hyperterminal. Fig.1 shows the basic layout.
And now the weather
The PICAXE takes a reading from a
Dallas DS18B20 temperature sensor
and a humidity reading from a Honey-
This view shows the completed
Weather Station board (bottom) with
its companion Radio Modem Transmitter board connected.
well HIH-3610-001. The readings are
processed and loaded into the modem
transmitter, together with information to make it more easily readable
by the user. In the example program
listing, the PICAXE loads bytes that
correspond to “T = ” before loading
the temperature value and “RH% = ”
before the humidity.
The receiver will then simply print
the received bytes onto the screen resulting in, say, T = 24, RH% = 64. As
an added refinement, I have followed
up the data with a separate transmission that sends an <enter> and <LF>
siliconchip.com.au
Fig.1: block diagram of the Weather Station. It uses a PICAXE microcontroller to monitor temperature and
humidity sensors and this then drives a Radio Modem Transmitter (described in November 2003). The RF signal is
picked up at the receiving station, decoded and fed into a PC which displays the data.
(line feed) command so that you end
up with a neat list of readings down
the lefthand side of the screen. Why
a separate transmission? Because the
modem accepts only 16 bytes at a
time and by the time you’ve loaded
T<space> = <space>, etc, there isn’t
room for the <enter> and <LF>.
Speaking of refinements, I’ve designed in an elegant switchmode
power supply from the clever people
at Maxim. Based on the MAX757, it
will accept any voltage between about
0.5V and 5V and turn it into a stable
5V. Not only can you use a 1.5V battery rather than an expensive 9V type,
you can also use a solar cell and Nicad
battery for “eternal” power.
As shown in the photos, my version
was built into a cheap solar garden
light, currently being sold just about
everywhere in almost any form you
can imagine.
Using garden lights was a real boon,
especially as they can be found for
around $10. The innards consist of
a solar cell charging a Nicad battery
through a diode, followed by a simple
circuit that switches the LED on at
sunset. Conversion consists of evicting
the original circuit board and wiring
the weather station in its place.
General arrangement
The weather station is in the form of
three separate logical building blocks.
First, let’s look at the power supply
siliconchip.com.au
which is a DC-DC switchmode converter operating in boost mode – see
Fig.2. Current from the low voltage
supply flows through inductor L1 and
into pin 8 of the MAX757. The boost
effect relies on the fact that the current in a coil is slow to start flowing
and equally slow to stop once it does
– think of it as an electronic version
of a flywheel. The current is allowed
to get up to a good clip and then pin
8 suddenly switches it off.
The energy in the coil then has
nowhere to go except through diode
D1 and into the 100µF storage capacitor – think of the capacitor as a water
tank. The clever part is that the final
voltage on the 100µF capacitor can be
controlled by varying the ratio of the
on to off times of pin 8. Pin 2 monitors
the voltage output and it is compared
to a reference voltage generated by a
potential divider made up of the 33kΩ
and 11kΩ resistors.
The MAX757 also has provision
for a low voltage warning at pin 4. I
haven’t used it in the weather station
but have provided for the possibility.
Thus, R2 is deleted and a wire link is
put in place of R6.
The PICAXE is the heart of the
circuit. The temperature sensor outputs a digital signal which is read
by a PICAXE command specifically
designed for this particular sensor,
called “READTEMP”. The humidity
is handled by an A/D conversion fol-
lowed by a mathematical equation that
is evaluated by the PICAXE to arrive
at a humidity reading from 0-100%.
It is important to note that both of
the readings are heavily processed
to turn them into something that can
be read by people. For example, the
temperature sensor is itself controlled
by its internal microprocessor and
the PICAXE must establish communications, download the temperature
reading (in a special format), convert
it to a more human readable form and
then finally convert it to the ASCII for-
The circuit is built into a low-cost
solar-powered garden light and is
powered from the existing solar cell
and Nicad battery.
December 2004 57
Fig.2: there are basically three parts to the circuit: (1) the weather station
circuitry consisting of PICAXE IC1 and the humidity and temperature sensors;
(2) a radio modem transmitter; and (3) a simple switchmode power supply.
mat which computers use for display
purposes.
The radio modem then has the simple job of taking the resulting data and
making sure it arrives at the computer’s
COM port in good order, exactly as a
good post office does.
There is an unusual feature in that
the modem is actually powered by
the PICAXE!
Construction
Start the construction by building
the power supply section only, taking
extra care to correctly orient the ca58 Silicon Chip
pacitors and diode. Once it’s finished,
connect a 1.5V battery and measure
the output at pin 6; it should be very
close to 5V.
Next up is the modem, which is
assembled as per the included instructions. You will be making life hard for
yourself if you don’t test the modem
before use – this is most easily done
by soldering a temporary link between
the SEND pin and ground. Plug the
receiver into your computer, fire up
Hyperterminal at 1200 bits/sec and
apply 5V to the transmitter. If you
get a neat series of ‘012345678:;<=>’
then you can be fairly sure the modem
works. If it does, remove the temporary
link and put the modem aside.
Next, solder in the two sensors and
put the programmed PICAXE into its
socket, then solder in the modem.
Apply power – if all is well, you will
get a line on your screen with the
temperature and humidity, followed
a short time later by a line feed.
If not, the first thing to check is the
power and control lines to the modem
transmitter. The power is supplied
by pin 8 of the PICAXE and SEND
is controlled by pin 7. Power should
of course sit at 5V and the SEND pin
should blip down to 0V twice every 15
seconds or so. Data is supplied to the
modem via pin 9 and you should see
siliconchip.com.au
Fig.3: follow this wiring diagram to assemble the Weather Station PC
board. The Radio Modem Transmitter board can be mounted at right
angles on this board and connected using tinned copper wire links – see
photo below right.
Above: this photo shows how the
board assembly is mounted on
the bottom of the plastic solar-cell
housing.
two brief “blurts” of data at the same
15-second repeat rate.
If you get lines of data on your screen
but the temperature or humidity value
is wrong or non-existent, check the
orientation and electrical integrity of
the sensors.
For the experimenter
I have included several features to
more easily adapt the weather station
to various tasks. Probably the most
siliconchip.com.au
important is that the PICAXE powers
the modem, specifically intended for
low-power operation. The PICAXE
December 2004 59
Radio modem transmitter &
receiver circuits
Fig.4: reproduced from the November 2003 issue, this diagram shows the Radio
Modem Transmitter (Tx) circuit. IC1 (an 8-pin PIC microcontroller) receives
serial data – in this case from the PICAXE on the Weather Station PC board –
and then sends it to the receiver via a UHF transmitter module.
Fig.6: parts
layout for the
Radio Modem
Transmitter
PC board.
Fig.7: parts layout for the Radio
Modem receiver board.
Fig.5: again described in the November 2003 issue, the front end of the receiver circuit is almost a mirror image of the
transmitter. PIC microcontroller IC1 receives data from the UHF receiver module and – after decoding and error checking
– passes it on to the PC’s serial port via a MAX232 receiver/driver chip (IC2). The optional external DATA output is not
used for the Weather Station.
60 Silicon Chip
siliconchip.com.au
Parts List
1 Toko 22µH inductor (494LYF0084M)
1 PC board, code 07112041, 61
x 39mm
1 18-pin DIL IC socket
Semiconductors
1 1N5819 Schottky diode (D1)
1 PICAXE-18A microcontroller
(IC1)
1 MAX757CPA DC-DC converter
(IC2)
1 Dallas DS18B20 smart
temperature sensor
1 Honeywell HIH-3610-001
humidity sensor
1 Radio modem Tx/Rx pair
Capacitors
1 220µF 10V electrolytic
1 100µF 16V low ESR electrolytic*
1 100n (0.1µF) monolithic (code
100n or 104)
Resistors
1 33kΩ
1 10kΩ
1 11kΩ
1 4.7kΩ
R2 – optional, see Fig.3
R6 – wire link, see Fig 3
* A low ESR capacitor will give
fractionally higher conversion
efficiency; they can be found at
Altronics and Jaycar. I personally don’t bother and just fit an
ordinary capacitor.
demo code transmits readings every
15 seconds or so and metaphorically
drives around in circles in between
times.
Low power operation
Low power operation usually requires that the transmitter power is
turned off (by pulling pin 8 low) and
the PICAXE is put to SLEEP between
transmissions. You may also find that
15 seconds is too short a time between
transmissions for the battery to maintain and so the PICAXE may need to
sleep for, say, five minutes at a time.
There are several extra inputs and
outputs on the board, perfect for extra
tasks such as reading rainfall or solar
radiation, turning on fans, etc. If a common theme emerges, I may develop
some extra modules to plug into the
basic unit.
As mentioned, the MAX757 DC-DC
siliconchip.com.au
Demonstration PICAXE Program
; DEMO.BAS by Nenad Stojadinovic
; This software is freeware and may be freely distributed
; This software is written for the PICAXE 18A or 18X and reads temperature from
; a Dallas Semiconductor DS18S20 and relative humidity from a Honeywell
; HIH-3610 sensor. Either the temperature or humidity section of the program can be
; used on its own, just cut out the bit you don’t need. Likewise the screen control
; section can be modified or cut out for use on LCDs.
; The temp and RH data is converted to ASCII and sent out at 1200 baud (N,8,1).
; Provision is made to control a radio modem transmitter, as detailed in Silicon Chip,
; Nov 2003. Output pin OUT 3 remains high until all sensor data is accumulated by the
; PICAXE and then it is pulled low for 100ms to trigger a radio transmission. Email to
; vladimir<at>u030.aone.net.au for more information.
; This software is based on articles originally published in Silicon Chip, Nov 03 and
; March 04.
; OUT 3 connected to the transmitter’s DATA line (high when idle)
; OUT 2 connected to the transmitters POWER input
; OUT 1 connected to the transmitters SEND line (high when idle)
; DS18B20 temperature sensor connected to IN 6
; Honeywell HIH-3610-001 relative humidity (RH%) sensor connected
; to IN 2 which makes an A/D conversion of the sensor voltage
; NOTE 1: putting the “#” before the register transmits the data in ASCII format
; that is suitable for computer comms progams (eg, Hyperterminal) or LCD displays
; such as the AXE 033.
; NOTE 2: This program sends a comma (44) after the temperature and a line feed (10)
; and carriage return (13) after the humidity. You can change this to anything you like,
; and you can also delete the "T = " and "RH = ". For example, you might like to log the
; temp and RH over a period of time and this is easily done using MS Excel by reading
; in the received data as comma separated variables (CSV).
; NOTE 3: The humidity sensor relies on a very accurate 5V power supply. Test the
; sensor by breathing on it – if it goes over 100% RH,check the power supply voltage
; or adjust the equation (see the SC article in Nov. 04). Note though that humidity
; sensors are not all that accurate – a few percent variation is considered very good.
high
3
;Initialise DATA line
high 2 ;Initialise POWER line
high 1 ;Initialise SEND line
wait
1
;Wait for it all to settle
main:
readtemp
if
serout
goto
neg:
let
serout
serout
humid:
readadc
let
serout
6,b1
b1 > 127 then neg
3,t1200,(“T = “,#b1,44)
humid
;Read the sensor, store in b1
;Is temperature negative?
;Send the temperature stored in b1
;Finished sending positive temp
b1 = b1 - 128
3,t1200,(“T = -”)
3,t1200,(#b1,44)
;Adjust negative value
;Send a minus sign
;Send the temperature stored in b1
2,b2
;Read the humidity, store in b2
b2 = b2-41*100/157
3,t1200,(“RH% = “,#b2)
;Send the humidity stored in b2
low
pause
high
1
100
1
wait
serout
low
pause
high
2
3,t1200,(10,13)
1
100
1
;Wait for trans to finish
;Screen control characters
;Lower SEND line to transmit
;Wait a bit
;Put the SEND line back to idle
wait
15
;Wait 15 seconds
goto
main
;Do it all again
;Lower SEND line to transmit
;Wait a bit
;Put the SEND line back to idle
December 2004 61
The solar cell housing is easily dismantled, by undoing a
few self-tapping screws. The transparent top cover is shown
immediately above, while at right is the solar cell section.
The solar cell charges a Nicad battery via a diode and on/off
slide switch, as shown at top right.
converter has a low-voltage indicator built in and this is implemented
using optional resistors R2 and R6.
If you want to use it, it’s simply a
matter of downloading the data sheet
from Maxim and then following the
instructions.
Antennas
I have found that the best antenna
Where To Get The Parts
Kits plus individual parts for this project are available from the author. Prices are
as follows:
(1). Weather Station PC board plus switchmode supply components....... $28.50
(2). Add PICAXE-18A ............................................................................... $10.50
(3). Add DS18B20 temperature sensor....................................................... $6.00
(4). Add HIH-3610-001 humidity sensor.................................................... $35.00
(5). Package deal of Tx/Rx modem plus Weather Station PC board
plus switchmode power supply components....................................... $93.00
All prices include postage within Australia and GST. To order, write or email the
author as follows:
Nenad Stojadinovic, PO Box 320, Woden, ACT 2606.
email: vladimir<at>u030.aone.net.au
Note: please contact the author before ordering as prices are very volatile (eg,
the humidity sensor has gone up by 400% in the last year)!
62 Silicon Chip
for the buck is a simple length of
insulated wire. Just cut it to 165mm
and solder it on – no adjustment is
necessary. In my case, it was possible
to feed the antenna down into the
plastic garden light post and I found
that the range was excellent.
For those who want to build the
transmitter into a smaller space, a coil
antenna may be more appropriate (see
photo). It simply consists of 24 turns
of 25-gauge enamelled copper wire
wound onto a 3mm drill bit, with a
total length of about 19mm (see photo).
It will need to be adjusted by stretching out or compacting the coils until
you get adequate range (remember
that radio spectrum users consider it
impolite to blast out more power than
you need, even at the low levels we are
generating). Note, however, that you
will never get the range of the simple
piece of wire.
If you need a professional appearance or real range, you can’t go past
the rubber duck antenna featured in
SC
the previous articles.
siliconchip.com.au
|