Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.

Log in or register to post/reply in the forum.

Periodic spike on SDi12 data?

PPeters Nov 24, 2020 02:24 AM


This is a bit of a fish for ideas as bit confused as to issue. 

We have a CR1000x running WQ sensors, primarily a sutron accubar and Handar shaft encoder for stage and Exo Sonde for WQ, we also have a secondary logger running an OTT SLD, modbus density sensor and Lisst aacoustic sediment sensor so some potential sources of interence.

The site has an autosampler and 2kw pump for water sampling and runs through some sensors.. 

we are getting random spikes in the Sutron data that we cant seem to rectify. We have tried swapping the sensor but spikes remain. I setup a diagnostic table to record every scan and you can identify when the spike occurs in the record. The logger records 5min avg, sd and point sample, daignostic records every scan; sutron raw, stage and handar

we dont see the spike in the handar and neither on the exo depth so dont believe it to be real, some form of interence

also ran a secondary logger with another sutron inline with the site sensor and dont pick up the spike...

then we observed something random.. the spike was detected on a site telemetry call and when the record is reviewed the frequency of the spike occurs on the same duration as the telemetry schedule.. So starting to think the comms call is influence the sdi12 result?

but can this even happen, feels wrong and on the wrong track but I have set the logger onto another schedule to confirm..

anything else to consider?

I though sdi-12 would be relatively immune from interence and would not expect the returned result to be corrupted, Interestingly this is our only site with the issue and our only cr1000x logger although do have cr300 sites with sdi12 wet transducers that also give unresolved spike issues..

We have tried to observe the sdi12 on the logger watchdog (best feature ever..thx CSI) but like all faults doesnt want to occur when you are watching

I read about looping the sdi12 into another control port to record the log so thatmight be my next test

Any ideas or recomendation much appreciated

daignostic record of spike looks like this

"TOA5","Manawatu at Teachers College","CR1000X","1272","CR1000X.Std.03.02","CPU:TCO_104v28_diagnostic.CR1X","52864","DATA_Diagnostic"

"2020-11-24 13:00:00",112,538.8,76.88,541
"2020-11-24 13:01:00",113,540.2,77.02,541
"2020-11-24 13:02:00",114,538.3,76.83,541
"2020-11-24 13:03:00",115,615.4,84.54,541            <<<<<<<<<<<
"2020-11-24 13:04:00",116,538.9,76.89,541
"2020-11-24 13:05:00",117,540.2,77.02,541
"2020-11-24 13:06:00",118,539.2,76.92,541
"2020-11-24 13:07:00",119,539.2,76.92,540

also inlcuding code set in case I have an issue that can be resolved

Cr1000x,, just loaded latest v4 firmware yesterday

'CR1000X Series Datalogger
' Version 104 Base Software
' Build 01 31-08-2012

' Station: Manawatu at Teachers College
' Pakbus Address: 711

' MK104
' ************************** IMPORTANT ******************************************************************************************
' Increment the site edition number with each change in code and comment changes
' Edition 00: Base software, Water Qulaity Pump Rig Site
' Edition 01: initial build, WQ sensors with dual stage
' Edition 02: resolving issues with Autosampler operation
' Edition 03: Modified code for 24V pump, run 1min before sample
' Edition 04: Moved Pump run code to 1 sec table, flow rate not recording on previous, code to resolve issue
' edition 05: Added PPP connection code for Netcomm modem
' Edition 06: Orifice remounted and offset changed. AS 31-03-2015
' Edition 07: Installing Nitrax sensor (Massey Investigation)
' Edition 08: Setup for Autosampler with Nitrax control (added Email Notification)
' Edition 09: Tweaked Email Notification and sample table
' Edition 10: Increased Autosampler run time for 2 bottles
' Edition 11: Change of pH sensor to E+H memosens(EHA14 100)
' Edition 12: Installing L-Dens density sensor inline for SS analysis, midnight line flush
' Edition 13: Removed some modem control, Logger is missing data punches! modbus issue, moved Density sensor to seperate scan
' Edition 14: Adding Trios nitrates, Nitrate and absorbstion
' Edition 15: Removed TriOS Sensor
' Edition 16: Altered orifice and changed offset
' Edition 17: Removed Modbus code as now on seperate logger, Now on IP from NL121
' Edition 18: Surveyed ESG1 and changed offset 6mm. AS 19-06-2017
' Edition 19: Added Handar Offset to aid in resets and Primary Switch
' Edition 20: Swapped comms to cybertec on switch, site is port forward on 6785.
' Secondary cr1000 with Density sensor, 1.2 port forward on 6784
' Edition 21: Removing WTW equipment, replaced with EXO sonde, CR1000x datalogger
' Edition 22: Added checks to site code to avoid errors on SDI12
' Edition 23: Modified EXO timing to avoid missed calls
' Edition 24: change EXO turb to new datasource
' Edition 25: Removed inline pH and conductivity, added Lisst ABS sensor
' Edition 26: Added sonde depth to water level table
' Edition 27: Issue with Turb naming? from version22 was called turb_ss but only influenced data flow on ver26??.. fixed
' Edition 28: Diagnostic code to resolve stage issue? spikes on avergae and sd but not point
' Edition 29: Updated Email address, tidied sampler code
' Edition 30: Suspect comms is cause of data spikes. Increased scan buffers to 10 for test.
' Edition 31: Changed buffers bact to 3 and increased 30 sec scan to 60 sec

' Date: 24-08-2020
' Modified by: Paul Peters
' *******************************************************************************************************************************
' Wiring
' C1 SDI-12 Sensor (Address 0) Sutron Se1 Not Used
' C2 Relay control ( Line Flush) Se2 Not Used
' C3 Exo Sonde Se3 Not Used
' C4 Autosampler activation Se4 Not used
' C5 SDI-12 Sensor (Address 0) Handar Se5 Not Used
' C6 Air Solinoid close Se6 Not Used
' C7 Not Used Se7 Not Used
' C8 Pump run Se8 Not Used
' VX1 Not used Se9 Not Used
' VX2 Not Used Se10 Not Used
' VX3 Not Used Se11 Not Used
' P1 Flow meter Se12 Not Used
' P2 Autosampler Response Se13 Not Used
' Sw12(1) Switched 12VDC, used for GPRS reset via relay se14 Not Used
' 5V Not Used Se15 Not Used
' SW12(2) Exo Power Se16 barometric Pressure 60-110 hPa 2.5V

' Flag 1 Initiation
' Flag 2 Reset Sampler
' Flag 3 Run Pump, set high to test
' Flag 4 Take sample
' Flag 5 Flush Line
' Flag 6 SW12(1) reset

' Standard Table outputs
' Data_5minPT Water level,WL Backup
' Data_15min Other data; WQ parameters
' Data_Sampler Autosampler
' Data_Status Battery Voltage, signature, version

' *******************************************************************************************************************************

'Declare Public Variables
Public Sutron
Public Handar
Public Stage_Trial
Public BaroP

Public EXO3_Sonde(12) 'Check inputs!!!!
Alias EXO3_Sonde(1) = Sonde_Volts
Alias EXO3_Sonde(2) = EXO_wiper
Alias EXO3_Sonde(3) = DO_DegC
Alias EXO3_Sonde(4) = DO_Sat
Alias EXO3_Sonde(5) = EXO_do_con
Alias EXO3_Sonde(6) = Turb_High
Alias EXO3_Sonde(7) = pH
Alias EXO3_Sonde(8) = ORP
Alias EXO3_Sonde(9) = SP_Cond
Alias EXO3_Sonde(10) = BlueGreenAlgae
Alias EXO3_Sonde(11) = Chlorophyll
Alias EXO3_Sonde(12) = EXO_Depth

Public Batt_Volt
Public Version
Public Prog_Sig
Public J_Day

Public Flowrate

Public Hach_Input = 1
Public Hach_Start = 150 ' The starting threshold, setup as approriate for input variable
Public Hach_Stop = 20 ' The stop threshold
Public Hach_Step = 60 ' the time step between samples
Public Take_sample = 0

Public Sample_No
Public Sample_Max = 25
Public Bottles_sample = 1

Public Flag(6) As Boolean ' Sets up 4 flags for program control

Alias Flag(1) = Code_Initiation
Alias Flag(2) = Reset_Sampler
Alias Flag(3) = Run_Pump
Alias Flag(4) = Manual_Sample
Alias Flag(5) = Flush_Line
Alias Flag(6) = SW12_1_reset
Public Ping_result

'Declare Other Variables
Dim LoggerTime(9)
Dim AS_Sample
Dim Sutron_Raw(2)
Dim FlowPulse
Dim Stage
Dim WL_Backup
Dim Hach_variable(3) ' This is used to control which variable drives the autosampler
Dim Pump_stop
Dim SDI12_Fault

'Email and site Threshold variables
Const ServerAddr = "####"
Const ToAddr = "###"
Const FromAddr = "####"
Const Subject = "Teachers College Autosampler Activation!"
Const Attach = ""
Const UserName = ""
Const Password = ""
Const CRLF = CHR(13) + CHR(10)

Public EmailResult As String *50
Public Message As String *250
Public EmailSuccess As Boolean

'Declare Constants
Const Software = 104
Const Edition = 31 ' Increment for changes in program, ie sensors added and offset changes (integer)
StationName ("Manawatu at Teachers College")
Const Stage_Offset = -230 ' Sutron offset
Const Handar_Offset = 794 ' Set to EPB

Public Primary_Switch ' use to remote switch primary sensor, default is 0 for Encoder
Public Primary As String *50
Public Diagnostics = 0

'Define Data Tables
DataTable (Data_5min,1,-1)
DataInterval (0,5,min,10)
Average (1,Stage,ieee4,SDI12_Fault)
StdDev (1,Stage,ieee4,SDI12_Fault)
Sample (1,Stage,ieee4)
Average (1,WL_Backup,ieee4,false)
StdDev (1,WL_Backup,ieee4,False)
Sample (1,WL_Backup,ieee4)
Sample (1,Stage_Trial,ieee4)

DataTable (Data_15min,1,-1)

DataTable (Data_Status,Flag(1),20)
Sample (1,Batt_Volt,ieee4)
Sample (1,Prog_Sig,ieee4)
Sample (1,Version,ieee4)

DataTable (Data_Sampler,AS_Sample,48)
Sample (1,Sample_No,FP2)
Sample (1,Hach_variable(Hach_Input),IEEE4)

DataTable (DATA_Diagnostic,Diagnostics,-1 )
Sample (1,Sutron,IEEE4)
Sample (1,Sutron_Raw(1),IEEE4)
Sample (1,Handar,IEEE4)

'Define Subroutines

'Main Program

Prog_Sig = status.ProgSignature
Version = (Software) + (Edition/100)
Flag(1) = True
SW12 (SW12_2,1 ,0)

Scan (1,Sec,3,0)

Hach_variable(1) = Turb_High
Hach_variable(2) = Stage
Hach_variable(3) = SP_Cond

If Bottles_sample = 2 Then
Pump_stop = 120
Pump_stop = 60

' Autosampler control, reads P2 for autosampler response and activaes with C4, Flag4 can be used for manual sample
PulseCount (AS_Sample,1,P2,1,0,1.0,0)
PulseCount (FlowPulse,1,P1,1,0,1.0,0)

Sample_No = Sample_No + AS_Sample
Flowrate = (FlowPulse *10) + Flowrate

' Pump Control uses port 8 to control a relay, activates 1 minute before punch
' And closes the autosampler catch tank

If IfTime (840,900,Sec) Then
Flag(3) = True
Flowrate = 0

If IfTime (Pump_stop,900,Sec) Then
Flag(3) = False

If Flag(3) = True Then PortSet(C8,1,0)
If Flag(3) = False Then PortSet(C8,0)

If IfTime (0,15,min) Then
If Hach_variable(Hach_Input) > Hach_Start Then Take_sample = True
If Hach_variable(Hach_Input) < Hach_Stop Then Take_sample = False

If Take_sample = True Then
If IfTime (0,Hach_Step,Min) Then Flag(4) = True
If Sample_No = 0 Then Flag(4) = True

If Sample_No >= Sample_Max Then Flag(4) = False

If Flag(4) = True Then
PortSet (C4,1 ) ' take sample with C4 pulse upon sampling criteria being meet or manually

CallTable Data_Sampler
Flag(4) = False


Scan (90,Sec,3,0)
If IfTime(810,900,sec) Then 'Start measuring EXO 90 seconds before punch (40 second exposure time)
EXO3_Sonde() = -1
SDI12Recorder (EXO3_Sonde(),C3,0,"C!",1.0,0,-1,1) 'Address 1 ()
End If

Scan (60,Sec,3,0) 'Standard sensor activation
' Calculate Julian day
J_Day = LoggerTime(9)

'Setup sensor activation and measurement here,
'choose appropriate instruction and set offset multiplier

SDI12_Fault = False ' Store SDI12 data
SDI12Recorder (Sutron_Raw(),C1,0,"M!",1,0)
SDI12Recorder (Handar,C5,0,"M!",100,Handar_Offset)
Sutron = (Sutron_Raw(1) * 10) + Stage_Offset
Flag(2) = False

' Can set which sensor system is Primary

If Primary_Switch = 0 Then
Stage = Sutron
WL_Backup = Handar
Stage_Trial = EXO_Depth
Primary = "GasPurge"
Stage = Handar
WL_Backup = Sutron
Stage_Trial = EXO_Depth
Primary = "Tower"
' checks SDI12data and suspends storage if fault
If Stage = "NAN" Then SDI12_Fault = true

' Measure the other sensors
VoltSe (BaroP,1,mV5000,16,1,0,250,0.2,600)' 600-1100Pa

Battery (Batt_Volt)

'Enter other measurement instructions
Batt_Volt = Round (Batt_Volt,3)
BaroP = Round(BaroP,2)

If IfTime(359,360,min) Then Flag(6) = True 'reset the modem with Flag(2) high
If Flag(6) = True Then ' resets power 1 min before 6hr interval
' SW12 (SW12_1,0 ,0) ' uses SW 12 supply to down power the modem
Flag(6) = False

'Call Output Tables
If IfTime (0,6,Hr) Then Flag(1) = True

CallTable Data_5min
CallTable Data_15min
CallTable Data_Status
CallTable Data_Diagnostic
Flag(1) = False


Scan (60,Sec,3,0)
If Sample_No = 0 Then EmailSuccess = False
If Sample_No = 2 Then EmailSuccess = False

Ping_result = PingIP ("",3000)

If Sample_No = 1 Then
If EmailSuccess = False Then
Message = "Manawatu at Teachers College Autosampler" + CRLF + CRLF
Message = Message + "This is a notification that the Autosampler at Teachers College has Started" + CRLF
Message = Message + "The current Trigger is " + Hach_variable(Hach_Input) + " at " + status.timestamp + CRLF + CRLF
Message = Message + "The Sampler has filled Bottle 1 and is running on a "+ Hach_Step + " minute fill rate "
EmailSuccess = EmailSend (ServerAddr,ToAddr,FromAddr,Subject,Message,Attach,UserName,Password,EmailResult)

If Sample_No = Sample_Max Then
If EmailSuccess = False Then
Message = "Manawatu at Teachers College Autosampler" + CRLF + CRLF
Message = Message + "This is a notification that the Autosampler at Teachers College has Finished" + CRLF
Message = Message + "The current Trigger is " + Hach_variable(Hach_Input) +" at " + status.timestamp + CRLF + CRLF
Message = Message + "The Sampler has filled the final bottle and is ready for collection "
EmailSuccess = EmailSend (ServerAddr,ToAddr,FromAddr,Subject,Message,Attach,UserName,Password,EmailResult)

If Flag(2) = -1 Then
Hach_Start = 150 ' The starting threshold
Hach_Stop = 20 ' The stop threshold
Hach_Step = 60 ' the time step between samples, increments of 15 min only
Sample_No = 0
Take_sample = 0
Flag(2) = 0
End If



packedease Nov 16, 2023 03:22 AM

Another problem with the code was that although the variables Rs, A, B, and C are necessary, they are not displayed. I located the Vaisala Handar 435E handbook and the Steinhart-Hart (code comment) data by searching for it. Using resistance values at -45C, 0C, and 45C, I calculated A and B using the S-H data and the temperature vs resistance information included in the 435E paper.

Noah101 Nov 23, 2023 02:07 AM

This post is under review.

Log in or register to post/reply in the forum.