cpa950462
https://www.amazon.com/gp/aw/d/B01D44N41U?psc=1&ref=ppx_pop_mob_b_asin_title

I purchased this a few months ago and was using it with a Nano. I'm switching to nodemce and OpenPLC and I'm trying to find what function block to use. I'm relatively new to function block diagrams. 

I need to count the pulses, run them through some math and output lpm/gpm and count total volume.

Meter
  • Flow range:0.3-10L/min
  • Frequency: F=38 * Q (L / Min) error:± 2%
  • Working voltage range: 3.5-12 VDC, Pressure range: 0-0.8MPa

I've looked for block definitions beyond what info is given when you hover over them but didn't find anything.

I have successfully done a couple simple boolean projects and am starting to really like the development board and openplc combo. Thank you to the developer (s).
Reply 0 0
thiagoralves
You can use CTU or CTD blocks to count pulses. However, beware, a PLC cannot count pulses faster than its scan time. Depending on how fast these pulses are sent, you may miss some if they come faster than the scan cycle. If you’re using a slave device to count pulses that makes it even more restrictive, as slave devices can have delays due to network latency. Ideally you can write a little code to count the pulses on the nodemcu itself and then send the accumulated value over to OpenPLC for further processing.
Reply 0 0
tim292stro
IMHO, better to use a device with a high-speed free-running pulse counter block that you can poll/clear at a fixed interval (to do flow volume math on).  Most embedded microprocessors have this type of block, including Arduino (input is good up to multi-MHz).  Stand-alone frequency counters are also available to convert into something that OpenPLC can use (be prepared for sticker shock: https://www.google.com/search?q=modbus+frequency+counter).

If you're looking to roll-your-own, or if you want to extra experience, take a look at 74HC4040 12-stage ripple counters - they'll run up to 24MHz asynchronous input @5V.  Doing a back of the napkin design, two of those cascaded gives you 24-bits (0-16,777,215) - take another pair of those hooked into a decent/stable 10MHz clock source and fed two three TI 74AS885 magnitude comparators gives you a way to trip an input inhibit at an arbitrary count on 100nSec increments (from 0.0000001 seconds up to 1.677215 seconds), and to signal an interrupt for a PIC to read out the register values of the counter, clear the interrupt, and send the counter back on its way.  Add some D-latches, and you can completely decouple the counter from the PIC, so the accumulation values can be sent at much lower rates than the count, and the PIC can spend all of its effort talking on something like Modbus. As the lowest pulse frequency is limited by the sample interval, the ability to program the count interval setting gives you immense optimization flexibility over this.  In software (on the PIC) you can accumulate sample values over time for even lower pulse counts (for example: add 1000x 1.677215 second long intervals, and now you can count down to one pulse in about 28 minutes or 0.036Hz).

You then just need to condition the ripple counter input for the type of pulse you want to measure - which can be as easy as a high speed op-amp comparator with 300mV of hysteresis, a 1.5V zener clamp diode, current limit resistor set for the maximum input voltage, and a 1V reference.  Should be able to take in any pulse from 2V to your current limiter design voltage.

TBH, building a frequency counter like this and understanding how to do the conversion math opens doors...  With a frequency counter you can do all kinds of other industrial measurements.  For example, with an LM331, you can measure voltage as a frequency - and this can even be done over a galvanic isolation barrier (turning a DC value into an AC coupled signal!!!).  Once you've crossed that bridge, you can start to build other classes of industrial sensing like current (think long and hard if you've ever seen a current sensor with a radiometric output!), 4-20mA loop current sensing (like this maxim app note: https://www.maximintegrated.com/en/design/technical-documents/app-notes/8/823.html) - and it goes on and on...
Reply 0 0
Reply