EnviroDIYModularSensors: A Library to give Environmental ...
Transcript of EnviroDIYModularSensors: A Library to give Environmental ...
EnviroDIY ModularSensors:ALibrarytogiveEnvironmentalSensorsaCommonInterfaceofFunctionsforusewithArduino-CompatibleDataloggers
Anthony K Aufdenkampe1, Sara Geleskie Damiano2, Shannon Hicks2 and Jeffery S Horsburgh3
(1) LimnoTech, Oakdale, MN; (2) Stroud Water Research Center; (3) Utah State University, Logan, UT
• Arduino-baseddevicesforDo-It-Yourselfenvironmentalscienceandmonitoringareveryappealingtoacademicsandcitizensciencegroups.
• ItischallengingtoprogramArduinostosimultaneouslyperformall requiredfunctionsofasolar-powered,wireless,multi-sensorlogger!
• Arduinocodeexamplesareavailableforallthefunctionsindividually,buttheyoftenhaveconflictsandinternalinconsistencies!
The Challenge EnviroDIY ModularSensors Library for Arduino Other EnviroDIY Libraries
• Thecommunityneedsaneasy-to-use,high-levellibrarythatunifiesalldataloggingcodeintoasetofcommonfunctionsthatworkforawidevarietyofArduinoboardsandenvironmentalandsensors.
EnviroDIY.org Community
Theeasy-to-learnArduinoprogramminglanguageisbuiltontheextremelypowerfulC++language.WeleverageC++object-orientedclass-subclassstructurestoprovideover50functionsthatworkidenticallyforforallsensors,variables,boardsandradios.
EnviroDIY/Libraries• Acollectionoflinkstospecificreleasesor
modificationsof3rd-partylibrariesthatarealltestedforcompatibilitywithEnviroDIY ModularSensors,andavailableforasingle,easydownload.
EnviroDIY/Arduino-SDI-12• ArduinolibraryforSDI-12communicationstoa
widevarietyofenvironmentalsensors.Thislibraryprovidesageneralsoftwaresolution,withoutrequiringanyadditionalhardware.
EnviroDIY/SensorModbusMaster• ThislibraryisdesignedtouseanArduinoasa
Modbusmastertocommunicatewithasensor/slavevia ModbusRTU,designedtohelpuserswhoarelargelyunfamiliarwiththeModbusprotocolandwantaneasywaytogetinformationfromaModbusdevice.
AllCode&Documentationathttps://github.com/EnviroDIY
Werecommendusingtheopen-sourcePlatformIO IDEIntegratedDevelopmentEnvironment
High-LevelFunctions(selectedexamples)• setupSensors() - Thissetsupallofthevariablesinthearray
andtheirrespectivesensorsbyrunningalloftheirsetup()functions.
• sensorsSleep() - Thisputsallsensorstosleep(i.e.,cutspower),skippingrepeatedsensors.
• sensorsWake() - Thiswakesallsensors(i.e.,givespower),skippingrepeatedsensors.
• connectNetwork() - ConnectstotheinternetviaWiFi orcellularnetwork.Returnstrueifconnectionissuccessful.
• setTimeZone(int timeZone) - Setsthetimezone thatyouwishdatatobeloggedin(in+/- hoursfromUTC). Thismustalwaysbeset!
• syncRTClock() - ThiscallsgetNISTTime()andthensynchronizestheDS3231realtimeclockwiththeNISTprovidedtimestamp.
• generateSensorDataCSV() - ThisreturnsanArduinoStringcontainingcommaseparatedlistofsensorvalues.
• logToSD(Stringrec) - Thiswritesadatalinecontaining"rec"thetheSDcardandsetsthe"filemodified"timestamp.
• postDataEnviroDIY() - CreatesproperheadersandsendsdatatotheEnviroDIY WaterQualityDataPortal(http://data.envirodiy.org).ReturnsanHTMLresponsecode.
SensorsinLibrary• MaxBotix MaxSonar: Ultrasonicwaterlevel• CampbellScientificOBS-3+ : Turbidity• Meter/Decagon5TM:Soilmoistureandtemperature• Meter/DecagonCTD-10:Waterconductivity,temp,depth• Meter/DecagonES-2:Waterconductivity,temp• MaximDS18TemperatureProbes:Watertemperature• AOSong AM2315:EncasedI2CAirtemp,relativehumidity• BoschBME280:Airtemp,relativehumidity,barometricpressure• AOSong DHT:Airtemperature,relativehumidity• ApogeeSQ-212:QuantumLightSensorfor Photosynthetically
ActiveRadiation(PAR)• Yosemitech BrandEnvironmentalSensors• Y502-AorY504-AOpticalDissolvedOxygenSensors• Y5820-A4-ElectrodeConductivitySensor• Y510-B OpticalTurbiditySensor• Y511-A OpticalTurbiditySensorwithwiper• Y514-AChlorophyllSensorwithWiper• Y532-ADigitalpHSensor
• MaximDS3231RealTimeClock• ProcessordataTreatedasSensors• Moreindevelopment!
Processor/BoardCompatibility• AtMega1284p(EnviroDIYMayfly,Sodaq Mbili,
Mighty1284).TheMayfly is thetestboardforthislibrary. Everything isdesignedtoworkwiththisprocessor.
• AtSAMD21(ArduinoZero,Adafruit FeatherM0,Sodaq Autonomo).Fullysupported.
• AtMega2560(ArduinoMega)&AtMega644p(Sanguino).Shouldbefullyfunctional,butuntested.
• AtMega328p(ArduinoUno,Duemilanove,LilyPad,Mini,Seeeduino Stalker,etc.)&AtMega32u4(ArduinoLeonardo/Micro,Adafruit Flora/Feather,etc.).Allfunctionsaresupported,butprocessordoesn'thavesufficientpowertouseallofthefunctionalityofthelibrary.Youwillonlybeabletouseasmallnumberofsensorsatonetimeandmaynotbeabletologdata.
UnsupportedProcessors:• ESP8266/ESP32,AtSAM3X(ArduinoDue),ATtiny,
Teensy2.x/3.x,STM32,Anythingelsenotlistedassupported.
Fundedby:
Contribute to EnviroDIY!• JointheEnviroDIY.org community!• TestModularSensors code&reportissues!• TestBoardsforCompatibility!• AddsensorstoModularSensors Library!
NSF Awards:EAR# 0724971EAR# 1331856