How to Build a River Gauge

From Irish WhiteWater Kayaking and Canoeing Wiki
Jump to navigationJump to search

System Overview

The diagram below gives an overall picture of the system. At the river end, the system is broken into two parts. At the bottom of the river, bolted to an existing stick gauge (or some other convienient location) is a differential pressure sensor. This sensor measures the difference in pressure between the athmosphere and the bottom of the river. To make this differential measurement , one side of the sensor is connected to a breather tube and the other end is open to the surrounding water. The pressure difference P=ρgh , where ρ is density, g is 9.81m/s2 and h is the height between the sensor and the surface of the water. The small signal voltage is amplified by an instrumentation amplifier chip.

The sensor board is connected to the controller board via a 3-core cable. One wire carries a 10V supply to the sensor board. Another wire carries the analog pressure signal back to the controller. The third wire is a ground. The controller board is mounted somewhere on the river bank, in a weather-proof box along with a 12V battery and an old mobile phone. A solar panel is mounted above the box so the location should have an unobstructed view of the southern sky. If vandalism is a concern, the system should perhaps be mounted on top of a tree or a high pole.

Every 15 minutes, the controller board powers up the sensor board and reads the signal once per second for thirty seconds. The measurements are averaged so that the reading is not affected by surges in the water level. Once the reading has been taken, it is stored in memory and the system goes into a low power mode until it is time to take the next reading. Once a day at 09:00, the 96 measurements taken the previous day are collated into a single sms message and sent to an email gateway. The email generated is read by a server which updates the wap and web sites.

The phone that is used is an old Siemens M35, but I think that the command set is the same for all of the M,C and S 25 and 35 phones. The phone does not contain its own battery. (The batteries in those phones were fairly bad anyway) Instead it runs from a supply taken from the 12V battery via a dc-dc converter.

When the system receives a phone call, it examines the caller id to see if an administrator is calling. If it is an admin, the system allows the remote phone to ring once and then hangs up. An sms is sent to the administrator containing the most recent level, the level from 30min previous, the level from 60 min previous and the current state of the 12V battery. If the caller id is not that of an admin, the system will answer the call and give a series of beeps to indicate the most recent level.


Controller board, phone, battery and solar panel mount

The photo below shows the original RiverSpy system with a controller prototyped on veroboard. RiverSpy 2 is laid out on a printed circuit board. The layout file is at the bottom of this page.

The controller board, power unit and phone box mounted on a pole

Administrator SMS

When admins ring the phone, the system declines the call and sends back a text of the level now, 30mins ago and 1 hour ago. When others ring the phone, the system answers the call and gives a series of beeps to indicate the current level.

How to get started

As you can see from the picture above, the original system was prototyped using veroboard. If you are not familiar with electronics, you will find it easier to build using a printed circuit board (pcb). The layout files are given below. You can order from within the expresspcb program. The MiniBoard service at expresspcb costs US$83 for 3 boards, including a courier service to Ireland. You only need one pcb per gauge but it is not possible to order just one pcb. (If you have a spare pcb, please send it to Daithi Power, Electrical Engineering Dept, University College Cork, Ireland) Alternatively, if you have pcb making facilities of your own, use the express pcb software to print overlays and make a pcb yourself. The right hand side of the pcb snaps off to make the sensor board. The larger left side is used to make the controller board. The controller board measures 3" by 2.5". The sensor part is 0.8" by 2.5".

To assemble and test the circuit, you will need the following tools

   * Soldering iron, solder and a small wet sponge to clean the iron
   * A small pliers and a snips
   * Multimeter for measuring voltages and testing connections

Electrical schematic is here

Bill of materials is here

PCB silkscreen is here PCB layout is here View and order PCBs using the free software at Three mini-boards cost $51 + shipping.

Assembly drawing of the layout

Layout file when viewed with expresspcb


Start with the pressure sensor end. It's the section in the dashed box on the first page of the schematic. Pictures of the construction are shown here. You will need a soldering iron, fine solder, a piece of vero board, a snips and a volt meter. Order the pressure sensor (26PCBFA6D), the INA122, and a small aluminium box from farnell. You will also need a 4m length of 1/4" plastic tubing and a long length of 3 core cable. The length of cable depends on the distance from the sensor to the solar panel at the river bank. Measure the distance with a throw-bag rope and add a few metres. I used shielded cable but ordinary house wiring cable should do fine. Solder the circuit together, power it with a 9V or 12V battery and measure the output using a volt meter. It should read about 0.1V normally and increase when you suck on the tube. If all is ok, put it in the box. You will have to drill holes in the box for the tube and cable. Use a separator to create a cavity for the open end of the sensor as shown in the pictures. Test the circuit again and then fill it with epoxy. Make sure nothing is shorted to the side and that epoxy doesn't get into the open end of the sensor. Test it again while the epoxy is wet by connecting a battery to the far end of the cable. If something has shorted, you will still have a chance to move things around. If all is okay, stick on the lid and let it dry. After it has cured, drop it in a barrel of water and power up the far side of the cable with your battery. If the signal voltage reads somewhere around 1.5V per metre of water, pat yourself on the back.

Before I potted the sensor with epoxy, I screwed the box to one end of a 0.5m length of stainless steel. At the other end of the steel, I drilled some 10m holes to allow me to bolt the sensor to the side of an existing stick gauge at the river bank. The distance between the sensor and 10mm holes allowed the sensor to be mounted under the water without having to drill any holes under water. The system should be installed while the river is at a very low level to ensure the sensor always stays under water.

Pictures of sensor construction Datasheets for the components can be found at Honeywell Texas Instruments and Farnell


Order the controller components and solder them in. The PIC, PT6102 and the INA122 can be obtained as free samples. Look at the Bill of Materials to get order numbers for the rest of the components. Use an ic socket to mount the PIC. The Batt and Phone connectors have extra holes to either use terminal blocks or "Molex" connectors. I find Molex very convenient but if you don't have a crimping tool, go for the terminal blocks. Once assembled you will need access to a PIC programmer such as the ICD2 . If you have no way of prorgamming it, send me a PIC and I'll program it for you. Program the PIC using the hex file below and the MPLAB software that you can download from Microchip . During programming, the ICD2 needs to be connected to, and configured to use, an external 9V supply. If you're stuck, send me a PIC and I'll program it for you. Next power up the system using a 12V supply or a battery. The LED should toggle on and off every second.

Hex file for programming PIC is here


So far, I have built systems using the Siemens M35 and the C45. Any old Siemens phone should do but the connectors on the later ones have gotten smaller so it won't be as easy to solder on the wires. The battery is removed from the phone and it is powered directly by the controller. The AT language used to talk to the internal modem is much the same for all Siemens phones. I have put some pictures of wiring an M35 here. The wire needs to be very fine. I used "wire-wrap" wire. It helps to put some solder on the wire before soldering to the phone. In the pictures shown, the red and black wires are soldered directly to the phone pcb. It is also possible (and easier) to solder them to the contacts that would normally press against the battery. Siemens also make a range of GSM modems such as the TC35. These are made for telemetry applications and would be easy to wire up but would cost you a lot more that an old phone.

Phone connector pin-out here

Pictures of phone wiring here


A picture of an early RiverSpy rev 2.0 controller is shown below. The latest version is a bit larger and uses through hold components instead of surface mount to make it easier for an inexperienced person to assemble. I'll put up some pictures of the latest rev later.

  1. Terminal block for solar panel or external 12V supply
  2. Molex connector for battery (paralleled with connector 1)
  3. Debugging interface can be used to monitor phone communications using a pc serial port
  4. ICD2 interface for programming the PIC
  5. Molex connector to mobile phone
  6. Molex connector to underwater sensor

The controller, battery and phone should be mounted in a waterproof box. A plastic box allows optimum phone coverage but if vandalism concerns require the use of a metal box, then an external antenna for the phone may be required. A frame should be contructed to mount the solar panel and the box. To optimise solar energy in winter, the solar panel must face south, have a clear view of the sky and be inclined at 70 degrees to the horizontal. Once all of the components have been connected together, configure it as per the installation manual given below. Send me an email if you need some help.

Installation manual is here


I have also put up a schematic of a small circuit that I use for debugging here . All it does is convert a 5V-0V signal to a +12V-12V signal suitable for connecting to the serial port of a pc or laptop. It listens in on the communications between the control board and the phone. I normally connect it to the RX (receive) line of the PIC. RX and GND are at pins 5 and 6 of the connector J4. RX carries the data going from the phone to the PIC. The phone should echo the characters sent from the PIC to the phone so you should see both sides of the conversation. If this is not working, it can also be connected to the TX (transmit) line but this only shows the characters sent by the PIC. The characters can be displayed on the pc using hyperterminal set at COM1, 9600,N,8,1, no flow control. A similar circuit is included in a siemens pc data cable so if you have one of those, just disassemble the connector at the phone end and use that instead. The pinout of the phone connector is given here . Do not connect the TX of the data cable (pin6, RX of the phone) to the phone at the same time as connecting the TX from the PIC. (its like two people trying to talk using walkie talkies at the same time) Also note that pin 3 (Power) and pin 4 (Fbatt+) shown in the phone connector pinout are not the same as the positive terminal of the phone battery (BATT+).


If you have questions, contact Daithí Power at Daithí Power

Thanks to Ian Roche for the software engineering, Tim Power for the mechanical engineering and Seán McIntyre for the civil engineering.