Determine sensor value

AMH94

Member
Join Date
Mar 2021
Location
Denmark
Posts
9
Hi.

I'm new to allen bradley PLC's and PLC's in general.

I've been asked to make a program that can determine the water flow of a machine. I have a HB-therm water heater that has a flow sensor connected to it and to the PLC's DI.

My question is, how do I determine the input voltage in the PLC? I figured that's the only way to determine the flow. When the sensor is at 24v/100Hz (Which is when the flow is at it's max), the flow is at max speed (15L/min) and vice versa with 0v. From there it's a simple calculation and few functions.

Any help is appreciated, since it's a pretty big task to do, as a beginner. Thanks in advance!
 
This is a bit confusing you say it is a digital sensor i.e. on when flow off when no flow ?.
You cannot get the flow rate from that as I suspect there is a hysteresis on the sensor i.e. it is on when the flow is above a certain level & off when below a certain level not on when it is at say 15/lm & off when 0, it is more likely that it is on when above say 5 l/m & off when it is below 2 l/m. The only way (although not very accurate) is if you know the pump speed then for example 0hz = 0 l/m & 100 hz = 15 l/m then the flow will be sort of proportional.
So with a digital signal there is no way of accurately determine the actual flow.
If it is a pulse output i.e. from a flow meter then the pulses would be x pulses per litre, in that case you would possibly need a high speed input on the PLC & sample the number of pulses every say 1 second to get a flow rate.
More information is required on the sensor is it just a flow sensor or a digital pulse based on flow rate etc.
 
@parky Thanks for the quick reply!

Yes you're completely right, the sensor output is a pulse signal. I know when it's at 15/lm it's 100hz and when at 0/lm its 0hz), also I can regulate the flow and I do know the pump speed (it's visible at the heater display).

You're definitely on to something, because I also got a HSC just in case the update frequencies on the PLC's wasn't fast enough. I figured I needed to sample the pulses, I just have no idea how.

I have been thinking about something with a counter and a timer, so when the timer is active, the counter counts the pulses? I might be off track here, but I'm out of ideas.
 
What model of AB PLC have you got, the smaller 820 has high speed inputs as standard, a 100hz signal into standard I/O would require a scan time of 200 scans per second to be able to catch the pulses i.e. a scan time of 5milliseconds , although it might get away with 8. I have not used CLX hardware for many years but I believe if you use HSC card then these can be set up via the I/O settings, then basically you could sample the count on an interrupt of say 1 second, use the count & simple maths to get the flow rate. or even use I/O interrupt to get the time in milliseconds between pulses to determine the flow rate, I'm sure there are plenty of AB/CLX programmers here that can help, I gave up on AB/Rockwell some 10 years ago due to their pricing/tech connect policies.
Just be aware there will be loads of replies to this & all sorts of ideas based on accuracy & it will probably stretch into a long & heated post, I suggest you give other posters exactly what you want to achieve, expected accuracy etc. I can see a number of possible requirements, Flow rate, accumulated litres, possible batching etc.
 
Last edited:
I have an allen bradley micro820, a 2080-lc20-20qwb to be precise.

I get what you're saying, I think that's a great solution really. I'm trying as much as I can not to be spoonfed here, but as a beginner it can be rather difficult unfortunately. I will try to figure out how to sample the pulses somehow, probably by a counter when at 100%/100hz/15lm, there might be an easier way, time will tell.

I agree, AB is not my PLC of choise either, I'd even use siemens rather than this.

I will definitely do that, thanks for the heads up.
 
I suggest you look at this manual, HSC in Rockwell is comprehensive but complicated, but this should give you some ideas.

https://literature.rockwellautomation.com/idc/groups/literature/documents/um/2080-um002_-en-e.pdf

I believe that like many other PLC's they use hardware counters built into the system, the first few Inputs are connected and if the hardware counters are enabled they work as HSC.
The inputs can be used as normal inputs but not at the same time. Mitsubishi have a very simple solution, i.e. they can be used as single ended just by one instruction to enable the counter.
 
Last edited:
I will dive deeper into the manual (I just skimmed it when I read it last time). Thanks for your input and help, as someone who is over my head, I really appreciate it a lot.
 
an A-B article that may help: ID: QA27156 | Access Levels: Everyone (start at https://www.rockwellautomation.com/en-us.html and create a free account if you do not already have one)



I assume you have already found chapter 8 in the manual.


Here is the Micro820 user manual; it states here that the -LC20-20QWB digital inputs are 24V, which should answer your initial query about input voltage. The wiring chapter is here.

I suggest searching this forum, or even The Google, with terms like
hsc flow rate pulse
or
hsc flowrate pulse
Most likely the flowrate will be calculated via some form of counted-pulses-per-time-period scaled to volume-per-time i.e. flowrate, but whether you measure the time for a fixed number of counts, or the counts for a fixed period of time, or do something else depends on you particular application.

For example, if the flow is being used in a control (PID?) loop, then a smaller fixed period of time may be called for so the PID gets a response ASAP to changes in its output. The problem there is accuracy and aliasing: the count of pulses in the chosen time period is discrete, so for e.g. an average rate of 9.9 pulses per time period, the counts will be 9 one time and 10 nine times, on average. There is also the issue of how to measure time: standard timers are only accurate to the PLC scan time, which is non-deterministic; using interrupt routines and/or grabbing the microsecond counter of the PLC clock have their own challenges, perhaps more so for the beginner, but are doable.

If accuracy is more important, then a fixed number of counts over a time period that varies and is measured is an alternative, but then there will be aliasing in the sampling. For example, a flowrate of 15l/min will reach 100 counts once a second, but if someone shuts off the flow suddenly, then all pulses will stop, the counter will never be done, and that 15L/min will remain as the last calculated value, so the program would need to detect such an event.

As someone new to PLCs, the configuration and programming may seem daunting, but that can be learned; the design choices are the real issue here. That said, I doubt this problem has never been solved before, so a PCLtalk.net/google/literature search should be the first step.
 

Similar Topics

Hello, i am a beginner with a Siemens Logo 8 PLC. I would determine the direction of an object if it passes a whole cycle of 2 input sensors. See...
Replies
2
Views
202
Have to determine volumes of packages on a conveyor. Client suggests that i utilise 3 ultrasonic analog sensors to do this. My concern is "what if...
Replies
7
Views
2,777
Hi all, Just looking through the CIP_AXIS_DRIVE data type in a Logix controller to look for something that can tell me whether the current...
Replies
2
Views
1,082
I'm currently working on an MES interface PLC which passes around a whole bunch of strings. A lot of these strings are really just to allow for an...
Replies
0
Views
1,128
I don't use AB much these days, and any installs I've done in years past have been setup by myself from scratch, so I've always known what...
Replies
8
Views
2,092
Back
Top Bottom