From Let's Control It
Jump to: navigation, search


The ESP8266 module can be used as an general purpose digital pulse counter device for various digital sensors. Think about optical sensors with a digital output. To be used for things like gas, water, electricity, door open/close counters, etc.

In this example we will connect an optical sensor. Connect the digital output to some chosen GPIO pin on the ESP module. Load the firmware and follow the firmware specific instructions. Other, more specific, examples is the Pulse logic input and LJ12A3.



A simple ESP8266 module like the ESP-01 is sufficient. We will use a TCR5000 optical sensor that is widely available. Connect pin 3 (DO) to some GPIO on the ESP and power up both the ESP and the sensor.

ESP Easy

Use the device tab on the ESP Easy web interface and create a new task by editing one of the available tasks. Select "Pulse Counter" from the dropdown box


Enter the IDX found in the Domoticz device page. Also select the GPIO pin that you have used to connect the pulse counting device.

With the some older versions you need to REBOOT the ESP Easy to get the show running. With later versions we have restricted possible task to have the pulse counter to TASK 1 - 4. This is done to make less interrupts in the polling cycle.

That should be all.

Optional settings

Use of formulas

Use of value names

And the final result if using Domoticz:

Domoticz PowerUsage.png

Domoticz PowerUsage Chart.png