News regarding Piface 1 & 2 (counter) issues
Moderators: fantom, leecollings
-
- Posts: 37
- Joined: Friday 13 September 2013 0:24
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
News regarding Piface 1 & 2 (counter) issues
Dear Piface users,
I have been getting some PM's and news during the last few months regarding the fact that the Piface / counters were not working any longer.
Sorry for the delay but I had little time during the past few months, and lacked some vital resources to investigate and debug this issue.
Actually I was not aware that so many people are using the PiFace.
I am glad to announce that I have found and fixed the problem, and summitted the fixes to Gizmocuz for implementation into the unstable tree.
The problems:
1) The counters were not sent each update interval
Another developer found it more efficient (which it is) to only sent the counter updates on each interval if they were changed.
However forgot to inform me and the other users.
Fixed:
I have added a new parameter to the piface.conf file which allows the user to select which counters should be updates each interval (even if its not changed) or only
when the counter has been updated.
count_update_type: on_change
always
The on_change parameter is the default setting, which means that the counters are only send during the update interval when they are changed.
2) The Piface board(s) was not detected
3) The counters stopped working
Both these issues have the same origin... The IO chip on the Piface was not properly initialized due to an chip selection (CE) error.
This chip selection error was appearantly caused by the replacement of the bcm2708 spi module from the kernel by the bcm2835 module.
In the new bcm2835 module the IO chip was not properly selected during the detection and initialisation phase of the Piface hardware when using the standard spidev
(sysfs) interface, and no workaround was available using this method.
Fixed:
I have now rewritten the piface code to use a different interface method to the bcm2835 module which provides more control, with good results.
To illustrate: Note:
To use the bcm2835, one should enable the device tree on the pi:
raspi-config
- advanced options -> SPI enable
-> reboot
So I hope that my fixes will be merged into the mainline code soon, and expect and hope that the issues will be solved.
Best Regards,
Robin
I have been getting some PM's and news during the last few months regarding the fact that the Piface / counters were not working any longer.
Sorry for the delay but I had little time during the past few months, and lacked some vital resources to investigate and debug this issue.
Actually I was not aware that so many people are using the PiFace.
I am glad to announce that I have found and fixed the problem, and summitted the fixes to Gizmocuz for implementation into the unstable tree.
The problems:
1) The counters were not sent each update interval
Another developer found it more efficient (which it is) to only sent the counter updates on each interval if they were changed.
However forgot to inform me and the other users.
Fixed:
I have added a new parameter to the piface.conf file which allows the user to select which counters should be updates each interval (even if its not changed) or only
when the counter has been updated.
count_update_type: on_change
always
The on_change parameter is the default setting, which means that the counters are only send during the update interval when they are changed.
2) The Piface board(s) was not detected
3) The counters stopped working
Both these issues have the same origin... The IO chip on the Piface was not properly initialized due to an chip selection (CE) error.
This chip selection error was appearantly caused by the replacement of the bcm2708 spi module from the kernel by the bcm2835 module.
In the new bcm2835 module the IO chip was not properly selected during the detection and initialisation phase of the Piface hardware when using the standard spidev
(sysfs) interface, and no workaround was available using this method.
Fixed:
I have now rewritten the piface code to use a different interface method to the bcm2835 module which provides more control, with good results.
To illustrate: Note:
To use the bcm2835, one should enable the device tree on the pi:
raspi-config
- advanced options -> SPI enable
-> reboot
So I hope that my fixes will be merged into the mainline code soon, and expect and hope that the issues will be solved.
Best Regards,
Robin
Last edited by RobinS on Sunday 22 November 2015 16:37, edited 1 time in total.
My domoticz setup:
PI [Doorbell on Audio out], DS1307 RTC, BMP085, PiFace [4* S0 meter, Doorbell In, PIR, GBS and Door sensors] and RFXCom 433 [5 HomeEasy, 2 Impluz]
2x P1 smartmeter on USB
Gammu-smsd with USB 3G modem
Andromoticz on control tablet
PI [Doorbell on Audio out], DS1307 RTC, BMP085, PiFace [4* S0 meter, Doorbell In, PIR, GBS and Door sensors] and RFXCom 433 [5 HomeEasy, 2 Impluz]
2x P1 smartmeter on USB
Gammu-smsd with USB 3G modem
Andromoticz on control tablet
-
- Posts: 37
- Joined: Friday 13 September 2013 0:24
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: News regarding Piface 1 & 2 (counter) issues
Some additional remarks:
I am getting a lot of questions / remarks regarding the fact the the Piface does not register all input changes (for instance a door bell button), and that the Piface is slow to react.
Part of this is due to the nature of the PiFace implementation, it reads the input pins several times a second. If a change occurs between these reads,it will not be detected.
Reading the input pins faster and more frequent is not possible due to the nature of linux, and it only allows the piface to be read approx 50x second (at max, and it could be less depending on the system load). For a good pin change at least 2 reads are needed.
Illustration:
Below is an image of the reading of the Piface I/O chip (yellow spike), the time between such a spike is 20ms (kernel controlled) hence 50x second.
After each reading the data is processed by the Piface driver and if needed sent to domoticz for further processing. Below a Piface reading sequence.
A piface reading takes 37 micro seconds.
The counters are processed in a different way.
As they are expected to be more frequent than I/O readings, and consist of pulses, changes are latched in the IO chip for later processing.
For a counter is does not really matter if there is an delay on the processing, however for input pins it does matter.
For this reason counter can sometimes better detect small pulses, but they can not detect high/low changes.
Hope this clarifies some of the questions outthere.
Best Regards,
Robin
I am getting a lot of questions / remarks regarding the fact the the Piface does not register all input changes (for instance a door bell button), and that the Piface is slow to react.
Part of this is due to the nature of the PiFace implementation, it reads the input pins several times a second. If a change occurs between these reads,it will not be detected.
Reading the input pins faster and more frequent is not possible due to the nature of linux, and it only allows the piface to be read approx 50x second (at max, and it could be less depending on the system load). For a good pin change at least 2 reads are needed.
Illustration:
Below is an image of the reading of the Piface I/O chip (yellow spike), the time between such a spike is 20ms (kernel controlled) hence 50x second.
After each reading the data is processed by the Piface driver and if needed sent to domoticz for further processing. Below a Piface reading sequence.
A piface reading takes 37 micro seconds.
The counters are processed in a different way.
As they are expected to be more frequent than I/O readings, and consist of pulses, changes are latched in the IO chip for later processing.
For a counter is does not really matter if there is an delay on the processing, however for input pins it does matter.
For this reason counter can sometimes better detect small pulses, but they can not detect high/low changes.
Hope this clarifies some of the questions outthere.
Best Regards,
Robin
My domoticz setup:
PI [Doorbell on Audio out], DS1307 RTC, BMP085, PiFace [4* S0 meter, Doorbell In, PIR, GBS and Door sensors] and RFXCom 433 [5 HomeEasy, 2 Impluz]
2x P1 smartmeter on USB
Gammu-smsd with USB 3G modem
Andromoticz on control tablet
PI [Doorbell on Audio out], DS1307 RTC, BMP085, PiFace [4* S0 meter, Doorbell In, PIR, GBS and Door sensors] and RFXCom 433 [5 HomeEasy, 2 Impluz]
2x P1 smartmeter on USB
Gammu-smsd with USB 3G modem
Andromoticz on control tablet
-
- Posts: 12
- Joined: Tuesday 27 May 2014 19:56
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: News regarding Piface 1 & 2 (counter) issues
Thanks Robin! are these changes available on the current beta?
-
- Posts: 37
- Joined: Friday 13 September 2013 0:24
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: News regarding Piface 1 & 2 (counter) issues
My pleasure.
No, the changes are not available thru GIT yet, as I lost my commit rights in the move from SVN to GIT.
So I mailed my changes to gizmocuz and asked him to merge them.
I have also asked him to post in this topic when he has merged them into the trunk.
No, the changes are not available thru GIT yet, as I lost my commit rights in the move from SVN to GIT.
So I mailed my changes to gizmocuz and asked him to merge them.
I have also asked him to post in this topic when he has merged them into the trunk.
My domoticz setup:
PI [Doorbell on Audio out], DS1307 RTC, BMP085, PiFace [4* S0 meter, Doorbell In, PIR, GBS and Door sensors] and RFXCom 433 [5 HomeEasy, 2 Impluz]
2x P1 smartmeter on USB
Gammu-smsd with USB 3G modem
Andromoticz on control tablet
PI [Doorbell on Audio out], DS1307 RTC, BMP085, PiFace [4* S0 meter, Doorbell In, PIR, GBS and Door sensors] and RFXCom 433 [5 HomeEasy, 2 Impluz]
2x P1 smartmeter on USB
Gammu-smsd with USB 3G modem
Andromoticz on control tablet
-
- Posts: 37
- Joined: Friday 13 September 2013 0:24
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: News regarding Piface 1 & 2 (counter) issues
Dear PiFace users,
As mentioned the issue is fixed, but unfortunately you all will need to wait some time longer for the fix to be available in the repo.
It turns out that there is a Pi 1 and Pi 2 platform dependency which complicates the build process.
I now have GIT access, and will look at this issue in the coming days, but unfortunately have extreemly limited time.
For the handy ones amongst you I hereby attach the fixed code (without any warranty).
Besides the code a library is needed, that can be obtained here:
http://www.airspayce.com/mikem/bcm2835/
I will post updates as they progress.
Best Regards,
Robin
As mentioned the issue is fixed, but unfortunately you all will need to wait some time longer for the fix to be available in the repo.
It turns out that there is a Pi 1 and Pi 2 platform dependency which complicates the build process.
I now have GIT access, and will look at this issue in the coming days, but unfortunately have extreemly limited time.
For the handy ones amongst you I hereby attach the fixed code (without any warranty).
Besides the code a library is needed, that can be obtained here:
http://www.airspayce.com/mikem/bcm2835/
I will post updates as they progress.
Best Regards,
Robin
- Attachments
-
- Update files Piface bcm fix.zip
- (23.15 KiB) Downloaded 141 times
My domoticz setup:
PI [Doorbell on Audio out], DS1307 RTC, BMP085, PiFace [4* S0 meter, Doorbell In, PIR, GBS and Door sensors] and RFXCom 433 [5 HomeEasy, 2 Impluz]
2x P1 smartmeter on USB
Gammu-smsd with USB 3G modem
Andromoticz on control tablet
PI [Doorbell on Audio out], DS1307 RTC, BMP085, PiFace [4* S0 meter, Doorbell In, PIR, GBS and Door sensors] and RFXCom 433 [5 HomeEasy, 2 Impluz]
2x P1 smartmeter on USB
Gammu-smsd with USB 3G modem
Andromoticz on control tablet
-
- Posts: 12
- Joined: Tuesday 27 May 2014 19:56
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: News regarding Piface 1 & 2 (counter) issues
Hi Robin,
Thanks for your good work on this one!
I think I will wait for the fixed image, any new when this will be available. no rush as I am working around the issues at the moment.
Thanks
Grant
Thanks for your good work on this one!
I think I will wait for the fixed image, any new when this will be available. no rush as I am working around the issues at the moment.
Thanks
Grant
-
- Posts: 10
- Joined: Wednesday 20 May 2015 23:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V3.7392
- Location: Netherlands
- Contact:
Re: News regarding Piface 1 & 2 (counter) issues
Sounds great!
When can we expect to see this in beta or stable release?

When can we expect to see this in beta or stable release?
-
- Posts: 10
- Joined: Saturday 14 February 2015 17:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Netherlands
- Contact:
Re: News regarding Piface 1 & 2 (counter) issues
Or can you let us know in a little more detail what steps to take to put the libary and files in place? 

- proohu01
- Posts: 95
- Joined: Friday 17 October 2014 12:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: The Netherlands
- Contact:
Re: News regarding Piface 1 & 2 (counter) issues
RobinS,
Can you give us some more info you PiFace troubleshooting project? Please!
Can you give us some more info you PiFace troubleshooting project? Please!
Pi 2 B | Pi Camera | PiFace 2 | RFXtrx433E (KaKu + Oregon Scientific) | Plugwise (9 Circles) | Aeon Z-Wave stick (Fibaro - dimmers, sockets, RGB, screens/blinds) | RFXMeter (Kwh/water/gaz) | WOL | Onkyo Receiver | RTC | Hikvision | Netatmo | Satel Integra
- proohu01
- Posts: 95
- Joined: Friday 17 October 2014 12:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: The Netherlands
- Contact:
Re: News regarding Piface 1 & 2 (counter) issues
I am ones again having a lot of problems with the PiFace integration. The input state nolonger reflects the real state. This is the ...(I lost count) time it breaks on me. I am starting to dislike the PiFace a lot!
Moving to something else for my inputs and outputs. Don't know what yet. UniPi looks nice but no integration with Domoticz. Perhaps just the RAW GPIO with some pull up logic. Maybe even some MySensors hardware.....
To bad RobinS doesn't have time. It looked like he had some clue on what was wrong with the integration.
Moving to something else for my inputs and outputs. Don't know what yet. UniPi looks nice but no integration with Domoticz. Perhaps just the RAW GPIO with some pull up logic. Maybe even some MySensors hardware.....
To bad RobinS doesn't have time. It looked like he had some clue on what was wrong with the integration.
Pi 2 B | Pi Camera | PiFace 2 | RFXtrx433E (KaKu + Oregon Scientific) | Plugwise (9 Circles) | Aeon Z-Wave stick (Fibaro - dimmers, sockets, RGB, screens/blinds) | RFXMeter (Kwh/water/gaz) | WOL | Onkyo Receiver | RTC | Hikvision | Netatmo | Satel Integra
- Sine
- Posts: 17
- Joined: Monday 02 February 2015 15:57
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Contact:
Re: News regarding Piface 1 & 2 (counter) issues
Te problem is not the piface, that thing is just a very simple serial IO expander.
Mysensors is ok for a lot of things, but if I can help it I really try to avoid adding ANOTHER wireless thing (with its own quirks)
If it's at all possible it I like directly connect things, and the piface WAS perfect for that.
When I started with my domoticz setup the thing worked a charm ... s0 counters, inputs, outputs ... the works.
s0 has been dead for months, the rest has been flaky at best.
Nowadays every friggin update seems to break *something* on the piface ... *SIGH* ... TEST this stuff people !!
The fact that the piface probbably does not have a very lage userbase doesn't exactly help either.
Yes ... I exaggerate (a tiny bit) ... but this is starting to get REALLY frustrating and annoys the hell out of me
(does it show?)
Mysensors is ok for a lot of things, but if I can help it I really try to avoid adding ANOTHER wireless thing (with its own quirks)
If it's at all possible it I like directly connect things, and the piface WAS perfect for that.
When I started with my domoticz setup the thing worked a charm ... s0 counters, inputs, outputs ... the works.
s0 has been dead for months, the rest has been flaky at best.
Nowadays every friggin update seems to break *something* on the piface ... *SIGH* ... TEST this stuff people !!
The fact that the piface probbably does not have a very lage userbase doesn't exactly help either.
Yes ... I exaggerate (a tiny bit) ... but this is starting to get REALLY frustrating and annoys the hell out of me

- proohu01
- Posts: 95
- Joined: Friday 17 October 2014 12:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: The Netherlands
- Contact:
Re: News regarding Piface 1 & 2 (counter) issues
I created a (hopefully temporary) workaround by plugging the PiFace onto an older "Pi B+" model with an older (3.12.35+) kernel. This second Pi is now a domoticz slave to my main "Pi2 B" Domoticz server. (https://www.domoticz.com/wiki/Setting_up_Device_sharing)
My master is running the latest beta v2.4337 and the slave is at v2.3530. This is working even-though the Wiki states...
I donated a PiFace to gizmocus a couple of months ago. I am still hoping he has this in his possession and it willing to put the problems with the PiFace on the todo list. I 'm sure It would be greatly appreciated by all PiFace users.
My master is running the latest beta v2.4337 and the slave is at v2.3530. This is working even-though the Wiki states...
Too bad I had to waste an additional Pi (and a slightly higher electricity bill) for thisall software should be at the latest version and all master and slave's must be running the same version

I donated a PiFace to gizmocus a couple of months ago. I am still hoping he has this in his possession and it willing to put the problems with the PiFace on the todo list. I 'm sure It would be greatly appreciated by all PiFace users.
Pi 2 B | Pi Camera | PiFace 2 | RFXtrx433E (KaKu + Oregon Scientific) | Plugwise (9 Circles) | Aeon Z-Wave stick (Fibaro - dimmers, sockets, RGB, screens/blinds) | RFXMeter (Kwh/water/gaz) | WOL | Onkyo Receiver | RTC | Hikvision | Netatmo | Satel Integra
-
- Posts: 4
- Joined: Friday 05 February 2016 18:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: News regarding Piface 1 & 2 (counter) issues
Hi,
I did a small fix to piface driver that is already integrated https://github.com/domoticz/domoticz/pull/426
Before this fix, my piface2 would not work at all or very randomly (random led output triggered, input count increasing without any input, piface not detected at all)
Hope it will help
I did a small fix to piface driver that is already integrated https://github.com/domoticz/domoticz/pull/426
Before this fix, my piface2 would not work at all or very randomly (random led output triggered, input count increasing without any input, piface not detected at all)
Hope it will help
- proohu01
- Posts: 95
- Joined: Friday 17 October 2014 12:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: The Netherlands
- Contact:
Re: News regarding Piface 1 & 2 (counter) issues
Thank you very much BADZ !
All is working again. You made a lot of PiFace users happy.
All is working again. You made a lot of PiFace users happy.
Pi 2 B | Pi Camera | PiFace 2 | RFXtrx433E (KaKu + Oregon Scientific) | Plugwise (9 Circles) | Aeon Z-Wave stick (Fibaro - dimmers, sockets, RGB, screens/blinds) | RFXMeter (Kwh/water/gaz) | WOL | Onkyo Receiver | RTC | Hikvision | Netatmo | Satel Integra
-
- Posts: 4
- Joined: Friday 05 February 2016 18:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: News regarding Piface 1 & 2 (counter) issues
Credit should go where it is due : Robin for creating this driver 
Happy that it works for others though !

Happy that it works for others though !
-
- Posts: 179
- Joined: Friday 12 July 2013 13:53
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta Ch
- Location: The Netherlands
- Contact:
Re: News regarding Piface 1 & 2 (counter) issues
Thank you Badz for fixing this.
-
- Posts: 229
- Joined: Wednesday 30 April 2014 20:27
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: The Netherlands
- Contact:
Re: News regarding Piface 1 & 2 (counter) issues
Hello Robin and batz (and the other fixers of course),
It was frustrating and we had to wait a long time. Some times I got the feeling that piface was on his way to the morgue. I am glad that the problems are solved. My pifaces work as expected, even with the latest kernel version.
Thanks a lot
Jan
It was frustrating and we had to wait a long time. Some times I got the feeling that piface was on his way to the morgue. I am glad that the problems are solved. My pifaces work as expected, even with the latest kernel version.
Thanks a lot
Jan
-
- Posts: 10
- Joined: Saturday 14 February 2015 17:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Netherlands
- Contact:
Re: News regarding Piface 1 & 2 (counter) issues
Hello All, I did a:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install raspberrypi-ui-mods
rebooted
I did switched to release channel "Beta"...no updates.
But still the Piface does not come back to life... what else do I need to do?
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install raspberrypi-ui-mods
rebooted
I did switched to release channel "Beta"...no updates.
But still the Piface does not come back to life... what else do I need to do?
-
- Posts: 4
- Joined: Friday 05 February 2016 18:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: RE: Re: News regarding Piface 1 & 2 (counter) issues
The last changes are not part of an official release AFAIK.Ronny wrote:Hello All, I did a:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install raspberrypi-ui-mods
rebooted
I did switched to release channel "Beta"...no updates.
But still the Piface does not come back to life... what else do I need to do?
You need to do a manual compiled version : http://www.domoticz.com/wiki/Installing ... rom_Source
Who is online
Users browsing this forum: No registered users and 0 guests