You are on page 1of 11

ProSample Controller for SDI-12 Logger

version 2.05

Scienterra Ltd 225 Whiterocks Road Oamaru, 9492 New Zealand info@scienterra.com For sales inquiries, please contact: ENVCO Environmental Collective Unit 7, 74 Upper Queen Street Newton, Auckland 1010 New Zealand info@envco.co.nz
Introduction The purpose of the ProSample Controller is to control the triggering of an automated water sampler. Usually, it is desirable to take multiple water samples at various times during a flood event, but this is often difficult to automate with a standard data logger and sampler. The ProSample Controller allows a researcher to start sampling at a specific water level, and take subsequent samples at appropriate times. It does this by eavesdropping on the SDI-12 communication between a data logger and a water level instrument. The ProSample Controller parses the water level data, without affecting the normal communication between the logger and the instrument. It then uses this data, together with a user configuration, to determine an appropriate action for the triggering of samples. Samples can be triggered by water level; by a fixed time interval; or by a fixed amount of discharge, as calculated by a rating curve.

User Configuration Appendix A gives a detailed description of the wiring between the data logger, the SDI12 water level instrument, and the ProSample Controller. At power-up, the unit is ready to operate. However, there are several parameters that should be adjusted before deployment, to configure the unit for its particular site. A simple RS232 interface is provided to allow these configurations. To connect, use a terminal emulator program like Hyperterminal or Teraterm. Set the communication for 115200 baud, no parity, 8 data bits, 1 stop bit. Plug a straight RS232 serial cable (not null-modem) into the supplied three-pin serial dongle. The dongle should affix to the circuit board at the three-pin connector adjacent to the green screw terminals. The ProSampler continues to be in normal operation mode until the user hits <esc> three times. This activates the menu mode. While menu mode is active, the other functions of the ProSample Controller are suspended. NOTE: Remember to exit the menu mode after you are done with the configuration! Hit x to exit. Failure to do so will leave the unit in configuration mode, and it will not function. After the third <esc>, the following menu appears on the screen: Menu level = 0 Main Menu 0: SDI-12 address [0] 1: SDI-12 index [1] 2: Trigger level [20.000] 3: Reset level [19.000] 4: Inhibit time (s) [45] 5: Max number of samples [24] 6: Sampling method (1=time, 2=level, 3=discharge) [1] 7: Sampling interval [3600] 8: 9: File I/O Press a key to select, or x to exit

Pressing the key that corresponds to the number before the option allows you to change the value of that option. For example, pressing 2 will allow you to change the trigger level.

SDI-12 Options The ProSample Controller has no SDI-12 address, as it does not communicate directly with the logger. Instead, the SDI-12 configuration is set to match the SDI-12 settings of the water-level instrument, which is also present on the bus. The first menu option, SDI-12 address, should match the SDI-12 address of the water level instrument. This tells the ProSample Controller which instrument to eavesdrop on. The second option, SDI-12 index, tells the ProSample Controller if the water level data is first, second, third, etc. in the SDI-12 data response. For example, suppose the water level is at 3.456 metres. If the SDI-12 water level instrument responds to a poll with "0+3.456" then the SDI-12 index should be set to 1, as the data is first in the list. However, if the water level instrument includes additional data in the response, then perhaps the water level data does not appear first. For example, for the response "0+21.9+3.456+M", the SDI-12 index should be set to 2, as the water level data is second in the list. This information will be in the SDI-12 water level instruments user's manual. Trigger level, Reset level, Inhibit function, and Maximum samples These parameters define when sampling will start and stop. Sampling begins when the water level rises above the "Trigger level. Keep in mind that the ProSample Controller uses the raw data as it comes from the water level instrument, so the configuration should be in the same units as the SDI-12 data. Subsequent samples are performed until the water level drops below the "Reset level. After such a drop, the water level must rise above the Trigger level for sampling to continue. After any sample is triggered, the sampler will take some time to fill a flask. If subsequent triggers occur during this period, bad things might happen (e.g., flask overfilling, mechanical jams, etc.) For this reason, subsequent triggers can be inhibited in the ProSample Controller using the Inhibit time function. When a sample starts, a timer runs for a specified number of seconds. If the next trigger occurs before this "inhibit timer" expires, the ProSample Controller will wait to trigger the next sample. The next trigger will occur when the inhibit timer expires. Set "Inhibit time" to equal the number of seconds that it takes for the water sampler to complete a sample. You may wish to add a few extra seconds, to prevent overlap. The sampling program is terminated when the number of samples reaches the specified maximum. Note that accessing the menu mode will reset this counter.

Sampling methodologies The remaining options determine the triggering behaviour of the subsequent samples, (that is, for each sample after the initial sample is triggered.) After the first sample is triggered, there are three ways to plan the triggering of subsequent samples. These methods are time, level, and discharge. Time-based sampling When time is selected as the sampling method, the ProSample Controller uses an internal timer to determine when the next sample should be taken. After the first sample is triggered, a timer counts a user-specified number of seconds before taking another sample. The number of seconds is specified by the "Sampling interval," which is set in the menu. After the next sample is taken, the timer is reset, and the process repeats. Sampling continues in this manner until either the level falls below the reset level, or the maximum number of samples has been taken. Note that this method is asynchronous to the logger's SDI-12 communication, meaning that samples could happen anytime, not just when the logger polls for data. Level-based sampling When level is selected as the sampling method, the ProSample Contoller will take another sample every time the data from the SDI-12 water level instrument indicates that the water level has changed (either risen or fallen) by a specified amount. This amount is specified by the "Sampling interval," which is set in the menu. (You may have noticed that this same parameter is used during time-based sampling. This same menu item is used in different ways, depending on the sampling method.) Using this option, when a sample is taken, the water level data is stored internally. Every time the logger polls for new water level data, the new data is compared to the stored data. If the new water level differs by more than the value specified by the "sampling interval," then a sample is taken, and the new water level is stored, replacing the previously stored value. There are a few things to note with this method. Note that the value in "Sampling interval" must be in the same units as reported by the SDI-12 water level instrument. Note that this method of sampling is synchronous to the logger's polling schedule. That is, samples will always be triggered when the logger polls for new data. Note that this method will not necessarily result in samples being taken at regular intervals of water level. If the water level is rising rapidly, the difference between two successive polls might be much greater than the sampling interval.

Discharge-based sampling When discharge is selected as the method of sampling, an additional item appears in the menu. Item 8 is the Rating curve menu, which is only applicable to this method of sampling. A little bit about rating curves A rating curve is a way to transform the stage (or water level) into discharge (or flow rate.) This relationship is usually not linear. For example, if a river is 1 metre deep, and discharging 1000 cubic metres per second, then when the river is 2 metres deep, it will probably be discharging far more than 2000 cubic metres per second. The rating curve is a way to express the relationship between stage and discharge. The traditional formula for discharge is Q = A * (stage - H) ^ b, where Q is discharge, and A, H, and b are constants. The ProSample Controller uses this formula to calculate discharge. For some locations, such as a man-made weir, the constants will be known. For others, they must be found. To find the constants, a table is generally used. Several physical measurements are done at the river, and the researcher defines a table with stage in the first column, and discharge in the second column. Once this table is defined, you can use the spreadsheet (Rating_curve.xls) supplied with the ProSample Controller to find the constants for the above equation. Simply cut and paste the table into the spreadsheet, and the spreadsheet calculates the constants for you. In the spreadsheet, a graph compares the data points in the table with the corresponding data points from the equation. At some sites with irregularly constrained river banks, a certain rating curve is valid below a certain level, but when the water rises above the banks, a different curve is needed. The ProSample Controller allows you to enter two rating curves, and to define a "breakpoint" that defines when the calculation should switch from the lower curve to the upper curve. To determine if your site needs one curve or two, try entering your rating table into the spreadsheet. If your rating table results in a graph that does not show a good fit for every point, try splitting your rating table into two sections, and fit each section separately. Remember to include the breakpoint in each section. Please see Appendix B for an example.

When you hit the <8> key in the ProSample Controller menu, the screen will display the Rating curve menu: Menu level = 1 Rating curve menu 0: A1 [1.0000] 1: H1 [0.0000] 2: b1 [1.0000] 3: Breakpoint [0.000] 4: A2 [1.0000] 5: H2 [0.0000] 6: b2 [1.0000] Coefficients used to calculate discharge Q=A*(level-H)^b Curve1 used above breakpoint, curve2 used below breakpoint. Make selection, \ to go back, or x to exit If you do not need two curves, just define the contants for the first curve (A1, H1, and b1), and enter "0" for the breakpoint. When using discharge as the sampling method, the ProSample Controller triggers the first sample at the "Trigger level" specified in the main menu. It then calculates the discharge rate based on the constants entered in the Rating curve menu and the water level reported by the SDI-12 water level instrument. Using this calculated discharge rate, the ProSample Controller calculates the time required for a specified volume of water to flow. This volume is specified in the "Sampling interval" field of the menu, and it must be in the same units as the second column of your discharge table. A timer is set for this calculated amount of time, and the next sample is triggered when the timer expires. If the logger polls for more data before the timer expires, the timer auto-adjusts based on the new data. In this way, the "Sampling interval" is kept as close as possible to the real-time conditions. After a sample is triggered, the timer is reset, using a new timing calculation based on the most recent data. The process repeats until the water level falls below the "Reset level" or until the maximum number of samples has been taken. Note that the second column of your rating table must be in units of "volume per second". What units of volume you use does not matter, as long as it is consistent with the value in "Sampling interval." The time units MUST be "per second" for the timer calculation to work properly. Note that this method is asynchronous with the logger. The samples might happen anytime, not only when the logger polls for data.

File I/O Menu Hitting 9 from the Main menu will bring you to the File I/O menu. There are options to read and write configuration files, but these are not often used, and will not be discussed here. Of particular concern is option 2 in this menu, Update firmware. This function allows for firmware upgrades. Before updating the firmware, be sure to set your terminal program to insert a 30-40ms delay between lines. This is usually done in the same screen where you configure the COM port. There are on-screen instructions to guide you through the update process, but instructions are presented here for clarity. Hit Esc/esc/esc to enter menu mode Hit 9 to enter the File I/O menu Hit 2 to update firmware Hit y to confirm Hit f for firmware Use your terminal program to send a simple text file (not XMODEM or Kermit). If done correctly, you will see dots streaming across the screen, ending with OK. This indicates that the process was successful. If the process is not successful, and you have trouble operating the unit after the failed attempt, it is possible that the existing firmware has become corrupted. This is extremely uncommon. There is a solution, but it requires more advanced guidance. Contact info@scienterra.com for more information.

Appendix A: Recommended wiring: The logger should connect to the SDI-12 water level instrument as normal. The ProSample Controller SDI-12 wires should also be connected to the SDI-12 bus. This is how the ProSample Controller obtains the data to know when to sample. The SDI-12 wires also provide power to the ProSample Controller. Black = GND Red = 12V White = SDI-12 data. The triggering wires take a signal from the ProSample Controller screw terminals to the water sampler. Wire A is the signal wire, and wire B is the common ground. The signal wire idles low. When a trigger occurs, the ProSample Controller will pulse the signal wire to 5V for 250ms, and then return to ground. If your triggering needs are different, please contact info@scienterra.com for a custom solution. A = Sampler trigger (signal) B = GND The water sampler will usually have an optional wire to send a signal to the logger, to indicate that a sample has been taken. This is optional, but recommended. This will allow the logger to timestamp the sampler's activity, together with the SDI-12 water level data. Appendix B: Example of situation requiring two rating curves. For some rating tables, a single rating curve will not accurately describe the data in the table. This is common in situations where the river has terraced banks; or where a river is very confined during low flows, but is more open at higher flows. With this table, there are large indiscrepancies in the curve fit.

Unrated(H) Rated(Q) 1000 67 1050 145 1100 245 1150 370 1200 530 1250 730 1300 990 1400 1690 1450 2100 1500 2580 1550 3170 1600 3920 1625 4405 1650 5110 1675 6000 1700 7200 1800 15500 1900 28000

2000 1800 1600 1400 1200 1000 800 600 400 200 0 0 5000 10000 15000 20000 25000 30000
Rated(Q) curve fit

By splitting the same rating table into two sections, two curves are generated. These curves do a better job of replicating the data in the table.
Unrated(H) Rated(Q) 1000 67 1050 145 1100 245 1150 370 1200 530 1250 730 1300 990 1400 1690 1450 2100 1500 2580 1550 3170 1600 3920 1625 4405

1800 1600 1400 1200 1000 800 600 400 200 0 0 1000 2000 3000 4000 5000
Rated(Q) curve fit

Note: the breakpoint appears in each table. In this case, the breakpoint is 1625.

Unrated(H) Rated(Q) 1625 4405 1650 5110 1675 6000 1700 7200 1800 15500 1900 28000

1950 1900 1850 1800 1750 1700 1650 1600 0 5000 10000 15000 20000 25000 30000
Rated(Q) curve fit

Appendix C: Specifications Size: Voltage: Current: Communication: Data protocol: Accessories: 15mm x 65mm. 7-20 VDC < 2mA max RS232 SDI-12, eavesdrop only 1-metre SDI-12 cable, provided Three-pin serial dongle for RS232 configuration, provided

You might also like