Forum Replies Created
-
AuthorPosts
-
You don’t have to post the actual sketch here since it likely contains the unique URLs, registration tokens, and UUIDs that we’ve developed for transmitting the data to the online database portal. We can contact you directly through email to get the code and can then take a look at it to see what’s causing the instability. I have some ideas about what might be causing your problem. Once we figure that out, I can post an update here for anyone else who might be having similar issues.
Mayfly boards have been back in stock on Amazon since earlier this week. The starter kits should be available on Amazon next week.
What logging sketch was your Mayfly running? Was this a sketch that you wrote yourself, or is it one we provided to you with the board?
Depending on the browser you’re using, your save options might be worded differently in the drop down box when you right-click on a link. You could also just go directly to the library.zip file page: https://github.com/EnviroDIY/Libraries/blob/master/libraries.zip
and then click the gray “Download” button on the lower-right side of the page. Note that this is different than using the green “Clone or Download” button on the previous page. Because our library repository is linking to submodules and not actual files, that green button doesn’t work, which is why you have to download the actual “libraries.zip” file.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.
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.
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.
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.
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.
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.
-
AuthorPosts