Install a New Sensor

Follow these steps to add, configure, and deploy a new sensor.

Step 1: Configure the Server

First, create a new sensor entry in the database. This configures the server to accept API requests from your device. An active account is required for this step.

Step 2: Program Your Device

Next, program your Mayfly device. You can use your choice of micro controller and use our pre-made Arduino scripts or write your own by following the API documentation. Please request approval for upload frequencies faster than once every 5 minutes.

Setup and Programming Instructions

  1. Download Prerequisites:
    • Install the Arduino IDE.
    • Download the required code and libraries from our GitHub Repository. This includes `Mayfly_Code_CustomAPI.ino`, `StrawberryCreekPublisher.h`, and the custom libraries.
  2. Configure Arduino IDE for Mayfly Board:
    • Open the Arduino IDE, go to File > Preferences.
    • In the "Additional Board Manager URLs" field, paste this URL:
      https://raw.githubusercontent.com/EnviroDIY/Arduino_boards/master/package_EnviroDIY_index.json
    • Go to Tools > Board > Boards Manager..., search for "EnviroDIY", and install it.
  3. Install Custom Libraries:
    • In the Arduino IDE, find your sketchbook location at File > Preferences.
    • Navigate to that folder on your computer and open the `libraries` subfolder (create it if it doesn't exist).
    • Place the custom library folders you downloaded from GitHub into this `libraries` folder.
  4. Configure and Upload the Code:
    • Open the `Mayfly_Code_CustomAPI.ino` file in the Arduino IDE.
    • Modify the `site_name` variable to exactly match the sensor name you configured in Step 1.
    • Generate an API key with an active account here and paste it into the `api_key` variable.
    • Connect the Mayfly board to your computer via USB.
    • Select the board (Tools > Board > EnviroDIY Mayfly) and the correct COM Port (Tools > Port).
    • Click the "Upload" button (the right-arrow icon).
  5. Verify Data Transmission:
    • After the upload succeeds, open the Serial Monitor (Tools > Serial Monitor).
    • Set the baud rate in the bottom-right corner to 57600.
    • Check for success messages confirming that data is being sent to the Strawberry Creek API.

That's it! Your device is now ready to send data and trigger alerts.

Step 3: Update the Interface (Optional)

To display the new sensor on the public map and analytics pages, please ask an administrator to add its site code to the following files: `strawberry_creek_map.html`, `analytics.js`, and `mushroom_analytics.js`.