@ensign
Active 2 weeks, 6 days agoForum Replies Created
-
AuthorPosts
-
This sketch is also available here: https://github.com/ScottEnsign/SDoutput. I’d welcome input and refinement.
Hi @Selbig. Here is a very simple sketch that prints a file from the microSD card to the serial monitor. It might be too rudimentary for your purposes, but thought I would share it here. Notice the line “// SD.remove(“datalog.txt”);” is commented out. Uncomment this line to DELETE the file specified instead of printing it to the serial monitor. I find it is helpful for my work to have this option available when I need it.
Arduino12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970//This sketch displays the files on a Mayfly Data Logger microSD card to the serial monitor and then outputs//a specific file named in the sketch below to the serial monitor.#include <SPI.h>#include <SD.h>File root;void setup() {Serial.begin(9600); // Open serial communications and wait for port to openwhile (!Serial) {; // wait for serial port to connect. Needed for native USB port only}Serial.print("Initializing SD card...");if (!SD.begin(12)) { // digital pin 12 is the microSD slave select pin on Mayfly; see if the card is present and can be initializedSerial.println("Card failed, or not present"); // don't do anything morewhile (1);}Serial.println("card initialized.");Serial.println("");root = SD.open("/");Serial.println("Files on microSD card");printDirectory(root, 0);Serial.println("");Serial.println("Displaying file:");// SD.remove("datalog.txt"); // THE NUCLEAR OPTION!!! UNCOMMENT TO DELETE THE FILE!File dataFile = SD.open("datalog.txt"); // Name the file to be opened.if (dataFile) { // if the file is available, write to it:while (dataFile.available()) {Serial.write(dataFile.read());}dataFile.close();}else {Serial.println("error opening datalog.txt"); // if the file isn't open, pop up an error:}}void loop() {// put your main code here, to run repeatedly:}void printDirectory(File dir, int numTabs) { //This is a function that displays all the files on the SD card to the serial monitor.while (true) {File entry = dir.openNextFile();if (! entry) {// no more filesbreak;}for (uint8_t i = 0; i < numTabs; i++) {Serial.print('\t');}Serial.print(entry.name());if (entry.isDirectory()) {Serial.println("/");printDirectory(entry, numTabs + 1);} else {// files have sizes, directories do notSerial.print("\t\t");Serial.println(entry.size(), DEC);}entry.close();}}Fiona, if you haven’t already found it, check out Adam Gold’s blog about using the Mayfly with Atlas Scientific sensors. Adam’s github has documentation about a carrier board that may involve isolation.
Hi Dan,
We recently did some internal testing of this issue and will post results soon. We don’t have a “fix”, but we did measure this behavior to guide our own interpretation of data.
Scott
Hi James,
I’ve used Atlas Scientific’s RGB sensor on lagrangian river drifters in the past. The application is written up in Limnology and Oceanography (or see this video abstract of the article). I’m attaching two simple sketches for using this sensor with the Mayfly Data Logger. The first (…AutoMode) just prints R,G,B, and Lux at an interval to the serial monitor. The …ManualMode sketch allows you to interact with the sensor using the commands from the datasheet. Please keep the EnviroDIY community updated on your progress.
Thanks,
Scott
Attachments:
Thanks, Neil. That’s helpful to know that ThingSpeak via Modular Sensors might be a better option for this user’s purposes. He has an interesting classroom laboratory application that I’ll encourage him to share if he is able to pilot it at his college.
Hi Jim: I haven’t been following this thread but I’m excited that you are pushing through this to get your data streaming to MonitorMyWatershed! I’m glad Sara has been providing help. It occurred to me that you might reach out to Adam Gold (@adamgold) because he was using both Atlas Sci hardware and PlatformIO. He published a blog detailing his project and also maintains his own website that details what he’s designed. Perhaps there are some solutions there?
Thanks Jim!
Scott
Hi Oscamo. Indeed, I was formerly at Planktos Instruments but now at the Stroud Center. In responding to Sara’s comment about trajectory data being hard to visualize, check out this video showing dissolved oxygen data along 22 miles of the Neuse River in North Carolina.
We’ve been collecting trajectory data with drifter technology here at the Stroud Center; this post doesn’t show data but the video is fun.
Can you share more about the data you are trying to collect and what parameters?
Sensors, no. Autonomous orthophosphate wet chemistry, yes. Check out Green Eyes Science’s NuLab (http://gescience.com/nulab/) and Seabird’s hydrocycle (https://www.seabird.com/hydrocycle-po/product?id=54721314201). There are others out there, but these come to mind first.
-
AuthorPosts