Jump to content

Best Way to get the ISY to Interact with an Analog Input


PLCGuy

Recommended Posts

Posted

Hi

 

I have been trying to use the ISY-994i to monitor the water levels in a large cistern. The idea is that the ISY can send water level warnings via email and make basic control decisions like reduce the watering cycle.

 

To do this, I have installed a ultrasonic water level transmitter that provides a 4-20 mA signal and planned to interface that with the ISY. So I purchased an EZIO2x4 for its analog features, but it didn't work out as planned. LeeG tells me that the ISY doesn't recognize the analog values in the EZIO, so this option is out.

 

So before I spend more $$$ on another piece of hardware (and more time on another experiment), what is the preferred way to get the ISY to read analog values? Here are a few of my thoughts:

  • [*:3fmykx50] Use a CAI webcontrol board to grab the 4-20 mA signal and send that value to the ISY via the REST interface.
    [*:3fmykx50] Use the Analog input feature that seems to reside in the Elk M1 to grab the 4-20 mA signal (with a resistor of course to make it 2-10V) and send that to the ISY via the Elk module

 

As much as I like the price of the CAI webcontrol board, the thought of another PLC to add to the complexity of the system worries me. But will the Elk solution work? I will have to buy another Elk I/O module (nothing near the Cistern now), but those aren't that much more than the CAI.

 

All suggestions appreciated.

Posted

Hi PLCGuy-

 

I don't know much of anything about Elk but I can tell you that a CAI board has a lot to offer. Digital and Analog IO along with a OneWire input for temp sensors and a Humidity sensor input. Fairly inexpensive, newer versions have direct support setting ISY variables via REST and rock solid stable. Only thing better would be if they brought all the connections to screw terminals and put it in an enclosure but that would likely increase the cost significantly.

 

The CAI board will certainly work for your current need and leave you with a lot of additional capabilities for expansion down the road.

 

-Xathros

Posted

What add on board does it take for a Pi to bring digital and analog inputs in, 8 to 16 would be nice?

 

Thinking of adding one for one-wire and some vegetronix moisture sensors in the grass, flower boxes, etc.

Posted

Both of those options will work but, for the latter, you do need the ELK module. Do you already have ISY's ELK module on your ISY?

Not yet. In fact there isn't even a Elk system in place. Currently there is a DSC, but interfacing to it has been less than fun. I know that it can be done through an intermediate computer running a web server (using DSCLink), but I don't like equipment with spinning parts being required 7x24 for a control system to work. Heck - that is one reason I really like the ISY (the other is the amazing service you and your team offers).

 

So the likely solution (provided it will work) is an ELK retrofit for the main alarm and then an Elk I/O module to measure the analog signal and various DIs like valve position, pump status and level alarms. Plus I can add a little security to the cistern area.

 

Thanks

  • 2 months later...
Posted

Two steps forward and one back...

 

After learning that the ISY can`t accept analog inputs (see above), I installed an Elk M1XIN Input module near the cistern and have wired the level transmitter to a Elk zone. The analog signal comes from an EchoPod DL24 ultrasonic level sensor that measures liquid levels in a tank. In this case the tank is the 20,000 gallon cistern containing water for the home. The Echopad provides a 4-20mA signal that indicates the water level; 4mA indications the tank is empty and 20 mA indicates the tank is full and a signal in between indicates a water level in between.

 

The whole thing works well - for example, right now Elk M1 is showing a 4.2 V signal from the ultrasonic sensor, which if I do a bit of math, indicates a water level of 27`inches or approximately 6080 gallons.

 

The trouble is that I am doing the math on my pocket calculator. The client wants the math to be done in the system and the water level (or even better the gallons) presented on the Elk keypad. This is important to them, as running out of water can really impact their life in a not so good way.

 

The math is simple:

Level = Voltage x 11.75 - 23.5

Gallons = Level x 189

 

BUT I discovered that I can not do ANY math in the Elk. All there are is some range compare functions and these are not likely to do the trick, unless I do about 100 of them, one for every 0.1 of voltage. That seems messy. Perhaps an Elk FOR loop would do the job, but I haven`t seen how to use those in the Elk logic - I think I saw these mentioned in the tech notes, but no examples (Any Elk users know about these?)

 

So I thought that ISY994 that could do the math if I could send numerical values to and from the Elk and ISY. Bought the ISY Elk Module and it allows the ISY to read the zone voltage.

 

But how do I take that floating point voltage and use it for ISY variables? Any help on using Elk voltage readings in variable math is greatly appreciated. Any help on handling those decimal places in the ISY is also great. Can I do something like Variable = Elk Voltage * 10 (just to preserve the decimal place)?

 

Regards

Eric

Posted

I am pretty sure there is no way to get a zone voltage directly from Elk into ISY variable.

 

I think you need to go with the CAI which can internally convert the voltage value to gallons and then post that directly to an ISY variable. From there you can have ISY post the value to an Elk keypad.

 

CAI board does not read milliamps, it reads volts. 0 to 10v is the range, but it is best to not go all the way up to 10v as CAI has some over-volt protection that sometimes interferes. Maybe you can change your resistor to make it more like 8v max. CAI will tell you how to modify the board to remove that protection if you like. It is not complicated.

 

The only other option would be a slew of programs in ISY

 

If
       Elk Zone 'cistern' 'Voltage' >= 2.9 Volts
   And Elk Zone 'cistern' 'Voltage' <= 3.1 Volts

Then
       $iGallons  = 2221

Else
  - No Actions - (To add one, press 'Action')

 

Depending on how fine you wanted the resolution, you probably would need 30 or 40 programs, maybe more? Each tenth of a volt is about 220 gallons. So if you wanted to know to within 220 gallons you would need 100 programs to cover the full range of 20,000 gallons.

Posted

Maybe with the new variable extensions coming you might be able to simplify things, the boolean operations coming might help as well.

 

I'm thinking in my head, and that could just be a whole mess, that you may be able to do something with the remainders and mod type math to make the programs smaller and simpler.

 

I think there are interesting math functions you can do with and and or

 

Assign $x = a

Add $x += a

Subract $x -= a

Multiply $x *= a

Divide $x /= a

Remainder $x %= a

And (binary) $x &= a

Or (binary) $x |= a

Xor (binary) $x ^= a

Posted
Maybe with the new variable extensions coming you might be able to simplify things, the boolean operations coming might help as well.

 

I'm thinking in my head, and that could just be a whole mess, that you may be able to do something with the remainders and mod type math to make the programs smaller and simpler.

 

I think there are interesting math functions you can do with and and or

 

Assign $x = a

Add $x += a

Subract $x -= a

Multiply $x *= a

Divide $x /= a

Remainder $x %= a

And (binary) $x &= a

Or (binary) $x |= a

Xor (binary) $x ^= a

 

I had suggested adding bitwise operations quite a while ago but didn't think that it was part of the plan. Do I understand that bitwise operations are going to be added?

Posted
Maybe with the new variable extensions coming you might be able to simplify things, the boolean operations coming might help as well.

 

I started off trying to use the variables, but I can't seem to find a way to assign a Elk voltage to a variable. I can create the IF compares with Elk voltages (as suggested by apostolakisl), but variables seem to be off limits for Elk values.

 

As apostolakisl points out, to use Compares, I need 100 programs :( Perhaps there is a way to construct some sort of For Loop to iterate for 0.1 to 10.0 and stop when there is an hit. Anyone ever tried that?

Posted
Maybe with the new variable extensions coming you might be able to simplify things, the boolean operations coming might help as well.

 

I started off trying to use the variables, but I can't seem to find a way to assign a Elk voltage to a variable. I can create the IF compares with Elk voltages (as suggested by apostolakisl), but variables seem to be off limits for Elk values.

 

As apostolakisl points out, to use Compares, I need 100 programs :( Perhaps there is a way to construct some sort of For Loop to iterate for 0.1 to 10.0 and stop when there is an hit. Anyone ever tried that?

 

There just isn't a way to do that. ISY has no way to compare a variable to an Elk zone voltage or set a variable based on an Elk zone voltage. Perhaps Michel will chime in with a comment regarding details of some of the upgrades to variables that are in the works. I have no idea if Elk zones are part of those upgrades or what any time line would be.

 

The CAI board is a pretty simple inexpensive solution and depending on noise levels and the accuracy of your range finder, you will be able to resolve down to 1/100 volt instead of 1/10. Since CAI added the webset function, it can directly post any of its values to ISY variables. You can have it post based on a timed schedule or you can have it post based on the value having changed by some amount, or other parameters which are too numerous and unlikely to discuss here. CAI board only costs about $35. You may also need a case for it if you aren't mounting it inside of the Elk enclosure, and you may need a wifi bridge if it is located somewhere you can't get an ethernet cable to it. Those would be about $35 more.

Posted

Hello apostolakisl,

 

 

I had suggested adding bitwise operations quite a while ago but didn't think that it was part of the plan. Do I understand that bitwise operations are going to be added?

 

Bitwise operations have been there since day 1.

 

With kind regards,

Michel

Posted
Hello apostolakisl,

 

 

I had suggested adding bitwise operations quite a while ago but didn't think that it was part of the plan. Do I understand that bitwise operations are going to be added?

 

Bitwise operations have been there since day 1.

 

With kind regards,

Michel

 

Ah. I just went back and looked at my post from ages ago. . . it appears other people responded to it, not you. The symbols rather than words make it somewhat less than obvious. What about bit shifting?

 

Just curious, why aren't there just words there instead of the symbols. The + - * and / are somewhat obvious, but the others not so much.

 

And also, how about the other variable changes that I have been hearing about. Like being able to compare variables to numbers aside from other variables (like percentage on levels) and being able to use variables to set Insteon devices. Also comparing Elk values to variables or setting variables based on Elk values (voltage).

Posted

Im just a newbie to ISY, but when I think industrial control and what can interface to the ISY I think Zigbee.

Zigbee has a host of IO options and I hear it is compatible with the ISY as well as other industrial control devices.

Posted

There just isn't a way to do that. ISY has no way to compare a variable to an Elk zone voltage or set a variable based on an Elk zone voltage. Perhaps Michel will chime in with a comment regarding details of some of the upgrades to variables that are in the works. I have no idea if Elk zones are part of those upgrades or what any time line would be.

 

The CAI board is a pretty simple inexpensive solution and depending on noise levels and the accuracy of your range finder, you will be able to resolve down to 1/100 volt instead of 1/10.

Ouch... I quickly saw the issue with trying to assign Elk voltages to a variable, but the fact that we can't use variables at all on the conditional side of IF Compare statements was a real shock. My backup plan for the inability to assign Elk values to variables had been to create an improvised FOR loop, using IF statement to hunt down the Elk voltage level. Now that is out.

 

Michael - any chance you will add variables for the conditions in IF Compare statements? That would add a lot of flexibility to the ISY, hopefully without a lot of extra effort.

 

As for the CAI, I appreciate the guidance and I may have to go that route. It certainly looks like a good box and better resolultion and variable handling would be nice. The issue for us isn't the cost of the CAI board (that is cheap) but rather the cost of labour for installation and configuration. Its another trip for our electrician to the site (and another power supply, unless we can run it off the ELK databus - anyone know?), another day for one of our techs to learn new product and so on. This gets expensive. Plus it is one more device to fail, so it reduces the overall reliability of the system. So as ugly as it is, it might just be cheaper to write 100 compare programs. :(

 

So if anyone else has any other ideas on how to get the ISY to interact with Analog values, great. I would be thrilled to get a solution that doesn't involve more hardware.

Posted

There just isn't a way to do that. ISY has no way to compare a variable to an Elk zone voltage or set a variable based on an Elk zone voltage. Perhaps Michel will chime in with a comment regarding details of some of the upgrades to variables that are in the works. I have no idea if Elk zones are part of those upgrades or what any time line would be.

 

The CAI board is a pretty simple inexpensive solution and depending on noise levels and the accuracy of your range finder, you will be able to resolve down to 1/100 volt instead of 1/10.

Ouch... I quickly saw the issue with trying to assign Elk voltages to a variable, but the fact that we can't use variables at all on the conditional side of IF Compare statements was a real shock. My backup plan for the inability to assign Elk values to variables had been to create an improvised FOR loop, using IF statement to hunt down the Elk voltage level. Now that is out.

 

Michael - any chance you will add variables for the conditions in IF Compare statements? That would add a lot of flexibility to the ISY, hopefully without a lot of extra effort.

 

As for the CAI, I appreciate the guidance and I may have to go that route. It certainly looks like a good box and better resolultion and variable handling would be nice. The issue for us isn't the cost of the CAI board (that is cheap) but rather the cost of labour for installation and configuration. Its another trip for our electrician to the site (and another power supply, unless we can run it off the ELK databus - anyone know?), another day for one of our techs to learn new product and so on. This gets expensive. Plus it is one more device to fail, so it reduces the overall reliability of the system. So as ugly as it is, it might just be cheaper to write 100 compare programs. :(

 

So if anyone else has any other ideas on how to get the ISY to interact with Analog values, great. I would be thrilled to get a solution that doesn't involve more hardware.

 

The CAI board calls for 9vdc. From the manual "Any voltage greater than 12V applied to this input may require adding heatsink to regulator, otherwise it may overheat" I have run several of the boards off of 12vdc without adding a heat sink and haven't had any fail. So, using the Elk's 12v power supply is unlikely to be a problem, especially if the board has descent ventilation and is in a conditioned room. The amp draw is small, but I don't know it off the top of my head. If you are at the limit of the Elk, then you will need to consider it. The ISY has it's own 5v outputs so current draw is dependent on if you are using those, which I don't think you are.

 

ISY does have "if" comparisons for variables, it is just that you can only compare to another variable or to a set value. Adding Elk voltages to that drop down menu (both on the condition side and the action side) is your wish.

Fullscreen_capture_7232013_122826_PM.jpg

 

You might just settle on 20 programs with 1000 gallon resolution for now.

Posted

ISY does have "if" comparisons for variables, it is just that you can only compare to another variable or to a set value. Adding Elk voltages to that drop down menu (both on the condition side and the action side) is your wish.

 

You might just settle on 20 programs with 1000 gallon resolution for now.

Yes, I now see that the "no variable in "if" comparisons" issue only happens with Elk objects. Variables can be compared with variables. My bad...

 

Off to try 20 programs...

Posted

ISY does have "if" comparisons for variables, it is just that you can only compare to another variable or to a set value. Adding Elk voltages to that drop down menu (both on the condition side and the action side) is your wish.

 

You might just settle on 20 programs with 1000 gallon resolution for now.

Yes, I now see that the "no variable in "if" comparisons" issue only happens with Elk objects. Variables can be compared with variables. My bad...

 

Off to try 20 programs...

 

 

One other idea. If you have the network module, you can post the voltage to a file on the built-in ISY webserver. From there, it is a matter of having an application that runs on some computer anywhere in the world that loads that file and then posts it to an ISY variable using the REST interface.

 

Instructions: http://wiki.universal-devices.com/index ... Networking

One note however, you'll have to wait for the next drop in the ISY firmware. See this: viewtopic.php?f=51&t=11981

  • 3 months later...
Posted

Well I wrote the 20 programs needed to process the analog values coming from the Elk. Actually if was closer to 85 programs.

 

The good news is that they work, most of the time. The bad news is "most of the time". It seems like we have some sort of occasional logic race condition that I can not figure out. Happens about once per week where the water Level goes to the millions of gallons. Retriggering cleans it all up.

 

The basic idea we tried was to have three types of programs with three states:

  • 1 program called WaterLvlInit which is waiting for a trigger
    81 programs called ChkxxxVolt that calculates the water level based on the voltage xxx
    1 program called WaterLvlDisplay to display the result on the Elk Keypad

 

This is what it looks like. Where did we mess up? And could we have used folder conditions to make this simpler? (FYI, the 81 voltage checking programs are sorted into 8 folders by voltage MSD)

 

// WaterLvlInit (Wait for a trigger to calculate and display the water level, then initialize the WtrGallons variable and move to State 1 (Check level))
If
       Time is  5:00:00AM
    Or Elk Keypad 'Main Keypad' 'F4' is Pressed

Then
       $WtrGallons  = $SlopeDiv10
       $State_LvlCalc  = 1

=====================================================
// Chk020Volt (Test if the Elk Zone 'Water Level' 'Voltage' is 2.0 Volts and if so, scale WtrGallons by 20)
If
       $State_LvlCalc is 1
   And Elk Zone 'Water Level' 'Voltage' is 2.0 Volts

Then
       $WtrGallons *= 20
       $WtrGallons -= $Offset
       $State_LvlCalc  = 2

// Chk021Volt (Test if the Elk Zone 'Water Level' 'Voltage' is 2.1 Volts and if so, scale WtrGallons by 21 and subtract the offset)
If
       $State_LvlCalc is 1
   And Elk Zone 'Water Level' 'Voltage' is 2.1 Volts

Then
       $WtrGallons *= 21
       $WtrGallons -= $Offset
       $State_LvlCalc  = 2
.
.
.
// Chk100Volt (Test if the Elk Zone 'Water Level' 'Voltage' >= 10.0 Volts and if so, scale WtrGallons by 100 and subtract the offset)
If
       $State_LvlCalc is 1
   And Elk Zone 'Water Level' 'Voltage' >= 10.0 Volts

Then
       $WtrGallons *= 100
       $WtrGallons -= $Offset
       $State_LvlCalc  = 2

=====================================================
// WaterLvLDisplay (Display the results in inches (rather than gallons) on the Elk Key Pad and go back to waiting)
If
       $State_LvlCalc is 2

Then
       $WtrLvl  = $WtrGallons
       $WtrLvl /= $GallonsPerInch
       Set Elk Area 'House' Display Text on Keypads, Content 'Elk_WaterLevel'
       $State_LvlCalc  = 0

Posted
Well I wrote the 20 programs needed to process the analog values coming from the Elk. Actually if was closer to 85 programs.

 

The good news is that they work, most of the time. The bad news is "most of the time". It seems like we have some sort of occasional logic race condition that I can not figure out. Happens about once per week where the water Level goes to the millions of gallons. Retriggering cleans it all up.

 

The basic idea we tried was to have three types of programs with three states:

  • 1 program called WaterLvlInit which is waiting for a trigger
    81 programs called ChkxxxVolt that calculates the water level based on the voltage xxx
    1 program called WaterLvlDisplay to display the result on the Elk Keypad

 

This is what it looks like. Where did we mess up? And could we have used folder conditions to make this simpler? (FYI, the 81 voltage checking programs are sorted into 8 folders by voltage MSD)

 

Have you attempted a check for proper values and limits for your variables? Adding a notification on top of that may help you track it down.

 

A couple routes for this.

 

The easy way, since you said redoing the Init fixes it, is to move your display to State 3 and have State 2 be a logic check.

 

If State 2 is passed an illogical value for the Gallons then it runs the (Then Path) for the WaterLvlInit; otherwise it raises the state to 3, and state 3 runs your display.

For this logic check, I would add an automatic way out (such as a counter) so that you don't get into an endless loop.

 

With running all those programs at the exact same time using a state change, I wonder if memory is messing something up.

 

You could add a logical check as part of each voltage check that the $WtrGallons is at the proper value (maybe <= Max Range) so that nothing gets duplicated.

You could spread out the execution of the code by adding 8 states (one for each folder) and have a wait timer built in.

 

Some random thoughts before bed.

Posted

I still wonder if we could not strip down the number of programs. Maybe something like a binary sort arrangement.

 

initial value divided by 2 is it bigger or lower than this number? Divide by 2 again, is it bigger or lower than this number, etc you get down pretty fast to a percentage you could show.

Posted
I still wonder if we could not strip down the number of programs. Maybe something like a binary sort arrangement.

Initial value divided by 2 is it bigger or lower than this number? Divide by 2 again, is it bigger or lower than this number, etc you get down pretty fast to a percentage you could show.

Believe me, we tried to simplify this, but when you can't assign the value from the Elk to a variable (see earlier in this thread), there is not much you can do in terms of an intelligent search. But, if you can think of a simpler way to do this under the constrains of the ISY programming language, please let me know.

 

That said, I think the issue is with the way we are using the state variables. I suspect, we should have created separate conditional and body programs as described in the great posting by ergodic (http://forum.universal-devices.com/viewtopic.php?f=26&t=6395) but before I rewrite all eighty some programs, I want to understand where we went wrong.

Posted
I still wonder if we could not strip down the number of programs. Maybe something like a binary sort arrangement.

Initial value divided by 2 is it bigger or lower than this number? Divide by 2 again, is it bigger or lower than this number, etc you get down pretty fast to a percentage you could show.

Believe me, we tried to simplify this, but when you can't assign the value from the Elk to a variable (see earlier in this thread), there is not much you can do in terms of an intelligent search. But, if you can think of a simpler way to do this under the constrains of the ISY programming language, please let me know.

 

That said, I think the issue is with the way we are using the state variables. I suspect, we should have created separate conditional and body programs as described in the great posting by ergodic (http://forum.universal-devices.com/viewtopic.php?f=26&t=6395) but before I rewrite all eighty some programs, I want to understand where we went wrong.

 

I don't think you need to write all 80 programs.

 

Add a program that enables or disables a folder instead.

 

If

Voltage is 1

or Voltage is 2

or Voltage is 3

 

Then

Enable Folder 1

Posted

I don't think you need to write all 80 programs. Add a program that enables or disables a folder instead.

 

If

Voltage is 1

or Voltage is 2

or Voltage is 3

 

Then

Enable Folder 1

Yes, that works great. But what is in "Folder 1" that will do the needed math on the Voltage variable? We need some function will determine if the voltage is say 2.0 versus 2.3 versus 8.3 so that the calculation $WtrGallons = Voltage * $Slope - $Offset can be conducted correctly. And since Voltage can only be part of a compare and can not be on the right side of an expression in the ISY, we are stuck. Again, maybe I am missing a trick here.

 

(Note: Certainly we could reduce this to 20+3 programs with approx 1000 gallon resolution, but for this application we really need 100 gallon resolution - a 1000 gallons is a lot of water to lose before you get any warnings.)

Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

  • Forum Statistics

    • Total Topics
      37.2k
    • Total Posts
      372.5k
×
×
  • Create New...