Skip to content

custom device 'flow meter': case study

Marco Sillano edited this page Aug 30, 2023 · 5 revisions

Custom device 'flow_meter_MQTT'

project

To improve the watering_sys I looked for a flow meter to get a real measure of the water used and not just an estimate. To my surprise, I have not found any suitable Tuya device!

I will make it. First I buy a Water Hall Flow sensor, very simple:

         
  • Water pressure resistance:> 1.2MPa
  • Operating voltage range: DC 5 ~ 15V
  • Insulation resistance:> 100MΩ
  • Accuracy: (1 ~ 30L \ MIN) ± 10%
  • Flow pulse characteristics: (6* Q), where Q = L / Min ± 3%
  • High pulse output:> DC 4.7V (input voltage DC 5V)
  • Output pulse low: Output pulse duty cycle: 50% ± 10%

For the electronic, we have many options. This will not be a 'native Tuya device' of course, but it must be a device easily integrable in tuyaDAEMON.

  • A natural option is an MQTT device, taking as a model some tuya meters: e.g. the ACmeter. This allows the use as a UI of standard MQTT dashboard apps, like IoT MQTT Panel. The DP definition is here.
  • As a processor, my choice falls on a Sonoff-basic + esp-MQTT. Here is required: Wifi, only one digital input, and a little code. The Sonoff, with Wifi, case, and AC power supply, offers all required HW features at a very cheap cost. And esp-MQTT (max. user code 4000 bytes) is a very good choice for small MQTT and data processing applications.

implementation

See as reference this good article

** work in progress **

the tuyaDAEMON interface

This interface is built as a direct replacement of a tuya-smart-device node, as done in Ozone_PDMtimer, but with a big advantage: in this case, the MQTT commands are chosen more standard, so the interface is now a 'generic MQTT' node, reusable with many devices.

Clone this wiki locally