78 Replies Latest reply on Mar 11, 2018 7:38 PM by oldcoder

    PiFace Problems

    keithtowns

      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.

        • Re: PiFace Problems
          cczjaw

          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).

            • Re: PiFace Problems
              cczjaw

              ... 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

                • Re: PiFace Problems
                  keithtowns

                  Wow, brilliant (the google docs). Lot's of reading, I'll give it another try.

                    • Re: PiFace Problems
                      cczjaw

                      ... if it helps, here's what I found useful to go alongside the google docs (see above) ...

                       

                      https://github.com/thomasmacpherson/piface/blob/master/README.md

                      All the piface software with quite a good explanation of how to download and what to download  (useful if downloading the man.ac.uk 4GB SD card image is an issue – which it probably is if you're not plugged into the HE backbone).

                       

                      https://projects.drogon.net/raspberry-pi/wiringpiface/

                      Wiringpiface - some alternative software which is quite well explained.

                       

                      https://projects.drogon.net/raspberry-pi/wiringpi/the-gpio-utility/

                      … and from the same place a gpio utility which I found a good starting point for simply turning lights on etc. The proviso with the two links above is that there are wrinkles and gotchas here and there (but I found it worth persevering).

                       

                      And lastly, 'documentation' (almost) for the RPi gpio pins

                      http://elinux.org/Rpi_Low-level_peripherals

                       

                      What I didn't find useful, in fact the biggest time-waster, was the RPi Foundation forum.

                       

                      Nevertheless, I have got the first part of my project working now - when its above 20c in the conservatory a fan turns on to blow warm air around the house (all done with RPi, sensors and a relay). In the process, I've come to realise that piface (and the gertboard) are hardware 'solutions' (to stop school kids from frying their RPis) and that an easy-to-use software companion simply doesn't exist. That's the frustrating part, and one which will most likely stymie the growth of the idea that got me interested - 'physical computing'.

                        • Re: PiFace Problems
                          tompreston

                          Hi,

                          I maintain and develop the software for PiFace (for the moment at least). The GitHub is pretty much the goto with regards to information from me since it's kept up to date. Is there anything in particular I can help with? You said that PiFace isn't an easy-to-use software companion? Apart from installation, what problems are there? I'd very much like to improve it so your input is invaluable!

                           

                          As for installation, it's not perfect. We're working on getting a more streamlined method. Are the instructions on the GitHub clear? Can I make them any better?

                           

                          Oh and just for reference, here is everything PiFace: https://github.com/thomasmacpherson/piface

                           

                          Thanks.

                            • Re: PiFace Problems
                              agropper

                              Hi,

                               

                              I've installed everything according to the PiFaceDigital_Get_Started_140213v1.pdf and commented out #blacklist spi-bcm2708, etc...

                               

                              sudo ... piface-emulator says: "Could not connect to the SPI module (check privileges)..."

                               

                              What do you think is going on and how might I fix this?

                               

                              Thanks,

                               

                              Adrian

                                • Re: PiFace Problems
                                  tompreston

                                  The PiFace software talks to the board through the SPI interface device. All devices in Linux are presented as files in /dev/ and the SPI interface is presented as /dev/spidev0.0 and /dev/spidev0.1. That error is because PiFace is struggling to connect to the SPI device. During testing this was most likely because the user pi did not have the permissions to access the file, hence the check privileges suggestion. Or the file did not exist, meaning that the Linux kernel hasn't created it because the SPI kernel module wasn't loaded correctly.

                                   

                                  To figure out which, let's take a look at the SPI files in /dev, run the command:

                                   

                                  $ 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

                                   

                                  This will long-list all of the spidev files in /dev.

                                   

                                  If the ls command returns nothing then Linux probably hasn't loaded the SPI module. Try listing all the currently loaded modules with:

                                   

                                  $ lsmod

                                   

                                  and see if spi_bcm2708 is there. If it isn't try loading it with:

                                   

                                  $ sudo modprobe spi_bcm2708

                                   

                                  and then check the SPI files again. If that works then double check that you have commented out the blacklist command in /etc/modprobe.d/raspi-blacklist.conf. Make sure you edit it as root! Also, make sure you've fully updated Raspbian (sudo apt-get update && sudo apt-get upgrade).

                                   

                                   

                                  If the ls command returns something like the above then the Linux kernel is doing it's job correctly. See the first column of output from ls -l (the crw-rw----T bit)? That describes user permissions. The third and fourth columns describe the owner and group, respectively. The output needs to be exactly as I have above otherwise only root will be able to access the SPI interface. Try running the spidev-setup script again from the scripts/ directory in piface and reboot.

                                   

                                  If non of this works, get back to me and I'll see what else I can do.

                                    • Re: PiFace Problems
                                      agropper

                                      Thanks for the quick response...

                                       

                                      There's "No such file or directory" spidev* in /dev

                                       

                                      $ lsmod shows spi_bcm2708     4815     0

                                       

                                      I note that the PiFaceDigital_Get_Started_140213v1documentation for the raspi-blacklist.conf file and $ sudo modprobe spi-bcm2708 shows a hyphen in the name while your message and lsmod show an _

                                       

                                      I tried $ sudo modprobe with both the - and the _ but still no spidev

                                       

                                      TIA

                                        • Re: PiFace Problems
                                          tompreston

                                          Are you sure you are using the latest version of Raspbian?

                                           

                                          Also, have you tried updating the firmware on your Raspberry Pi? Follow the instructions here: https://github.com/Hexxeh/rpi-update

                                           

                                          modprobe translates the hypen to an underscore, I think. So it doesn't matter which.

                                            • Re: PiFace Problems
                                              agropper

                                              sudo apt-get upgrade seems to have done the trick!

                                               

                                              I didn't do the rpi-update but I will the next time I run into a mystery.

                                               

                                              Thank you so much, Thomas and everyone on this list!

                                              • Re: PiFace Problems
                                                keithtowns

                                                Hi Thomas

                                                 

                                                Many thanks for your posts. I have to put aside a day to do this so I'll let you know how I get on. My target is to get the PiFace working so my daughter can program it through Scratch to control a set of traffic lights (3 LEDs) when a Matchbox car approaches (reed switch and magnet on the car).

                                                 

                                                But I've got to get it going first!

                                                 

                                                Cheers

                                                 

                                                Keith

                                                  • Re: PiFace Problems
                                                    keithtowns

                                                    Hello All

                                                     

                                                    I have just spent my Sunday morning trying to get this working again.

                                                     

                                                    Using 512Mb Pi and Transcend 8Gb SD card:

                                                     

                                                    1. Downloaded latest Raspian 2013-02-09-wheezy-raspbian
                                                    2. Updated Firmware https://github.com/Hexxeh/rpi-update
                                                    3. Followed instructions in http://www.element14.com/community/servlet/JiveServlet/previewBody/53057-102-1-267727/PiFaceDigital_Get_Started_140213v1.pdf
                                                    4. Did another sudo apt-get update && sudo apt-get upgrade

                                                     

                                                    When I run the emulator it can see the PiFace but no LED's or relays change.

                                                     

                                                    This is not getting my daughter very interested in computing.

                                                     

                                                    Any help will be really apreciated.

                                                     

                                                    Thanks

                                                     

                                                    Keith


                                                      • Re: PiFace Problems
                                                        tompreston

                                                        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?

                                                          • Re: PiFace Problems
                                                            keithtowns

                                                            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

                                                              • Re: PiFace Problems
                                                                dgmcneil

                                                                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

                                                              • Re: PiFace Problems
                                                                james harris

                                                                I have run the programme in idle and get back no module name piface pfio

                                                                 

                                                                help please

                                                                I am trying get on buttons working on my piface work in emulator over ride mode 

                                                                leds light up when press

                                                                 

                                                                my buttons on my piface are no working?

                                                              • Re: PiFace Problems
                                                                mrbuzzcut

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

                                                                  • Re: PiFace Problems
                                                                    keithtowns

                                                                    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

                                                                      • Re: PiFace Problems
                                                                        mrbuzzcut

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

                                                                        • Re: PiFace Problems
                                                                          tompreston

                                                                          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.

                                                                            • Re: PiFace Problems
                                                                              keithtowns

                                                                              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

                                                                                • Re: PiFace Problems
                                                                                  tompreston

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

                                                                                   

                                                                                  $ python

                                                                                  >>> import piface.pfio as p

                                                                                  >>> p.init()

                                                                                  >>> p.digital_read(0)

                                                                                    • Re: PiFace Problems
                                                                                      keithtowns

                                                                                      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

                                                                                        • Re: PiFace Problems
                                                                                          tompreston

                                                                                          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.

                                                                                            • Re: PiFace Problems
                                                                                              keithtowns

                                                                                              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

                                                                                                • Re: PiFace Problems
                                                                                                  tompreston

                                                                                                  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 ). If you have any trouble then start a new thread and I'll try to help when I can.

                                                                                                   

                                                                                                  Good luck, and have fun!

                                                                                                    • Re: PiFace Problems
                                                                                                      asayler

                                                                                                      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

                                                                                                        • Re: PiFace Problems
                                                                                                          tompreston

                                                                                                          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!

                                                                                                            • Re: PiFace Problems
                                                                                                              asayler

                                                                                                              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

                                                                                                                • Re: PiFace Problems
                                                                                                                  tompreston

                                                                                                                  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.

                                                                                                                    • Re: PiFace Problems
                                                                                                                      svenk

                                                                                                                      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

                                                                                                                        • Re: PiFace Problems
                                                                                                                          tompreston

                                                                                                                          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.

                                                                                                                            • Re: PiFace Problems
                                                                                                                              svenk

                                                                                                                              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.

                                                                                                                                • Re: PiFace Problems
                                                                                                                                  tompreston

                                                                                                                                  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.

                                                                                                                                • Re: PiFace Problems
                                                                                                                                  gasar

                                                                                                                                  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

                                                                                                                                    • Re: PiFace Problems
                                                                                                                                      tompreston

                                                                                                                                      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).

                                                                                                                                        • Re: PiFace Problems
                                                                                                                                          gasar

                                                                                                                                          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

                                                                                                                                            • Re: PiFace Problems
                                                                                                                                              tompreston

                                                                                                                                              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__)"

                                                                                                                                                • Re: PiFace Problems
                                                                                                                                                  gasar

                                                                                                                                                  Python3: 3.2.3 (Mar 1) GCC 4.6.3

                                                                                                                                                  PiFacedigitalio: 2.0.3

                                                                                                                                                  PiFaceCommon: 3.0.0

                                                                                                                                                    • Re: PiFace Problems
                                                                                                                                                      tompreston

                                                                                                                                                      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.

                                                                                                                                                      • Re: PiFace Problems
                                                                                                                                                        tompreston

                                                                                                                                                        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

                                                                                                                                                          • Re: PiFace Problems
                                                                                                                                                            gasar

                                                                                                                                                            3.1.1 still nothing happend

                                                                                                                                                             

                                                                                                                                                            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

                                                                                                                                                              • Re: PiFace Problems
                                                                                                                                                                tompreston

                                                                                                                                                                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?

                                                                                                                                                                  • Re: PiFace Problems
                                                                                                                                                                    gasar

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

                                                                                                                                                                      • Re: PiFace Problems
                                                                                                                                                                        tompreston

                                                                                                                                                                        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?

                                                                                                                                                                          • Re: PiFace Problems
                                                                                                                                                                            gasar

                                                                                                                                                                            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

                                                                                                                                                                              • Re: PiFace Problems
                                                                                                                                                                                gasar

                                                                                                                                                                                Hello Thomas,

                                                                                                                                                                                I have my SD card inserted and tested in a different RPi with another PiFace. The error is thus definitely somewhere in the software configuration!

                                                                                                                                                                                I'm going to make the Raspian completely new and write down step by step what I did. Perhaps you notice what's wrong or missing.

                                                                                                                                                                                 

                                                                                                                                                                                Thanks for your help so far!!

                                                                                                                                                                                  • Re: PiFace Problems
                                                                                                                                                                                    tompreston

                                                                                                                                                                                    Sounds like a good idea. Hopefully we can get to the bottom of this!

                                                                                                                                                                                      • Re: PiFace Problems
                                                                                                                                                                                        gasar

                                                                                                                                                                                        Okay that's exactly what I did, no more and no less!

                                                                                                                                                                                         

                                                                                                                                                                                         

                                                                                                                                                                                        • Downloading 2013-09-10-wheezy-raspbian from raspberrypi.org
                                                                                                                                                                                        • Writing Image on SD Card with win32 disk imager (v0.9)
                                                                                                                                                                                        • First boot
                                                                                                                                                                                        • Enable boot to desktop
                                                                                                                                                                                        • Reboot
                                                                                                                                                                                        • Connect via WinSCP
                                                                                                                                                                                        • Copy common 3.1.1 and digitalio 2.1.0
                                                                                                                                                                                        • Install common (sudo dpkg –i python3-pifacecommon…)
                                                                                                                                                                                        • Reboot
                                                                                                                                                                                        • Install digitalio (sudo dpkg –i python3-pifacedigital…)
                                                                                                                                                                                        • Reboot
                                                                                                                                                                                        • Lunch IDLE3
                                                                                                                                                                                        • Select  / usr/share/doc/python3-pifacedigitalio/examples/presslights.py
                                                                                                                                                                                        • Run F5
                                                                                                                                                                                        • Press the Buttons

                                                                                                                                                                                         

                                                                                                                                                                                        Nothing happens. Still the same sh** :-( I'm desperate ...

                                                                                                                                          • Re: PiFace Problems
                                                                                                                                            keithtowns

                                                                                                                                            Hi Thomas

                                                                                                                                             

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

                                                                                                                                             

                                                                                                                                            Cheers

                                                                                                                                             

                                                                                                                                            Keith

                                                                                                                                • Re: PiFace Problems
                                                                                                                                  ogii

                                                                                                                                  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.....

                                                                                                                            • Re: PiFace Problems
                                                                                                                              imac

                                                                                                                              Hi

                                                                                                                              Not sure if appropriate but I downloaded new version of  WHEEZY came out dated 9th Feb and found that it fixed a few of the problems I had.

                                                                                                                              Its hard keeping up with these updates.

                                                                                                                              Feel the whole of the Raspberry Pi project suffers from this.

                                                                                                                            • Re: PiFace Problems
                                                                                                                              mrbuzzcut

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

                                                                                                                  • Re: PiFace Problems
                                                                                                                    Joe Alderson

                                                                                                                    Updated version here - let us know how you get on. There was a "-O" missing from:

                                                                                                                     

                                                                                                                    wget -O - http://pi.cs.man.ac.uk/download/install.txt | bash

                                                                                                                     

                                                                                                                    PiFace Get Started Guide: http://www.element14.com/community/docs/DOC-53057/l/piface-get-started-guide

                                                                                                                      • Re: PiFace Problems
                                                                                                                        mcb1

                                                                                                                        Joe

                                                                                                                        Not sure if you are the man or not.

                                                                                                                         

                                                                                                                        Your download and instruction has an issue at :-

                                                                                                                        It seems the python script subtracts 1 so you need to use 1 to 8

                                                                                                                        ie pfio.digital_write(1,1) # turn on

                                                                                                                         

                                                                                                                        or pfio.digital_write(1,0) # turn off

                                                                                                                         

                                                                                                                         

                                                                                                                        cheers

                                                                                                                        Mark

                                                                                                                      • Re: PiFace Problems
                                                                                                                        imac

                                                                                                                        Hi

                                                                                                                        I have experienced the same problems.

                                                                                                                        An update came out on the 14th Feb and seems to work fine.

                                                                                                                        http://www.element14.com/community/servlet/JiveServlet/previewBody/53057-102-1-267727/PiFaceDigital_Get_Started_140213v1.pdf

                                                                                                                        Hope this helps.

                                                                                                                        • Re: PiFace Problems
                                                                                                                          arifm

                                                                                                                          hello,

                                                                                                                          I ma having issues with my piface digital.

                                                                                                                          My Rasbian is upto date.

                                                                                                                          Installed the piface libraries & emulator as per following PiFace – Install PiFace Digital Software – Updating Raspbian

                                                                                                                          however when I run the python3 /usr/share/doc/python3-pifacedigitalio/examples/blink.py

                                                                                                                          I get following error;

                                                                                                                          Traceback (most recent call last):

                                                                                                                            File "/usr/share/doc/python3-pifacedigitalio/examples/blink.py", line 9, in <module>

                                                                                                                              pifacedigital = pifacedigitalio.PiFaceDigital()

                                                                                                                            File "/usr/lib/python3/dist-packages/pifacedigitalio/core.py", line 82, in __init__

                                                                                                                              self.init_board()

                                                                                                                            File "/usr/lib/python3/dist-packages/pifacedigitalio/core.py", line 107, in init_board

                                                                                                                              h=self.hardware_addr, b=self.bus, c=self.chip_select))

                                                                                                                          pifacedigitalio.core.NoPiFaceDigitalDetectedError: No PiFace Digital board detected (hardware_addr=0, bus=0, chip_select=0).

                                                                                                                           

                                                                                                                          I have checked using ls -l /dev/spi* command and I get following

                                                                                                                          pi@raspberrypi /usr/local/bin $ ls -l /dev/spi*

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

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

                                                                                                                           

                                                                                                                          python version is

                                                                                                                          pi@raspberrypi /usr/local/bin $ python

                                                                                                                          Python 2.7.3 (default, Mar 18 2014, 05:13:23)

                                                                                                                          [GCC 4.6.3] on linux2

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

                                                                                                                          >>>

                                                                                                                           

                                                                                                                           

                                                                                                                          am I  missing something. please help me out.

                                                                                                                          • Re: PiFace Problems
                                                                                                                            joman

                                                                                                                            The PiFace Digital 2 documentation is almost non-existent. You can't install it using the instructions. It does not work with Raspbian Stretch and you can't download earlier versions of raspbian. Element14 should address this problem or STOP SELLING PRODUCTS THAT DO NOT WORK!

                                                                                                                             

                                                                                                                            Your best bet is buy something else that actually works. The support from Element14 is terrible and they should be ashamed of themselves.