Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of WikiWatershed, an initiative of Stroud Water Research Center designed to help people advance knowledge and stewardship of fresh water.
New to EnviroDIY? Start here

Recording data from pressure sensors on an SD card

Home Forums Mayfly Data Logger Recording data from pressure sensors on an SD card

Viewing 12 reply threads
  • Author
    Posts
    • #2188
      MillerG
      Participant
        Hello,

        I have a Mayfly data logger and am looking for some advice on how to log data from 2 pressure sensors onto an SD card. I am a novice in the data logger community so please, bear with me.

        I

      • #2189
        Anthony Aufdenkampe
        Participant
          MillerG, thanks for posting your question here!

          In the meanwhile, have you successfully run the “Simple File Example” sketch? It’s here: https://envirodiy.org/mayfly/software/simple

        • #2190
          Sara Damiano
          Moderator

            If you would like your sensors added to the ModularSensors library, please create an issue for them there!

          • #2192
            MillerG
            Participant
              Anthony,

              I have run that Sample Code but do not have success when I try to merge it in with my code.

              This is my current code:

            • #2193
              MillerG
              Participant
              • #2195
                Shannon Hicks
                Moderator
                  The first couple things that stand out are this:

                  You don’t have to say “Serial.begin(9600)” more than once in your sketch. Just do it once near the beginning of your setup() functi

                • #2206
                  Anthony Aufdenkampe
                  Participant
                    MillerG, can you paste in the error codes you get with your first sketch?
                    Also, I reformatted your first sketch so that it would render better, but I’m slightly worried that I may have messed so
                  • #2210
                    MillerG
                    Participant

                      I don’t get an error code from the sketch. The sketch will upload and show data in the serial monitor. But, it will not log the data onto an SD card, which is my goal.

                    • #2211
                      MillerG
                      Participant

                        Anthony,

                        The first code complied just fine. I will try and upload it to the Mayfly later and let you know how it goes. Thanks!

                      • #2212
                        Shannon Hicks
                        Moderator
                          Something I’m not seeing in your first sketch is where you declare what chipselect pin for the SD card. On the Mayfly it’s 12, so on line 42, change the “SS” to “12̶
                        • #2220
                          MillerG
                          Participant
                          • #2221
                            hank
                            Participant

                              in your main loop function, somewhere in lines 44-47 you need to call:

                              logData(dataRec);

                            • #2222
                              MillerG
                              Participant

                                Thanks Hank! You’re right, that was all we needed.

                            Viewing 12 reply threads
                            • You must be logged in to reply to this topic.