@dan-wachusett
Active 1 months agoForum Replies Created
-
AuthorPosts
-
Neil/Anthony,
I think we will be able to purchase one Keller CTD this year and I will work on getting it going on the Mayfly 1.1 in whatever spare time I can find in my schedule. I appreciate all the input so far and I am looking forward to digging into this in the coming months. I will keep you both posted as I get going… I’m sure there will be lots of questions. Gathering any necessary hardware will be the first step, so I will check out the RS485 driver wing board you mention above. Unfortunately, working for a government agency makes it rather impossible for me to purchase additional sensors for testing/development.
Regards,
Dan
Thanks for the advice Neil, I think you helped me figure out a path forward here. I have a stream with long-term monitoring data that I do not want to interrupt, so my inclination is to use a sensor that I know how to use (Hydros 21) and if budget/free time allows I would purchase the Keller CTD without being under any time constraints to get it deployed. From the input that you and Anthony provided I am fairly confident that the Keller CTD sensor could work with the Mayfly… I just need to figure out if I can realistically dedicate the time needed to take the lead in figuring it out. It certainly sounds interesting and I know it would be a great learning opportunity.
Thanks for the information everyone, I really appreciate it!
It sounds like RS485 is the way to go if I want to keep it simpler and use methods similar (hopefully) to the Acculevel 0r Nanolevel sensors. The RS485 interface only requires 3.2 V, so does this mean that no voltage booster/level shifter would be required?
The RS485 version would have 4 wires in the cable (power, ground, RS485A, RS485B)… would I be able to connect this to the Mayfly using the EnviroDIY Multipurpose 6-pin Screw Terminal Grove Adapter?
At the moment I am a bit hesitant to be the first to try this sensor with the Mayfly given that I only have a very limited understanding of the electronics and communications protocols. If I were to do this I would need a fair amount of assistance along the way, and I have no idea how simple/complicated this would be.
If there were interest from others and expertise to lend, I could be up for the challenge.
Thanks for your input Neil and Cal. I pulled my station from the field where the battery was not recharging so I could do some testing. I’ll report back with my testing results to see if anyone has any advice. I would still be interested in the 12 v battery option if anyone out there uses one successfully with their Mayfly board v 0.5.
2021-11-02 at 12:12 PM in reply to: Mayfly not writing to SD card = possibly a libraries issue? #16092I am experiencing a similar issue that may be related, although without the RTC issue…
- Built with Modular sensors v0.30.0
- Data is saved to SD card when connected to computer via cable. RTC time is correct (or close enough)
- If I disconnect the board from the computer it fails to wake up or log any data to the SD card
- Battery voltage is sufficient (3.88 V, tested with multimeter)
- One of my boards was operating fine using a previous sketch and prior version of modular sensor dependencies, so I don’t think its a hardware issue. I am experiencing the exact same problem on 6 boards.
I’ve included my sketch below (UUIDs and Tokens have been scrubbed). I have seen sketch examples (DRWI_LTE.ino) where the wake pin is set to 31, whereas I have it set to A7. Perhaps this is the issue? If anyone has any thoughts or suggestions for troubleshooting please let me know.
Thanks,
Dan
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367/*****************************************************************************Mayfly_WACH-MD01.inoWritten By: Sara Damiano (sdamiano@stroudcenter.org)Development Environment: Arduino IDEHardware Platform: EnviroDIY Mayfly Arduino DataloggerSoftware License: BSD-3.Copyright (c) 2017, Stroud Water Research Center (SWRC)and the EnviroDIY Development TeamThis example sketch is written for ModularSensors library version 0.23.16This sketch is an example of logging data to an SD card and sending the data toboth the EnviroDIY data portal as should be used by groups involved withThe William Penn Foundation's Delaware River Watershed InitiativeDISCLAIMER:THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN.* Modified by Dan Crocker - October 2021*****************************************************************************/// ==========================================================================// Defines for the Arduino IDE// In PlatformIO, set these build flags in your platformio.ini// ==========================================================================#ifndef TINY_GSM_RX_BUFFER#define TINY_GSM_RX_BUFFER 64#endif#ifndef TINY_GSM_YIELD_MS#define TINY_GSM_YIELD_MS 2#endif// ==========================================================================// Include the base required libraries// ==========================================================================#include <Arduino.h> // The base Arduino library#include <EnableInterrupt.h> // for external and pin change interrupts#include <LoggerBase.h> // The modular sensors library// ==========================================================================// Data Logger Settings// ==========================================================================// The name of this fileconst char* sketchName = "Mayfly_WACH-MD01.ino";// Logger ID, also becomes the prefix for the name of the data file on SD cardconst char* LoggerID = "WACH-MD01";// How frequently (in minutes) to log dataconst uint8_t loggingInterval = 15;// Your logger's timezone.const int8_t timeZone = 0; // UTC// NOTE: Daylight savings time will not be applied! Please use standard time!// ==========================================================================// Primary Arduino-Based Board and Processor// ==========================================================================#include <sensors/ProcessorStats.h>const long serialBaud = 115200; // Baud rate for the primary serial port for debuggingconst int8_t greenLED = 8; // MCU pin for the green LED (-1 if not applicable)const int8_t redLED = 9; // MCU pin for the red LED (-1 if not applicable)const int8_t buttonPin = 21; // MCU pin for a button to use to enter debugging mode (-1 if not applicable)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 pin (-1 if not applicable)const int8_t sdCardSSPin = 12; // MCU SD card chip select/slave select pin (must be given!)const int8_t sensorPowerPin = 22; // MCU pin controlling main sensor power (-1 if not applicable)// Create the main processor chip "sensor" - for general metadataconst char* mcuBoardVersion = "v0.5b";ProcessorStats mcuBoard(mcuBoardVersion);// Create battery voltage variable pointers for the processorVariable* mcuBoardBatt = new ProcessorStats_Battery(&mcuBoard, "12345678-abcd-1234-ef00-1234567890ab");/** End [processor_sensor] */// ==========================================================================// Wifi/Cellular Modem Options// ==========================================================================/** Start [xbee_cell_transparent] */// For any Digi Cellular XBee's// NOTE: The u-blox based Digi XBee's (3G global and LTE-M global)// are more stable used in bypass mode (below)// The Telit based Digi XBees (LTE Cat1) can only use this mode.#include <modems/DigiXBeeCellularTransparent.h>// Create a reference to the serial port for the modemHardwareSerial& modemSerial = Serial1; // Use hardware serial if possibleconst int32_t modemBaud = 9600; // All XBee's use 9600 by default// Modem Pins - Describe the physical pin connection of your modem to your board// NOTE: Use -1 for pins that do not applyconst int8_t modemVccPin = -2; // MCU pin controlling modem powerconst int8_t modemStatusPin = 19; // MCU pin used to read modem statusconst bool useCTSforStatus = false; // Flag to use the modem CTS pin for statusconst int8_t modemResetPin = 20; // MCU pin connected to modem reset pinconst int8_t modemSleepRqPin = 23; // MCU pin for modem sleep/wake requestconst int8_t modemLEDPin = redLED; // MCU pin connected an LED to show modem// status (-1 if unconnected)// Network connection informationconst char* apn = "vzwinternet"; // The APN for the gprs connectionDigiXBeeCellularTransparent modemXBCT(&modemSerial, modemVccPin, modemStatusPin,useCTSforStatus, modemResetPin,modemSleepRqPin, apn);// Create an extra reference to the modem by a generic nameDigiXBeeCellularTransparent modem = modemXBCT;// Create RSSI and signal strength variable pointers for the modemVariable* modemRSSI = new Modem_RSSI(&modem, "12345678-abcd-1234-ef00-1234567890ab");Variable* modemSignalPct = new Modem_SignalPercent(&modem, "12345678-abcd-1234-ef00-1234567890ab");// ==========================================================================// Maxim DS3231 RTC (Real Time Clock)// ==========================================================================#include <sensors/MaximDS3231.h>// Create a DS3231 sensor objectMaximDS3231 ds3231(1);// Create a temperature variable pointer for the DS3231Variable* ds3231Temp = new MaximDS3231_Temp(&ds3231, "12345678-abcd-1234-ef00-1234567890ab");// Deleted Campbell Scientific Sensor - Not Applicable here// ==========================================================================// Meter Hydros 21 Conductivity, Temperature, and Depth Sensor// ==========================================================================/** Start [hydros21] */#include <sensors/MeterHydros21.h>const char* hydrosSDI12address = "1"; // The SDI-12 Address of the Hydros 21const uint8_t hydrosNumberReadings = 6; // The number of readings to averageconst int8_t SDI12Power = sensorPowerPin; // Power pin (-1 if unconnected)const int8_t SDI12Data = 7; // The SDI12 data pin// Create a Meter Hydros 21 sensor objectMeterHydros21 hydros(*hydrosSDI12address, SDI12Power, SDI12Data,hydrosNumberReadings);// Create specific conductance depth and temperature variable pointers for the Hydros21 sensorVariable* Hydros21Cond =new MeterHydros21_Cond(&hydros, "12345678-abcd-1234-ef00-1234567890ab");Variable* Hydros21Depth =new MeterHydros21_Depth(&hydros, "12345678-abcd-1234-ef00-1234567890ab");Variable* Hydros21Temp =new MeterHydros21_Temp(&hydros, "12345678-abcd-1234-ef00-1234567890ab");/** End [hydros21] */// ==========================================================================// Creating the Variable Array[s] and Filling with Variable Objects// ==========================================================================Variable* variableList[] = {Hydros21Cond,Hydros21Depth,Hydros21Temp,mcuBoardBatt,ds3231Temp,modemRSSI,modemSignalPct};// *** CAUTION --- CAUTION --- CAUTION --- CAUTION --- CAUTION ***// Check the order of your variables in the variable list!!!// Be VERY certain that they match the order of your UUID's!// Rearrange the variables in the variable list if necessary to match!// *** CAUTION --- CAUTION --- CAUTION --- CAUTION --- CAUTION ***const char* REGISTRATION_TOKEN = "12345678-abcd-1234-ef00-1234567890ab"; // Device registration tokenconst char* SAMPLING_FEATURE = "12345678-abcd-1234-ef00-1234567890ab"; // Sampling feature UUID// Count up the number of pointers in the arrayint variableCount = sizeof(variableList) / sizeof(variableList[0]);// Create the VariableArray objectVariableArray varArray(variableCount, variableList);// Put only the particularly interesting variables into a second array// NOTE: We can the same variables into multiple arraysVariable* variableList_toGo[] = {Hydros21Cond,Hydros21Depth,Hydros21Temp};// Count up the number of pointers in the arrayint variableCount_toGo = sizeof(variableList_toGo) / sizeof(variableList_toGo[0]);// Create the VariableArray objectVariableArray arrayToGo(variableCount_toGo, variableList_toGo);/** End [variable_arrays] */// ==========================================================================// The Logger Object[s]// ==========================================================================// Create a new logger instanceLogger dataLogger(LoggerID, loggingInterval, &varArray);// Create "another" logger for the variables to go out over the internetLogger loggerToGo(LoggerID, loggingInterval, &arrayToGo);// ==========================================================================// A Publisher to WikiWatershed// ==========================================================================// Device registration and sampling feature information can be obtained after// registration at http://data.WikiWatershed.orgconst char* registrationToken = REGISTRATION_TOKEN; // Device registration tokenconst char* samplingFeature = SAMPLING_FEATURE; // Sampling feature UUID// Create a data publisher for the EnviroDIY/WikiWatershed POST endpoint#include <publishers/EnviroDIYPublisher.h>EnviroDIYPublisher EnviroDIYPOST(loggerToGo, &modem.gsmClient, registrationToken, samplingFeature);// ==========================================================================// 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);}// Read's the battery voltage// NOTE: This will actually return the battery level from the previous update!float getBatteryVoltage(){if (mcuBoard.sensorValues[0] == -9999) mcuBoard.update();return mcuBoard.sensorValues[0];}// ==========================================================================// Main setup function// ==========================================================================void setup(){// Start the primary serial connectionSerial.begin(serialBaud);// 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);// if (String(MODULAR_SENSORS_VERSION) != String(libraryVersion))// Serial.println(F(// "WARNING: THIS EXAMPLE WAS WRITTEN FOR A DIFFERENT VERSION OF MODULAR SENSORS!!"));// Start the serial connection with the modemmodemSerial.begin(modemBaud);// 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);// Attach the modem and information pins to the loggerdataLogger.attachModem(modem);loggerToGo.attachModem(modem);modem.setModemLED(modemLEDPin);dataLogger.setLoggerPins(wakePin, sdCardSSPin, sdCardPwrPin, buttonPin, greenLED);// Begin the loggerdataLogger.begin();// Note: Please change these battery voltages to match your battery// Check that the battery is OK before powering the modemif (getBatteryVoltage() > 3.55 || !dataLogger.isRTCSane()){modem.modemPowerUp();modem.wake();modem.setup();// Synchronize the RTC with NISTSerial.println(F("Attempting to connect to the internet and synchronize RTC with NIST"));if (modem.connectInternet(120000L)){dataLogger.setRTClock(modem.getNISTTime());}else{Serial.println(F("Could not connect to internet for clock sync."));}}// Set up the sensors, except at lowest battery levelif (getBatteryVoltage() > 3.4){Serial.println(F("Setting up sensors..."));varArray.setupSensors();}// Power down the modemmodem.modemSleepPowerDown();// 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 correct// Writing to the SD card can be power intensive, so if we're skipping// the sensor setup we'll skip this too.if (getBatteryVoltage() > 3.4){dataLogger.turnOnSDcard(true); // true = wait for card to settle after power updataLogger.createLogFile(true); // true = write a new headerdataLogger.turnOffSDcard(true); // true = wait for internal housekeeping after write}// Call the processor sleepSerial.println(F("Putting processor to sleep\n"));dataLogger.systemSleep();}// ==========================================================================// Main loop function// ==========================================================================// Use this short loop for simple data logging and sendingvoid loop(){// Note: Please change these battery voltages to match your battery// At very low battery, just go back to sleepif (getBatteryVoltage() < 3.4){dataLogger.systemSleep();}// At moderate voltage, log data but don't send it over the modemelse if (getBatteryVoltage() < 3.55){dataLogger.logData();}// If the battery is good, send the data to the worldelse{dataLogger.logData();//loggerToGo.publishDataToRemotes(); // disable until SIM cards are installed}}@vogelrnws, thanks for the digi link… this does seem like something that could work very well to send information to AWS from a XBee modem. There are still several steps to figure out in terms of getting a Mayfly program to execute the python code that is on the modem, perhaps like calling a function?, with the sensor data as the message formatted in a JSON string. These details are way beyond my capabilities, so I can’t really pursue this option on my own. I am hoping to come up with a solution that utilizes existing modular sensor libraries with some minor tweaks. Maybe this is unrealistic, but I have neither the time or ability to develop a novel solution from scratch, on my own. I am very thankful to be able to take advantage of all the existing work and know-how in this community. I will keep researching options and report back if I find a solution that is within my technological reach.
@vogelrnws, We are using 4G LTE modems that are recommended by EnviroDIY with the LTE Bee Adapter. Verizon will send us SIM cards once we give them a list of IMEI numbers for the modems. Fortunately, our agency has access (with approval) for certain AWS storage/computing services, so I can take advantage of this since this project is relatively small, data-wise. I will only have 7 sensors sending data at 15 minute increments.
The main hurdles I need to address are items 2 and 3 in the original post on this thread. Basically, setting up a publisher script to push to an amazon endpoint, and configuring that endpoint to process the JSON data streams that get sent every 15 minutes.
Thanks for your input @neilh and @vogelrnws. I work for a state agency, so I have limited options when it comes to IT related endeavors, especially things that are new (like technology from the last 20 years). I am basically trying to follow pathways that have been lightly trodden, rather than attempt to blaze my own trail.
I am in the process of building some new monitoring stations with Mayfly loggers and Hydros-21 sensors pushing data over the cell network with 4G LTE modems. I have to use our existing Verizon accounts to add data plans using the M2M service, which actually seems pretty reasonably priced. I don’t mind using MMW for real-time data access, however my reason for wanting to push data to AWS is that we can leverage our existing account with ESRI to ingest data files from AWS into GeoEvent Server, which would enable us to make customized dashboards to display our real-time monitoring data. I know there are other options, but I first want to see if I can go the AWS/ESRI route because this workflow already has momentum at another agency in my state, and I can sort of “draft” behind that effort.
Personally, I am open to other options (like Thingspeak), however the hurdles in setting up new contracts for IT related services are almost insurmountable. Its not even a matter of cost ($650 a year is a pretty easy sell). However, I basically need to prove that this project will not work with our existing IT tools/products/services before anyone will entertain another option.
It took me 18 months just to purchase 1 Mayfly board due to all the bureaucratic and procurement protocols that are in place!
Thanks,
DanThanks Shannon, that is sound advice. We have 7 new Gen 2 Hydros-21 sensors and I will be delving in to this more later this summer. I do plan to test them in a controlled environment to make sure that the variation in output is within the accuracy range specified by the manufacturer.
Thanks @fisherba… I will take a look at the updated sketch. It seems like this correction should be part of the device firmware, but perhaps it was modified at some point and not included. I may try to apply this correction to my previous data downloads and see if fixes the issue. If so, then will update the sketch on the mayfly to perform this correction prior to writing data to the sd card. I’ll update this post with results once I get to it… which might not be until later this summer.
-
AuthorPosts