Forum Replies Created
-
AuthorPosts
-
Are you following the instructions from the top of this page to add the Mayfly board to your IDE: https://www.envirodiy.org/mayfly/software/
You should be able to copy-and-past the URL of the json file into the appropriate place in the IDE Preference window and then the IDE will fetch the file and load it properly. We haven’t made any changes to the board definition files in several years, so there shouldn’t be any problems. What version of the Arduino IDE are you using?
That panel wouldn’t be a problem. Any panel that produces 6v will be safe for the Mayfly, but some cheap 6v panels actually produce higher than 6v in direct sun, so you should measure it (under load) in full sun to make sure it won’t output higher than the max input voltage of the MCP73831 (7 volts). The solar charger on the Mayfly boards v0.5b and earlier will limit the charging current to 500ma output to the battery no matter what the solar panel power output is, so you won’t damage the battery.
Are you using Windows or Mac for connecting to the Mayfly board? Have you tried more than one USB cable? Are these two unresponsive Mayfly boards brand new or are they running previously-programmed sketches? Are there any LEDs that light up when you power the Mayfly board, either from a USB cable or a LiPo battery pack? Is the small slide switch near the FTDI connector set to the “USB/Lipo” setting and not the “Ext” setting?
Those sensors use Modbus RS485 protocol to communicate with a host device, which the Mayfly logger can’t do natively do with its current hardware, so you’ll need to add either an aftermarket RS485-to-TTL interface board, or build one like Anthony (@aufdenkampe) has done. He, and a few other people on the forum, have deployed some Yosemitech sensors for quite awhile and should be able to provide some feedback about their performance.
There’s not a direct replacement for that sensor, meaning one with the same operating specs and output. There are some alternatives, but most are significantly more expensive, or require different interface hardware (like the Yosemitech sensors), or Turner Cyclops sensors (but require user calibration). Unless you need a turbidity sensor immediately, I’d recommend waiting just a little bit longer and there will be some good sensor options unveiled soon.
Campbell Scientific discontinued the OBB3+ sensor about a year ago. They have new turbidity sensor models in development, but I’ll let them make the announcement about when it will be ready.
No, the Meter Group sensor will not work with Modular Sensors if its address is set to ‘0’. When it’s set to ‘0’, the data string is not in proper SDI12 delimeted format and Modular Sensors won’t be able to see anything. Plus, the only way to get it to take multiple readings would be to turn the sensor power off and back on each time you want to take a reading, and use a Serial parsing code to capture the data instead of Modular Sensors SDI12 libraries.
So in order to use Modular Sensors code using SDI12 commands with a Meter Group sensor, you MUST change the channel to something other than ‘0’.
Meter Group sensors that use SDI12 protocol (like the Hydros 21) come from the factory with a default SDI12 address of ‘0’. Their sensors are programmed to output a serial data string containing the current measurement upon powerup if the address is set to ‘0’. Meter Group’s dataloggers all talk to their sensors like this. You can see it in action if you use a sketch using SoftwareSerial to monitor the sensor data pin and capture the serial data string immediately after you apply power to the sensor. That would work fine if you were only using one sensor on the bus, and only wanted one reading. Since we typically take 6 to 10 readings and average them, plus we usually have several other SDI12 sensors all connected to the same data wire, then having individual addressed for each sensor is imperative. If you connect 2 or more Meter Group sensors to the same data pin and they’re both set to channel ‘0’, they’ll both attempt to send the serial string at the same time, and you won’t be able to capture it properly with the Mayfly logger.
In order for the Meter Group sensors to properly respond to SDI12 commands, they need to be programmed to any other channel EXCEPT ‘0’.
Most other sensors don’t have this specification, and we sometimes leave them as ‘0’ if we’re just testing it. But for deployments, we’ve been using our own “in-house” channel allocations, just to keep things simple. For example, our turbidity sensors are usually channel ‘2’ or ‘3’, oxygen sensors are ‘5’, etc. That makes it a little easier to keep track of when juggling the sketches for hundreds of stations, each with different combinations of sensors.
I saw this happen with someone recently who was having the same issue with data not showing up online and getting the 504 response code. Turns out it was a missing UUID in the list of sensor variables in the Arduino sketch. When there’s a mismatch between the string you send Monitor My Watershed and what it’s expecting, you get the 504 response. I can’t see the original string that was posted before Sara edited to remove the UUIDs, but it appears that there’s a UUID missing from the string right before the last parameter (which I’m guessing is cell signal percent?)
So make sure there are the same number of parameters in the sketch as what the website is expecting, and that the sketch code in the two sections that deal with the UUIDs and parameters are matched up properly.
No, there is not a built-in voltage divider on the Mayfly to protect either the 1284p’s 10-bit ADC or the auxiliary 16-bit ADS1115 ADC input. The jumpers on the Mayfly that let you select the Switched 3.3 or Switched 5v only change the voltage that’s supplied to the Grove jack’s VCC pin. There’s nothing to protect the Mayfly’s ADC inputs from overvoltage because there’s an infinite number of input voltages someone could attach to the Mayfly, so it’s up to the users to make sure they reduce their signal to keep it under 3.3v. (A little history: the Mayfly board was originally designed to work with a turbidity sensor that needed 5v excitation but produced a 0-2.5v output, so overvoltage was never a concern until the board started being used by a wider audience, and later once we started using other analog-output sensors with outputs like 0-5v.)
From the link you provided, it doesn’t appear that there’s any sort of voltage divider included in that interface device. It specifically says it’s a 0-5 volt module, so there doesn’t appear to be any way to force it to adjust its output voltage range. It also says it needs 6-30v excitation, so I’m curious what you’re using to power it. I’m guessing there are other resistance-to-voltage modules out there that would operate just fine on 3.3v excitation and have a 0-2.5v or 0-3.3v output, or even better – a digital output like I2C or SPI. You can also have your Mayfly do the resistance to voltage measurement with just a little bit of hardware and some code.
But if you want to continue using the 0-5v module, you’ll need to lower it to a safer range in order for the Mayfly to read it properly. When I have a sensor with a 0-5v output, I put two perfectly matched 100k resistors (check the resistance with a precision ohm-meter of about a dozen 10% precision resistors and you’ll find a couple that are the same) in series between the sensor output and ground, and then read the voltage in the middle of the two resistors and you’ll get exactly half. So for a sensor with a 0-5v output, you’ll now get a range of 0-2.5v. If you really wanted to maximize your resolution, you could use a 2/3 resistor divider to give it a range of 0-3.3v, but with the ADS1115, we’re already getting resolution finer than a fraction of a millivolt, so it’s doubtful you’d see much improvement between using a 1/2 divider when compared to a 2/3 divider.
As for your code, I have a few suggestions. Line 52 should be removed. The Pin 2 you mentioned in that pinMode statement is actually the 1284p processor’s pin 2, which is the secondary UART RX pin, so if you were using something like a Bee module, that could cause problems. In line 38, you declared the variable eTapePin was defined as 2, and because that’s the channel number of the aux ADS1115, there’s no reason to set the pinMode for it. You only have to use the variable name when making the readADC statement like you did in line 64. And filling an array in order to find the median uses more memory and takes lots of complicated code when compared to a simple averaging loop, especially if you later want to increase the number of readings.
Here’s a sketch I used recently for taking 100 readings (10ms apart) from the ADS1115 aux analog pin and then averaging them and displaying the result to the serial monitor. If the signal you’re measuring is 3.3v or less, no change is necessary. If you’re measuring a voltage like 5v, use a 50/50 voltage divider to cut the voltage in half and then use line 76 to calculate the average voltage instead of line 74.
Arduino123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778//Takes lots of readings from the EnviroDIY Mayfly's ADS1115 Aux Analog ADC and averages them, prints to screen#include <SPI.h>#include <Wire.h>#include <Adafruit_ADS1015.h>Adafruit_ADS1115 ads; // The Mayfly's ADS1115 Aux ADC is 16-bit versionfloat average_volts; //variable to hold the calculated averageint State8 = LOW;int State9 = LOW;int aux_channel = 2; //channel number of whatever pin you've got your input connected to for the ADS1115 Aux Analog chip (AA0 = 0, AA1 = 1, AA2 = 2, AA3 = 3)int readcount = 100; //the number of readings you want to take for each sampleint time_between_readings = 10; //number of milliseconds between each reading in a samplevoid setup(){Serial.begin(57600); //Start the serial connection with the computerads.begin(); //begin adafruit ADS1015pinMode(8, OUTPUT); // define the red and green LEDs as outputspinMode(9, OUTPUT);digitalWrite(8, HIGH); //turn on one of the LEDs to start withdigitalWrite(9, LOW);pinMode(22, OUTPUT); //switched power pin declared as outputdigitalWrite(22, HIGH); //turn on the Switched sensor voltageSerial.println("EnviroDIY Mayfly Aux-Analog Averaging Sketch ");Serial.print("Aux ADC Channel: ");Serial.print(aux_channel); Serial.print("(AA"); Serial.print(aux_channel);Serial.print(") Number of readings per sample: ");Serial.println(readcount);Serial.println("-------------------------------------------------------------");delay(2000); //wait 2 seconds}void loop(){auxanalog_sample(); //go take a measurement with the ADS1115//blink the red and green LEDs in alternating fashion on each loopif (State8 == LOW) {State8 = HIGH;} else {State8 = LOW;}digitalWrite(8, State8);State9 = !State8;digitalWrite(9, State9);Serial.print("Averaged analog voltage (volts): "); //print the results to the serial monitorSerial.println(average_volts,5);delay(100); //wait a little bit between loops, adjust as you want} //end loopvoid auxanalog_sample() // function that takes reading from ADS1115 Aux Analog chip on Mayfly{int16_t adc_bits = 0; //int to hold the value of the bits that get readfloat bit_sum = 0.0; //sum of all the bits readfor (int i = 0; i < readcount; i++){adc_bits = ads.readADC_SingleEnded(aux_channel); //take a single-ended reading with the ADS1115bit_sum += adc_bits; //add the latest reading to the sumdelay(time_between_readings); //wait x milliseconds between readings, adjust as you want}float average_bits = bit_sum / readcount; //find the average by dividing the bit_sum by readcount//now convert bits into voltsaverage_volts = (average_bits * 3.3)/17585.0;// use this next line instead of the previous line if you're using a voltage divider to reduce an external sensor's voltage// average_volts = ((average_bits * 3.3)/17585.0) * 2.0; //multiply by 2 if you used a 50/50 divider} -
AuthorPosts