Silicon ChipSimple Data-Logging Weather Station; Pt.2 - October 2007 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Cheap DVD players are just that: cheap!
  4. Feature: DVD Players: How Good Are They For HiFi Audio? by Mauro Grassi
  5. Review: Agilent DS05054A 4GS/s 500MHz Digital Scope by Mauro Grassi
  6. Project: Oscar: Electronic Noughts & Crosses Game by Brian Healy
  7. Project: PICProbe: A Versatile Logic Probe by Ross Purdy
  8. Project: Rolling Code Security System; Pt.1 by John Clarke
  9. Project: Simple Data-Logging Weather Station; Pt.2 by Glenn Pure
  10. Project: AM Loop Antenna & Amplifier by Branko Justic & Ross Tester
  11. Vintage Radio: Nazi Germany’s Peoples’ Radio (Volksempfaenger) by Rodney Champness
  12. Book Store
  13. Advertising Index
  14. Outer Back Cover

This is only a preview of the October 2007 issue of Silicon Chip.

You can view 40 of the 112 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.

Items relevant to "Oscar: Electronic Noughts & Crosses Game":
  • PIC16F84A-04(I)/P programmed for Oscar (Programmed Microcontroller, AUD $10.00)
  • PIC18F84 firmware and source code for Oscar (Software, Free)
  • Oscar PCB pattern (PDF download) [08110071] (Free)
  • Oscar front panel artwork (PDF download) (Free)
Items relevant to "PICProbe: A Versatile Logic Probe":
  • PIC10F20x firmware and source code for the PIC Probe (Software, Free)
  • PIC Probe PCB pattern (PDF download) [04110071] (Free)
Items relevant to "Rolling Code Security System; Pt.1":
  • Rolling Code Receiver PCB [01510071] (AUD $5.00)
  • PIC16F88-I/P programmed for the Rolling Code Keyless Entry System receiver unit [ircroll.HEX] (Programmed Microcontroller, AUD $15.00)
  • PIC16F628A-I/SO programmed for the Rolling Code Keyless Entry System transmitter unit [irxmroll.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC18F628A firmware and source code for the Infrared Rolling Code Transmitter [irxmroll.HEX] (Software, Free)
  • PIC18F88 firmware and source code for the Infrared Rolling Code Receiver [ircroll.HEX] (Software, Free)
  • Rolling Code Keyless Entry System PCB patterns (PDF download) [01510071/2] (Free)
  • Rolling Code Keyless Entry System receiver front panel artwork (PDF download) (Free)
Articles in this series:
  • Rolling Code Security System; Pt.1 (October 2007)
  • Rolling Code Security System; Pt.1 (October 2007)
  • Rolling Code Security System; Pt.2 (November 2007)
  • Rolling Code Security System; Pt.2 (November 2007)
Items relevant to "Simple Data-Logging Weather Station; Pt.2":
  • PIC16F88 firmware and source code for the Data Logging Weather Station (Software, Free)
  • Data Logging Weather Station PCB patterns (PDF download) [04109071/2] (Free)
  • Simple Data-Logging Weather Station front panel artwork (PDF download) (Free)
Articles in this series:
  • Simple Data-Logging Weather Station, Pt.1 (September 2007)
  • Simple Data-Logging Weather Station, Pt.1 (September 2007)
  • Simple Data-Logging Weather Station; Pt.2 (October 2007)
  • Simple Data-Logging Weather Station; Pt.2 (October 2007)

Purchase a printed copy of this issue for $10.00.

Simple Data-Logging Weather Station Part II – by Glenn Pure Last month, we introduced our new Rain and TemperatureMeasuring Weather Station, with all the electronics. This month, we get into the nitty-gritty of building it – all the mechanical detail and then the actual construction. B Y NOW, WE’VE HOPEFULLY WHETTED YOUR appetite with this simple design. Most of the mechanical detail here is “roll your own” but there is an alternative commercial rain sensor available if you don’t have the time or inclination to make one. For those who do . . . Making the rain sensor The rain sensor uses a tipping bucket mechanism, consisting of a rain collection funnel that feeds water into a pivoting bucket divided into two opposing halves. When one side of the bucket fills and tips, it empties itself, at the same time positioning the opposing side under the funnel 68  Silicon Chip outlet where it can fill, tip and repeat the cycle. The tipping back and forth can be detected in various ways. Since power consumption was important for this project, a passive sensing mechanism was chosen. This involves momentarily closing a switch each time the bucket tips. As shown in the circuit diagram last month (Fig.1), the switch closure pulls the rain sensor line low (it is normally held high by a 220kW pullup resistor). To keep the design simple and maximise reliability, I used a magnetic reed switch that is mounted on a bracket next to the tipping bucket. The switch is closed by a tiny rare- earth magnet (measuring only 3 x 2mm) that is mounted on the tipping bucket. As the bucket swings, the magnet moves past the reed switch, closing it for a brief moment. A similar mechanism is found in many commercial rain sensors and has the advantage that the reed switch is practically immune to moisture and corrosion, etc. To achieve its light weight and non-magnetic properties, the tipping bucket and its mount are made from 0.7mm thick aluminium sheet. You may well have some of this in your junk box, salvaged from those utility boxes that come with both an aluminium lid and a plastic one. siliconchip.com.au The main funnel is glued using silicone sealant into a 100mm PVC pipe end-cap which has its end removed. Note the mesh leaf and insect trap on the bottom end. The water then passes into a secondary funnel, mounted on a U-shaped bracket fixed to another (complete) PVC pipe end cap. You can see this end cap in the next photo. Under the secondary funnel is the tipping bucket mechanism which fills with water and tips when it gets too heavy. A magnet on the tipper trips a reed switch to indicate one “fill”. The only problem with using this sheeting is that it is work-hardened, making it difficult to bend and shape easily. This can be fixed simply by heating, which will anneal the aluminium and make it much easier to shape. I used a blow torch for maybe 10 or 20 seconds, with the flame constantly moving over the piece. Do not heat it so that it starts to glow. If you don’t have a blowtorch, try sitting the sheet on an electric stove (solid) hotplate for a minute or two. However, before annealing the sheet, mark out and cut the bucket according to the plan shown in Fig.4. For accurate cutting, use a utility knife to score the sheet repeatedly, then bend it back and forth along the score line to snap it (bending it only 10° or so each way is enough). Practice on a scrap piece – you will quickly get the idea. Next, very lightly score a line along the centres of the drill holes. Continue this line across the whole width of the sheet as it is useful later when centring and mounting the divider between the two halves of the bucket. Drill the holes now as it is a lot easier before the bucket is bent into shape. The holes for the axle in the tipping bucket should be very slightly larger than the axle and located as marked on the template. It’s important that the axle sits close (a millimetre or two) below the bottom of the main body of the bucket as this makes for more sensitive operation. Now, anneal the sheet then proceed to bend it into shape. Start by bending the bucket supports (containing the axle holes) back down against the body of the bucket. Keep the bend sharp, for example by clamping along the bend line in a vice. Next, shape the main body of the bucket by bending it over a tube or rod about 25-30mm in diameter. A broom handle works well, as does some 1-inch diameter PVC pipe. Make sure the result is symmetrical and even in shape, both lengthways and sideways. The aluminium should be quite soft and easy to reshape if necessary. Finally, cut a divider to separate the two halves of the bucket. The width of the divider will depend on the diameter of the rod used to shape the bucket. The divider is “glued” into place using a small amount of silicone sealant or epoxy. It’s a good idea to include narrow (3mm wide) right-angle flanges on the sides of the divider to help glue it in place (see template). Once the glue has set, smear a thin bead of silicone sealant along the edge of the divider, where it meets the inside of the bucket, to ensure water doesn’t flow from one half of the bucket to the other. A cotton tip from the medicine cupboard will do the trick. Minimise Here’s the way the magnet is mounted on the tipping bucket – it (or in some cases they) is (are) glued into this hole made in the side (top) of the tipping bucket. Another close-up of an important part: the plastic washer which stops the bucket mechanism fouling the mounting bracket. Without this, the readings may be erroneous. Once the bucket has tipped and the water measured, it needs to escape. These mesh-covered holes in the pipe end-cap are for that purpose. Note the measurement for the two screw holes. siliconchip.com.au October 2007  69 REAL VALUE AT $13.95 PLUS P & magnet hole (3.5mm) 4 axle hole cL 80 bend down 180o axle hole 28 45 outside width of bucket +4mm 32 bend to semicircle axle hole hole for tieing off cable to reed switch 15 65 P 4mm hole fold lines 25 30 12 Silicon Chip Binders 0.6-0.8mm aluminium sheet TIPPING BUCKET BRACKET TEMPLATE TIPPING BUCKET TEMPLATE bend flange 90 o to back flange 3-4mm end open divider on centre line (magnet) inside height of tipping bucket These binders will protect your copies of S ILICON CHIP. They feature heavy-board covers & are made from a dis­ tinctive 2-tone green vinyl. They hold 12 issues & will look great on your bookshelf. H 80mm internal width H SILICON CHIP logo printed in gold-coloured lettering on spine & cover H Buy five and get them postage free! Price: $A13.95 plus $A7 p&p per order. Available only in Aust. Silicon Chip Publications PO Box 139 Collaroy Beach 2097 Or call (02) 9939 3295; or fax (02) 9939 2648 & quote your credit card number. Use this handy form Enclosed is my cheque/money order for $________ or please debit my  Bankcard   Visa    Mastercard Card No: _________________________________ Card Expiry Date ____/____ Signature ________________________ Name ____________________________ Address__________________________ __________________ P/code_______ 70  Silicon Chip bend flange 90 o to front inside width of tipping bucket TIPPING BUCKET DIVIDER TEMPLATE (axle under) (axle) plan elevation end open TIPPING BUCKET ASSEMBLED Fig.4: follow this diagram to make the tipping bucket assembly for the Simple Data Logging Weather Station. the amount of silicone applied, but apply it to both halves of the bucket to better balance the two sides. The rare earth magnet can now be glued into the locator hole on the upper side of the tipping bucket. One more thing is needed to finish the tipping bucket. When it is in operation, it appears to empty more efficiently and consistently if the inside surface of the bucket is water repellent. This can be achieved by coating it with a silicone car polish. Don’t be tempted to smear a thin coat of silicone sealant as this tends to be sticky and collects fine particles over time, impeding the proper operation of the tipping bucket. The tipping bucket pivots on a thin axle. For this, a short length of stainless steel wire (1.4mm in diameter) was used, although galvanised steel wire would probably be fine. The diameter isn’t critical. The wire was obtained from the whisk part of a $2 stainless steel egg whisk. A bracket to mount the tipping bucket on its axle can now be made from another piece of aluminium sheet (don’t use steel sheet as it is magnetic). Again, drill the holes in this for the axle before bending. The exact dimensions of the bracket will depend on the width of the tipping bucket. Precision isn’t necessary since washers or spacers should be used to keep the tipping bucket away from direct contact with the bracket, ensuring an unimpeded tipping action. Such spacers (or washers) are also important to ensure minimum sideways play of the tipping bucket on the axle. Avoiding such play will keep the magnet on the bucket positioned a constant distance from the reed switch each time it swings past. A distance of about 3-4mm should be the target (face of magnet to centre axis of reed switch). Adjustment of the bracket to achieve the correct spacing is made by simply bending it. If the magnet is too close, the force of attraction between it and the reed switch can be sufficient to cause the tipping bucket to lock in centre position. If the gap is too great, the reed switch simply won’t close. The spacers can be cut from the end of the plastic ink tube of a ballpoint pen. The reed switch is glued to the outside of the bracket that holds the tipping bucket. Be warned that the part of the reed switch that is most sensitive to the magnet is either end of the switch, not the middle of it, so ensure the reed switch is mounted so the magnet swings past one end (see Fig.6). A separation of 3-4mm between the magnet and the reed switch is best. Care is needed when soldering wires to the reed switch since it appears to partly melt at soldering temsiliconchip.com.au MATERIAL: 0.4mm GALVANISED STEEL SHEET RADIUS 180mm RADIUS 12mm MAIN FUNNEL TEMPLATE (50% ACTUAL SIZE) Fig.5: these two templates will help you make your main (primary) and secondary funnels. The main funnel catches the rain, the secondary funnel directs it into the tipping mechanism. Note that the main funnel template needs to be blown up 200% when photocopying, otherwise it will be a tad too small! The overlap when you bend the funnel shapes should be about 8mm. Seal this overlap with silicone sealant. perature. Hence it is essential to use a good heatsink between the switch and the end of the wire being soldered (firmly gripping with a pair of needlenose pliers will achieve this). Once soldered up, the switch and connections should be covered with sealant to waterproof them since the connecting wires on the switch are made from steel and will corrode over time if they get wet. The tipping bucket is housed inside a length of 100mm diameter PVC sewer pipe. A rain collection funnel is fitted to the top end of the pipe. The funnel was made from thin (0.4mm) galvanised steel sheet (see Fig.5). After bending, it was held in shape with pop rivets then the join soldered up, although silicone sealant would be fine also. A piece of fine wire gauze was then bent and glued over the bottom end of the funnel. The gauze was scavenged from one of those gauze covers for frying pans that are used to stop the fat spattering. Two-part epoxy or silicone sealant would be siliconchip.com.au SECONDARY FUNNEL TEMPLATE (ACTUAL SIZE) MATERIAL: 0.6 –0.8mm ALUMINIUM SHEET RADIUS 50mm fine to glue this in place. To fit the funnel to the top of the pipe, use a PVC pipe end cap. Cut the end out of this cap, effectively leaving only the side wall. Fix the funnel into this “ring” with acrylic or silicone sealant. Since neither of these sealants will stick very well to the PVC, it’s a good idea to run a bead of epoxy around the inside of the ring, after the sealant has cured. Make sure there is no sealant or glue fouling the inside of the PVC ring otherwise it won’t slide onto the pipe later. By mounting the funnel this way, it will slip nicely over the end of the pipe and be held in place by gravity. A hole tapped into the pipe and a machine screw can always be added to make sure it doesn’t move. A small secondary funnel has also been included. This sits between the main collection funnel and the tipping bucket and enables the rain collected from the main funnel to be aimed accurately into the tipping bucket mechanism. RADIUS 3mm It’s best to make the secondary funnel from annealed aluminium sheet since this is much easier to bend into shape. This funnel is held over the tipping bucket by a U-shaped bracket. It would be a good idea to coat the inside surface of the secondary funnel so it is water repellent (as you did for the tipping bucket surface). The tipping bucket itself, along with the secondary funnel, is bolted onto another end cap which slips onto the bottom of the PVC pipe. The two are mounted together to keep them in good alignment. Two M4 x 20mm-long screws (with Just in case you haven’t come across one before, this is a glass-encapsulated magnetic reed switch of the type used in this project. Its contacts are normally open and close in a magnetic field. The most sensitive areas of a reed switch are towards each end. October 2007  71 180 locking nuts) have also been tapped into the end cap and sit underneath each half of the tipping bucket. They are used to adjust the amount the bucket will hold before it tips. Brass or stainless steel machine screws (M4) and nuts should be used throughout for corrosion resistance. There are two larger holes opposite one another near the edge of the end cap. The holes should be about 12-15mm in diameter and are the exit points for the water from the tipping bucket when it empties. Make sure the outside of these holes is also covered with fine wire gauze (glued in place) so that insects or other debris can’t get inside the sensor and foul the mechanism. Calibration Fig.6: here’s how the funnels and the tipping bucket assembly all go together. Note that the magnet is aligned with one end of the reed switch (not with its centre). PRIMARY (MAIN) FUNNEL SILICONE SEALANT “GLUE” 140 100mm PVC PIPE CAP WITH 95mm HOLE Once the sensor is assembled, calibration can then be done. Make sure the end cap is placed on a MOUNTING BRACKET level surface before starting. Calibration is done by slowly dripping water into the primary or secondary POP RIVETS funnel and measuring how much it takes before the bucket tips. Do this 10 or 20 times and average the results. Aim for about 5ml each time, using the adjustment screws under each side of the bucket to fine-tune the tipping point. Ensure the same amount of water is needed no matter which direction the bucket is tipping. To convert the amount needed to cause the bucket to tip into millimetres of rain, first measure the diameter of the top of the primary funnel in centimetres then calculate the area of this opening. (To find the area, divide the diameter by two to get the radius, square this value then multiply by p [ie, 3.1416]). The area in square centimetres will be the number of millilitres of rain the funnel will collect for every 10mm of rainfall. You will get a value of about 250ml for a 180mm-diameter funnel, or about 25ml per mm of rainfall. If it takes 5ml to fill and tip the bucket each time, that is 0.2mm of rainfall for each bucket tip. ALL DIMENSIONS IN MILLIMETRES 150mm LENGTH 100mm PVC PIPE # COVERED WITH MESH TO PREVENT SPIDER/INSECT OR LEAF INGRESS 12 # 50 5 We showed the electronics “box” in Pt.1 last month. However, it needs to be housed so it is protected from the elements (and nosey cows, etc!). A “case” can be made from the same 100mm PVC pipe and a friction-fit pipe end, as were used to make the rain gauge. However, in this instance, I elected to use only a top cover, leaving the bottom open to the elements “just in case” something leaked and it decided to fill with water. 5 POP RIVETS 7 MAGNET 3mm DIAM, 2mm LONG SECONDARY FUNNEL 88 15mm WIDE STRIP OF 0.4mm THICK GALVANISED STEEL SHEET 3–4mm CLEARANCE FROM FACE OF MAGNET TO CENTRE OF REED SWITCH 12–15 END OF REED SWITCH ALIGNED TO CENTRE OF MAGNET DIVIDER Electronics housing 72  Silicon Chip SILICONE SEALANT “GLUE” 100mm PVC PIPE FRICTION CAP TIPPING BUCKET 12.5–15 RADIUS REED SWITCH (GLUED TO BRACKET) AXLE 4mm DIAM HOLES DRAIN HOLE# WASHERS 60 BRACKET FOR TIPPING BUCKET DRAIN HOLE# siliconchip.com.au The box is not secured to the pipe; rather it hangs from simple metal bracket mounted on the top pipe cover. The cabling simply drops out of the bottom of the case. All cabling must be secured to star pickets or to some other mounting poles – a cable dangling in the breeze is too much of a temptation for curious livestock (especially cattle!). Mounting the sensors and the controller Most of the hard work is done. The main job left to do is to assemble and mount the bits and pieces. Since this is designed for use in remote locations, I assumed that a quick and simple way to mount the sensors and weatherproof the electronics was needed. A star picket commonly used for fencing was used. These have convenient pre-drilled holes though which brackets made from bolts and steel strips can be mounted. The photos illustrate how to make these up. The mount for the rain gauge is constructed so that it can be tilted on two axes, enabling the sensor to be levelled when installed. Specifically, the base of the sensor, on which the tipping bucket is mounted, should be set so it is level, otherwise accuracy will be degraded. By the way, I haven’t done a check to see how accurate the rain gauge is but commercial units of this type are typically accurate to within a few percent. As indicated above, the utility box containing the electronics is fitted inside a length of PVC sewer pipe fitted with an end-cap. This end-cap is fitted with a metal bracket bent up from a piece of sheet metal. A second bracket is attached to the utility box, so that it can be hung in place – see photos. Initial set up The only job to do is to perform the clock correction if accuracy better than about five seconds a day is needed. First, start the weather station by inserting three AA batteries into the battery clip. The temperature or rain sensors don’t need to be connected. You will need an accurate means to measure 24 hours to within a second or so. A handheld GPS or good quartz wristwatch will do the job. Alternatively, find a time service on the internet. You will have to use one that gives a seconds reading and automatically increments this (for example, try www.timeanddate.com). First, reset the controller using the Reset button. With the case open, press the clock correction switch (S2) momentarily and note the exact time it was pressed. The LED will come on as soon as the switch is closed and stay on for four seconds to indicate that the clock correction process has successfully started. Note that the clock correction switch will be disabled 30 minutes after a reset (assuming the controller has been programmed with a 30-minute logging frequency). At the same time the next day, about 20 seconds before 24 hours has elapsed, the LED will come on. At exactly 24 hours, press the clock correction switch again. The LED will turn off and the correction value will be stored. This value is stored in the PIC in nonvolatile memory, so is retained even if power is removed from the PIC. If you forget to press the switch, the LED will turn off after about 40 seconds but no correction value will be recorded and the controller will simply resume normal operation. Logging weather data Set up the rain and temperature sensors, power up the weather station, and reset it. Make a note of the time and date at which the reset occurred. The first data will be recorded 30 minutes (or one logging frequency) after the reset. Parts List (Louvred Housing) All sheet metal used in 0.4mm thick galvanised steel (0.6mm thick aluminium is preferable for the louvres themselves but is harder to obtain). Sheet metal 1 170 x 170mm (for top cover) 1 150 x 150mm (for top) 5 400 x 25mm (for louvres) 4 110 x 20mm (for corner supports – you should use galvanised steel for strength to make these even if you do make the louvres from aluminium sheet) Other 30 small pop rivets (to fix louvres to corner supports) 3 M4 x 30mm machine screws & nuts 3 M4 x 20mm tapped spacers 1 mounting bar made from aluminium channel (12 x 12mm), approx 150mm long (for mounting the housing) 2 6-8mm long pop rivets (for mounting bar) 1 50 x 8mm bolt, head cut off, with nut and two washers to suit (for mounting bar) Parts List (Rain Gauge) 1 360mm square sheet metal (main funnel and bucket parts, U-shaped bracket) 1 100mm-diameter semicircle 1 150mm length of 100mm-diameter PVC pipe with friction caps 1 magnetic reed switch 1 3mm-diameter x 2mm rare earth magnet Various screws, pop rivets and scraps of metal siliconchip.com.au October 2007  73 Making The Temperature Sensor Housing For accurate readings, the location of the temperature sensor is important. It must be placed so that it is not affected by radiant heat from the Sun or other direct heat sources. It should also not get wet as evaporation would cool a wet sensor – yet there should be free air movement around the sensor to enable it to equilibrate with the current air-temperature. To achieve the right conditions, professional weather stations usually include a louvred housing that is typically mounted a fixed height above ground level (1.25 metres is apparently the international standard). The housing shades the sensor and stops it getting wet while allowing free air flow. If the housing itself gets hot, it can heat air that passes through it and cause an incorrect reading at the sensor. So the housing should be painted white so as to minimise the absorption of radiated heat. It must also be designed to reduce the chance that the housing itself will create localised heating or cooling of the sensor that’s different to the current air-temperature. A louvred housing can be made relatively easily from thin sheet metal. Aluminium sheet about 0.6mm thick is ideal for ease of handling, low thermal mass and weight but may be hard to obtain. If this isn’t available, use 0.4mm galvanised steel sheeting. The housing design consists of a top, a top cover over this to improve resistance to radiant heat from overhead, four vertical corner supports and five louvres made from bent sheet metal which fix directly to the corner supports. The easiest way to assemble the housing is with pop-rivets. A piece of aluminium channel is also pop- It’s not a template but this photo can be used as a cutting and drilling guide for your temperature sensor housing. And here is that first louvre fixed to the four side supports. Once you have achieved this, the rest is easy! 74  Silicon Chip riveted or bolted on to the top cover for mounting the whole assembly. Commence construction by cutting out all the sheet metal parts (see photo). The dimensions for these parts are given in the parts list on the previous page). Don’t bend any of the parts yet. It’s a good idea to drill the holes that will be needed for assembly now since this is easier to do on flat (unbent) sheet). Start with the top and top cover. First, tape them together in accurate alignment and drill three holes (4mm diameter) as shown on the template – this will ensure that the holes in the top cover align with those in the top when you come to screw the top cover on. Four holes for pop-rivets can also be drilled in the top – see photo below left. Pop-rivet holes can also be drilled in the Here are the components for one side of the housing – the largest piece is the top cover, the four pieces below the side guides. A few minutes later and all louvres are fitted, now ready for the top cover to be fixed in place. siliconchip.com.au louvres. Don’t drill any holes in the corner supports though. Now bend the top and top cover into shape as well as bending the corner supports and louvres as shown in the photo below. Mark lines at 20mm intervals along the corner supports (these will be used to align the louvres). The last line marked will be only 10mm from the end of the corner support and is where the first (bottom-most) louvre will be mounted. Drill and pop-rivet the bottom louvre to the corner supports so its top edge aligns with the 10mm line (see photo). The easiest way to drill the corner supports is to clamp a short length of scrap timber (19 x 42mm cross-section) to the work bench so it protrudes from the bench. Hold the corner support with a large bulldog clip while the louvre is placed over it and the hole is drilled (see photo). The next louvre up can now be popriveted into place, aligning its top edge with the next mark 20mm along the corner support. Fix the remaining louvres into place. When all the louvres are fixed, the top can be pop-riveted on. The top should slide nicely over the upper ends of the corner supports if you have measured, cut and bent accurately. The housing is now almost finished. It’s now time to make the mounting bar, which is made from a piece of aluminium channel. I used 12mm channel since this makes it easier to fit a bolt to the other end (an 8mm diameter bolt will fit easily in the channel). The easiest way to hold the bolt in place is to put it in a vice and crush the top edges of the channel over the bolt shaft (see photo). Two part epoxy will ensure it stays in place. Next, rivet the mounting bar to the top cover after first cutting away a portion of the channel so the mounting bar will sit flat on the top cover (the prototype louvred Drilling holes in small, thin bits of metal is not only tricky, it can be dangerous if you don’t properly clamp and support the work. The mounting bar is made from a piece of U-shaped (channel) aluminium with an 8mm bolt crushed in position then secured with 2-part epoxy. This is then secured to the (inner) top cover with pop rivets. The outer top cover, which helps prevent the housing from heating up and giving false readings, is mounted 12mm above the inner top cover by means of 12mm threaded Nylon standoffs so there is no heat conduction from one part to the other. siliconchip.com.au housing shown in the photos in part 1 had the mounting bar fixed under the top cover but this is clumsy so don’t try it). Now fix the top cover in place with machine screws and spacers. Finally the housing should be painted white to minimise absorption of radiant heat. A can of fast drying spray paint is the easiest way to do this. Remember that several light coats are better than one heavy coat. The temperature sensor itself is mounted on short lengths of wire that are suspended from the corner supports of the louvred housing (simply bend them around the top of the corner supports between the top and the first louvre). The sensor should be mounted in about the centre of the louvred housing and can be held in place with a twist tie or short length of wire. Make sure it can’t drop out when left unattended for a lengthy period. Here we are preparing the first louvre, ready for securing to the corner support with a pop rivet. An upside-down finished view of the housing. The four stiff wires inside the housing support the temperature sensor itself. October 2007  75 Left: the controller box inside its PVC pipe case. It hangs free on brackets fixed as shown above. The pipe mounting bolt is flexible to allow the pipe to be moved at will. The rain and temperature sensors can be plugged in at any time, although, obviously, nothing will be recorded until they are. Even though the temperature sensor is a programmable digital device, the software in the weather station enables it to be plugged in and unplugged even when the weather station is operating. If the rain sensor is left unplugged or is faulty, zero values will be recorded for temperature. There is nothing else to do, except come back in a month – or a year – and download the data. Downloading the data Downloading is also straight forward. Instructions are printed on the front label of the weather station. Freeware data-logging software is used to receive the data (see below) on your computer or laptop. This software will write the data to any file you nominate. Data is transmitted in text form as comma-separated values that can easily be imported into spreadsheets. A “header” is transmitted first, listing the total number of data points recorded since the last reset. The weather station does not record the time directly. You will need to calculate the time of each data record based on the time the weather station was reset (or powered up) and the logging frequency. Don’t forget that the first data set isn’t recorded until one logging period after the weather station is started. Some basic error detection is also built into the software. When each data record is written, the value 255 (decimal) is also written to all four bytes of the next record. During a data dump, if the weather station software encounters these values, it will transmit the following text string “BREAK” then “NULL” on the next line. Since data only up to the last valid record are normally transmitted, such a BREAK will never be seen during a normal dump operation. It will occur if there was a power down and power up, or an internal reboot of the weather station while it was operating. A reboot will occur if the software detects some abnormal conditions during operation, such as a suspicious looking interrupt. It can also occur if the internal record counter becomes corrupted, although this in unlikely. An entire dump of the weather station’s data can also be performed. This will show a BREAK where data finished recording following the most recent reset. BREAKs may also be seen further into the data record from some earlier resets (only those that weren’t overwritten since the last reset). Performing a full data dump of the entire EEPROM contents is easy. Simply do a reset on the weather station just before doing a data dump. A sample spreadsheet is attached showing weather data recorded from 17 January 2007 to 4 March 2007, in my backyard in Canberra. Some plots of the data are also included, including a very heavy rain event where about 50mm fell in 30 minutes. The rain gauge is able to handle both heavy and light rainfall events, although I would expect problems with extremely heavy rain or hail. If you need to change the logging frequency . . . Full-size front panel artwork for the Data Logging Weather Station. It can also be downloaded from www.siliconchip.com.au 76  Silicon Chip The firmware is nominally written for a 30-minute logging frequency, meaning rain and temperature will be recorded every 30 minutes. The logging frequency can be changed by modifying the firmware, recompiling this and reprogramming the resultant hex file into the PIC. The software for the PIC siliconchip.com.au N A T A H G W N I Z A ! M R A OFFE Agilent Technologies Buy yourself one of the world’s most versatile digital multimeters – the incredible Agilent U1252A True RMS – between now and December 31 2007, and you’ll also enjoy a FREE 12-month subscription to SILICON CHIP – Australia’s world-class electronics magazine!* SEE THE REVIEW IN APRIL 2 SILICON CH0I07 P! * offer valid only in Australia. If you are already a subscriber this can be made a gift subscription That’s right: a bonus valued at $89.50, yours free of charge when you buy the Agilent U1252A DMM! It’s so much more than just a DMM – look at these specs: FEATURES: * True RMS measurements * 20 MHz frequency counter * Up to 0.025% basic DCV accuracy * Programmable square wave generator * Frequency, temperature and capacitance measurements * 50,000 counts resolution on both displays * IR to USB connectivity (optional U1173A connectivity cable sold separately) * -20°C to + 55°C operating temperature * Category III 1000V safety compliance * 100 manual data storage points and unlimited data logging points when connected to a PC Resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50000 counts Basic DCV accuracy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0.025% Displays (50,000 count) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Dual True RMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . AC + DC Capacitance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10nF to 100µF Resistance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500MΩ Current . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10A Frequency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0.5Hz to 500kHz Math Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Frequency Counter . . . . . . . . . . . . . . . . . . . . . . . . 0.5Hz to 20MHz Programmable square wave generator . . . . . . . . . 0.5Hz to 4800Hz Data logger . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 points (manual) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 points (interval) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Unlimited (PC) Operating temperature . . . . . . . . . . . . . . . . . . . . . -20 C to +55 C Safety compliance . . . . . . . . . . . . . . . . . . . . . . . . . . Cat III 1000V Battery . . . . . . . . . . . . . . . . NiMH Rechargeable with power adapter I/O interface . . . . . . . . . . . . . . . . . . . . . . . . . . IR to USB(optional) Dimensions . . . . . . . . . . . . . . . . . . . . . . . . 203.5 x 94.4 x 59.0mm Approximate weight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527g Here’s how to take advantage of this amazing offer! WA, NT, SA: ACT, NSW, QLD, TAS & VIC: CALL! FAX:# BY PHONE:* TRIOBY(02)SMARTCAL PTY LTD OR MEASUREMENT INNOVATION PTY LTD 9939 2648 (02) 9939 3295 FAX! 24 Hours 7 Days 9-4 Mon-Fri PHONE: 1300 853 407 FAX: 1300 853 409 EMAIL! <at> sales<at>triosmartcal.com.au siliconchip.com.au www.triosmartcal.com.au ONLINE! PHONE: 08 9437 2550 FAX: 08 9437 2551 info<at>measurement.net.au O 2007  77 www.measurement.net.au ctober An Excel spreadsheet from the author’s installation outside Canberra. Because the data from the Weather Station is virtually “universal” in format, it can be used in a wide range of applications. contains the following defined constants near the start: LOG_FREQ EQU D’6’ ; Frequency (minutes) with which data is logged HRS24 EQU D’240’ ; = (No of minutes in 24 hours)/LOG_FREQ Changing these will change the logging frequency. The above example shows a logging frequency of 6 minutes. Setting LOG_FREQ to 30 (decimal) and HRS24 to 48 (decimal) will give a 30 minute logging frequency and a normal 24-hour clock. Logging frequencies down to one minute are possible but the HRS24 value can only be a maximum of 255. The only thing HRS24 affects is the frequency with which clock error correction occurs (including the initial setting of the clock error). So if LOG_FREQ is set to 1 and HRS24 set to 255, the PIC will apply the clock correction value every LOG_FREQ x HRS24 minutes (ie, 1 x 255 minutes). Similarly, performing an initial 78  Silicon Chip clock calibration will complete 255 minutes after it is started, not 24 hours later. Obtaining parts & software The data logging software is available from www.eltima.com/products. Download the freeware “RS232 data logger”. The 3 x 2mm rare earth magnet is available from Oatley Electronics in Sydney (www.oatleyelectronics. com) for 25 cents each plus $7 pack and post). Similar 3 x 1mm magnets are also available from www.frenergy.com.au (12 cents each; $5.50 pack and post) – you will need two of these stacked to get a magnet with the same power as a 3 x 2mm magnet. I contacted both of these suppliers and neither can offer any further discount on shipping. This is one case where it costs far more to pack and post than the (tiny) items are worth. If you wish to avoid the high pack and post charges, I’m willing to provide them for a nominal shipping charge. Check my web page for details (www. evans-pure.net/weather.htm). Alternatively, you may be able to scrounge a suitable magnet or two from, say, an old hard disk drive. Most reed switches are quite sensitive and will work with most magnets. The advantage of the “rare earth” magnets used here is their incredible size-topower ratio. Commercial rain sensor For those who don’t want to make their own rain sensor, a commercially available sensor is available for about $200 that uses a similar mechanism to the sensor described here. It is made by Peet Bros in the US and is sold in Australia by Sphere Innovative Technologies (www.sphere.net. au/site/products.php?cat=wm_acc). You will need to order the “Rain gauge – wired”. I haven’t tested it myself but have investigated its specifications and am confident it will work. SC siliconchip.com.au