This library currently supports the following Yosemitech sensors:
- Y502-A or Y504-A Optical Dissolved Oxygen Sensors
- Y510-B Optical Turbidity Sensor
- Y511-A Optical Turbidity Sensor with Wiper
- Y514-A Chlorophyll Sensor with Wiper
- Y520-A 4-Electrode Conductivity Sensor
- Y532-A Digital pH Sensor
- Y533 ORP Sensor
- Y550-B UV254/COD Sensor with Wiper
- Y4000 Multiparameter Sonde
All of these sensors require a 5-12V power supply and the power supply can be stopped between measurements. (Note that any user settings (such as brushing frequency) will be lost if the sensor loses power.) They communicate via Modbus RTU over RS-485. To interface with them, you will need an RS485-to-TTL adapter. The white wire of the Yosemitech sensor will connect to the "B" pin of the adapter and the green wire will connect to "A". The red wire from the sensor should connect to the 5-12V power supply and the black to ground. The Vcc pin on the adapter should be connected to another power supply (voltage depends on the specific adapter) and the ground to the same ground. The red wire from the sensor does not connect to the Vcc of the adapter. The R/RO/RXD pin from the adapter connects to the TXD on the Arduino board and the D/DI/TXD pin from the adapter connects to the RXD. If applicable, tie the RE and DE (receive/data enable) pins together and connect them to another pin on your board. While this library supports an external enable pin, we have had very bad luck with most of them and recommend against them. Adapters with automatic direction control tend to use very slightly more power, but have more stable communication. There are a number of RS485-to-TTL adapters available. When shopping for one, be mindful of the logic level of the TTL output by the adapter. The MAX485, one of the most popular adapters, has a 5V logic level in the TTL signal. This will fry any board like the Mayfly that uses 3.3V logic. You would need a voltage shifter in between the Mayfly and the MAX485 to make it work.
The sensor constructor requires as input: the sensor modbus address, a stream instance for data (ie,
Serial), and one or two power pins. The Arduino pin controlling the receive and data enable on your RS485-to-TTL adapter and the number of readings to average are optional. (Use -1 for the second power pin and -1 for the enable pin if these don't apply and you want to average more than one reading.) For all of these sensors except pH, Yosemitech strongly recommends averaging 10 readings for each measurement. Please see the section "[Notes on Arduino Streams and Software Serial](https://envirodiy.github.io/ModularSensors/page_arduino_streams.html)" for more information about what streams can be used along with this library. In tests on these sensors, SoftwareSerial_ExtInts did not work to communicate with these sensors, because it isn't stable enough. AltSoftSerial and HardwareSerial work fine. Up to two power pins are provided so that the RS485 adapter, the sensor and/or an external power relay can be controlled separately. If the power to everything is controlled by the same pin, use -1 for the second power pin or omit the argument. If they are controlled by different pins and no other sensors are dependent on power from either pin then the order of the pins doesn't matter. If the RS485 adapter, sensor, or relay are controlled by different pins and any other sensors are controlled by the same pins you should put the shared pin first and the un-shared pin second. Both pins cannot be shared pins.
By default, this library cuts power to the sensors between readings, causing them to lose track of their brushing interval. The library manually activates the brushes as part of the "wake" command. There are currently no other ways to set the brushing interval in this library.
The lower level details of the communication with the sensors is managed by the EnviroDIY Yosemitech library
- module Yosemitech Y4000 Multi-Parameter Sonde
- module Yosemitech Y504 Dissolved Oxygen Sensor
- module Yosemitech Y510 Turbidity Sensor
- module Yosemitech Y511 Wipered Turbidty Sensor
- module Yosemitech Y514 Wipered Chlorophyll Sensor
- module Yosemitech Y520 Conductivity Sensor
- module Yosemitech Y532 pH Sensor
- module Yosemitech Y533 ORP Sensor
- module Yosemitech Y550 UV245/COD Sensor