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

Shannon Hicks

Forum Replies Created

Viewing 10 posts - 461 through 470 (of 568 total)
  • Author
    Posts
  • in reply to: Interrupt #2228
    Shannon Hicks
    Moderator

      Because the v0.5 board can now accept an input supply voltage up to 12v, I had to change the onboard voltage divider that’s used for measuring the battery voltage by way of A6. So the formula for reading the battery voltage on a v0.3 or v0.4 board is this:

      rawBattery = analogRead(A6);
      sensorValue_battery = (3.3 / 1023.) * 1.47 * rawBattery;

      But for boards v0.5 and later, the formula is now this:

      rawBattery = analogRead(A6);
      sensorValue_battery = (3.3 / 1023.) * 4.7 * rawBattery;

      This is built in to the MayflyOnboardSensors library we posted recently on Github. More instructions will hopefully be posted soon about how to use all of our new libraries.

      EDIT: I’ve also updated the Battery Measurement example to show both formulas.

      in reply to: Interrupt #2226
      Shannon Hicks
      Moderator

        The Mayfly has 3 hardware interrupts. They are RXD1 (INT0), TXD1 (INT1), and D10 (INT2). To use the “attachInterrupt” function, you can only use the three hardware interrupt pins, and you have to refer to them as “0”, “1”, or “2”. So if you want to use the D10 interrupt pin, you’ll need to say the following on line 8:

        attachInterrupt(2, countUp, CHANGE);

        You also don’t have to define the interrupt pin in line 1 of your above code, or set the pinMode in line 7, so remove both of those lines.

        Depending on what hall effect sensor you’re using, you’ll probably need to use a pullup resistor on the output of the sensor. If you’re using the Mayfly v0.5, you can use the optional onboard pullup resistor for D10 by closing SJ12, meaning you can measure a switch like the hall effect sensor as an interrupt with no additional parts.

        in reply to: Mayfly availability #2223
        Shannon Hicks
        Moderator

          For anyone wondering about current Mayfly availability, I just received the shipment from the manufacturer today. I’ll be working to get them to Amazon by the end of the week. I sent in a bunch more of the protoshields today, next I’ll be sending lots of both the bare Mayfly boards and the starter kits.

          in reply to: Recording data from pressure sensors on an SD card #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”. Then remove all the extra Serial.begin(9600) statements so there’s only one at the beginning of the setup function. And remove the RTC stuff on lines 11, 16, and 41. See if that will write the data to your card.

            in reply to: Powering V0.5 with >12V #2208
            Shannon Hicks
            Moderator

              That’s a good question, thanks for asking: The new v0.5 board will handle an absolute maximum input voltage of 16v, so you should be okay. The 12v limit is the maximum “recommended” voltage. A charger for a 12v battery will output 13 or 14v, but it’s still safe to use that with the Mayfly (version 0.5 only). The older v0.3 and v0.4 boards get way too hot if you put more than 6v on the external input because the onboard solar charging regulator has a max input of 7v. The switch on the new v0.5 disconnects the charging regulator as well as protects the USB port (and your computer) from any accidental overvoltage coming from the external source.

              in reply to: Recording data from pressure sensors on an SD card #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() function and that’s it.

                You don’t have to set the date and time of the RTC every time you run the sketch. The way it is written in your examples means that the clock gets programmed with that prewritten date/time every time the board boots up, which is definitely not something you ever want to do. If you’re using a Mayfly (or any real-time-clock) module with a battery backup (the little silver watch-battery), then your RTC will remember the correct date and time for many years, so you only need to set that time once using a standalone sketch like the “Adjust” example sketch with the SODAQ_DS3231 library. Once the clock is set, you can remove all of the lines in your logger sketches that were essentially re-setting it each time. So in the above sketch, remove lines 11, 16, and 41.

                I’ll see if I can add the code for SD functionality to the second sketch you posted and attempt to compile it on my computer.

                in reply to: inconsistent Results #2181
                Shannon Hicks
                Moderator

                  I plotted the temperature and VWC on the same chart and you can see that they are very much linked together. Can you answer whether the sensor is completely buried in the soil, and if so how deep is it? If only the fiberglass tines are inserted into the soil but the rest of the sensor body is above ground and subjected to direct sunlight or drastic temperature swings, then I would assume that’s what causing the issue.

                  Can you also post the actual sketch you used on your Arduino board to capture your data and write it to the memory card. I can also show you how to record more significant digits for the VWC parameter so that you get finer resolution and a smoother curve. But I need you to post the actual sketch you used for the logger. And tell us exactly how the sensor was installed in the ground. Can you repeat this experiment indoors where the temperature is constant and in a pot of soil or somewhere where you can purposely vary the moisture content?

                  Attachments:
                  in reply to: inconsistent Results #2174
                  Shannon Hicks
                  Moderator

                    The graph looks more like a plot of temperature rather than VWC. Are you sure you’re plotting the right column of data? What are you using to actually record the data? Your sketch doesn’t output the data to a file or even print it in a easily-captured string out to the serial port, so I’m wondering how you collected multiple days of data. Plot your other variable and see what it looks like. The code also shows that you’re using 2 sensors. What does the data from the second sensor look like? The easiest way to see if a probe is working properly is to install 2 of them in the same location and in the same media and see if you get similar results for both of them.

                    in reply to: inconsistent Results #2169
                    Shannon Hicks
                    Moderator

                      It would be helpful for you to attach a jpg of png image of your graph instead of a Powerpoint slide. You also can’t attach the raw .ino file to forum posts, but you can cut and paste it using the “code” tags in the post editor tools.

                      And on your graph, can you please label both the x and y-axis? I don’t know what parameter you’re graphing and on what time scale your measurements covered. I’m assuming your graph shows either temperature or soil moisture. 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?

                      in reply to: Setting the real time clock #2161
                      Shannon Hicks
                      Moderator

                        Did you try running the PCsync.exe file on your computer with the Mayfly attached? That method worked for me last time I tried it. But I usually just use the adjust.ino sketch available in the Examples folder of the Sodaq_DS3231 library. Or you could use any DS3231 library since there’s nothing unique about the Mayfly’s RTC configuration.

                      Viewing 10 posts - 461 through 470 (of 568 total)