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: Newbie Mayfly Setup for RS485 sensor to internet

Home Forums Mayfly Data Logger Newbie Mayfly Setup for RS485 sensor to internet Reply To: Newbie Mayfly Setup for RS485 sensor to internet

Sara Damiano

    The modbus power up and down *can’t* include the begin or the pin settings because the modbus functionality is built around any Arduino stream type object. You can use a modbus sensor connected to anything that you can communicate with as an Arduino stream – that means HardwareSerial, SoftwareSerial, Client, etc. If you’re not using Serial1 for a modem, I’d actually strongly recommend you use it and not AltSoftSerial. Stream is a pure virtual class and it doesn’t actually have a begin function. The begin() functions are implemented by specific streams. And unless you are using the AltSoftSerial stream instance on a Mayfly or Mbili board, that digital write low won’t work.

    The powerUp and powerDown functions themselves are implemented in SensorBase. Though, actually, in the newest branch I’ve moved the modbus ones (Yosemitech/Keller) into their direct parents to allow for separate power to the sensor and an RS485 adapter. I’m about to submit a pull request with that and some other updates.