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

Mayfly Data Logger Software

Programming the EnviroDIY Mayfly

You can use the free Arduino IDE programming software to program the EnviroDIY Mayfly.

  1. If you’re following along with previous workshop tutorials or other instructional documents, you’ll want to use the Legacy IDE software (version 1.8.x). You must install the IDE software before connecting the Mayfly data logger to your computer with the USB cable. Download the Legacy IDE version (1.8.19) from Arduino.cc. If you already have the IDE installed on your computer, ensure you are using version 1.8.x, not a newer version that begins with 2.
    • NOTE: Windows users may need administrative privileges to install the software.
    • DO NOT use the cloud-based IDE or the Windows app version.
    • Users can attempt to use the newer IDE version 2.3.7, but some people have reported bugs and stability issues so the Legacy version is recommended.
  2. Once the Arduino IDE is installed, you will need to add the Mayfly board to the list of available boards. To do this:
    1. Start the Arduino software, then click on File > Preferences and paste the following URL into the box labeled Additional Boards Manager URLs and click OK: https://raw.githubusercontent.com/EnviroDIY/Arduino_boards/master/package_EnviroDIY_index.json
    2. Back in the IDE, click on Tools > Board > Boards Manager.
    3. Use the dropdown box to select Contributed, or search for EnviroDIY. You should then see an option for EnviroDIY ATmega Boards.
    4. Click the Install button to add the EnviroDIY boards to your IDE.

Now, when you click Tools > Board, you will see the EnviroDIY Mayfly 1284P listed either at the top or bottom of your list of available boards. Select that, and the IDE will be configured to program the Mayfly Data Logger.

Connecting a Computer to the Mayfly Data Logger

  1. Plug a USB-C cable into the Mayfly Data Logger, then plug the other cable end into a free USB port on your computer.
  2. Turn the Mayfly power switch to the on position. If this is the first time your board has been connected to your computer, wait while the computer recognizes the board and assigns it a COM port number. You might have to allow your operating system to install additional serial port drivers.
  3. To select the COM port, open the Arduino IDE. Select the COM port assigned to your Mayfly by selecting Tools > Port > COM2 (or COM3, COM4, etc.).
  4. If no COM ports are available, then your computer either doesn’t recognize the Mayfly, meaning that additional drivers need to be installed, or the computer doesn’t see the Mayfly because the board isn’t turned on, or you have a defective cable, or some other electronic issue. Mac computers will usually not need additional drivers installed. Windows PCs will sometimes need the driver to be manually updated. To do this, first download the Universal Windows Driver from this site and unzip the folder to your desktop. Then open your PC’s Device Manager, and you should see a device listed (usually under Ports-COM or Other Devices) with a yellow triangle indicating that it needs drivers. Right-click the device, then select Update Driver. When prompted, choose the Browse my computer for drivers option, navigate to the folder you just unzipped on your desktop, and click OK. It should then say that the driver was successfully updated, and now Windows should recognize your Mayfly board as a serial device, assign it a COM port, and you’ll be able to select it in the Arduino IDE by selecting Tools > Port > COM2 (or COM3, COM4, etc.).
  5. In the Arduino IDE, open the Serial Monitor (either the button in the upper right corner of the Arduino window or Tools > Serial Monitor). At the lower right of the serial monitor window, set the baud rate to 57600. All of the Mayfly boards have been preprogrammed with a sample sketch. This sketch instructs the Mayfly to blink the LEDs, take some onboard sensor readings, and report them to the PC via the Serial Monitor. You should now see that data is printed on the Serial Monitor every few seconds.

Installing Libraries

Preparing sketches for programming the Mayfly Data Logger is simplified by using libraries: packages of functions that serve as shortcuts when writing sketches. A set of many helpful libraries has been compiled on GitHub. Not all of these libraries are required, but many will be needed to program an EnviroDIY Monitoring Station to send data to the Monitor My Watershed data portal. To download all of the libraries together:

  1. Go to EnviroDIY / Libraries on GitHub.
  2. Scroll down to the ReadMe.
  3. Follow the instructions in that section carefully to install the recommended EnviroDIY libraries.zip file and add it to your Arduino IDE.
  4. Once you have copied all of the library files to your computer, restart (close and reopen) the Arduino IDE so the software can recognize them.

Example Sketches and Tutorials

  • You can find a series of example sketches using the EnviroDIY Mayfly Data Logger in the EnviroDIY_Mayfly_Logger GitHub repository.
    • The examples folder contains a series of sketches of increasing complexity that showcase many of the features of the Mayfly. If you are new to programming, start with the Blinking LEDs and Battery Measurement sketches.
    • The workshop folder has a similar set of sketches, specifically those used in workshops taught by Stroud Water Research Center.
  • You can find another full set of tutorials on programming Arduino-framework micro-controllers as environmental data loggers at https://envirodiy.github.io/LearnEnviroDIY/.
  • Are you somewhat comfortable with programming and looking for ready-to-use code for the Mayfly as an environmental data logger? Check out the ModularSensors GitHub repository.
  • The most comprehensive instructions for using a Mayfly data logger to build a full monitoring station are in the EnviroDIY Monitoring Station Manual.