Forum Replies Created
-
AuthorPosts
-
I tried to re-word the instructions on GitHub a little and get the link to the zip right so maybe it’s a little less confusing.
I’m sorry for the hassle. You also cannot use the Arduino IDE’s library manager to directly import the libraries; using “add zip library…” won’t work. You have to follow the longer instructions for manual installation because there are multiple libraries in the same zip. That is, you have to extract (unzip) the libraries.zip file into another folder on you computer and then copy all of the sub-folders into “..\<you>\DOCUMENTS\Arduino\libraries” or where ever your sketchbook libraries are stored on your computer.
If you would like your sensors added to the ModularSensors library, please create an issue for them there!
Please, like Shannon suggested, copy in your actual code using the “Add Code Snippet” button and actually attach your raw data, not a picture of it. Also, like Shannon said, please plot your EA and temperature to see how they look. And, again, like Shannon said, explain:
How were you testing the sensor? Was is installed outside or in a controlled environment? What kind of results were you expecting and what makes you think something is inconsistent?
I got and accepted your pull request. The fix is in the library now.
One more thing: If you’re going to use your Mayfly as a logger, make sure you set the real time clock first! I’ve written a sketch and tiny executable to synchronize the Mayfly with your computer clock. You can find it here: https://github.com/EnviroDIY/Sodaq_DS3231/tree/master/examples/PCsync
Yup, doing the soldering will make your 3.5mm jack connection much prettier and more secure than using the screw terminals. If you’re skilled with a soldering iron, it’s the way to go.
If you’re skill-less and solder-less like I am, the jacks with screw terminals are a solution.
If you would prefer, you can also look into the Modular Sensors library, which has functions already built into it for getting data from a Decagon CTD, a Decagon ES2, and a Decagon 5TM and then logging that data to a SD card.
If you downloaded the full package of libraries I mentioned in #2134, the Modular Sensors library is already included in it. If not, you download the zip at https://github.com/EnviroDIY/ModularSensors/archive/master.zip and unzip that for the Arduino IDE or install in PlatformIO using “pio lib -g install https://github.com/EnviroDIY/ModularSensors.git”.
Now that your sensor is connected and has an address set, you can get data from it using code like this:
C++1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071SDI12 mySDI12(_dataPin);mySDI12.begin();delay(500); // allow things to settlemyCommand = "";myCommand += _SDI12address;myCommand += "M!"; // SDI-12 measurement myCommand format [address]['M'][!]mySDI12.sendCommand(myCommand);Serial.println(myCommand); // For debuggingdelay(30);// wait for acknowlegement with format [address][ttt (3 char, seconds)][number of measurments available, 0-9]sdiResponse = "";while (mySDI12.available()) // build response string{char c = mySDI12.read();if ((c != '\n') && (c != '\r')){sdiResponse += c;delay(5);}}mySDI12.flush();// find out how long we have to wait (in seconds).unsigned int wait = 0;wait = sdiResponse.substring(1,4).toInt();Serial.print(F("Waiting ")); // For debuggingSerial.print(wait); // For debuggingSerial.println(F(" seconds for measurement")); // For debugging// Set up the number of results to expectnumMeasurements = sdiResponse.substring(4,5).toInt();Serial.print(numMeasurements); // For debuggingSerial.println(F(" results expected")); // For debuggingunsigned long timerStart = millis();while((millis() - timerStart) < (1000 * wait)){if(mySDI12.available()) // sensor can interrupt us to let us know it is done early{Serial.println("Wait interrupted!"); // For debuggingmySDI12.flush();break;}}delay(30);mySDI12.flush();Serial.println(F("Requesting data")); // For debuggingmyCommand = "";myCommand += _SDI12address;myCommand += "D0!"; // SDI-12 command to get data [address][D][dataOption][!]mySDI12.sendCommand(myCommand);Serial.println(myCommand); // For debuggingdelay(30);Serial.println(F("Receiving data")); // For debuggingmySDI12.read(); // ignore the repeated SDI12 addressfloat sensorValues[numMeasurements] = {0}; // Create an array to receive datafor (int i = 0; i < numMeasurements; i++){float result = mySDI12.parseFloat();sensorValues[i] += result;Serial.print(F("Result #")); // For debuggingSerial.print(i); // For debuggingSerial.print(F(": ")); // For debuggingSerial.println(result); // For debugging}// Wait for and discard anything elsemySDI12.flush();Once you have an array of values from the sensor, you can save them to an SD card or anything you’d like.
The next step is to set the SDI-12 address of the sensor. Communication with the sensor depends on its 1-character alphanumeric address (1-9, A-Z, a-z). Unfortunately, Decagon ships all of its sensors programmed to an SDI-12 address of 0, which cannot be used to get measurements from the sensor.
Within the SDI-12 library on GitHub, there is an example with instructions for changing the address. Find it here: https://github.com/EnviroDIY/Arduino-SDI-12/tree/master/examples/b_address_change
-
AuthorPosts