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 8554 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 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
  • Former Member
    Former Member over 12 years ago in reply to Former Member

    Hi Thomas, I'm new to R-Pi and Pi-Face. I thus far have everything working quite well with your pifacedigitalio; but have an issue on the interrupts. Once I have called wait_for_input with loop=True I would like to be able to exit gracefully from the interrupt routine. Currently I try to set loop=false with one of the inputs but that does not work (I think for obvious reasons). Any help on how I can exit gracefully after receiving the interrupt I need?

     

    Thank you

    Sven

    • 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 Sven,

    Currently the interrupt handler only supports looping forever or exiting after one interrupt. It should also handle a keyboard interrupt gracefully (Ctrl+C).

     

    For some reason I never thought of the use-case where you might want to exit the loop only from a certain interrupt. I've updated the code so that instead of using a loop variable to determine whether the loop should continue waiting for inputs, it decides based on the return value of the callback. If a callback returns True, wait_for_input keeps waiting for interrupts. If False, wait_for_input should return.

     

    I've updated this in a new branch called dev_interrupt_return but I haven't tested it yet (I'm in the middle of exams, I can test later in the week). The branch is here if you want to test the new version for me. Inspect the README for new interrupt instructions.

     

    How are you finding the interrupts on pifacedigitalio by the way? I tried to make it as simple as possible but I've not had much feedback! In particular, how is the spartan README? I was going for brief, but informative.

    • 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,

     

    Firstly, apologies for disturbing your exams. I will most certainly test the new branch. At the moment the interrupts are doing the job I need them to do and when I hit input [1] I have simply put in a rather crude sys.exit(). It works for now. I kind of like the readme, it forces you to think about the situation.

     

    Interestingly, the solution you proposed with the boolean return from the callback is exactly what I tried but I could not quite get it to work.

     

    Thanks for your quick response, I'll let you know how it goes.

     

    Cheers

    Sven

     

    Edit:

    I got it working. I had to make some small changes to your code, I added the following in call_mapped_input_functions():

     

    if int_bit == 0:

        keep_waiting = True

        continue

     

    and I also added the following at the end of the function:

    return keep_waiting.

     

    These may not be the most elegant solutions but for now it is working. Thanks again for your help.

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

    Sven, I never saw your edit before I updated the code. No worries, I've done a similar fix. It should work now.

     

    I've slightly changed the naming of things too: instead of 'into' I'm now using 'direction' because it's clearer. This also uses predefined direction variables: IN_EVENT_DIR_ON, IN_EVENT_DIR_OFF and IN_EVENT_DIR_BOTH.

     

    Check out the new instructions.

     

    Hope that helps.

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

    Hi, can I join the queue of disgruntled piface buyers (note not users) that has spent far too long trying to decode how to get this as yet useless board working?

     

    I've updated as per previous posts.

     

    My error message in response to an lxterminal command of piface/scripts/piface-emulator is

     

    Bash ........emulator: input output error.

     

    Any ideas please?

     

    Like previous poster the piface was bought to help a 10 year old interact with a model railway set up.

     

    At this moment I think rather than being customer ready this is more a geeks experiment that should not have reached production yet until all aspects of the set up instructions had been tested.

     

    It's certainly failing the sales of goods act at the moment.....

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

    Are you using the most up to date software. We've moved over to Python 3, now. You can get it from https://github.com/piface

     

    > Bash ........emulator: input output error.

     

    That looks like an error with bash and not the emulator. I can't seem to replicate your problem and my Python 2 emulator works when I issue the commands:

     

    $ git clone https://github.com/thomasmacpherson/piface.git

    $ cd piface/python/

    $ sudo python setup.py install

    $ cd ../scripts/

    $ ./piface-emulator

     

    Can describe how you reach your problem in more detail, please?

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

    Thomas

    If you want a better image showing the default jumpers you can use my picture.

    http://www.element14.com/community/roadTestReviews/1452

    If you want the fullsized image, PM me with your email.

     

     

    Mark

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

    Hello Thomas,
    I have the PiFace 2.1 with the latest version of pifacecommon and pifacedigitalio on the last raspbian running. Control of IO is not a problem. But the interrupts do not work with python. The sample code, for example, shows no function. But the interrupts works fine withe the Java lib Pi4J. Do you have any idea what could go wrong?

    best greetings Andreas

    • 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, sorry for the delayed reply, I've been on holiday!

     

    Are you using the example code from here: http://piface.github.io/pifacedigitalio/example.html#interrupts? Did you reboot after installing? Can you show me the code you are trying to use?

     

    Pi4J is a Java library for accessing the GPIO pins, not PiFace (to my knowledge at least).

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

    Hi, sorry for the delayed reply, I've been on holiday!

     

    Are you using the example code from here: http://piface.github.io/pifacedigitalio/example.html#interrupts? Did you reboot after installing? Can you show me the code you are trying to use?

     

    Pi4J is a Java library for accessing the GPIO pins, not PiFace (to my knowledge at least).

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

    Hey Thomas,
    thanks for your answer. I have reinstalled the distribution. I try the / usr/share/doch/python3-pifacedigitalio/examples/presslights.py program and also the example code on the webpage (ure link). Nothing works. But simple polling on a button works fine. So buttons and leds are working...

    To Pi4J, "With the Pi-Face Java API interface now available in the libraries Pi4J (Pi4J in version 0.0.5-SNAPSHOT and later)" Source: http://www.savagehomeautomation.com/projects/raspberry-pi-programming -pi-face-with-java-pi4j.html
    The API package comes with two examples for the piface PiFaceExample.java and PiFaceGpioExample.java. I compile and run the PiFaceExample
    (it use listener (interrupts)) and it ran as it should, so I think that the interrupts generally works?!

     

    I hope you have another ideas image

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

    That's great news about Java support for PiFace!

     

    Are you running the latest versions of the Python modules? Can you show me the output of the following commands:

     

    $ python3 -c "import pifacedigitalio.version as p; print(p.__version__)"

    $ python3 -c "import pifacecommon.version as p; print(p.__version__)"

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

    Python3: 3.2.3 (Mar 1) GCC 4.6.3

    PiFacedigitalio: 2.0.3

    PiFaceCommon: 3.0.0

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

    How about the outputs from the following commands:

     

    groups

    lsmod

    cat /etc/modprobe.d/raspi-blacklist.conf

    cat /lib/udev/rules.d/60-python3-pifacecommon.rules

     

    I can't seem to replicate the issue I'm afraid.

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

    PiFace Common is now on v3.1.1, which has a fix for an installation bug that was there since v3.1, maybe even v3.0. Can you try installing the lastest version and see if that fixes your issue?

     

    https://github.com/piface/pifacecommon/releases

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

    3.1.1 still nothing happend image

     

    groups:

    pi adm dialout cdrom sudo audio video plugdev games users netdev input spi gpio

     

    lsmod:

    Module                  Size  Used by

    snd_bcm2835            16432  0

    snd_pcm                77728  1 snd_bcm2835

    snd_seq                53482  0

    snd_timer              20110  2 snd_pcm,snd_seq

    snd_seq_device          6462  1 snd_seq

    snd                    58744  5 snd_bcm2835,snd_timer,snd_pcm,snd_seq,snd_seq_device

    snd_page_alloc          5169  1 snd_pcm

    joydev                  9356  0

    spidev                  5248  4

    evdev                   9450  6

    leds_gpio               2243  0

    led_class               3570  1 leds_gpio

    spi_bcm2708             4841  0

    hid_cherry              1575  0

     

    cat /etc/modprobe.d/raspi-blacklist.conf

    #blacklist spi-bcm2708

    blacklist i2c-bcm2708

     

    cat /lib/udev/rules.d/60-python3-pifacecommon.rules

    KERNEL=="spidev*", GROUP="spi", MODE="0660"

    SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c 'chown -R root:gpio /sys/class/gpio && chmod -R 770 /sys/class/gpio; chown -R root:gpio /sys/devices/virtual/gpio && chmod -R 770 /sys/devices/virtual/gpio'"p

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

    Everything appears to be set up correctly. Does the following Python code print anything when you press switch 0 after the last line?

     

    import pifacedigitalio

    pifacedigitalio.init()

    pifacedigital = pifacedigitalio.PiFaceDigital()

    listener = pifacedigitalio.InputEventListener()

    listener.register(0, pifacedigitalio.IODIR_ON, print)

    listener.activate()

     

     

    As a last resort, have you tried reinstalling Raspbian and then installing pifacedigitalio on a fresh install?

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

    Okay. I run ure sample code, no output. Reinstalling Rasbian was my first try of troubleshooting.

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

    Did you press switch 0? Perhaps your switch is broken? Try connecting the ground pin and pin 0 with a wire (a paperclip will do). What happens then?

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

    Hey, i think you mean sw1 / input0, but i also try all the other switches and as i said in a earlier post "But simple polling on a button works fine. So buttons and leds are working...".  So the hardware should be fine?!. Strange that I seem to be the only one with this behavior image

    • 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