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

Reply To: Atlas Scientific Logger – Sleep between readings

Home Forums Mayfly Data Logger Atlas Scientific Logger – Sleep between readings Reply To: Atlas Scientific Logger – Sleep between readings

Shannon Hicks

    It looks like this code was based on one of our old sleeping Mayfly logger example sketches, but there’s some stuff in the main Loop that is out of order. I’m assuming you’ve got the Atlas sensors connected to the I2C Grove port on the Mayfly. If you want to be able to switch their power on and off, then you need to move the small jumper on the headers pins next to those Grove ports to the 3.3v-SWITCHED position. Then you need to turn on the sensor power pin (D22) on and off in your code. Pin D8 is the green LED and your code sets it low once but never does anything else with it. I typically turn the green LED on when the board is awake and taking a reading, to let the use know that something is happening. You’ll also see the red LED by the Grove sockets turn on when the switched power is turned on, too. You’ve also got to run the sensor sampling function while the sensor power is on, and in your code you’ve got that happening after everything, including writing the data. I didn’t go through the entire sketch to look for all problems, but I think fixing a few things in the main Loop will get you most of the way to solving your issue. Here’s how I would write that section, but you might want to change it based on your goals.