Code Monkey home page Code Monkey logo

yosemitechmodbus's Introduction

Yosemitech Modbus

A library to use an Arduino as a master to control and communicate with the sensors produced by Yosemitech via Modbus RTU over RS-485. This library requires the use of the EnviroDIY/SensorModbusMaster library.

YosemiTech sensors only support these modbus commands:

  • 3 (0x03, Read holding registers)
  • 16 (0x10, Write multiple registers)

The communication rate is set at 9600 baud/8-N-1. The default slave ID from the factory is 0x01.

The implementation of modbus by these sensors is not fully compliant with the official modbus standards. These are some of the irregularities we have found so far:

  • The sensors do not act on server broadcast messages (that is, write commands sent to address 0x00).
  • The sensors give no response to properly formed requests for data from any registers except those few listed in the modbus manuals. (See the "doc" folder for copies of the manuals for the sensors we have.)

Another note: The sensors seem to be somewhat.. finickey about resolving similar addresses when several are connected to the same bus. I recommend giving the sensors addresses a few numbers away from each other to help separate them on the bus. (That is, instead of numbering them as 0x01, 0x02, 0x03, 0x04, and 0x05 try 0x01, 0x03, 0x05, 0x07, and 0x09.)

Hardware

Power Supply

All of these sensors require a 5-12V DC power supply and the power supply can be stopped between measurements. Older sensors may require higher voltage power supplies. Do note that any time the sensor looses power, some internal configurations (such as brushing interval for sensors with wipers) will be reset to their factory values, whereas other internal configurations (such as calibration coefficiencts) are saved.. The red wire from the sensor should connect to the positive pole of the 5-12V power supply and the black to ground.

Current Consumption: The current consumption of the Yosemitech sensors is specified to be <50mA, this is not accurate for their sensors which include a wiper brush, for these sensors an inductive spike exists when the brush begins to spin, which draws significantly more current than specified. Below is a table describing the current draws for several different opeating conditions of the Yosemitech 511 Turbidity senor (with brush). All tests were driven by a power supply with a 9v output

Condition Current
Brush Starting <290mA1
Brush Running 52mA
Sensing 27mA
Idle 7mA

Note 1: The current on brush start can be seen in the image below, where the yellow line shows current into the sensor with a gain of 10 V/A, and the blue line is the output voltage to the sensor. The spike peak is approximately 290mA, with an exponential decay over the next 10-15ms, while this is short, it is more than enough time to brown out many low current power supplies found in data logger systems, so appropriate percautions must be taken to avoid this problem.

CurrentSpike

RS485 communication/connection:

The sensors need to communicate with the Arduino via a 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". Note that most RS485 adapters require 3.3-5V of power and do NOT provide any power to the sensors. For adapters that require it, this library does include code to toggle the RE and DE (receive/data enable), though the timing for this is very persnickety. I recommend an adapter board with built in flow control. Also, 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. Up to 247 different devices can be connected in the same RS485 circuit, provided that each sensor has been separately assigned a uniques slave id.

Receiving TTL Data:

If possible, always connect the RS485 adapter so the TTL signal is going to a Hardware Serial port on the Arduino. Hardware serial ports are more stable than software/pin change serial emulation. If you do not have an available hardware serial port, AltSoftSerial is probably the best Arduino alternative, if your board is supported. NeoSWSerial is also a decent alternative at the Yosemitech's 9600 baud. Use the standard Arduino SoftwareSerial if nothing else is available, but be aware that some sensors may not respond correctly.

Suggested setup with an EnviroDIY Mayfly

We suggest using a Modbus-Mayfly_WingShield, which combines this TTL to RS485 Adapter / 485 to Serial Port UART Level Converter Module (XY-017) with a step-up boost regulator and capacitors. Plans to construct one can be found at https://github.com/EnviroDIY/SensorModbusMaster/tree/master/hardware/Modbus-Mayfly_WingShield.

yosemitechmodbus's People

Contributors

aufdenkampe avatar bschulz1701 avatar fisherba avatar srgdamia1 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.