How to simulate a counter widget?

hi! I would like to know if you can do something similar to a widget in Cayenne. A meter of water for example that registers the m3 consumed. :slight_smile:

Hi @ricardo_ramos,

What are you using as a sensor?

Cheers,

Craig

hi!! I’m using flow meters

So you would interface them to the Pi or Arduino analog in, then create a VIRTUAL_OUT function with a calculation to express your flow in volume, then display the virtual channel using MQTT or native Cayenne using the generic value or graph widgets.

Cheers,

Craig

Yes, I had thought about it. But how to restart that counter after a while? it’s possible?

Then you would have a reset button on your dashboard, and when pressed, you have a VIRTUAL_IN function in your code that clears the counter.

How are you thinking of interfacing? is it 4-20mA or analog voltage out, serial?

Craig

The power is by usb. What would be the code?

This is what you mean? ( a example)

You can use a button widget to reset your counter.

Here is a good example of using that sensor.

Then you would need to just add an accumulator and integrate it with the Cayenne serial sketch from the cayenne.mydevices.com dashboard.

Once you are connected to Cayenne and reading flow, I can help you with the virtual functions if you haven’t figured it out yet. Searching CAYENNE_OUT and CAYENNE_IN in this forum, should help.

Cheers,

Craig

I’ll try. Thank you, I’ll tell you later