Review of PiFace Digital

Table of contents

RoadTest: PiFace Digital

Author: richvillehill

Creation date:

Evaluation Type: Independent Products

Did you receive all parts the manufacturer stated would be included in the package?: True

What other parts do you consider comparable to this product?: Programmable Logic Controls Microcontroller

What were the biggest problems encountered?:

Detailed Review:

PiFace Road test

5/29/13

David Hartle

My usage of the piface is as an industrial controls device.  Industrial control devices are primarily programmable logic controllers (PLC’s), microcontrollers, and or relays and pushbuttons.  Industrial PLC’s are expensive and the software proprietary and/or unavailable.  Microcontrollers require supporting circuitry to build and troubleshoot before it can be used.  The piface is inexpensive and ready to go to work right out of the package. 

The raspberry pi is an amazingly inexpensive computer.  It is a powerful tool to use in many different methods.  When the pi is coupled with the piface, the system is a great tool to use as a low cost industrial controls PLC.

The piface has 4 onboard momentary push buttons that serve as inputs.  It has two onboard relays to serve as outputs, and 8 LED output indicators.

Example #1

A simple control circuit used in industrial controls is a start/stop circuit.  The circuit uses two momentary push buttons and a relay to turn on or off a device.  The circuit can be hard wired as shown in Figure 1.  Notice the first pushbutton labeled “stop” is a normally closed push button and the second pushbutton labeled “start” is a normally open pushbutton.  The last device on the rung is the coil of the relay labeled “CR”.  When the relay coil is energized contacts labeled “CR” (connected in parallel with “start”) close to serve as a “seal”.  The seal in contacts maintain current to the coil even after the “start” pushbutton is released.  

image

Figure 1

 

 

The order of operations for the circuit in Figure 1: 

Press “start”: “CR” will turn on and “seal” in, staying even after releasing “start”

                Press “stop”: “CR” will turn off and remain off even after releasing “stop”

Programming the simple start/stop control circuit requires the use of logical operators.  Rungs are built using “and” “or” “not” statements in conjunction with variables that are defined to the input and output hardware available on the piface.

I used python to program the pi and control the piface with this simple control circuit method. Because all the buttons on the piface are normally open, the “stop” input has to be inverted with a “not” operator.

Here is the example code:

 

import piface.pfio as pfio

pfio.init()

x=pfio.digital_read(4)            # 4 pushbutton halts the program

cr=0                              # set variable initial value

while(not(x)):                    # continue until 4th pushbutton is pressed

         

        start = pfio.digital_read(1)      #button 1 is start pb

        stop = pfio.digital_read(2)       #button 2 is stop pb

 

        cr = not(stop) and (start or cr)  #simple start stop control with logical operators

 

        pfio.digital_write(1,cr)          # update output 1, Relay

               

        x = pfio.digital_read(4)          # 4 pushbutton halts the program

 

 

 

When the code is executed on the pi with the piface attached, one can press the first momentary pushbutton on the piface and the first relay should “click” on and LED output #1 will light.  The output will remain on until pushbutton number 2 is pressed.  Pressing pushbutton number 4 will halt the program operation.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Example #2

 

The next simple control circuit uses three inputs.  The inputs will include 2 from the previous example, start and stop, and one more called jog.  Figure 2 shows the hardwired control circuit.  This circuit provides operation like example one but also provides another input called “jog” that operates the relay “out” only as long as the button is pressed.  The “out” relay coil is operated when either “cr” or “jog” is activated.

 

image

 

 

 

Figure 2

 

The order of operations for the circuit in Figure 2: 

Press “start”:     “CR” will turn on and “seal” in, staying even after releasing “start”

                                “CR” will turn on “out”                 

                Press “stop”:      “CR” will turn off and remain off even after releasing “stop”

                                                “CR” will turn off “out”

                Press “Jog”:        “out” will turn on, “out” turns off when “jog” is released

 

 

Here is the python code to implement example 2:

 

import piface.pfio as pfio

pfio.init()

x=pfio.digital_read(4)     # 4 pushbutton halts the program

cr=0                      # set variable initial value

out = 0                   # set variable initial value

while(not(x)):             # continue until 4th pushbutton is pressed

         

        start = pfio.digital_read(1)     #button 1 is start pb

        stop = pfio.digital_read(2)     #button 2 is stop pb

        jog = pfio.digital_read(3)       #button 3 is jog pb

 

        cr = not(stop) and (start or cr)  #simple start stop control with logical operators

       out = jog or cr                     # jog input or cr

       

        pfio.digital_write(1,out)         # update output 1, Relay

               

       x = pfio.digital_read(4)   # 4 pushbutton halts the program

 

 

 

Conclusion:

The raspberry pi and piface are a great tool to learn how to build control logic circuits.   The free software and inexpensive hardware make it very affordable for the first time experimenter.  I will be using this hardware in my course work in the future.

Anonymous
Parents Comment Children
No Data