Using GPIO to measure energy
Moderator: leecollings
-
- Posts: 402
- Joined: Wednesday 26 February 2014 15:28
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: the Netherlands
- Contact:
Re: Using GPIO to measure energy
Nobody an idea on what can be the problem of the isrcounter not stating?
-
- Posts: 49
- Joined: Monday 07 October 2013 10:51
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Using GPIO to measure energy
You can debug into more detail by using 'sudo bash -x /etc/init.d/isrcounter status'
Does the daemon executable exist ? Check that what is in NAME=isr.... in the init script exists in your PATH. Mine is NAME=isrcounter1 and exists in /usr/local/bin/isrcounter1
Does the daemon executable exist ? Check that what is in NAME=isr.... in the init script exists in your PATH. Mine is NAME=isrcounter1 and exists in /usr/local/bin/isrcounter1
-
- Posts: 402
- Joined: Wednesday 26 February 2014 15:28
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: the Netherlands
- Contact:
Re: Using GPIO to measure energy
"NAME=isrcounter" and exists in "/usr/local/bin/isrcounter" and "/usr/local/bin" does exists in PATH.hansrune wrote:You can debug into more detail by using 'sudo bash -x /etc/init.d/isrcounter status'
Does the daemon executable exist ? Check that what is in NAME=isr.... in the init script exists in your PATH. Mine is NAME=isrcounter1 and exists in /usr/local/bin/isrcounter1
'sudo bash -x /etc/init.d/isrcounter status' gives.
Code: Select all
+ PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
+ DESC='ISR pulse counter and uploader'
+ NAME=isrcounter
+ NAME_SAVEFILE=watermeterstand
+ USERNAME=pi
+ DEVIDX=6
+ LOGFILE=/var/run/shm/isrcounter
+ SAVEFILE=/home/pi/domoticz/scripts/watermeterstand
+ DAEMON=/usr/local/bin/isrcounter
+ DAEMON_ARGS=/var/run/shm/isrcounter
+ SCRIPTNAME=/etc/init.d/isrcounter
+ '[' -x /usr/local/bin/isrcounter ']'
+ . /lib/init/vars.sh
++ TMPTIME=0
++ SULOGIN=no
++ DELAYLOGIN=no
++ UTC=yes
++ VERBOSE=no
++ FSCKFIX=no
++ '[' -f /etc/default/rcS ']'
++ . /etc/default/rcS
+++ FSCKFIX=yes
++ unset EDITMOTD
++ unset RAMRUN
++ unset RAMLOCK
++ '[' -r /proc/cmdline ']'
+++ cat /proc/cmdline
++ for ARG in '$(cat /proc/cmdline)'
++ case $ARG in
++ for ARG in '$(cat /proc/cmdline)'
++ case $ARG in
++ for ARG in '$(cat /proc/cmdline)'
++ case $ARG in
++ for ARG in '$(cat /proc/cmdline)'
++ case $ARG in
++ for ARG in '$(cat /proc/cmdline)'
++ case $ARG in
++ for ARG in '$(cat /proc/cmdline)'
++ case $ARG in
++ for ARG in '$(cat /proc/cmdline)'
++ case $ARG in
++ for ARG in '$(cat /proc/cmdline)'
++ case $ARG in
++ for ARG in '$(cat /proc/cmdline)'
++ case $ARG in
++ for ARG in '$(cat /proc/cmdline)'
++ case $ARG in
++ for ARG in '$(cat /proc/cmdline)'
++ case $ARG in
++ for ARG in '$(cat /proc/cmdline)'
++ case $ARG in
++ for ARG in '$(cat /proc/cmdline)'
++ case $ARG in
++ for ARG in '$(cat /proc/cmdline)'
++ case $ARG in
++ for ARG in '$(cat /proc/cmdline)'
++ case $ARG in
++ for ARG in '$(cat /proc/cmdline)'
++ case $ARG in
++ for ARG in '$(cat /proc/cmdline)'
++ case $ARG in
++ '[' '' ']'
+ . /lib/lsb/init-functions
+++ run-parts --lsbsysinit --list /lib/lsb/init-functions.d
++ for hook in '$(run-parts --lsbsysinit --list /lib/lsb/init-functions.d 2>/dev/null)'
++ '[' -r /lib/lsb/init-functions.d/20-left-info-blocks ']'
++ . /lib/lsb/init-functions.d/20-left-info-blocks
++ FANCYTTY=
++ '[' -e /etc/lsb-base-logging.sh ']'
++ true
+ case "$1" in
+ status_of_proc /usr/local/bin/isrcounter isrcounter
+ local pidfile daemon name status OPTIND
+ pidfile=
+ OPTIND=1
+ getopts p: opt
+ shift 0
+ '[' -n '' ']'
+ daemon=/usr/local/bin/isrcounter
+ name=isrcounter
+ status=0
+ pidofproc /usr/local/bin/isrcounter
+ local pidfile base status specified pid OPTIND
+ pidfile=
+ specified=
+ OPTIND=1
+ getopts p: opt
+ shift 0
+ base=isrcounter
+ '[' '!' '' ']'
+ pidfile=/var/run/isrcounter.pid
+ '[' -n /var/run/isrcounter.pid ']'
+ '[' -e /var/run/isrcounter.pid ']'
+ '[' -x /bin/pidof ']'
+ '[' '!' '' ']'
+ status=0
+ /bin/pidof -o %PPID -x /usr/local/bin/isrcounter
+ status=1
+ '[' 1 = 1 ']'
+ return 3
+ status=3
+ '[' 3 = 0 ']'
+ '[' 3 = 4 ']'
+ log_failure_msg 'isrcounter is not running'
+ '[' -n 'isrcounter is not running' ']'
+ log_begin_msg isrcounter is not running ...
+ log_begin_msg_pre isrcounter is not running ...
+ log_daemon_msg_pre isrcounter is not running ...
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ '[' -t 1 ']'
+ '[' xxterm '!=' x ']'
+ '[' xxterm '!=' xdumb ']'
+ '[' -x /usr/bin/tput ']'
+ '[' -x /usr/bin/expr ']'
+ /usr/bin/tput hpa 60
+ /usr/bin/tput setaf 1
+ '[' -z ']'
+ FANCYTTY=1
+ case "$FANCYTTY" in
+ true
+ /bin/echo -n '[....] '
[....] + '[' -z isrcounter ']'
+ /bin/echo -n isrcounter is not running ...
isrcounter is not running ...+ log_begin_msg_post isrcounter is not running ...
+ :
+ log_end_msg 1
+ '[' -z 1 ']'
+ local retval
+ retval=1
+ log_end_msg_pre 1
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ '[' -t 1 ']'
+ '[' xxterm '!=' x ']'
+ '[' xxterm '!=' xdumb ']'
+ '[' -x /usr/bin/tput ']'
+ '[' -x /usr/bin/expr ']'
+ /usr/bin/tput hpa 60
+ /usr/bin/tput setaf 1
+ '[' -z 1 ']'
+ true
+ case "$FANCYTTY" in
+ true
++ /usr/bin/tput setaf 1
+ RED=''
++ /usr/bin/tput setaf 2
+ GREEN=''
++ /usr/bin/tput setaf 3
+ YELLOW=''
++ /usr/bin/tput op
+ NORMAL=''
+ /usr/bin/tput civis
+ /usr/bin/tput sc
+ /usr/bin/tput hpa 0
+ '[' 1 -eq 0 ']'
+ '[' 1 -eq 255 ']'
+ /bin/echo -ne '[FAIL'
[FAIL+ /usr/bin/tput rc
+ /usr/bin/tput cnorm
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ '[' -t 1 ']'
+ '[' xxterm '!=' x ']'
+ '[' xxterm '!=' xdumb ']'
+ '[' -x /usr/bin/tput ']'
+ '[' -x /usr/bin/expr ']'
+ /usr/bin/tput hpa 60
+ /usr/bin/tput setaf 1
+ '[' -z 1 ']'
+ true
+ case "$FANCYTTY" in
+ true
++ /usr/bin/tput setaf 1
+ RED=''
++ /usr/bin/tput setaf 3
+ YELLOW=''
++ /usr/bin/tput op
+ NORMAL=''
+ '[' 1 -eq 0 ']'
+ '[' 1 -eq 255 ']'
+ /bin/echo -e ' failed!'
failed!
+ log_end_msg_post 1
+ :
+ return 1
+ true
+ return 3
+ exit 3
-
- Posts: 11
- Joined: Wednesday 26 August 2015 16:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Using GPIO to measure energy
Sorry to kick this old threat but I got the same error as roblom, can start the compiled script fine, but won't be able to use the start/stop script.
- sincze
- Posts: 1300
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Using GPIO to measure energy
Ok will setup demo on separate raspberry to see what is wrong. Currently II don't have access to my hardware. Really interested what is going wrong here.Panda wrote:Sorry to kick this old threat but I got the same error as roblom, can start the compiled script fine, but won't be able to use the start/stop script.
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
- sincze
- Posts: 1300
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Using GPIO to measure energy
I started from scratch today.sincze wrote:Ok will setup demo on separate raspberry to see what is wrong. Currently II don't have access to my hardware. Really interested what is going wrong here.Panda wrote:Sorry to kick this old threat but I got the same error as roblom, can start the compiled script fine, but won't be able to use the start/stop script.
Can you guys confirm you modified the script as described in this thread http://www.domoticz.com/forum/viewtopic ... =40#p30924?
From:
Code: Select all
USERNAME=pi
Code: Select all
pi@raspberrypi ~/domoticz/watermeter $ sudo /etc/init.d/isrcounter start
pi@raspberrypi ~/domoticz/watermeter $ sudo /etc/init.d/isrcounter status
[FAIL] isrcounter1 is not running ... failed!
Code: Select all
USERNAME=root
Code: Select all
pi@raspberrypi ~/domoticz/watermeter $ sudo /etc/init.d/isrcounter start
pi@raspberrypi ~/domoticz/watermeter $ sudo /etc/init.d/isrcounter status
[ ok ] isrcounter1 is running.
pi@raspberrypi ~/domoticz/watermeter $ sudo /etc/init.d/isrcounter stop
pi@raspberrypi ~/domoticz/watermeter $ sudo /etc/init.d/isrcounter status
[FAIL] isrcounter1 is not running ... failed!
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
-
- Posts: 3
- Joined: Friday 13 November 2015 11:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Using GPIO to measure energy
Hello All
I implement the solution that is mentioned in this topic to record the pulses from one meter Landis + Gyr E650.
Everything works well and the measurements are very good.
The only problem I have is when the raspberry does restart, which will record a very large number of units and bringing the number of Kwhs be far from reality.
If the raspberry works continuously without any interruption everything is correct.
The same happens if I run the following command...and as you will see the second entry has a huge number of pulses ..
root@raspberrypi:~# sudo /usr/local/bin/isrcounter /var/run/shm/isrcounter
Waiting ... Done. counter: 16709236: 0
Waiting ... Done. counter: 16709335: 16709236
Waiting ... Done. counter: 16709418: 99
Waiting ... Done. counter: 16709511: 83
Waiting ... Done. counter: 16709591: 93
Waiting ... Done. counter: 16709684: 80
Waiting ... Done. counter: 16709771: 93
Waiting ... Done. counter: 16709861: 87
Waiting ... Done. counter: 16709950: 90
Waiting ... Done. counter: 16710045: 89
Waiting ... Done. counter: 16710129: 95
Is there a solution to deal with this problem .. ??
Thanks in advance
George
I implement the solution that is mentioned in this topic to record the pulses from one meter Landis + Gyr E650.
Everything works well and the measurements are very good.
The only problem I have is when the raspberry does restart, which will record a very large number of units and bringing the number of Kwhs be far from reality.
If the raspberry works continuously without any interruption everything is correct.
The same happens if I run the following command...and as you will see the second entry has a huge number of pulses ..
root@raspberrypi:~# sudo /usr/local/bin/isrcounter /var/run/shm/isrcounter
Waiting ... Done. counter: 16709236: 0
Waiting ... Done. counter: 16709335: 16709236
Waiting ... Done. counter: 16709418: 99
Waiting ... Done. counter: 16709511: 83
Waiting ... Done. counter: 16709591: 93
Waiting ... Done. counter: 16709684: 80
Waiting ... Done. counter: 16709771: 93
Waiting ... Done. counter: 16709861: 87
Waiting ... Done. counter: 16709950: 90
Waiting ... Done. counter: 16710045: 89
Waiting ... Done. counter: 16710129: 95
Is there a solution to deal with this problem .. ??
Thanks in advance
George
- sincze
- Posts: 1300
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Using GPIO to measure energy
Hi George
You mention the isrcounter script just as an example right? Not using this script for landis meter right?
I assume domoticz takes care of your energy values via a /dev/ttyUSBx?
You mention the isrcounter script just as an example right? Not using this script for landis meter right?
I assume domoticz takes care of your energy values via a /dev/ttyUSBx?
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
-
- Posts: 3
- Joined: Friday 13 November 2015 11:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Using GPIO to measure energy
Hi sincze
I use the script for real measurements and not for an example..
From the meter Landis + Gyr get pulses and count through the GPIO 23 with isrcounter.
Everything works fine except if you close the power abruptly from the raspberry or if I give the command..
isrcounter status
Waiting ... Done. counter: 32365: 0
Waiting ... Done. counter: 32371: 32367
Waiting ... Done. counter: 32457: 9
As you see on my second line adds a very large number of units..
Thank you
George
I use the script for real measurements and not for an example..
From the meter Landis + Gyr get pulses and count through the GPIO 23 with isrcounter.
Everything works fine except if you close the power abruptly from the raspberry or if I give the command..
isrcounter status
Waiting ... Done. counter: 32365: 0
Waiting ... Done. counter: 32371: 32367
Waiting ... Done. counter: 32457: 9
As you see on my second line adds a very large number of units..
Thank you
George
-
- Posts: 15
- Joined: Saturday 06 December 2014 19:25
- Target OS: Linux
- Domoticz version:
- Contact:
Re: Using GPIO to measure energy
Hi all,
i have my TCRT5000 hooked up to my Raspberry GPIO and with GPIO readall i can see when the disc from my watermeter passes by (showing 1 or 0)
I have made a contact in Domoticz that show the status also. But now i'm stuck. Where do i go from there.
How do i get the watermeter to count in my utility view? What steps do i have to go over?
i have my TCRT5000 hooked up to my Raspberry GPIO and with GPIO readall i can see when the disc from my watermeter passes by (showing 1 or 0)
I have made a contact in Domoticz that show the status also. But now i'm stuck. Where do i go from there.
How do i get the watermeter to count in my utility view? What steps do i have to go over?
Sony Raspberry Pi B V2.0
Homemade P1 cable on Landis/Gyr E350
C&K/Honeywell Security system connected to Domoticz
AEON Labs USB Z-Wave
TCRT5000 sensor watermeter -> revived..... and in progress....
Homemade P1 cable on Landis/Gyr E350
C&K/Honeywell Security system connected to Domoticz
AEON Labs USB Z-Wave
TCRT5000 sensor watermeter -> revived..... and in progress....
- sincze
- Posts: 1300
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Using GPIO to measure energy
Did you find this link?? Isrcounter?Lieuwke wrote:Hi all,
i have my TCRT5000 hooked up to my Raspberry GPIO and with GPIO readall i can see when the disc from my watermeter passes by (showing 1 or 0)
I have made a contact in Domoticz that show the status also. But now i'm stuck. Where do i go from there.
How do i get the watermeter to count in my utility view? What steps do i have to go over?
viewtopic.php?t=5021
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
-
- Posts: 15
- Joined: Saturday 06 December 2014 19:25
- Target OS: Linux
- Domoticz version:
- Contact:
Re: Using GPIO to measure energy
LoL in a topic i started myself a loooooong time ago, 
thank you sincze.
I asume you mean the isrcounter.zip ?
Can you explain to me wich steps i have to take with it? (i'm not very well at these things.)
put it in a file, how do i adjust for my GPIO pin? etc. Whats self explaining for someone who has done these things over and over can be very challenging for the unexperienced. Thank you for your effort and patience.
Best regards,
Martin

thank you sincze.
I asume you mean the isrcounter.zip ?
Can you explain to me wich steps i have to take with it? (i'm not very well at these things.)
put it in a file, how do i adjust for my GPIO pin? etc. Whats self explaining for someone who has done these things over and over can be very challenging for the unexperienced. Thank you for your effort and patience.
Best regards,
Martin
Sony Raspberry Pi B V2.0
Homemade P1 cable on Landis/Gyr E350
C&K/Honeywell Security system connected to Domoticz
AEON Labs USB Z-Wave
TCRT5000 sensor watermeter -> revived..... and in progress....
Homemade P1 cable on Landis/Gyr E350
C&K/Honeywell Security system connected to Domoticz
AEON Labs USB Z-Wave
TCRT5000 sensor watermeter -> revived..... and in progress....
- sincze
- Posts: 1300
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Using GPIO to measure energy
You are right the information is all over the forum let met try to find the individual posts and show it to you it works excellent
seems I have to thank to u for the idea. These are my connections.

And the instructions
viewtopic.php?t=3151&start=20
Sent from my SM-G925F using Tapatalk


And the instructions
viewtopic.php?t=3151&start=20
Sent from my SM-G925F using Tapatalk
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
-
- Posts: 15
- Joined: Saturday 06 December 2014 19:25
- Target OS: Linux
- Domoticz version:
- Contact:
Re: Using GPIO to measure energy
Hi Sincze,
thank you very much. I was at that same topic, but got stuck on step 3 ( i think i got step 2 ok)
thank you very much. I was at that same topic, but got stuck on step 3 ( i think i got step 2 ok)
Mayby you can tell me the steps that are involved in step 3?Step 3: The interrupt handler is adapted from the wiringPi samples. Under wiringPi/examples, add the C program isrcounter1.c. I also added an output for a feedback LED in series with a current-limiting resistor. The LED output changes every other pulse received. Adjust pin numbers as needed in the C program, then make isrcounter1. Copy the compiled code to /usr/local/bin/isrcounter1. Source code can be downloaded from http://hansrune.net/domo/isrcounter1.c
Step 4: Add a system startup / service script to /etc/init.d/isrcounter. You can download my version from http://hansrune.net/domo/isrcounter
Step 5: Wire your input signal, and optionally the feedback output
Step 6: Under domoticz application settings, adjust the number of pulses and costs per unit of consumption
Sony Raspberry Pi B V2.0
Homemade P1 cable on Landis/Gyr E350
C&K/Honeywell Security system connected to Domoticz
AEON Labs USB Z-Wave
TCRT5000 sensor watermeter -> revived..... and in progress....
Homemade P1 cable on Landis/Gyr E350
C&K/Honeywell Security system connected to Domoticz
AEON Labs USB Z-Wave
TCRT5000 sensor watermeter -> revived..... and in progress....
- sincze
- Posts: 1300
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Using GPIO to measure energy
As long as you put my compiled isrcounter in the /usr/local/bin directory and have it attached as in my screenshot that is sufficient for step 3
Sent from my SM-G925F using Tapatalk

Sent from my SM-G925F using Tapatalk
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
-
- Posts: 15
- Joined: Saturday 06 December 2014 19:25
- Target OS: Linux
- Domoticz version:
- Contact:
Re: Using GPIO to measure energy
Hi Sincze,
the compiled isrcounter. Is this the right file: download/file.php?id=3097 ?
In the zip i see a txt file. Do i copy the contents into a file called isrcounter in the /usr/local/bin directory? I'm not quite sure what i have to do with the txt file. (i'm using a windows pc and putty)
As you can see, i'm lacking some basic skills on the software side off things......
Update:
I copied the contents of the txt file into a file called isrcounter.c with nano
then i did: gcc -o isrcounter isrcounter.c -lwiringPi
When i run:
isrcounter1 /var/run/shm/isrcounter1
i get:
Waiting ... Waiting ... Waiting ... Done. counter: 18639: 1
Waiting ... Done. counter: 18707: 1
Waiting ... Done. counter: 18732: 83
Waiting ... Done. counter: 18734: 10
Waiting ... Done. counter: 18761: 2
Waiting ... Done. counter: 18797: 47
Waiting ... Done. counter: 18803: 16
Waiting ... Done. counter: 18805: 6
And my watermeter is finally showing some values. They suck
But at least i have a feeling i'n going in the right direction.
Few thing to do:
- See if the counting starts automatically
- Change the value of the meter to the actual values
- and I need to figure out where all those pulses are coming from (maybe a need to add a pull up/down resistor on the GPIO? Thought i didn't need one with the TCRT5000 since it's output is digital i/o) because now it's counting way to many.
Thanks for the great work on it and your kind support!
the compiled isrcounter. Is this the right file: download/file.php?id=3097 ?
In the zip i see a txt file. Do i copy the contents into a file called isrcounter in the /usr/local/bin directory? I'm not quite sure what i have to do with the txt file. (i'm using a windows pc and putty)
As you can see, i'm lacking some basic skills on the software side off things......
Update:
I copied the contents of the txt file into a file called isrcounter.c with nano
then i did: gcc -o isrcounter isrcounter.c -lwiringPi
When i run:
isrcounter1 /var/run/shm/isrcounter1
i get:
Waiting ... Waiting ... Waiting ... Done. counter: 18639: 1
Waiting ... Done. counter: 18707: 1
Waiting ... Done. counter: 18732: 83
Waiting ... Done. counter: 18734: 10
Waiting ... Done. counter: 18761: 2
Waiting ... Done. counter: 18797: 47
Waiting ... Done. counter: 18803: 16
Waiting ... Done. counter: 18805: 6
And my watermeter is finally showing some values. They suck

But at least i have a feeling i'n going in the right direction.
Few thing to do:
- See if the counting starts automatically
- Change the value of the meter to the actual values
- and I need to figure out where all those pulses are coming from (maybe a need to add a pull up/down resistor on the GPIO? Thought i didn't need one with the TCRT5000 since it's output is digital i/o) because now it's counting way to many.
Thanks for the great work on it and your kind support!
Sony Raspberry Pi B V2.0
Homemade P1 cable on Landis/Gyr E350
C&K/Honeywell Security system connected to Domoticz
AEON Labs USB Z-Wave
TCRT5000 sensor watermeter -> revived..... and in progress....
Homemade P1 cable on Landis/Gyr E350
C&K/Honeywell Security system connected to Domoticz
AEON Labs USB Z-Wave
TCRT5000 sensor watermeter -> revived..... and in progress....
- sincze
- Posts: 1300
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Using GPIO to measure energy
Let me check the instructions tomorrow. The initial meter value you have to set in a temp file:) that isrcounter is using the final file is the file domoticz reads. I don't use a resistor so don't worry we will get it running. Mine has been for over 2 years and same installation with 4 neighbours. Hahaha.
Sent from my SM-G925F using Tapatalk
Sent from my SM-G925F using Tapatalk
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
-
- Posts: 15
- Joined: Saturday 06 December 2014 19:25
- Target OS: Linux
- Domoticz version:
- Contact:
Re: Using GPIO to measure energy
Hi sincze,
i don't worry at all, your are very kind and patient, so i'm confident we will get it going right
I also want to document the steps i'm making for myself. Now i'm running on a rpi 1b v2 with domoticz 2.2826 that is a bit outdated, but it's working. I've got a Rpi3 lying here i want to use with the new domoticz version and i have to do the steps all over again.
I noticed no increase on my watermeter values since last evening, so i think it's not starting automatically.
i don't worry at all, your are very kind and patient, so i'm confident we will get it going right

I also want to document the steps i'm making for myself. Now i'm running on a rpi 1b v2 with domoticz 2.2826 that is a bit outdated, but it's working. I've got a Rpi3 lying here i want to use with the new domoticz version and i have to do the steps all over again.
I noticed no increase on my watermeter values since last evening, so i think it's not starting automatically.
Sony Raspberry Pi B V2.0
Homemade P1 cable on Landis/Gyr E350
C&K/Honeywell Security system connected to Domoticz
AEON Labs USB Z-Wave
TCRT5000 sensor watermeter -> revived..... and in progress....
Homemade P1 cable on Landis/Gyr E350
C&K/Honeywell Security system connected to Domoticz
AEON Labs USB Z-Wave
TCRT5000 sensor watermeter -> revived..... and in progress....
- sincze
- Posts: 1300
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Using GPIO to measure energy
A yes. the famous how to get back from a disaster or... I want to upgrade my hardware scenarioLieuwke wrote:Hi sincze,
i don't worry at all, your are very kind and patient, so i'm confident we will get it going right
I also want to document the steps i'm making for myself. Now i'm running on a rpi 1b v2 with domoticz 2.2826 that is a bit outdated, but it's working. I've got a Rpi3 lying here i want to use with the new domoticz version and i have to do the steps all over again.
I noticed no increase on my watermeter values since last evening, so i think it's not starting automatically.

Add this to your manual as well ;'-)
Step 0: http://www.domoticz.com/forum/viewtopic ... =20#p28371
Step 1: Connect the tcrt5000 device with plain dupont cables to:
Code: Select all
HeaderPin 1: 3,3 volt
HeaderPin 9: Ground
HeaderPin 12: GPIO1
Code: Select all
Install Wiring PI (http://wiringpi.com/download-and-install/)
- sudo apt-get install git-core
- sudo apt-get update
- sudo apt-get upgrade
- git clone git://git.drogon.net/wiringPi
- cd wiringPi
- git pull origin
- ./build
Step 4: Startup script in /etc/init.d/. Rename the isrcounter_startup_service to isrcounter
Step 5a: Set Initial value in temp file /var/run/shm/isrcounter1
Code: Select all
echo 2142454 > /var/run/shm/isrcounter1
Code: Select all
http://<YOUR_IP_HERE>:8080/json.htm?type=command¶m=udevice&idx=<YOUR_IDX_HERE&nvalue=0&svalue=<YOUR_METER_VALUE_HERE>
Install Monit
Code: Select all
sudo apt-get install monit
sudo monit
Code: Select all
check process Water_Meter matching "/usr/local/bin/isrcounter1"
start program "/etc/init.d/isrcounter start"
stop program "/etc/init.d/isrcounter stop"
Code: Select all
sudo monit status
sudo monit reload

Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
-
- Posts: 15
- Joined: Saturday 06 December 2014 19:25
- Target OS: Linux
- Domoticz version:
- Contact:
Re: Using GPIO to measure energy
Wow sincze,
that looks fabulous! A complete howto!
I will try this asap and let you know. The misses wants some quality time this week, so i don't know if i can get around to it this week already.
that looks fabulous! A complete howto!
I will try this asap and let you know. The misses wants some quality time this week, so i don't know if i can get around to it this week already.
Sony Raspberry Pi B V2.0
Homemade P1 cable on Landis/Gyr E350
C&K/Honeywell Security system connected to Domoticz
AEON Labs USB Z-Wave
TCRT5000 sensor watermeter -> revived..... and in progress....
Homemade P1 cable on Landis/Gyr E350
C&K/Honeywell Security system connected to Domoticz
AEON Labs USB Z-Wave
TCRT5000 sensor watermeter -> revived..... and in progress....
Who is online
Users browsing this forum: No registered users and 0 guests