Piface Digital outputs

201 views
Skip to first unread message

Blue Collar Ingenuity

unread,
May 13, 2015, 9:22:16 AM5/13/15
to web...@googlegroups.com
Does anyone have experience programming the 2 change over relays separately from the 8 open collector relays? I am stuck as I need 10 separate outputs. 
Here is what I am using to control the open collectors 

Output0 = 0 # 0-7 Wireless Enable LED
pfd.digitalWrite(Output0,1)

Currently this will switch both, the relay and the open collector. 
I can isolate the relays but am unsure how to command them separately 

Jeff 

Pete Dudash

unread,
May 13, 2015, 10:24:56 AM5/13/15
to web...@googlegroups.com
According to the documentation I read, the leds are connected in parallel with the relays.  So you can't drive them independently.  However, there could be another way...

MCP23S17SP has 16 pins that can be configured for either input or output.  If you can afford to lose 2 inputs, you can change those to outputs.  But keep in mind that these pins don't go through the darlington buffer (are not open collector).  That means you can only source/sink a maximum of 25mA on the pin rather than 600mA.  Also remember that the inputs are in series with some resistance - so that will also limit the max current (see schematic).

You'll just have to change the chip initialization routine to account for your particular input/output requirements.  I've never used one, so I can't help you with that.  But I imagine it wouldn't be too difficult.

Blue Collar Ingenuity

unread,
May 13, 2015, 10:50:28 AM5/13/15
to web...@googlegroups.com
Thanks Pete, 

Looking at the document I use pfd.digitalWrite(Output0,1) to control the open collectors 

LEDs

The LED’s are connected in parallel to each of the outputs. This means that when you set output pin 4 high, LED 4 illuminates.

>>> import pifacedigitalio
>>> pifacedigital = pifacedigitalio.PiFaceDigital()
>>> pifacedigital.output_pins[4].turn_on()  # this command does the same thing...
>>> pifacedigital.leds[4].turn_on()  # ...as this command

Can I not use >>> pfd.relays[0].turn_on() #  Will this not switch the relay separately? 

Relays

The two Relays are connected in parallel to output pins 0 and 1 respectively. When you set output pin 0 high, LED 0 illuminates and Relay 0 activates.

>>> import pifacedigitalio
>>> pifacedigital = pifacedigitalio.PiFaceDigital()
>>> pifacedigital.output_pins[0].turn_on()  # this command does the same thing...
>>> pifacedigital.leds[0].turn_on()  # ...as this command...
>>> pifacedigital.relays[0].turn_on()  # ...and this command...

I am at work and will have to test tonight. My deadline is Thursday night I want my project completed for the weekend to remotely launch fireworks :). 

Jeff 

Pete Dudash

unread,
May 13, 2015, 12:14:26 PM5/13/15
to web...@googlegroups.com

But that document clearly states When you set output pin 0 high, LED 0 illuminates and Relay 0 activates That means you cannot drive the leds separately from the relay because the LED’s are connected in parallel to each of the outputs. If you look at the schematic, you’ll see one output is tied to both the led and the relay. Try it out to make sure though.

If you verify that is true, you can reconfigure the I/O registers as I suggested previously. This Piface was designed to simply provide 8 inputs and 8 outputs all next to each other. But you can theoretically mix and match any number of in/outputs and in arbitrary locations. The only catch is you will not have an open collector output (or led) if you convert an input. You can easily add a FET/BJT to accomplish the same thing, however.

Perhaps someone with real-life experience with the Piface can verify/deny me here and provide additional insight.

Maybe you can get creative and use the DPDT functionality of the relays to add extra outputs.
Or even add a couple AND gates: pin 0 - launches firework0, pin 1 - launches fw1, pin 0 and pin 1 - launches fw2, etc.

Blue Collar Ingenuity

unread,
May 13, 2015, 1:18:56 PM5/13/15
to web...@googlegroups.com
Damn, 
           I read it but it didn't sink in When you set output pin 0 high, LED 0 illuminates and Relay 0 activates. 
I need all the inputs so I think I'm screwed. I am thinking this route http://goo.gl/7X5NhY but it isn't cheap. 
I don't know if I can add that device to my piface digital 2....more googling to do. 
I'm kind of stuck for space also. Hopefully I can post pictures tonight. 

Pete Dudash

unread,
May 13, 2015, 1:40:35 PM5/13/15
to web...@googlegroups.com
That is expensive and a bit overkill - at least for the two additional outputs you need.  Depending on your hardware requirements and available space, you can add a quad AND gate in a DIP package and four NPNs in the TO92 package.  With some careful wiring and software control, you can add four more open collector outputs.  That might not even take up too much more space.  If you really need those two more outputs, I know you can find space for them somewhere.  :-)

Or if you have NPNs (or NFETs) readily available, you can wire them up in series (NAND gate).  Rather than connecting that pullup resistor, you can use it as another open collector (drain) output.  This might be the easiest/fastest/cheapest solution so you can have the fireworks controller ready for the weekend!

Good luck!
Reply all
Reply to author
Forward
0 new messages