Silicon ChipPIC-Based Water-Tank Level Meter; Pt.2 - December 2007 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Electric cars are viable right now
  4. Project: Signature Series Kit Loudspeaker System by Russell Storey & Leo Simpson
  5. Feature: Restoring A Vintage TV Set by Timothy Stuart
  6. Project: Infrared Audio Headphone Link For TV by Jim Rowe
  7. Review: Rohde & Schwarz FS300 & SM300 Test Gear by Mauro Grassi
  8. Project: An Enhanced 45-Second Voice Recorder Module by Jim Rowe
  9. Project: PIC-Based Water-Tank Level Meter; Pt.2 by John Clarke
  10. Project: Playback Adaptor For CD-ROM Drives; Pt.2 by Mauro Grassi
  11. Vintage Radio: Kriesler 11-59 5-Valve Dual-Wave Mantel Receiver by Rodney Champness
  12. Book Store
  13. Advertising Index
  14. Outer Back Cover

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

You can view 32 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 "Infrared Audio Headphone Link For TV":
  • Infrared Audio Headphone Link transmitter PCB pattern (PDF download) [01112071] (Free)
  • Infrared Audio Headphone Link receiver PCB pattern (PDF download) [01112072] (Free)
  • Infrared Audio Headphone Link panel artwork (PDF download) (Free)
Items relevant to "PIC-Based Water-Tank Level Meter; Pt.2":
  • PIC16F88-I/P programmed for the Water Tank Level Meter telemetry base station (Programmed Microcontroller, AUD $15.00)
  • PIC16F88-I/P programmed for the Water Tank Level Meter main/transmitter unit (Programmed Microcontroller, AUD $15.00)
  • PIC16F88 firmware and source code for the Water Tank Level Meter receiver [water tank level receiver.HEX] (Software, Free)
  • PIC16F88 firmware and source code for the Water Tank Level Meter transmitter (Software, Free)
  • Water Tank Level Meter base station PCB patterns (PDF download) [04101081/2] (Free)
  • Water Tank Level Meter main PCB pattern (PDF download) [04111071] (Free)
  • Water Tank Level Meter base station front panel artwork (PDF download) (Free)
  • Water Tank Level Meter main sensor/transmitter unit front panel artwork (PDF download) (Free)
Articles in this series:
  • PIC-Based Water-Tank Level Meter; Pt.1 (November 2007)
  • PIC-Based Water-Tank Level Meter; Pt.1 (November 2007)
  • PIC-Based Water-Tank Level Meter; Pt.2 (December 2007)
  • PIC-Based Water-Tank Level Meter; Pt.2 (December 2007)
  • Water Tank Level Meter, Pt.3: The Base Station (January 2008)
  • Water Tank Level Meter, Pt.3: The Base Station (January 2008)
Items relevant to "Playback Adaptor For CD-ROM Drives; Pt.2":
  • ATmega8515 programmed for the CDROM Playback Adaptor (Programmed Microcontroller, AUD $15.00)
  • ATmega8515 firmware and source code for the CDROM Playback Adaptor (Software, Free)
  • CDROM Playback Adaptor PCB pattern (PDF download) [07112071] (Free)
Articles in this series:
  • Playback Adaptor For CD-ROM Drives (November 2007)
  • Playback Adaptor For CD-ROM Drives (November 2007)
  • Playback Adaptor For CD-ROM Drives; Pt.2 (December 2007)
  • Playback Adaptor For CD-ROM Drives; Pt.2 (December 2007)

Purchase a printed copy of this issue for $10.00.

PIC-Based Water Tank Level Meter Pt.2: By JOHN CLARKE Building the two versions plus calibration & installation Last month, we published the circuit of the Water Tank Level Meter and described how it worked. This month, we show you how to build both the basic and telemetry versions and detail the installation. Both the basic and telemetry versions of the Water Tank Level Meter use the same PC board (code 04111071, 104 x 79mm). This is housed in a 115 x 90 x 55mm sealed polycarbonate enclosure with a clear lid. Basically, the telemetry version uses a handful of extra parts, among them 78  Silicon Chip a 433MHz transmitter module and two BCD rotary switches. It also uses parts that are salvaged from a solar garden light. These include the solar cell, a single AA NiMH or NiCd cell and the Schottky diode which is used for diode D2. This is by far the cheapest way to obtain the solar cell and you also will have some spare parts such as a white LED driver, a white LED and garden light hardware components. Typically single solar garden lights cost around $10. Don’t be tempted to get the multi-pack solar garden lights that sell for around $5 or less per light. These generally use lower quality solar cells. Before removing the parts, it’s a good idea to first charge the NiMH or NiCd cell by placing the garden light in the sun for a few hours. Don’t forget to remove the insulation tab from the battery before doing this, otherwise it will never charge. siliconchip.com.au Fig.10 (below): this diagram shows the board layout if you use an RGB LED with a different pin-out to the Jaycar ZD-0012. Note the changes to two of the 1kW resistors. Table 2: Capacitor Codes Fig.9: follow this parts layout diagram to build the basic version of the Water Level Meter. The pressure sensor is shown mounted on the board here but we now recommend installing it in a separate box that either sits on the bottom of the tank or is attached to the side of the tank. Value mF Code IEC Code EIA Code 100nF 0.1mF 100n 104 10nF .01mF   10n 103 Table 1: Resistor Colour Codes o o o o o o o o No. 1 3 2 1 1 7 1 Value 100kW 22kW 10kW 2.2kW 1.8kW 1kW 330W Once that’s done, you can remove the solar cell, the rechargeable AA cell and the 1N5819 Schottky diode (or equivalent). Board assembly Begin construction by checking the PC board for any defects such as shorted tracks or breaks in the tracks. It’s rare to find such defects these days but it’s always a good idea to make sure as it’s usually easier to spot any defects before the parts are installed. Check also that the hole sizes are correct. The four corner mounting holes should all be 3mm in diameter, as should the mounting holes for Sensiliconchip.com.au 4-Band Code (1%) brown black yellow brown red red orange brown brown black orange brown red red red brown brown grey red brown brown black red brown orange orange brown brown sor 1 and holes for the cable ties that are used to secure inductor L1. That done, check that the PC board is cut and shaped to size so that it fits into the box. Fig.9 shows the parts layout diagram for the basic version, while Fig.11 shows the PC layout for the telemetry version. It’s just a matter of following the diagram for the version you are building. Note that if you build the basic version, this can later be upgraded to the telemetry version simply by adding the extra parts. The software for the PIC micro is the same for both versions. Begin the board assembly by install- 5-Band Code (1%) brown black black orange brown red red black red brown brown black black red brown red red black brown brown brown grey black brown brown brown black black brown brown orange orange black black brown ing the six wire links, then install the resistors. Table 1 shows the resistor colour codes but you should also use a digital multimeter to check each resistor because the colours can sometimes be difficult to decipher. Note that if you are using the Jaycar RGB LED, then the 1kW resistors immediately to the left of the cell holder are installed as shown in Figs.9 & 11. However, if you are using a different RGB LED that has the alternative pinout, the resistors must be connected as shown in Fig.10. Next, install PC stakes at test points TP1-TP6, at either end of the cell holder position and at the termination December 2007  79 Fig.11: this is the parts layout for the telemetry version of the Water Level Meter. It basically adds the 433MHz transmitter module, two BCD switches, diode D2, jumper shunt LK1, a 1kW resistor and two 100nF capacitors This is the fully-assembled PC board. Note how the pressure sensor is mounted and the method used to attach the 170mm-long antenna. points for inductor L1. That done, install a couple of PC stakes at top right to terminate the leads for switch S1 (basic version only). Alternatively, fit a 2-way pin header to these PC stakes if you are building the telemetry version (see Fig.11). If you are building the telemetry ver80  Silicon Chip sion, install an additional PC stake to terminate the antenna lead – this goes in immediately to the bottom left of the 433MHz transmitter module. Follow these parts with diode D1 (and D2 for the telemetry version), then install the ICs. IC1 & IC2 can be directly soldered to the PC board, while IC3 (the PIC micro) should be installed using a socket. Take care with the orientation of each IC and the socket. Don’t plug IC3 onto its socket yet – that step comes later, after the power supply has been checked. A 4-way single-in-line (SIL) socket is used for the pressure sensor connection. This can be made by cutting off one side of an 8-pin IC socket to obtain the 4-way socket strip. The capacitors are next on the list. Note that the electrolytic types must be oriented as shown. Note also that there are two types of 100nF capacitors: the rectangular MKT types and the ceramic disc-shaped types. Be sure to install the 100nF ceramic capacitor(s) in the positions shown. Follow these with transistor Q1, the LM335Z temperature sensor (Sensor 2) and trimpots VR1-VR4. Note that it’s a good idea to orient the multi-turn trimpots as shown (ie, screw adjustments to the right) so that the sensor signal from IC2c increases as the adjustments (wipers) are turned clockwise. Be sure to use the correct value trimpot in each position. Trimpots are usually marked with a code instead of the actual value. This means that siliconchip.com.au ➊ ➋ ➏ ➌ ➍ 1. Tri-colour LED 2. 433MHz transmitter 3. Encode/update switch 4. Tank select switch ➎ 5. Pressure sensor 6. NiMH or NiCd cell The in-tank tube from the pressure sensor emerges through a cable gland in the side of the case, while the solar cell cable runs through a second cable gland in the bottom of the case. (Note: the author no longer recommends mounting the pressure sensor on the PC board – see panel). the 50kW trimpot (VR1) may have a “503” marking, the 10kW trimpots (VR3 & VR4) may be marked as “103” and the 1kW trimpot may be marked as “102”. Installing Sensor 1 Sensor 1 can either be installed directly on the PC board (no longer recommended – see footnote) or it can be mounted in a separate box and submersed in the water tank (see Fig.14). In the latter case, it’s connected back to the PC board via a 4-way cable. If you elect to install it on the PC board, you first have to bend the leads down through 90° so that they can be inserted into the 4-way SIL socket strip. However, take care to orient the sensor correctly. It must be installed with its notched pin to the right and with the type markings for the sensor siliconchip.com.au (MPX2010DP) visible on top. Once the sensor is in position, it can be secured in place using two M3 x 15 screws and nuts. The AA cell holder can be installed now. It’s secured to the PC board using two No.4 self-tapping screws. That done, wire the cell holder’s leads to the adjacent PC stakes. Telemetry version parts If you are building the telemetry version, the next step is to install the BCD switches. Note that these have an orientation dot that must be positioned as shown. In addition, be sure to install the 0-9 position switch in the BCD1 position and the 0-F switch in the BCD2 position. Once these parts are in, install the 433MHz transmitter module (it goes in just below the RGB LED). Make sure this part is correctly oriented – the pin designations are labelled on both the transmitter PC board and the main board, so be sure to match them up. The antenna is made using a 170mm length of hookup wire which is soldered to the antenna PC stake (immediately to the left of the transmitter module). As shown, it’s then fed through three holes in the PC board to hold it in position. Alternatively, for long-range transmissions over 50m, the antenna should be made using a 170mm-long length of 1mm enamelled copper wire. This wire is stripped of insulation at one end and soldered to the antenna PC stake. It then protrudes through a small hole in the side of the box. Finishing up Inductor L1 is made by winding 27 December 2007  81 Here’s another view of the assembled PC board. Don’t get the BCD switches mixed up and be sure to orient them correctly. turns of 0.5mm enamelled copper wire onto an iron-powdered toroid core. Wind the turns on evenly around the toroid, then scrape away the enamel at the wire ends using a sharp hobby knife and tin them with solder. L1 should now be secured in place using two cable ties, as shown in the layout diagrams. Once it’s in position, solder its leads to the adjacent PC stakes. Next, for the basic version, connect switch S1 to the 2-pin header. Alternatively, for the telemetry version, install a jumper shunt over the 2-pin header and connect switch S1 between TP1 and TP3. Testing To test the unit, first insert a charged NiMH (or Nicad) or alkaline cell into the holder and connect a multimeter between test points TP1 and TP2. That done, set the multimeter to read volts and press switch S1 if you built the basic version (pressing S1 is not necessary for the telemetry version). Now adjust trimpot VR1 for a reading of 5.0V. When that’s correct, check that 5V is also present between pins 14 & 5 of IC3’s socket. You now need follow this step-bystep set-up procedure: (1) Switch off and insert IC3 into socket (make sure it’s oriented correctly). 82  Silicon Chip (2) Connect a multimeter between test points TP2 & TP4. (3) If you have the basic version, connect a link between TP1 and TP3. (3) Switch on, press S1 and adjust trimpot VR3 for a reading of 1.0V on the multimeter. (4) Connect the multimeter between TP2 & TP5 and adjust trimpot VR4 for a reading of 2.98V when the ambient temperature is 25°C degrees. You can also make this adjustment at any ambient temperature by setting VR4 so the reading is 2.73V plus the temperature divided by 100. For example, if the ambient temperature is 15°C, the voltage should be adjusted to 2.73V plus 0.15V or 2.88V. Table 3 provides all the values, to save you doing the calculations yourself. (5) Remove the cell and disconnect the short between TP1 & TP3 for the basic version. (6) Install IC3 into its socket, making sure it is oriented correctly, then reinsert the cell. (7) Check that the RGB LED now lights for two seconds when switch S1 is pressed with either version. If this does not happen, check that the RGB LED is oriented correctly. Final assembly If you buy a kit for this unit, then the box will be supplied with all the holes drilled. If not, you will have to drill the holes yourself. Fig.12 shows the drilling details. Note that some of the internal ribbing will have to be removed where the nut for the pressure sensor cable gland is located, so it can sit flat against the side of the box. You can use a sharp chisel or a file to remove these. For the telemetry version, an extra cable gland is required for the solar cell lead and this can be mounted on the end of the box. A small hole must also be drilled in the box to allow the air pressure inside to vary in line with the atmospheric pressure (this air pressure is applied to the P2 port of the pressure sensor). The exact hole position will depend on your particular installation. Basically, it must be located on the lowest face of the box, so that rainwater cannot enter it. A hole with a diameter of just 1.5mm is required. Finally, a diffuser should be attached to the inside top of the lid above the RGB LED. This makes the colours more obvious by blending the individual red, green and blue spots of colour from the RGB LED. A suitable diffuser can be made using a translucent strip cut from a plastic A4 folder. This can be affixed inside the lid using clear silicone sealant. Alternatively, you can diffuse the inside area of the lid just above the LED by using some fine-grade sandpaper to roughen up the transparent surface, thereby making it translucent. Installation The Water Tank Level Meter can either be attached directly to the tank or mounted on a nearby wall. Which ever method you choose, it must be mounted so that it is always out of the direct sun. This is necessary to prevent the temperature sensor reading excessively high and producing incorrect temperature compensation. The positioning also depends on your tank and whether you have built the basic or the telemetry version. For the telemetry version, the unit also needs be positioned so that the base station can receive the transmitted signal. In this case, we suggest you build the Base Station to be described next month before deciding on a mounting position for the meter. Note that the box has four mounting points that are effectively outside the box’s sealed section but which are siliconchip.com.au Fig.12: follow this diagram to mark out and drill the holes in the plastic case. Alternatively, you can photostat the diagram and use the various sections as drilling templates. The holes are best made by first using a small pilot drill and then carefully enlarging them to size using a tapered reamer. covered by the lid. It’s simply a matter of removing the lid to access these mounting holes. By the way, do not drill holes anywhere in a concrete tank, as this can cause cracks that can leak. By contrast, plastic and steel tanks can have mounting holes drilled in the top cover but not the sides. Plastic tanks also generally have lifting attachment points and you can either drill into these sections or use the existing lifting hole for mounting. If you want to mount the box on the side of the tank, the best approach is to first secure two 19 x 19 x 120mm hardwood batons to the tank using siliconchip.com.au builders’ adhesive or silicone sealant. These should be spaced to match the box’s mounting holes. The box can then be attached using short wood screws into the timber (make sure that these screws are short, so that they cannot possibly go all the way through the timber and into the tank). Solar cell mounting In most cases, you can use the stainless steel surround supplied with the solar-powered garden light as its mounting bracket. A convenient mounting location is on top of the water tank itself, provided it receives adequate sunlight. Alternatively, you can mount the solar cell on the house (or shed) roof, or even install it on the ground using the garden light fittings. Note that it should face north towards the midday sun, to ensure best performance. In practice, this means tilting the cell away from the horizontal (in a northerly direction) by about your latitude plus 15°. The tilt angles for major Australian and NZ cities are as follows: 27° for Darwin, 42° for Brisbane, 46° for Perth, 49° for Sydney and Adelaide, 51° for Auckland, 52° for Melbourne, 56° for Wellington and 57° for Hobart. The lead between the solar cell and December 2007  83 The solar cell was salvaged from a defunct garden light. It can be left in its original aluminium housing to facilitate mounting. the Water Level Meter should be run using single-core microphone cable. In most cases, you will have to drill a hole in the stainless steel housing to feed this lead through to the cell. A rubber grommet should then be fitted to this entry hole, to prevent damage to the cable. Use the core wire for the positive connection to the cell and the shield for the negative connection but note that the connections to the solar cell are easily damaged, so take care here. In practice, it’s best to use neutral-cure silicone sealant to first secure the leads that are already attached to the cell. The microphone cable is then soldered directly to these leads and the connections anchored and waterproofed using additional silicone. Finally, the microphone cable itself can be secured using silicone, especially around the entry grommet. A plastic cable tie can also be fitted to the cable, to prevent it from being pulled back through the grommet. At the other end, the microphone cable passes through the cable gland in the box and its leads soldered to the solar cell PC stakes. Installing the tubing In most cases, the plastic tubing that goes into the tank can be inserted through a small hole in the inlet screen – especially if it isn’t exposed to the sun. If it is exposed, we recommend shielding the tubing with some white flexible conduit to prevent excessive solar heating. Alternatively, with a steel or plastic 84  Silicon Chip The connections to the solar cell are coated with neutralcure silicone sealant to make them waterproof and to anchor the leads in position (see text). tank, the tube can be inserted through a hole drilled in the top of the tank, in a position that’s shaded from the sun. Before installation, you will first have to remove the insect screen or manhole to gain access to the inside of the tank. If the tank isn’t full, measure the distance from the full position down to the current level and record this for later use. To support the pressure sensor tubing, a length of 25mm PVC tubing wedged between the base and the roof of the tank can be used – see Fig.13. The top of this pipe can later be secured to the roof of the tank using silicone sealant or builders’ adhesive (ie, after calibration). As shown, the 3mm sensor tubing is attached to the 25mm PVC tubing using cable ties. Alternatively, a weight could be attached to the end of the tubing to hold it down but don’t use anything that will contaminate the water, such as lead. This weight needs to be about 150g per metre of tubing in the water. A 2.54cm (or larger) galvanised steel water-pipe end-stop is recommended. The best way to attach this weight is to first drill a 6mm hole through the top, so that the tube can protrude a little way inside the end stop. This hole should be large enough to let water pass around the outside of the tube. The tube is then secured to the weight using cable ties on either side of the hole. Whichever method you use, the assembly should be adjusted so that when it is later placed inside the tank, the end of the 3mm tube is level with the bottom of the tank’s outlet pipe. Note that if the access hole in the top of the tank is some distance away from the screened inlet, it may be necessary to pull the 3mm tubing through using a draw wire. Similarly, if you ever need to remove the assembly, then you may have to retrieve it using a pole with a hook. As stated previously, it’s important to route the tubing between the tank and the Level Meter so that it is not exposed to direct sunlight. If necessary, it can be protected from the sun by covering it in flexible PVC tubing. At the Level Meter, the tubing runs through the cable gland in the side of the box and fits over the Port 1 nozzle of the pressure sensor. In most cases, you will have to gently heat the end the tube using a hot-air gun so that it will slide over the nozzle. This should form an airtight connection but if you have any doubts, apply some silicone sealant around the connection behind the nozzle flange. Clamping the tube with a cable tie can also help prevent air leaks. The rest of the tubing and its weight can now be lowered into the water tank until it sits in the correct position. That done, wait for at least an hour for the air temperature inside the tube to stabilise. This is necessary because the cooling effect of the tank water can affect calibration. At the end of this 1-hour period, remove the tube from the tank, shake it so that all water runs out, then reinstall it in the tank. Complete the installation by replacing the inlet screen siliconchip.com.au Table 3: TP5 Voltage vs Temperature Fig.13: the 3mm PVC tubing that runs to the pressure sensor is installed as shown here. The 25mm PVC pipe is used to keep this tubing vertical in the tank. Note that the end of the 3mm tube should sit level with the base of the tank’s outlet. (Note: this method is no longer preferred by the author). filter or manhole cover on the tank. Note that it is always necessary to lower the tube assembly into the tank after connecting it to the pressure sensor. If this not done, the water will not pressurise the air inside the tube. Calibration Basically, it’s simply a matter of calibrating the Level Meter to the current water level in the tank. If the tank is full, then the meter is calibrated to read 100%. Similarly, if it’s half-full, the meter is set to read 50%. Note, however, that to ensure accuracy, it’s best to calibrate the meter when the tank is at least 25% full. The step-by-step calibration procedure is as follows: (1) Determine the water height that represents 100% full. This is done by measuring the vertical distance between the outlet hole at the bottom of the tank and the overflow pipe at the top. If there’s no overflow pipe, then measure to the bottom of the inlet strainer. (2) Measure the actual depth of the water (ie, the distance between the top of the water and the outlet pipe). You can easily calculate this depth by measuring the distance to the top of the water and then subtracting this from the full water height. (3) Calculate the water level in the tank as a ratio of full capacity. This simply involves dividing the actual water height by the full water height. siliconchip.com.au (4) Use this ratio to calculate the calibration voltage. This is done by first multiplying the ratio value by 2 (this converts it to the 2V range that the meter uses for water level measurement) and then adding 1 (since the calibration voltage is 1V when the tank is empty). For example, if the tank is half full, the full-height ratio is 0.5. This value is then doubled (0.5 x 2 = 1) and then 1 is added to give a result of 2V. Similarly, if the tank is two thirds full, the result is 0.66 x 2 + 1 = 2.32V. And if the tank is full, the result 1 x 2 + 1 = 3V. (5) Calibrate the meter by adjusting trimpot VR2 so set the voltage at TP4 to the calculated calibration value. Note that switch S1 will have to be pressed while you do this. Note also that for the basic version, power will only be applied to the sensor while the tri-colour LED is alight. This means that if the LED goes out and you need more time to adjust VR2, the switch will have to be pressed again. (6) If practical, remove the tubing from the tank again and shake the water out. Adjust trimpot VR3 (offset) for a reading of 1V between TP4 and TP2. (7) Reinstall the tube assembly in the tank and readjust VR2 to give the calibration voltage at TP4 (ie, between TP4 & TP2). Calibration temperature The next step involves setting the Temperature (°C) TP5 Voltage 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 2.83 2.84 2.85 2.86 2.87 2.88 2.89 2.90 2.91 2.92 2.93 2.94 2.95 2.96 2.97 2.98 2.99 3.00 3.01 3.02 3.03 3.04 3.05 3.06 3.07 3.08 3.09 3.10 3.11 3.12 3.13 current calibration temperature, so that the readings can be corrected for any subsequent temperature changes. Note, however, that if you intend mounting the pressure sensor inside the tank, this procedure is not required. Setting the calibration temperature is easy – simply connect a short jumper lead between test points TP2 and TP6. For the telemetry version, the RGB LED should immediately flash green three times. If it doesn’t, try removing the jumper at LK1, then wait a few seconds and reconnect the jumper again. For the basic version, S1 must be pressed for the LED to flash when the jumper is connected. Note that if the tank ever runs dry, then the air trapped in the tube when the water subsequently rises again may be at a different temperature to that set during the calibration. As a result, the calibration may be slightly in error. Generally, this will not cause much continued on page 88 December 2007  85 Building The In-Tank Pressure Sensor Fig.15: here’s how the in-tank pressure sensor is installed and connected to the Water Level Meter. The end of the tube connected to port P1 should sit level with the bottom of the tank’s outlet pipe. Fig.14: follow this diagram to build the in-tank pressure sensor. Make sure that all electrical connections are sealed with epoxy resin and that the box is filled with silicone sealant, as described in the text. I NSTEAD OF mounting the pressure sensor on the PC board, the author now recommends that it be mounted in a separate small box which is then placed at the bottom of the tank. The sensor’s leads are then connected back to the PC board via a 4-wire telephone cable fitted with a 4-way header plug. The big advantage of this scheme is that the sensor now directly measures the water pressure. This eliminates the problems associated with air-pressure variations within the connecting tube due to temperature. In practice, a short air-tube is fitted to prevent direct water contact to the sensor’s element but this has little effect on the readings. That’s because this tube is very short (just 40mm long) and because of the more stable temperatures inside the water tank. Fig.14 shows the assembly details for the “bottom of the tank” sensor. As shown, the sensor is mounted on two M3 x 9mm tapped Nylon spacers and has a “snorkel” attached to its P2 port which vents to the atmosphere. The short tube attached to the P1 port 86  Silicon Chip just exits from the bottom of the box. As stated, the air inside this tube isolates the water from the sensor. This air will remain in the tube unless the assembly is inverted in the water tank. The snorkel tube has to be long enough to reach beyond the top of the tank. It can exit either via a hole in the insect screen or the tank’s lid and must be positioned to keep out both rainwater and any run-off from the tank itself. In practice, this means that the tube must be bent so that the end faces downwards after it exits from the tank – see Fig.15. This can be done by gluing the tube down the side of the tank (eg, using silicone). Make sure that the radius of the bend is large enough to prevent the tube from kinking. When installing the wiring, be sure to make a note of the wire colour used for each sensor connection. This will make it easy when it comes to making the connections to the 4-way pin header that plugs into the sensor’s socket on the Water Level Meter’s PC board. By the way, the pressure sensor in Fig.14 is depicted from the rear whereas Figs.9 & 11 show the sensor from the front. As a result, the pin designations run in different directions. Be sure to match the pins correctly. Fortunately, if you do get the connections to the sensor reversed, it is unlikely to be damaged. That’s because the sensor comprises piezo resistive elements that act just like resistors. However, it will not operate unless it is connected correctly. Note that the 4-way header that plugs into the PC board will not fit through the cable gland. This means that the lead must be passed through the gland first, before making the final connection to the 4-way header. The next step is to check that the unit is operating correctly by blowing gently into the short tube (ie, the one going to port P1). The RGB LED should immediately light up to a colour higher than red (depending on the pressure) when the LED display is activated (eg, by pressing switch S1). If it doesn’t, check the wiring connections and check that the sensor port connections are correct. If it works OK, the connections are ready to be sealed. This involves coating all of siliconchip.com.au Above: this view of the in-tank sensor assembly shows the inside the box before the epoxy resin and silicone was applied to waterproof the connections. Note that the pressure sensor is mounted upside down here compared to its orientation on the PC board (see Figs.9 & 11). The view at right shows the completed unit with the weight attached so that it sinks to the bottom of the tank. the exposed wire and lead connections to the sensor with epoxy resin and then filling the box with neutral-cure silicone sealant. Note that the epoxy resin used must be suitable for use in wet conditions and must adhere to both PVC and thermosetting plastics; eg, J-B Weld (part No.8270) and Bostik Titan Bond Plus. It should be mixed according to the instructions and applied to totally cover the attachment points where each sensor lead enters the sensor body. In addition, you should apply resin around the central seal between the two halves of the sensor. Note that you will need to temporarily remove the sensor from the box in order to access the whole underside section. Next, use epoxy resin to cover the whole length of the lead connections up to where they enter the outer sheath and around the end of the sheath itself. You should also lightly coat the gland in the box where the cable exits, so that the cable will be affixed in position. That done, remount the sensor and clamp the 4-way cable in place on its gland until the resin cures. Once it has cured, check the coating for any gaps and re-coat if necessary. Filling the case with silicone The inside of the box must now be filled siliconchip.com.au with neutral-cure silicone (use a type that’s suited to wet area use). This provides added protection and also prevents any lead movement that may cause the resin to crack. First, apply the silicone so that it reaches to top of the box but do not overfill. That done, allow the silicone to cure without the lid in place. During this period, the tubing should be held in place at the exit points using cable ties or bulldog clips. Be sure not to let any silicone get inside the short tube connected to port P1 during the above procedure. It will take some 24-72 hours for the silicone to cure, depending on the type used. Once it has cured, apply additional silicone all around the edges of the box so that the lid can be sealed. Note that the specified box has two outlet slots at one end and one outlet slot at the other, with matching flanges on the lid. Each slot can be held closed with a cable tie around the exposed flanges. These cable ties will crimp the tubes a little but not enough to close them. Weighing it down A weight must be attached to the bottom of the box, so that it sinks to the bottom of the tank. As shown in Fig.14, you can use a 25mm ID brass pipe end-cap for this weight (or you can use galvanised steel). This can be secured to a mounting eyelet at the end of the specified box using a Nylon screw and nut. Alternatively, the box can be attached to a length of 25mm PVC conduit tube, as before. No temperature compensation Another advantage of the in-tank sensor installation is that temperature compensation is not required (although temperature calibration is still carried out). This means that if the compensation has already been set (eg, if you are converting to the in-tank sensor set-up), then it will need to be adjusted to the no compensation setting (see main text). Finally, the calibration procedure is the same as for the in-tube method – ie, the sensor is inserted into the tank and trimpot VR2 adjusted to set the calculated calibration voltage on TP4 (see main text). That done, the sensor is removed from the tank and VR3 is adjusted for a 1V reading at TP4. The sensor is then reinstalled and VR2 again re-adjusted to set the calibration voltage at TP4. December 2007  87 Fig.15: this fullsize front panel artwork can be cut out and used directly or you can download the artwork from the SILICON CHIP website and print it out on a colour printer. plied to improve accuracy. Initially, no compensation is set but you can alter the compensation in 10 discrete steps. The amount of compensation required will depend on the length of tubing exposed to the air outside the tank compared to the length inside the tank. To some extent, it also depends on the pressure sensor and its variation in output with temperature. This can be up to a 4% change over 85°C. Changing the compensation of a variation in level readings. However, if you are using temperature compensation, you can correct the reading by momentarily linking TP6 to TP2 to set a new calibration temperature. If running out of water is going to be a constant problem, you can install the pressure sensor inside the tank instead – see panel. Fig.16: this chart shows the LED colours produced for the temperature compensation adjustment. Temperature compensation Having set the calibration temperature, check the water tank level readings over a wide temperature range during the day. You probably will not notice any variations with the basic version because the graduations are in 10% steps and so there is no need to apply temperature compensation. Conversely, when using the unit with the Base Station (to be described), any small variations will be seen and so compensation is worthwhile. Basically, if the reading rises with higher ambient temperatures and falls with cooler temperatures, then temperature compensation can be ap- Building An Improved Pressure Sensor ALTHOUGH THE PC board was originally designed to accept the pressure sensor, the author no longer recommends mounting this sensor on the PC board and using the “tube in tank” method of Fig.13 for water level sensing. That’s because the measurement will become inaccurate after an extended period of time due to some diffusion of the air into the water, resulting in loss of pressure. As a result, the author now recommends that the pressure sensor be mounted inside the tank – see Fig.14. An even better scheme is to mount the sensor in a separate box outside the tank, with its input connected directly to the outlet at the base of the tank via a T-piece. This “improved” sensor is easier to install and does not require in-tank tubing or wiring – see next issue for details. 88  Silicon Chip To change the temperature compensation value, you first need to connect a link between TP5 & TP2. If you have the basic version, you then simply press switch S1 to change the compensation. Similarly, for the telemetry version, you have to remove jumper LK1, wait for a few seconds and then re-attach the jumper (to apply power). Each time you do this, the compensation will step to the next value and the LED display will light to indicate this. The indicated compensation level follows the same colour pattern as for water level, with red indicating zero temperature compensation and white indicating full compensation – see Fig.16. Note that to reduce the compensation from the current setting, you will have to cycle through the colours to return to the wanted colour. You will need to experiment to arrive at the best compensation setting. As a guide, full compensation gives a variation of about 10% for a 30°C range in temperature. Don’t forget to remove the link between TP5 & TP2 after you are finished. Low battery voltage Finally, note that the solar cell will not recharge an NiMH (or Nicad) cell if the cell voltage drops below about 1.0V. That’s because the stepup voltage converter circuit (based on IC1) draws excessive current from the rechargeable cell in an attempt to maintain a 5V output but the solar cell cannot match this current. In that case, you can recharge the cell by removing jumper LK1, so that the cell is disconnected from the circuit while it charges. That’s all for now. Next month, we’ll describe the LCD Base Station and an improved pressure sensor that doesn’t require tubing inside the tank SC or temperature compensation. siliconchip.com.au