Forum Replies Created
-
AuthorPosts
-
It’s hard to tell exactly what’s going on with your wires from the photo, but you should make sure your separate power supplies are sharing a common ground. If you’ve got 12v going to the sensor and 5v going to the board, you need to have the ground of both of those supplies (or batteries) connected to the same ground as the Mayfly.
I edited your original post to put the code into the Code Snippet tool.
I check every one of the Mayfly boards thoroughly before they get sent out to Amazon, so it’s possible that one with an FTDI or USB jack issue slipped by since that’s the only part of it that I don’t check. Send me an email to mayfly@envirodiy.org and I’ll see what I can do about addressing the overheating board issue.
I edited your post to move the sketch code into code snippet box. Next time, use the “Add Code Snippet” button at the top of the text editor box when you’re writing a post or comment. It makes it much easier to read, especially for long sketches.
It’s very easy to add an integer or characters to a string, you did it correctly with the line 263: data += samplenum
However, that only works for integers and characters (or words). But you can’t do that with floating point numbers. To add a floating point number to a string, the best way to do that is with a separate generic function you can paste into the very bottom of any of your sketches:Arduino123456static void addFloatToString(String & str, float val, char width, unsigned char precision){char buffer[10];dtostrf(val, width, precision, buffer);str += buffer;}So then anytime you want to add floating point numbers (like batteryvoltage and turbvoltage) to your data string, just use these lines:
Arduino123addFloatToString(data, batteryvoltage, 4, 2);data += ",";addFloatToString(data, turbvoltage, 6, 4);Notice that you can adjust the number of significant digits (numbers after the decimal point) by changing the value for precision.
You can see an example of how I did all this in the Sleeping Mayfly Logger example on the sample code page:Also something to note, in line 269 you have 5.0 in the formula for the board voltage, but that should be 3.3 since the Mayfly board voltage is 3.3, and not 5 like in most other Arduino boards. Are you powering your turbidity sensor with 3.3v or 5v, and what is the output voltage range of your sensor? Feeding anything greater than 3.3v back into the analog input pin (A0 in your code) will damage the Mayfly, so you should either use a voltage divider or some other method to protect the Mayfly from excessive input voltage on the analog input.
Also, another fun trivia fact, if you simply want to print a float to the serial monitor, you don’t have to use the special function above, it’s only for adding floats to strings. To print a float to the serial monitor, just do this:
Serial.print(voltage);
But if you wanted to see 4 significant digits, do this:
Serial.print(voltage,4);
The default precision for printing a number in Arduino is only 2 significant digits. So if you want anything more than that, just put a comma followed by the number of places you want to see. It’s a handy trick to know, but not mentioned widely enough that it is common knowledge.
The Mayfly logger processor is just like any other Arduino board, and loading sketches onto it is just like any other Arduino board. The uploaded sketch is “burned” into the microprocessor chip in the center of the board. The microSD card slot is just an optional device to allow users to store recorded variables or other data during the subsequent operation of the logger. The Mayfly is not like a Raspberry Pi that has an actual operating system and executable files on the memory card.
Regarding SDI-12 addressing, you can connect a Hydros 21 sensor to any pins you want, you just need one data line, one power excitation line, and one ground line. Are you using a sensor with bare wires or did you purchase one with the 3-pin stereo plug (3.5mm)? If you’re using the stereoplug-to-grove adapter board that we sell, then just use a grove cable to connect the adapter board to the Mayfly’s D6-D7 grove jack, and then you would use data pin 7 in the sketch. If you’re using a bare wire sensor, then you’re free to connect them to any free digital pin, but for simplicity you should use D7 when starting out so you don’t have to change the sketch. The reason for the power excitation pin D22 in the sketch is that the onboard switchable voltage regulator is controlled by turning on pin D22. But you need to hook any external sensors you want to operate to the “Switched 3v” line because that’s where the actual switched power comes from, and not D22. Again, this is taken care of if you’re using the grove jack stereo plug adapter board, but you have to hook it up right if you’re using a bare wire sensor. Whenever D22 is on, there’s a red LED in the bottom corner of the Mayfly that comes on to indicate that the sensor (and anything else on the switched 3v or switched 5v line) is being powered.
The Mayfly is not designed to have 2 microSD cards inserted at the same time. No one should ever insert two cards. The reason for the second vertical socket is for people who have the logger mounted inside an enclosure that makes it difficult to remove the card in the regular horizontal socket. Various electrical irregularities will occur if you use two cards at the same time, and the processor will only write to one card anyway, so there’s no benefit to having two cards in together.
So are you saying that the board performs properly as long as you’re using only one card? Because I have seen a few of the optional vertical memory card adapter boards have the bent pin that results in the short circuit when a single card is inserted. The issue is fixed by simply replacing the vertical memory card board. I’ve never seen a Mayfly have the issue with the onboard horizontal memory card socket because that’s one of the things I test for before shipping each Mayfly.
What you’re describing with the microSD card is definitely not normal. I’ve encountered it only a few other times in over 1000 boards, and it’s usually caused by a bent pin inside the microSD socket that causes a short circuit when a card is inserted. Is this a brand new board? And are you seeing this behavior with the microSD socket that’s built into the Mayfly, or with the supplemental vertical microSD card adapter board (that comes with the starter kit) that plugs into the 8-pin SPI header between the power switch and the D21 pushbutton? And do you see this same behavior with various microSD cards, or just one? Sometimes a malfunctioning microSD card will cause the problem instead of the socket itself.
It sounds like your PC is just not seeing the Mayfly. You should make sure the Mayfly is turned on at the main power switch, and that the small power-select slide switch is set to the USB/Lipo setting (not Ext). Sometimes the switches can be a little glitchy, so you can try sliding them back and forth to make sure they’re getting good contact. And also ensure that you’re using a proper microUSB cable, like the one that came with the starter kit, if you bought one. Some users have reported issues with cheaper cables due to bad connections, broken wires, or bent pins on the cable. And verify that you’ve chosen the proper COM port in the Arduino IDE settings. Sometimes your computer will assign a new COM port to the Mayfly, but the IDE doesn’t always update the COM setting to the newest port, so it’s looking for the Mayfly on the wrong port.
The 4G LTE modules we use are brand new and have only been available for a few weeks. I just stocked the LTE bee adapter board in our Amazon storefront last week too, so the materials you need for building the signal tester are so new that I haven’t had a chance to document the building and programming process. I’ll be building a few more once I get back in the office in early August after all my workshop and conference travels currently happening, so hopefully I can post some instructions and code so you can build your own. In the meantime, you can use any AT&T cell phone to see if you’ve got LTE coverage. When we were using the older 2G GPRSbee modules, they utilize T-mobile networks that are starting to be phased out all over the country, so having a dedicated 2G T-mobile signal tester was the only way to test for the specific coverage that those modules needed. It also helps that my new LTEbee adapter has a signal strength indicator LED on it so just powering the board with a module attached will give you an instant indicator of signal availability and strength, even without programming the Mayfly and having a dedicated LCD display.
The way a voltage divider works is for you to use 2 resistors in series, and then you measure the junction between the two resistors, and you’ll see a fraction of the overall voltage. The best method for breaking a 5v signal down to something the Mayfly can tolerate would be to use two identical value resistors (like 10k-ohms each), so that way the point your measuring is exactly half of the overall voltage, hence the *2 multiplication in my formula above. You can use any ratio you want, but a pair of identical resistors is easiest for your first voltage divider.
Also, you need to use 3.3 volts as the board voltage in your conversion formula and not 5.0 volts. And if you’re measuring a 50/50 voltage divider, you’ll then need to double the measured voltage to get the true sensor voltage. So:
float voltage = (sensorValue * (3.3 / 1023.0)) * 2.0;
-
AuthorPosts