Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of WikiWatershed, a web toolkit designed to help citizens, conservation practitioners, municipal decision-makers, researchers, educators, and students advance knowledge and stewardship of fresh water. New to EnviroDIY? Start here

Wingshield for Modbus Communication with Isco Signature

Home Forums Mayfly Data Logger Wingshield for Modbus Communication with Isco Signature

Viewing 5 reply threads
  • Author
    Posts
    • #13391
      NathanStoltz
      Participant

      I am interested in using the Mayfly to monitor the our water sampling stations. Basically, we have a flow monitor (Isco Signature) and an automatic water sampler (Isco 6712) to monitor water quality at a handful of sites. I am already using the Mayfly for basic weather monitoring, but am looking to expand to use it to also monitor a number of the Signature parameters using its Modbus protocal.

      I have looked into the Wingshield, and have assembled one based on the Github guidance. I am not a programmer, so am a bit lost on the coding/programming for reading the Signature parameters. As anyone used a Signature before and could point me in the right direction for getting started? I’m linking the Signature manual below, which has some of the Modbus communication guidance.

      Isco Signature Manual

      Thanks in advance for any guidance !
      Nathan

    • #13396
      Sara Damiano
      Moderator

      I’ve only ever used a much older ISCO automated sampler and that only using its internal programming. This is something new to me; I’m skimming your manual. The Signature itself is obviously more powerful than the Mayfly. Are you just looking to use the Mayfly to report live data in order to avoid buying the ISCO supplied modem? Doing that looks like it would be relatively straightforward.

      Based on my read of the manual, here’s what I’d do:

      Don’t bother with the wing thing. It’s really nice if you’re going to power the your RS485 sensor through the Mayfly and connect to multiple RS485 devices, but since the Signature needs way more power than the Mayfly can provide and you haven’t mentioned any other RS485 gadgets, you’re not getting anything out of using it. The wing board also limits you to AltSoftSerial which may or may not work. Just use an RS485 adapter by itself. Do get one that uses 3.3V logic with automatic flow control.

      You need to set up the Signature to use Modbus output following 2.6.4 in the manual. Pick any device ID, just be sure to make note of it. Pick ‘RTU’ protocol type; 2400 bps (Mayfly is too slow to use 115200); 8 data bits; ‘none’ parity; 1 stop bit. Power cycle the Signature to make sure the settings take effect.

      Connect the Signature’s DO- to A-; DO+ to B+; and ground to ground on the RS485 adapter.

      Connect the RS485 adapter to power and ground on the Mayfly. Also connect data out of the RS485 adapter to Mayfly pin 6 and data in to pin 5. I’ve gotten adapters with Tx and Rx labeled differently so if you get no communication, try flipping them.

      Program your Mayfly using AltSoftSerial (https://www.pjrc.com/teensy/td_libs_AltSoftSerial.html) and SensorModbusMaster (https://github.com/EnviroDIY/SensorModbusMaster). AltSoftSerial says that it can be used stably at 2400 baud, but I’ve never tested it at that low a speed on the Mayfly. Be prepared to test and switch to using HardwareSerial if communication isn’t stable enough and values get garbled. If you need to use HardwareSerial to talk to the Signature and you still want to use the XBee slot to for external communication you can cut both sides of SJ8 and SJ9 on the Mayfly to disconnect the XBee slot from Serial1 and run jumper wire on the back of the Mayfly to connect pin 6 to pin 2 of the XBee slot and pin 5 to pin 3.

      I’ll upload a code snippet for you in a bit. I’d had something all typed out and then clicked away and it disappeared on me.

    • #13398
      Sara Damiano
      Moderator

      Okay, this should get you pretty far.

    • #13421
      NathanStoltz
      Participant

      Sara, that’s great, thanks for your response. You are correct – a primary reason I’m hoping to use a Mayfly with the Signature is the telemetry. The Isco modem, while I’m sure very nice, is prohibitively expensive and locks the user into going with telemetry the way they have it set up. I also like the ability of the Mayfly to interface with additional sensors, and potentially down the road to use the Mayfly to control the sampler for the benefit of a 2-part program (baseline and event sampling).

      I hope to have time this week to test this out. A few questions – to monitor additional variables (likely a second level and velocity from an A/V sensor, maybe temperature, external voltage, etc), can I copy lines 41-60 and place within the loop, properly assigning variable names and addresses? Also, can I place this code into the ModularSensors code I’ve been using, treating the Signature as an additional sensor with the levels and velocity as logged and transmitted variables?

      Thanks! I’m excited to continue to learn and to incorporate this into our sampling and monitoring program.

    • #13439
      Sara Damiano
      Moderator

      You should be able to copy that chunk of code and apply it to any variable you’re interested in. You can even grab multiple variables in the same query. In the example I typed up I grabbed all six registers for the date/time at once (with the getRegisters call) and then used the uint16FromFrame function to separate them into the component parts. You could just as easily grab the level value in the same call as the date and time or get the sec/min/hr/etc each in individual calls. It takes less time (the actually communication time between the Mayfly and the ISCO) to make one request for many registers than to make multiple calls for single registers, but the code might be easier (for a person) to follow if you request each result separately. The maximum number of registers you can get in a single call is 125.

      You could hack the variables from the Signature into ModularSensors by calling them “calculated” variables where the “calculation” is actually to interrogate the Signature for current values. You’d have to make sure that “calculation” includes the code to power up your RS485 adapter if you’re powering it from the Mayfly because the calculations are all run after all normal sensors are finished and put to sleep.

      If you want to really treat the Signature properly as a sensor, you should create a new sensor within ModularSensors. You might want to base it on either one of the Keller or Yosemitech sensors – they also use modbus. If you want to go that way, I can look it over and give some pointers and review, but I probably won’t be able to write it up for you anytime soon.

    • #13440
      Sara Damiano
      Moderator

      Oops, I was just looking over again the code I gave you and realized there’s a mistake in line 41. The levelStatus should be the inverse of the modbus result since 0 is good. (bool levelStatus = !modbus.uint16FromRegister(0x03, 40042)) I corrected it above.

Viewing 5 reply threads
  • You must be logged in to reply to this topic.