element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum PiFace Problems
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 78 replies
  • Subscribers 676 subscribers
  • Views 8520 views
  • Users 0 members are here
  • raspberry_pi
  • piface
  • raspberry_pi_accessories
Related

PiFace Problems

keithtowns
keithtowns over 12 years ago

Am I missing something? I have two PiFace and 3 Raspberry Pi. I followed the instructions the get the PiFace working but have yet to succeed. I have tried the image provided as well as updating an existing Raspian image to no avail. I have also tried all my Pi and the two PiFace in all the combinations. I almost gave up but also tried a different power supply and SD card. None of the above got the emulator to switch on the LEDs and I could not do it through Python. Any ideas? I've spent hours on this, please tell me I've missed something. Thanks.

  • Sign in to reply
  • Cancel
Parents
  • Former Member
    Former Member over 12 years ago

    Keith, you are not alone. The 'documentation' with the piface is worse than useless. I particularly like the typo on page 2 of the 'instructions' (etc/ which should be /etc/) and that if the emulator fails (I can't get it to work – ends with 'segmentation fault') the 'instructions' that follow are, again, useless. I will get it working in the end, but no thanks to the fools at man.ac.uk. How difficult would it have been to provide basic instructions in the box? Good luck with it - I'll reply back when I've finished arm-wrestling with it and got it doing something (I have a job in mind).

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to Former Member

    ... not sure if urls are allowed here - if they are, here's some documentation for piface ...

     

    https://docs.google.com/folder/d/0B-UAZ9CyJCLGQjJ3RDlqa2pqaDg/edit?pli=1

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to keithtowns

    Hi Keith,

    Does the board work when just using Python? Try opening a Python shell and talking to PiFace:

     

        $ python
        >>> import piface.pfio as p
        >>> p.init()
        >>> p.digital_write(1, 1)

     

    What error does that produce?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • mrbuzzcut
    mrbuzzcut over 12 years ago in reply to Former Member

    Maybe a little late, but I fixed the spi permission issue by adding myself to the spiuser group.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • keithtowns
    keithtowns over 12 years ago in reply to Former Member

    Hi Thomas

     

    I tried your code in a Python shell from a LXTerminal and from Python 2.7.3 Shell.

     

    No errors were reported when I typed in each of the lines but I guess this was going to switch on an LED or relay? Neither happened.

     

    Thanks for your help so far.

     

    Keith

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • dgmcneil
    dgmcneil over 12 years ago in reply to keithtowns

    Hi Keith, did you ever get you PiFace to work?

     

    I spent two days struggling with this.  I found it hard to find documentation and I could have saved myself two days of trouble-shooting had I just had access to a schematic.

     

     

    My PiFace was shipped without a jumper on JP7.  The absence of JP7 disables the 5 V rail for the outputs so there was no lights, no relay click.  Adding JP7 made the PiFace work as advertised.

     

    While I'm typing I may as well add that I'm disappointed that the designer of the PiFace didn't make the unused IO ports on the Raspberry Pi available on the board.  This limits what would have otherwise been a very nice addition to the Pi.

     

    Dave

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • keithtowns
    keithtowns over 12 years ago in reply to dgmcneil

    Hi Dave

     

    No my PiFace is still not working and both of them have a jumper 7 installed.

     

    Thanks anyway

     

    Keith

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • mrbuzzcut
    mrbuzzcut over 12 years ago in reply to keithtowns

    Did you get any error messages in the terminal window when you ran the emulator?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • keithtowns
    keithtowns over 12 years ago in reply to mrbuzzcut

    Hi Jeff

     

    No errors, the emulator window opens and says piface detected but nothing works. In the terminal window the cursor waits and returns to root@raspberrypi:~# once the emulator has been closed.

     

    Cheers

     

    Keith

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • mrbuzzcut
    mrbuzzcut over 12 years ago in reply to keithtowns

    PiFace detected...that's a start. Did you click the override button?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to keithtowns

    Keith, can you run the commands I listed in post #8 and tell me the output? If you can see the SPI device files (/dev/spidev0.0 and /dev/spidev0.1) and running the Python shell commands doesn't error then it's probably an error with your board.

     

    Also, try reading from the board:

     

    $ python

    >>> import piface.pfio as p

    >>> p.digital_read(0)

     

    This should return a 1 or 0 value depending on whether the switch was pressed. So you should run the digital_read() command twice, once while holding the first switch and once while not. The returned values should be different. If they are the same even when you have held down the switch then it's a hardware fault.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • keithtowns
    keithtowns over 12 years ago in reply to Former Member

    Hello Thomas

     

    The commands returned the following:

     

    root@raspberrypi:~# ls -l /dev/spidev*

    crw-rw---T 1 root spiuser 153, 0 Jan  1  1970 /dev/spidev0.0

    crw-rw---T 1 root spiuser 153, 1 Jan  1  1970 /dev/spidev0.1

     

    However, the input was more revealing:

     

    root@raspberrypi:~# python

    Python 2.7.3 (default, Jan 13 2013, 11:20:46)

    [GCC 4.6.3] on linux2

    Type "help", "copyright", "credits" or "license" for more information.

    >>> import piface.pfio as p

    >>> p.digital_read(0)

    Traceback (most recent call last):

      File "<stdin>", line 1, in <module>

      File "/usr/local/lib/python2.7/dist-packages/piface/pfio.py", line 249, in digital_read

        current_pin_values = read_input()

      File "/usr/local/lib/python2.7/dist-packages/piface/pfio.py", line 300, in read_input

        port, data = read(INPUT_PORT)

      File "/usr/local/lib/python2.7/dist-packages/piface/pfio.py", line 329, in read

        operation, port, data = send([(READ_CMD, port, 0xff)])[0] # send is expecting and returns a list

      File "/usr/local/lib/python2.7/dist-packages/piface/pfio.py", line 342, in send

        raise InitError("The pfio module has not yet been initialised. Before send(), call init().")

    piface.pfio.InitError: The pfio module has not yet been initialised. Before send(), call init().

    >>>

     

     

    Thanks

     

    Keith

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • keithtowns
    keithtowns over 12 years ago in reply to Former Member

    Hello Thomas

     

    The commands returned the following:

     

    root@raspberrypi:~# ls -l /dev/spidev*

    crw-rw---T 1 root spiuser 153, 0 Jan  1  1970 /dev/spidev0.0

    crw-rw---T 1 root spiuser 153, 1 Jan  1  1970 /dev/spidev0.1

     

    However, the input was more revealing:

     

    root@raspberrypi:~# python

    Python 2.7.3 (default, Jan 13 2013, 11:20:46)

    [GCC 4.6.3] on linux2

    Type "help", "copyright", "credits" or "license" for more information.

    >>> import piface.pfio as p

    >>> p.digital_read(0)

    Traceback (most recent call last):

      File "<stdin>", line 1, in <module>

      File "/usr/local/lib/python2.7/dist-packages/piface/pfio.py", line 249, in digital_read

        current_pin_values = read_input()

      File "/usr/local/lib/python2.7/dist-packages/piface/pfio.py", line 300, in read_input

        port, data = read(INPUT_PORT)

      File "/usr/local/lib/python2.7/dist-packages/piface/pfio.py", line 329, in read

        operation, port, data = send([(READ_CMD, port, 0xff)])[0] # send is expecting and returns a list

      File "/usr/local/lib/python2.7/dist-packages/piface/pfio.py", line 342, in send

        raise InitError("The pfio module has not yet been initialised. Before send(), call init().")

    piface.pfio.InitError: The pfio module has not yet been initialised. Before send(), call init().

    >>>

     

     

    Thanks

     

    Keith

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • Former Member
    Former Member over 12 years ago in reply to keithtowns

    Ah, my bad. You need to initialised the pfio first.

     

    $ python

    >>> import piface.pfio as p

    >>> p.init()

    >>> p.digital_read(0)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • keithtowns
    keithtowns over 12 years ago in reply to Former Member

    Hi Thomas

     

    I tried the code below:

     

    root@raspberrypi:/home/pi# python

    Python 2.7.3 (default, Jan 13 2013, 11:20:46)

    [GCC 4.6.3] on linux2

    Type "help", "copyright", "credits" or "license" for more information.

    >>> import piface.pfio as p

    >>> p.init()

    >>> p.digital_read(0)

    1

    >>> p.digital_read(1)

    1

    >>> p.digital_read(0)

    1

    >>> p.digital_read(1)

    1

    >>>

     

    For the first two tries, no button was pressed. For the second two, I pressed all the buttons.

     

    Cheers

     

    Keith

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • keithtowns
    keithtowns over 12 years ago in reply to Former Member

    Hi Thomas

     

    Just tried the same again with my other Piface board, exactly the same results.

     

    Cheers

     

    Keith

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to keithtowns

    Where are your jumpers on the board in the correct place? They should both be on 0. Here is a picture I just took of my PiFace for reference.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • keithtowns
    keithtowns over 12 years ago in reply to Former Member

    Hi Thomas

     

    THAT FIXED IT!

     

    Both PiFace came with the jumpers set in the other position - THANK YOU! (and why would they do that?)

     

    I believe that Scratch needs an updated version to work with PiFace, is there anywhere I can download it from using my current version of Raspian?

     

    Thanks

     

    Keith

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to keithtowns

    Ah-ha! That's brilliant news! The jumper switches tell PiFace what number it is. With both set to 0, you tell PiFace that it's board 0. By default the Python module addresses board 0 so that's why it wasn't working when you had it set to whatever-else.

     

    I don't think you need an updated version of Scratch, you just need to enable Mesh. Here are some old instructions (I'll be honest, they need improving image). If you have any trouble then start a new thread and I'll try to help when I can.

     

    Good luck, and have fun!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to Former Member

    Hi Thomas,

     

    I just installed the new Python3 version of pifacedigitalio following the directions on github: https://github.com/piface/pifacedigitalio. I'm using the latest version of Raspbian (2013-02-09) with all of the latest updates installed (via apt) and the latest firmware (via hexxeh's rpi-update script).

     

    For some reason, my system is not setting up the permissions properly for the /dev/spidev* files. Output of 'ls -al /dev/spi*' is below:

     

    pi@raspberrypi ~ $ sudo ls -al /dev/spi*

    crw------- 1 root root 153, 0 Dec 31  1969 /dev/spidev0.0

    crw------- 1 root root 153, 1 Dec 31  1969 /dev/spidev0.1

     

    I'm getting ready to just add manual udev rules to set the permissions, but I wanted to check as to why they aren't being setup automatically. Does the new Python3 version of the Piface Python IO library setup not handle permission setup yet?

     

    Thanks,

    Andy

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to Former Member

    Ah, so I haven't! I'll add this to the install script tomorrow, it must have slipped my mind since I was already working on a machine that had the permisions set up.

     

    For now, try running the spidev-setup script here.

     

    Thanks for the heads-up!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to Former Member

    Yea, I just manully ran the old script and got it working. Thanks of the confirmation. With that sorted out, both the io library and emulater seem to be working properly.

     

    -Andy

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to Former Member

    I've updated the pifacedigitalio install script to update the spi permissions. Everything should work now, I might also add auto un-blacklisting the spi kernel module later.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube