Home › Forums › Environmental Sensors › InSitu RDO PRO-X not reading
- This topic has 2 replies, 2 voices, and was last updated 2021-06-29 at 8:20 PM by Selbig.
-
AuthorPosts
-
-
2021-06-29 at 5:33 PM #15628
I’m using the code pulled from the menu_a_la_carte for the InSitu RDO PRO-X and Decagon ES2. I’m able to get values for the Decagon but the RDO returns -9999 values. I was able to communicate with the RDO using WinSitu software and change the SDI address to 5. I’m powering the RDO using a separate 12v battery. I’m pretty confident my connections are correct but I’m less confident in the code. Is there anything missing or in error? Here’s an example of what is returning in the serial window:
-> SampNum
-> Battery
-> BoardTemp
-> RDOpercent
-> RDOppm
-> RDOtempC
-> RDOppO2
-> ES2Cond
-> ES2Temp\/—- Line Saved to SD Card —-\/
2021-06-28 22:25:00,3,4.852,28.75,-9999.00,-9999.00,-9999.00,-9999.00,1.5,14.15123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227/** =========================================================================* @file simple_logging.ino* @brief A simple data logging example.** @author Sara Geleskie Damiano <sdamiano@stroudcenter.org>* @copyright (c) 2017-2020 Stroud Water Research Center (SWRC)* and the EnviroDIY Development Team* This example is published under the BSD-3 license.** Build Environment: Visual Studios Code with PlatformIO* Hardware Platform: EnviroDIY Mayfly Arduino Datalogger** DISCLAIMER:* THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN.* ======================================================================= */// ==========================================================================// Include the libraries required for any data logger// ==========================================================================/** Start [includes] */// The Arduino library is needed for every Arduino program.#include <Arduino.h>// EnableInterrupt is used by ModularSensors for external and pin change// interrupts and must be explicitly included in the main program.#include <EnableInterrupt.h>// To get all of the base classes for ModularSensors, include LoggerBase.// NOTE: Individual sensor definitions must be included separately.#include <LoggerBase.h>#include <Wire.h>#include "Sodaq_DS3231.h"DateTime dt(2021, 06, 29, 4, 10, 0, 0); //Set the date and time everytime you download the program to initiate the clock// ==========================================================================// Data Logging Options// ==========================================================================/** Start [logging_options] */// The name of this program fileconst char* sketchName = "Madison Wetpond.ino";// Logger ID, also becomes the prefix for the name of the data file on SD cardconst char* LoggerID = "East_In";// How frequently (in minutes) to log dataconst uint8_t loggingInterval = 5;// Your logger's timezone.const int8_t timeZone = -6; // Eastern Standard Time// NOTE: Daylight savings time will not be applied! Please use standard time!// Set the input and output pins for the logger// NOTE: Use -1 for pins that do not applyconst int32_t serialBaud = 115200; // Baud rate for debuggingconst int8_t greenLED = 8; // Pin for the green LEDconst int8_t redLED = 9; // Pin for the red LEDconst int8_t buttonPin = 21; // Pin for debugging mode (ie, button pin)const int8_t wakePin = A7; // MCU interrupt/alarm pin to wake from sleep// Set the wake pin to -1 if you do not want the main processor to sleep.// In a SAMD system where you are using the built-in rtc, set wakePin to 1const int8_t sdCardPwrPin = -1; // MCU SD card power pinconst int8_t sdCardSSPin = 12; // SD card chip select/slave select pinconst int8_t sensorPowerPin = 22; // MCU pin controlling main sensor power/** End [logging_options] */// ==========================================================================// Using the Processor as a Sensor// ==========================================================================/** Start [processor_sensor] */#include <sensors/ProcessorStats.h>// Create the main processor chip "sensor" - for general metadataconst char* mcuBoardVersion = "v0.5b";ProcessorStats mcuBoard(mcuBoardVersion);/** End [processor_sensor] */// ==========================================================================// Maxim DS3231 RTC (Real Time Clock)// ==========================================================================/** Start [ds3231] */#include <sensors/MaximDS3231.h> // Includes wrapper functions for Maxim DS3231 RTC// Create a DS3231 sensor object, using this constructor function:MaximDS3231 ds3231(1);/** End [ds3231] */// ==========================================================================// InSitu RDO PRO-X Rugged Dissolved Oxygen Probe// ==========================================================================#include <sensors/InSituRDO.h>const char* RDOSDI12address = "5"; // The SDI-12 Address of the RDO PRO-Xconst int8_t RDOPower = -1;//sensorPowerPin; // Power pin (-1 if unconnected)const int8_t RDOData = 7; // The SDI12 data pinconst uint8_t RDONumberReadings = 3;// Create an In-Situ RDO PRO-X dissolved oxygen sensor objectInSituRDO insituRDO(*RDOSDI12address, RDOPower, RDOData, RDONumberReadings);// ==========================================================================// Decagon ES2 Conductivity and Temperature Sensor// ==========================================================================#include <sensors/DecagonES2.h>const char* ES2SDI12address = "1"; // The SDI-12 Address of the ES2const int8_t ES2Power = sensorPowerPin; // Power pin (-1 if unconnected)const int8_t ES2Data = 11; // The SDI12 data pinconst uint8_t ES2NumberReadings = 5;// Create a Decagon ES2 sensor objectDecagonES2 es2(*ES2SDI12address, ES2Power, ES2Data, ES2NumberReadings);// ==========================================================================// Creating the Variable Array[s] and Filling with Variable Objects// ==========================================================================/** Start [variable_arrays] */Variable* variableList[] = {new ProcessorStats_SampleNumber(&mcuBoard),// new ProcessorStats_FreeRam(&mcuBoard),new ProcessorStats_Battery(&mcuBoard),new MaximDS3231_Temp(&ds3231),new InSituRDO_DOpct(&insituRDO,""),new InSituRDO_DOmgL(&insituRDO,""),new InSituRDO_Temp(&insituRDO,""),new InSituRDO_Pressure(&insituRDO,""),new DecagonES2_Cond(&es2,""),new DecagonES2_Temp(&es2,""),};// Count up the number of pointers in the arrayint variableCount = sizeof(variableList) / sizeof(variableList[0]);// Create the VariableArray objectVariableArray varArray;/** End [variable_arrays] */// ==========================================================================// The Logger Object[s]// ==========================================================================/** Start [loggers] */// Create a logger instanceLogger dataLogger;/** End [loggers] */// ==========================================================================// Working Functions// ==========================================================================/** Start [working_functions] */// Flashes the LED's on the primary boardvoid greenredflash(uint8_t numFlash = 4, uint8_t rate = 75) {for (uint8_t i = 0; i < numFlash; i++) {digitalWrite(greenLED, HIGH);digitalWrite(redLED, LOW);delay(rate);digitalWrite(greenLED, LOW);digitalWrite(redLED, HIGH);delay(rate);}digitalWrite(redLED, LOW);}/** End [working_functions] */// ==========================================================================// Arduino Setup Function// ==========================================================================/** Start [setup] */void setup() {// Start the primary serial connectionSerial.begin(serialBaud);Wire.begin();rtc.begin();rtc.setDateTime(dt);// Print a start-up note to the first serial portSerial.print(F("Now running "));Serial.print(sketchName);Serial.print(F(" on Logger "));Serial.println(LoggerID);Serial.println();Serial.print(F("Using ModularSensors Library version "));Serial.println(MODULAR_SENSORS_VERSION);// Set up pins for the LED'spinMode(greenLED, OUTPUT);digitalWrite(greenLED, LOW);pinMode(redLED, OUTPUT);digitalWrite(redLED, LOW);// Blink the LEDs to show the board is on and starting upgreenredflash();// Set the timezones for the logger/data and the RTC// Logging in the given time zoneLogger::setLoggerTimeZone(timeZone);// It is STRONGLY RECOMMENDED that you set the RTC to be in UTC (UTC+0)Logger::setRTCTimeZone(0);// Set information pinsdataLogger.setLoggerPins(wakePin, sdCardSSPin, sdCardPwrPin, buttonPin,greenLED);// Begin the variable array[s], logger[s], and publisher[s]varArray.begin(variableCount, variableList);dataLogger.begin(LoggerID, loggingInterval, &varArray);// Set up the sensorsSerial.println(F("Setting up sensors..."));varArray.setupSensors();// Create the log file, adding the default header to it// Do this last so we have the best chance of getting the time correct and// all sensor names correctdataLogger.createLogFile(true); // true = write a new header// Call the processor sleepdataLogger.systemSleep();}/** End [setup] */// ==========================================================================// Arduino Loop Function// ==========================================================================/** Start [loop] */void loop() {dataLogger.logData();}/** End [loop] */ -
2021-06-29 at 6:00 PM #15629
I successfully used that sensor with a Mayfly v0.5 board with no problem. If you’re powering the sensor with a separate 12v battery, do the Mayfly and the 12v battery share a common ground? The white wire from the sensor is the SDI-12 data line, which should go to pin 7 , as you stated in Line 93. It’s fine to use a separate battery to provide the 12v power to the sensor (red wire), but you need to make sure the Ground pin of the Mayfly is connected to that external battery, and the ground line of the sensor (black) is connected to the external battery as well. I assume you used the sensor’s two RS485 wires (green & blue) to connect to some sort of modbus-to-PC adapter so you could use their software to change the SDI-12 channel number? For future reference, you can use the Mayfly to change that channel number using the example “b_address_change” sketch included in our SDI-12 library. Once you’ve deployed your sensor and don’t need to access the RS485 wires anymore, make sure you cover the bare ends of the green and blue wire and don’t let them touch anything on the Mayfly board or other pins in your logger enclosure.
I would also suggest removing line 172, because it’s going to reprogram the RTC time every time the board is turned on or restarted to whatever time you’re written in line 34. If you’ve got a CR1220 coin cell battery in the Mayfly’s battery holder, there’s no reason to set the clock more than once. It’s best to set the clock in a sketch all by itself, then verify that it’s synchronized, then upload any other sketch you want and the clock will keep the correct time for several years, until either the CR1220 dies or is removed.
-
2021-06-29 at 8:20 PM #15630
Thank you for the useful advice. I grounded the Mayfly to the 12v battery ground and voila! The RDO is reading perfectly. Never would have thought of that one so you saved me a ton of time. Thanks!!!!
-
-
AuthorPosts
- You must be logged in to reply to this topic.