PiFace 2 Digital Setup

I have a RPi3 with a PiFace2 Digital setup. The two relays are connected to my garage doors and I’ve connected two reed switches to inputs 0 & 1 to sense if the garage doors are open. Up until yesterday I hadn’t heard of Cayenne so I have a Python Flask webapp that I created that shows me if either my left or right garage door is open, and I can click on the left or right door and it will trigger the relay.

I’d like to abandon my Flask app, and move everything to Cayenne. I’ve added the RPi3 to my Cayenne account. I added the PiFace to the RPi3. But I cannot figure out how to sense the values of the reed switches attached to inputs 0 or 1. And I can’t figure out how to trigger either of the two onboard relay switches.

Any help would be greatly appreciated. Thanks

Be very careful about initial states (on power loss). I just went through this with a project to water my spring seedlings. If the power goes out and the system reboots the water valve may allow the water tank to drain and flood the seedlings. Pull ups are necessary. I say this because you wouldn’t want your garage doors flying open after a power loss.

As for the reed switches, have you tried the 0/1 2 state widget? These work for my moisture sensor two-state devices. I use them to alert me (via text msg) so that I can manually turn the water valve on or off remotely through cayenne.

Currently in my python script (I code python for a living), I monitor the state of the garage door before anything. I guess the trick will be to do the same in Cayenne.

Doesn’t the PiFace2 use a MCP23S17 GPI/O expander chip? ADD the MCP23S17 “Extention” software to the Pi (from Cayenne Dashboard) so you can address the expander chip. After that chip is addressed, you will be able to “see” the GPI/O widgets under your RasPi device on the Cayenne dashboard. Then you will be able to drag-and-drop your GPI/O widgets, and you can assign inputs or outputs as required. :slight_smile:

1 Like

I already added the PiFace as an extension to the RPi. Under the RPi I can see the PiFaceDigital under extensions. On that page it lists ports 0 thru 15.

I’ve tried adding widgets to show the status of the reeds and I’ve tried to figure out where the relays are, but it almost seems like the PiFace extension doesn’t work. Has anyone actually gotten this to work?