PiFace support added

RobinS
Posts: 67
Joined: Friday 13 September 2013 0:24
Target OS: Raspberry Pi
Domoticz version:
Contact:

PiFace support added

Post by RobinS » Thursday 03 October 2013 23:37

Dear All,

I am please to announce that r1045 contains PiFace support
Upto 4 pifaces can be used (maximum possible)

Functions:
Inputs:
Changes (when applicable) are reported to Domoticz at 100 msec rate
Configuration options: (thru configuration file)
Level,
rising edge (button press)
falling edge (button release)
Inverted level

Output:
The following options for output state reporting are possible, HOWEVER Domoticz does not seem to like anything else than Level, have to figure out why...
Configuration options:
Level,
rising edge (button press)
falling edge (button release)
Inverted level

Counters:
Can be enabled on ALL inputs and outputs.
For the inputs hardware edge detection is used, for the outputs software edge detection is used @ the input report rate. (both are rising edge)
The hardware registers are sampled every 20 msec (at least that is the intention... :? ), which should allow for 50Hz signals....
Tests @ 5Hz showed an error rate of approx 0.5- 0.7% (tested with 40000 and 185000 counts, with 50/50 and 30/70 duty cycles, tested with 3 parallel connected inputs)
Tests @ 10Hz showed an error rate of approx 3.3 - 3.7 % (avg 3.4 %) (tested with 40000 and 87000 counts, with 50/50 duty cycles)
Initial test @ 20Hz showed an error rate near 10%
The encountered errors are due to kernel / userland switches and the linux multitasking mechanism, and are the best achievable.

The PiFace driver works as follows:
- Enable spi-bcm2708 module in /etc/modprobe.d/raspi-blacklist.conf (put a # before blacklist)
- Reboot
- Put a piface.conf configuration file in the domoticz program folder, needed if the default config (see later on) needs to be changed.
- Select PiFace from hardware dialog
- Goto devices screen and add devices..

PiFace devices and numbering:
Enabled I/O ports will be reported as a lighting 1 (impuls) device.
The ID field will show if a pin is a input (I) or output (O).
The Unit field will show the PiFace board, and pin number. The decade number ID's the PiFace board, the unit number the pin number.
So Unit 25 = PiFace Board address 2, and pinnumber 5 (pincount starts at 0)

Enabled Counters will be reported as a RFXMeter.
The ID field will show the PiFace address, Pintype, and Pinnumber.
The hundreds tell if a pin = input or output (input = 1xx, output 0xx)
The decades = address of the PiFace board
The unit number = pinnumber

The default configuration (without a piface.conf):
Input 0-3 (the buttons) enabled, with rising edge toggle (button press), counters disabled
Input 4-7 disabled, counters enabled with 10 seconds update time
Outputs 0-7 enabled, with level, counters enabled with 10 seconds update time

All can be changed with the piface.conf (a basic version for address 0 is included in r1045).

Enjoy...

Any remarks, questions etc., please place them in this topic.

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

User avatar
Keptenkurk
Posts: 440
Joined: Wednesday 21 August 2013 17:24
Target OS: -
Domoticz version:
Location: Waalre, The Netherlands
Contact:

Re: PiFace support added

Post by Keptenkurk » Friday 04 October 2013 8:26

Congratulations, and thanks for the efforts! Really happy with this add-on :D
Ordered some CNY70's to put the counters to work.

User avatar
CopyCatz
Developer
Posts: 751
Joined: Thursday 11 July 2013 17:28
Target OS: -
Domoticz version:
Location: Outer Heaven
Contact:

Re: PiFace support added

Post by CopyCatz » Friday 04 October 2013 16:22

Any examples of cool stuff to do with a piface?

User avatar
Keptenkurk
Posts: 440
Joined: Wednesday 21 August 2013 17:24
Target OS: -
Domoticz version:
Location: Waalre, The Netherlands
Contact:

Re: PiFace support added

Post by Keptenkurk » Friday 04 October 2013 17:46

Any examples of cool stuff to do with a piface?
Well, see it as an on-board I/O extension for the RPi capable of
* counting 8 channels (replacement of RFXMeter) or
* sensing ordinary wired switches (existing doorbell?, door/window contacts?) or
* switching ordinary wired devices (heating system?, doorbell ringer?, Selecting antenna on remote radio station, ...).
Most applications will have their dedicated RF solutions but this opens up the use of Domoticz in the DIY area.

RobinS
Posts: 67
Joined: Friday 13 September 2013 0:24
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: PiFace support added

Post by RobinS » Friday 04 October 2013 22:43

As an addition to keptenkurk;
Besides the inputs, there are outputs as well.
The PiFace hardware has 2 relays, which allows you to switch all kinds of power signals directly.
Also 6 high current outputs are available, one can use this to control a motor fi.
Also do not forget that due to the nature of domoticz event system, (using blocky and Lua) one can have the I/O of the PiFace interact with all the other (RF stuff) available in Domoticz.


To give you an idea, this is the project that I am working (and the reason why I wrote the PiFace driver): (Pi will be mounted in my utillity closet)
- Hook up my doorbell switch, and play MP3 sound with Pi audio out. (and have logging and kodak moments ; p available at the same time).
- Connect 3 KWh S0 meters to register and keeptrack of my energy consumption
- Connect 3 water flow meters to register and keeptrack of my water usage, and signal leakage.
Unfortunately this is a nogo with the PiFace as the water flow meters produce a frequency modulated pulse signal that requires more processing than the PiFace can offer, so I will need to design new hardware for it.
- Hook up 3 solenoid valves to control my outdoor sprinklers and faucets.

This of course all can be done with RF modules, but they generally do not work 100% reliable and for some controls like to solenoid valves one needs reliability.
Besides this a PiFace is far cheaper than a set of RF modules, and less bulky (if all stuff to controll in close by).
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

RobinS
Posts: 67
Joined: Friday 13 September 2013 0:24
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: PiFace support added

Post by RobinS » Friday 04 October 2013 23:06

Hi Bistoury,

Here is a photo of a PiFace with a additional header soldered onto it, to allow stacking.
In this case I used a standard header, as I had an extended version on my experimental addon board.

Soldering is a bit tricky and a soldering iron with a long pointy tip is required, because you will need to solder the back row of pins through the pin openings.
Its advisable to have a socket header ontop of the pinheader to prevent the pins in the addon header to slant, as they can get hot and the connector plastic can melt, and the pins can slant due to the side pressure of the soldering process. Normally this will not be the case but again this is not normal soldering ;)
I also suggest to remove the solder from the top of the header pins of the PiFace board, with fi. desoldering wire (Litze), so the addon connector will have a proper base.

I made some photo's of my 'handy' work.

Best Regards,

Robin
Attachments
PiFace with DIY addon board.JPG
PiFace with DIY addon board
PiFace with DIY addon board.JPG (188.52 KiB) Viewed 9761 times
PiFace width Addon connector.JPG
PiFace with stack connector
PiFace width Addon connector.JPG (181.18 KiB) Viewed 9761 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

bistoury
Posts: 158
Joined: Friday 12 July 2013 14:14
Target OS: -
Domoticz version:
Contact:

Re: PiFace support added

Post by bistoury » Saturday 05 October 2013 1:04

Hi Robin,

You tease me !

I don't think that I am at the same level than you for soldering things, and more specialy if it requires a specific attention.

Maybe we could suggest Piface manufacturer to have such a stackable header as an option. I think lot of people would pay for it !

I would love to by a piface, but first I need to have the Razberry for my Z-wave devices, and for the moment I do not want to by a second pi just for piface stuff...


Do you think there is a way to solve this issue with a triple header cable (ribbon) : I can remember that old IDE cables (for IDE hard drives) use to have 3 header : 1 for the motherboard, 1 for a master drive, and 1 for a slave drive.
maybe this would do the trick ? what about ?


As usual, any suggestion is welcomed !

bistoury.

User avatar
Keptenkurk
Posts: 440
Joined: Wednesday 21 August 2013 17:24
Target OS: -
Domoticz version:
Location: Waalre, The Netherlands
Contact:

Re: PiFace support added

Post by Keptenkurk » Saturday 05 October 2013 7:35

There is a PiStack for upto 4 PiFaces available!
EDIT: It should be PiRack (not PiStack)
Last edited by Keptenkurk on Saturday 05 October 2013 22:54, edited 1 time in total.

bistoury
Posts: 158
Joined: Friday 12 July 2013 14:14
Target OS: -
Domoticz version:
Contact:

Re: PiFace support added

Post by bistoury » Saturday 05 October 2013 9:30

Keptenkurk wrote:There is a PiStack for upto 4 PiFaces available!
But i ma not sûre that ip gpio are connected together...

User avatar
Keptenkurk
Posts: 440
Joined: Wednesday 21 August 2013 17:24
Target OS: -
Domoticz version:
Location: Waalre, The Netherlands
Contact:

Re: PiFace support added

Post by Keptenkurk » Saturday 05 October 2013 15:15

Added Wiki page "PiFace" for this addon.

RobinS
Posts: 67
Joined: Friday 13 September 2013 0:24
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: PiFace support added

Post by RobinS » Saturday 05 October 2013 22:05

bistoury wrote: Do you think there is a way to solve this issue with a triple header cable (ribbon) : I can remember that old IDE cables (for IDE hard drives) use to have 3 header : 1 for the motherboard, 1 for a master drive, and 1 for a slave drive.
maybe this would do the trick ? what about ?
Hi bistoury,

What you are proposing can succeed, however not with IDE cables, as they have sockets pressed on.
You will need 1 presson header socket (std ribbon) connector, and several presson boxed pinheader connectors, these all exist, and should be available at farnell.
However I think that it can be quite costly, as some of these presson boxed pinheader connectors can be quite expensive.

I fully agree with keptenkurk's suggestion, as I it was my next suggestion.. (the kepten beat me to it ;) )...

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

bistoury
Posts: 158
Joined: Friday 12 July 2013 14:14
Target OS: -
Domoticz version:
Contact:

Re: PiFace support added

Post by bistoury » Saturday 05 October 2013 22:20

Sorry, but I don't understand.

I've googled a bit, and to me Pi-Stack is just a case. There is nothing to connect Pi's GPIO on different boards (such as Pi Face + Raberry).


For the Presson header and Ribbon, do you have any link @farnall, I can't find by myself :(

For sure, I must not be the first one to want to stack more than 2 child board on the same pi, without to having to solder... I am ?


I think you are both more experience than me for DIY stuff... and I feel like a noob :)

User avatar
Keptenkurk
Posts: 440
Joined: Wednesday 21 August 2013 17:24
Target OS: -
Domoticz version:
Location: Waalre, The Netherlands
Contact:

Re: PiFace support added

Post by Keptenkurk » Saturday 05 October 2013 22:53

Sorry bistoury,
My fault. The thing is called a PiRack (not a PiStack, not a bad name either).
Look here.

User avatar
Keptenkurk
Posts: 440
Joined: Wednesday 21 August 2013 17:24
Target OS: -
Domoticz version:
Location: Waalre, The Netherlands
Contact:

Re: PiFace support added

Post by Keptenkurk » Sunday 06 October 2013 10:55

PiFace Applications Part 1: Connect your S0 Smartmeter

This little circuit will allow you to connect your smartmeter's S0 bus to the input of a PiFace.
Attachments
PiFace S0 interface.jpg
PiFace S0 interface.jpg (43.18 KiB) Viewed 9589 times

RobinS
Posts: 67
Joined: Friday 13 September 2013 0:24
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: PiFace support added

Post by RobinS » Sunday 06 October 2013 11:24

Nice schematic : )

With this ciruit the PiFace inputs can be made much more robust, and can also be used for other I/O applications.
When using the 2N7000 this circuit can handle max 40V dc as input voltage, instead of the default 3v3 of the PiFace...
For the S0 appilication the 1K resistors are needed, but for other applications they can be changed to higher values like 10k or 100k to reduce input current.
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

bistoury
Posts: 158
Joined: Friday 12 July 2013 14:14
Target OS: -
Domoticz version:
Contact:

Re: PiFace support added

Post by bistoury » Sunday 06 October 2013 11:59

Keptenkurk wrote:Sorry bistoury,
My fault. The thing is called a PiRack (not a PiStack, not a bad name either).
Look here.

Yeah ! is there a case for that ? :)
I would love something simpler like IDE ribbons, but at least there's a solution for me (which is not really WAF, I must admit )

RobinS
Posts: 67
Joined: Friday 13 September 2013 0:24
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: PiFace support added

Post by RobinS » Sunday 06 October 2013 17:53

bistoury wrote: Yeah ! is there a case for that ? :)
I would love something simpler like IDE ribbons, but at least there's a solution for me (which is not really WAF, I must admit )
[/quote]

I will have a look at the ribbon connectors for you.
But I wonder if any Pi project will ever meet the WAF... unless its hidden ;)
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

bistoury
Posts: 158
Joined: Friday 12 July 2013 14:14
Target OS: -
Domoticz version:
Contact:

Re: PiFace support added

Post by bistoury » Sunday 06 October 2013 19:33

thnks for keeping investigating.

Regarding WAF of Pi project, I must admit your right. At least there are some LEDS, so at night in the garage it looks like a Chrismas tree :)

RobinS
Posts: 67
Joined: Friday 13 September 2013 0:24
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: PiFace support added

Post by RobinS » Monday 07 October 2013 20:57

As promised...
I scanned some catalog pages of my farnell catalog (old one), of the connectors you can use.
I highted the ones that you might need, the connectors are still available, although the pricing may have changed.

https://www.dropbox.com/s/k7lsk1o0ndy75 ... arnell.pdf

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

bistoury
Posts: 158
Joined: Friday 12 July 2013 14:14
Target OS: -
Domoticz version:
Contact:

Re: PiFace support added

Post by bistoury » Monday 07 October 2013 22:12

thanks for the references (and for your time !)

So to sum up things, I would need the following Items :
- 1 ribbon 10 to 15 cm, with 26 ways (I have found ref. 1207444 or ref. 1207422 --if you want some colors !-- but it has a pitch of 1.27 => this is half the pitch of the connector so I wonder if this would fit my needs)
- 1 female connector to connect the ribbon to the Pi's GPIO (26 ways, pitch 2.54, ref 1098511)
- 2 male connectors to connect Piface and Razberry Boards (26 ways, pitch 2.54, ref 1098599)
- 1 Piface (as a starter :)) (ref. 2218566)

So for me this would mean an investment of (without transportation fee) :
- solution a) DIY connections + Piface : 1.56€ + 1.79€ + 2*5.23€ + 25.38€ = 39,19€ => 49.87€ VAT Incl.
- solution b) PiRack + PiFace : 10.83€ + 25.38€ = 36.21€ => 43.30€ VAT Incl.

I must admit that solution b) is only 6€ cheaper and have evolution possibilities....but is absolutly not WAF...
whereas as solution a) can be a bit more stylish (with the appropriate Piface case, around 20€ )...

any comment ?

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests