I’m a scientist with a limited amount of coding background and an even more limited understanding of electrical engineering, and EnviroDIY Modular Sensors on GitHub has made Arduino framework environmental monitoring possible for me. This blog post will point you to a tutorial that is intended to get end-users like me doing Arduino framework environmental monitoring like a pro.
The Arduino Revolution makes electronics easy! (chortles)
Rumor has it that the Arduino revolution has made DIY electrical gadgets accessible to the masses. The assertion continues that the information is (mostly) open-source so you have a direct window into seeing how it’s all done! The kid with the light-up LED Halloween costume is a testament to this, but the complexity of environmental monitoring requires users to run multiple sensors with different warm up times, conserve energy (e.g. putting the sensors to sleep), use solar energy to recharge batteries, save information to an SD card, stream information to an internet portal, and put all of that functionality together into one sketch because an Arduino framework microcontroller can do one thing at a time.
The folks at EnviroDIY (so much credit and gratefulness to @srgdamiano) have made all of this simpler for users by creating a Modular Sensor library that allows users to select from an ever-growing list of research-grade environmental sensors and run them with sketches designed for environmental monitoring.
The Library Crux
When I started using Modular Sensors, trying to manage my libraries manually turned me into a frustrated mess in a hurry, which sent me sprinting to learn how to manage libraries in PlatformIO. If you are switching from simple sketches to the EnviroDIY Modular Sensor ecosystem, this is a great time to also start using an IDE.
EnviroDIY Modular Sensors is capable of running a variety of sensors and radios. Even if you are not using all of the sensors (don’t run that many sensors at a time!), you will need to keep track of the libraries for all of the sensors that are supported by Modular Sensors.
(Side note: My analogy for Arduino libraries is that they are like printer drivers; in order to communicate with a printer, your computer needs the correct software to speak with every make and model of printer. If you have the wrong printer driver, sometimes nothing will happen and sometimes the printer will print gobbledygook. Most operating systems manage printer drivers very well, in the Arduino world, library management requires your attention.)
I use PlatformIO (https://platformio.org/), and as a humble end-user, I am aware that other IDEs exist, but I don’t know them by name. You may use any IDE that allows you to point to the web addresses of repositories (repos) for your library dependencies instead of maintaining a downloaded version of them. If you choose PlatformIO, you will need to install PlatformIO for Atom or VSCode text editor. When I needed to learn this, PlatformIO for Atom was the only option, so the tutorial that I co-authored with @aufdenkampe, leads you through those resources. We hope to expand the tutorial to include instructions for VSCode, which is more friendly for PC users.
The Learn EnviroDIY Programming Tutorial begins with basic Arduino tutorials that we curated from some Arduino-famous people. Future versions of this tutorial will have modifications for the EnviroDIY Mayfly instead of the Arduino UNO. If you already have basic Arduino experience, you may be able to skip (or skim) episodes 1.1 and 1.2. The tutorial is designed to get you connected to GitHub and functioning in PlatformIO using basic sketches before you begin to use the Modular Sensors sketches.
Please post questions or revision requests in the blog comments or (preferably) as an issue in the tutorial GitHub repository.
If you choose to stick with the Arduino IDE, you will need to install all of the library dependencies independently or use the carefully crafted repository of them here: https://github.com/EnviroDIY/Libraries. Here’s the official EnviroDIY Sensor Station Manual that outlines this approach: https://www.envirodiy.org/mayfly-sensor-station-manual/.