34 Replies Latest reply on Oct 19, 2017 10:13 AM by mibarnes

    PiFace Digital 2 - setup and use

    urkraft

      PiFace Digital 2

       

      Introduction

       

      I used the PiFace Get Started Guide created by Joseph Man for the previous version of the PiFace Digital as my starting point as i was unable to find any documentation specifically for the PiFace Digital 2 and as both designs appeared to be very similar with only the changes necessary in order to accommodate the 40 pin GPIO of the Raspberry Pi B+ and to allow the physical mating without any obstructions as well as a radical improvement of the layout . There were nevertheless a few things in that document which required further investigation and improvising in order to get it to work.

       

      Although the Raspberry Pi B+ is capable of supplying power to a greater electrical load than its predecessor with the correct configuration and an adequate power supply, i do not believe that it is a good idea to rely on it to be able to take the load that this type of card could represent under certain circumstances. Since i did not have any extra power supplies to use to power the output of the PiFace card i had to use the 5V from the Raspberry Pi B+, so i used my powered USB hub to connect all by usb devices (mouse, keyboard, and sound card) in order to reduce the load on the Raspberry Pi's power supply. By doing this and only testing one output at a time i was quite sure that there was little likelihood of me experiencing problems due to overloading the power supply and i also did not need to make any changes to the default jumper configuration that the PiFace came with. My PiFace came with all the 2-pin jumpers shorted and JP1 and JP2 had the two left pins short circuited when viewed as shown in the picture below. Hopefully the official documentation will be available by the time i can get a hold of a good power supply for the PiFace and gadgets to control with it.

       

      Configuring the Raspberry Pi B+ for the PiFace Digital 2

      Before i connected the PiFace Digital 2 i did all the general preliminary configuration necessary for a Raspberry Pi  B+ (referred to as "RPi" from now on). I installed the Raspbian operating system on my RPi, booted it up, did all my special configurations, rebooted, logged in, updated everything to the latest versions by typing the following the following commands in the console:

       

      sudo apt-get update

      sudo apt-get upgrade

      sudo apt-get dist-upgrade

      sudo reboot

       

      After it had done all the work and was up again, i logged in again and enabled the SPI driver by making the necessary changes via raspi-config and by editing the raspi-blacklist.conf file. First, the raspi-config changes (in the console):

       

      sudo raspi-config

       

      This starts the configuration software for the Raspberry Pi. You need to navigate down to the "Advanced Options" menu with the down arrow key, tab to <Select>, press "Enter", arrow down to "A5 SPI", tab to <Select>, hit "Enter", highlight <Yes> with the appropriate arrow key and press "Enter", hit "Enter" again on <OK>, tab to <Finish> and hit "Enter". You should then be back in the console again. Enter:

       

      sudo shutdown -Ph now

       

      After the Pi has shut down, remove all connections, connect the PiFace Digital 2, reconnect everything - saving the power connection for last, and log in at the prompt when it is up again, then, in the console type:

       

      sudo nano /etc/modprobe.d/raspi-blacklist.conf

       

      Make sure that there is a hash (#) at the start of the line "blacklist spi-bcm2708" in the file and save the file and exit. Then, in the console again, type:

       

      sudo apt-get update

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

      sudo apt-get install python3-pifacedigitalio python-pifacedigitalio

      sudo apt-get install python3-pifacedigital-emulator

      sudo apt-get install python3-pifacedigital-scratch-handler

      sudo reboot

       

      After the last reboot is finished you can login start the LXDE GUI (startx) and you will find an icon for the "Pi Face Digital" emulator on the desktop. Double click it and click the "Enable" menu and choose "Output Control". This enables controlling the output of the output on the Pi Face Digital via the emulator buttons. Go wild! Test all of the output signals as well as the 4 input signals that the buttons were connected to without any further hardware configuration or connections.

       

      When you are finished playing around with the emulator you are ready to play around with Python.

       

      First steps with Python

       

      To use PiFace Digital 2 with Python you need to import the pifacedigitalio module by typing the following line at the beginning of your Python script:

       

      import pifacedigitalio as pfio

       

      Before using it the board must be initialized with a call to init(), like this:

       

      pfio.init()

       

      There are three main functions to control the interface:

       

      pfio.digital_read(pin_number)

       

      which returns 1 or 0 depending on the state of the input numbered pin_number

       

      pfio.digital_write(pin_number, state)

       

      sets the output numbered pin_number to state 0 or 1. State 1 turns the LED on and enables the open collector to sink current

       

      pfio.digital_write_pullup(pin_number, state)

       

      sets a 10k pullup on input numbered pin_number to be state 0 or 1. State 1 is pullup enabled.

       

      Based on this information you should be able to follow the examples of reading and writing to the PiFace Digital 2 that Joseph Man gives in that section of his document - but just remember to import the correct module and not the one that he refers to. Alternatively, you can download the Python2 script that i have made and attached to this document and play around with that (more about that further down in this document). But you should make sure that you have really understood which connection terminals are controlled by the signals you will be activating with Python. Hopefully this will be quite clear after reading the next section.

       

      Tour of the PiFace Digital 2

       

      PiFaceDigital2.png

      Picture Description:

      IO connection terminals: Starting from the bottom right corner of the picture above and working counter clockwise along the PCB edge

      • (O-0) first up are the 3 connection terminals for the first relay which is controlled by output 0. The first terminal is connected to the Normally Open (NO) terminal of the relay, the second is connected to the Common (C) terminal, and the third to the Normally Closed (NC) terminal.
      • (O-1) next are the 3 connection terminals for the second relay which are controlled by output 1. The first terminal is connected to the Normally Open (NO) terminal of the relay, the second is connected to the Common (C) terminal, and the third to the Normally Closed (NC) terminal.
      • Next are two ground connections, followed by a 5V connection.
      • Then on the top edge of the card starting from the right is a 5V connection followed by the 8 terminals that are connected to the open collector outputs (the orange connection blocks). These are controlled by output 0 through 7 in that order. The corresponding surface mounted LEDs can be seen just below. Note that output 0 controls the first relay, LED 0, and the open collector 0.
      • Next up to the left of the outputs along the top edge are the input terminal connections (the green blocks), beginning with input 0 through to input 7, then lastly a connection for ground. Below these are the 4 push button switches. Input 0 through 3 are controlled by the status of the switches as well as the signal levels of the input teminals. For example, either S0 must be activated or the signal level at input terminal 0 must be high or both must be active for input 0 to be interpreted as '1'.

       

      I have tested every input and output on my PiFace Digital 2 - both with the emulator and with my own Python3 script (actually the only input i tested with my script was the push button input signals) - and everything worked as expected.

       

      The led_show.py Python3 script

       

      This is only a simple script that i wrote to test the Python module which is used specifically for controlling the PiFace Digital 2 card. Of course, it simultaneously tests all of the on-board LED's and push button switches. I used the emulator to perform the other hardware tests described later in this document.

       

      Be aware that you do need to have successfully installed all of the Python modules as described at the beginning of this document for this script to work, and it has to be run with root privileges by (for example) using the following command from the same directory that you have placed the script:

       

      sudo python3 led_show.py

       

      It is a very simple and primitive script, but it demonstrates how to initialize the module and how to read from and write to the PiFace Digital 2 board.

       

      How i tested all of the IO using the emulator

       

      To test the inputs i simply read the signals at each of them in turn before and after shorting them to the ground terminal which is beside the input 7 terminal. I also read the push button signals before and after pushing them.

       

      To test the outputs i used an LED in series with a 180Ω resistor and tested each output in turn as follows. I connected the 5V terminal that is beside the output 0 terminal to the 180Ω resistor, and the other end of the resistor to the anode of the LED (the longest terminal on a new LED), and from the cathode of the LED to the output terminal being tested. Writing a 1 to the output being tested turned the LED on, and writing 0 turned it off (exactly as with the respective on-board LED). To test the relays required a slightly different approach. Here, i connected the same circuit, but with the cathode of the LED connected to the Common (C) terminal of the output relay being tested. I also grounded either the Normally Closed (NC) terminal or the Normally Open (NO) terminal. If it was the NC terminal that was grounded then the LED would light up when a 0 signal was sent to the output that controlled it, and it would go out if a 1 signal was sent to it. If it was the NO terminal that was grounded than it would function in the opposite way.

       

      I hope this information is helpful while you are waiting on the official documentation.

        • Re: PiFace Digital 2 - setup and use
          jamesm999

          I Appreciate all the work you have done. You are right about the lack of docs. I have got the digital 2 working, however can you share how the relays are operated?

            • Re: PiFace Digital 2 - setup and use
              urkraft

              Hello James,

               

              Thought i explained that at the end of my description about setup and use found here: http://www.element14.com/community/thread/39390/l/piface-digital-2--setup-and-use where i wrote:

               

              "To test the relays required a slightly different approach. Here, i connected the same circuit, but with the cathode of the LED connected to the Common (C) terminal of the output relay being tested. I also grounded either the Normally Closed (NC) terminal or the Normally Open (NO) terminal. If it was the NC terminal that was grounded then the LED would light up when a 0 signal was sent to the output that controlled it, and it would go out if a 1 signal was sent to it. If it was the NO terminal that was grounded than it would function in the opposite way."

               

              You can modify the Python code that i supplied to manipulate the LED's that share the same outputs.

               

              Let me know if there is anything specifically that you would like for me to elaborate on?

               

              Regards,

              raymond

            • Re: PiFace Digital 2 - setup and use
              ernyz

              Hi Raymond,

               

              many thanks for your detailed giude!

              I am a linux newbie and I'm struggling to setup piface digital2 on my brand new RaspberryPi B+. Actually all steps from your procedure completed without errors but virtual device GPIO is missing and as a result pifacedigital-emulator gives an exception on startup.

              I did look for /dev/spidev0.0 and /dev/spidev0.1 and they are present (so I guess kernel module is ok).

              I did also look for /sys/class/gpio which is present, and tested doing echo 25 > /sys/class/gpio/export, it actually create /sys/class/gpio/gpio25 so permissions are ok.

               

              Any idea on what to check next would be very appreciated!

               

              Thanks,

               

              Daniele

                • Re: PiFace Digital 2 - setup and use
                  urkraft

                  Hello Daniele,

                   

                  Firstly, i would like to point out that official documentation for the PiFace Digital 2 is now available, and that it should be used instead of the document that i published when it was still undocumented.

                   

                  And now i address your problem:

                   

                  I am almost certain that your problems are due to you running this command that was included in my document:

                   

                  sudo rpi update

                   

                  I apologize deeply for including it in my documentation. I have found out a short while ago that that command is only meant to be used for advanced Raspberry Pi users to test an experimental version of the kernel. Unfortunately some major changes are introduced in the latest experimental version which i am quite sure are responsible for the problems you are experiencing. You need to roll back to the last official version by issuing the following 2 commands (and NEVER use the above command unless in a normal Raspberry Pi working environment):

                   

                  sudo apt-get --reinstall install libraspberrypi-bin libraspberrypi-dev libraspberrypi-doc libraspberrypi0 raspberrypi-bootloader

                  sudo reboot

                   

                  After the Raspberry Pi has rebooted and you log in the problem should no longer be there.

                   

                  Again, i apologize for including the command that has caused you these problems. When i created the document that i had published i included it because i found a reference somewhere on the internet suggesting that it always be used when updating the Raspberry Pi. That source did not mention anything about it's real purpose.

                   

                  Regards,

                  raymond

                    • Re: PiFace Digital 2 - setup and use
                      ernyz

                      Hi Raymond,

                       

                      thank you for the explaination.

                      I made a little bit more of research and I found out about overlays... Not that I master this concept but the basic effect is that I have to explictly enable additional devices to be inserted in device tree by adding a line in config.txt

                      So I gave it a shot and added to my config.txt the following two lines:

                       

                      dtparam=spi=on

                      dtoverlay=bcm2708-rpi-b-plus.dtb

                       

                      After rebooting everything is working perfectly. Now, if this change introduced in firmware is a 'preview' of what is coming in the future, I think that keeping my current firmware (and config) is ok even in case of future upgrades, correct?

                      In any case thank you very much for your help!

                       

                      Regards,

                       

                      Daniele

                        • Re: PiFace Digital 2 - setup and use
                          prisemut

                          Hi,

                          I more or less have the same problem as Daniele.

                           

                          I use a Raspi B with a Piface Digital 1. Everything worked fine until yesterday.

                          Yesterday I upgraded the Raspian to version 3.18.5+. The piface python stopped working with:

                               IOError: [Errno 2] No such file or directory: '/sys/devices/virtual/gpio/gpio25/value'

                           

                          The virtual/gpio directory does not exist anymore and I don't know how to create it with the links.

                           

                          Now I started from scratch with a blank SD card and the 31.01.2015 raspian image and python3-pifacedigitalio.

                          Same error.

                          The spi devs are there:

                          ls  /dev/spi*

                          /dev/spidev0.0  /dev/spidev0.1

                           

                          Daniele's config.txt trick  did not help.

                           

                          gpio readall yields:

                           

                          +-----+-----+---------+------+---+-Model B2-+---+------+---------+-----+-----+

                          | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |

                          +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+

                          |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |

                          |   2 |   8 |   SDA.1 |   IN | 1 |  3 || 4  |   |      | 5V      |     |     |

                          |   3 |   9 |   SCL.1 |   IN | 1 |  5 || 6  |   |      | 0v      |     |     |

                          |   4 |   7 | GPIO. 7 |   IN | 1 |  7 || 8  | 1 | ALT0 | TxD     | 15  | 14  |

                          |     |     |      0v |      |   |  9 || 10 | 1 | ALT0 | RxD     | 16  | 15  |

                          |  17 |   0 | GPIO. 0 |   IN | 0 | 11 || 12 | 0 | IN   | GPIO. 1 | 1   | 18  |

                          |  27 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |

                          |  22 |   3 | GPIO. 3 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |

                          |     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |

                          |  10 |  12 |    MOSI | ALT0 | 0 | 19 || 20 |   |      | 0v      |     |     |

                          |   9 |  13 |    MISO | ALT0 | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |

                          |  11 |  14 |    SCLK | ALT0 | 0 | 23 || 24 | 1 | ALT0 | CE0     | 10  | 8   |

                          |     |     |      0v |      |   | 25 || 26 | 1 | ALT0 | CE1     | 11  | 7   |

                          +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+

                          |  28 |  17 | GPIO.17 |   IN | 0 | 51 || 52 | 0 | IN   | GPIO.18 | 18  | 29  |

                          |  30 |  19 | GPIO.19 |   IN | 0 | 53 || 54 | 0 | IN   | GPIO.20 | 20  | 31  |

                          +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+

                          | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |

                          +-----+-----+---------+------+---+-Model B2-+---+------+---------+-----+-----+

                           

                          Any idea, what's going wrong?

                           

                          Thanks,

                          Prisemut

                            • Re: PiFace Digital 2 - setup and use
                              urkraft

                              Prisemut:

                               

                              I have explained in great detail how to fix this problem in post 17 of the discussion titled "i2c stopped working". There are many other posts there about possible solutions, but i believe that the solution i have described is the intended one by the developers of the Raspberry Pi. I have tested it extensively and it is the only solution that i have found that has solved all the prolems that i have experienced.

                              • Re: PiFace Digital 2 - setup and use
                                urkraft

                                Since this site is the absolutely most exasperating site i have ever experienced, i decided to copy the solution i have posted elsewhere and post it again here (it is easier than explaining how to navigate in it):

                                 

                                As i have pointed out earlier, the problems appear to be due to changes in the kernel after updating the Raspbian software by issuing these commands:

                                 

                                sudo apt-get update

                                sudo apt-get dist-upgrade

                                 

                                and rebooting. This procedure is highly recommended to keep your raspi updated with the latest updates that have been thoroughly tested (and we need to avoid using the "sudo rpi-update" command because that is not meant to be used by normal users but rather by developers and testers). But after doing this the problems with the drivers start because the new kernel comes configured to use the new device tree by default (rather unfortunate, in my opinion). Ok then. What to do? Well i found out that there is also a new update available for raspi-config, and that has a configuration setting which allows you to set up your raspi correctly depending on which device solution you prefer to use. So the first thing you need to do after upgrading the raspi software is to upgrade your raspi-config tool. This is done from the raspi-config tool, and you start the tool with this command:

                                 

                                sudo raspi-config

                                 

                                When the tool starts, you need to navigate down to the "Advanced Options" choice using the arrow-down key, then press the "Tab" key to highlight "Select", then hit "Enter". In the Advanced Options meny, navigate down to the "Update" choice using the arrow-down key, then hit the "Tab" key to highlight "Select", then hit the "Enter" key. This starts the process of updating the tool. When it is finished you will be returned to the raspi-config tool. Back in the tool, navigate down to the "Advanced Options" with the down-arrow, hit the "Tab" key to highlight "Select", hit "Enter", navigate down to "Device Tree" with the down-arrow key, hit "Tab" to highlight "Select", hit "Enter", hit the "Tab" key until "No" is highlighted (in response to the question "Would you like the kernel to use Device Tree?"), then hit "Enter". Hit "Enter" again when it indicates that "Device Tree is disabled" and "Ok" is highlighted. "Tab" to "Finish", then hit "Enter". Now reboot again:

                                 

                                sudo reboot

                                 

                                When the raspi is up again and you log in everything should work again.

                                  • Re: PiFace Digital 2 - setup and use
                                    prisemut

                                    Dear Raymond, Daniele,

                                     

                                    Thanks so much for your help. Raymod's procedure fixed the problem. I also learned a lot about device trees.

                                     

                                    I a bit concerned about this, though. The Piface is targeting on absolute beginners, such as high school students.

                                    Without this detailed knowledge the board won't work and causes a lot of fustration. I know, that the problem arises from the rasbian image,

                                    however, a work-around in the piface package would be great. I am not sure, if this is possible.

                                     

                                    By the way:

                                    I used the board for home automation. I attached door switches, an RFID-reader-Keypad and a 433MHz transmitter (element14 nr. 1304024) to the Piface.

                                    it works like a charme, If the door opens without RFID-identification, the buzzer sounds and light goes on an a send messages to my Telegram account.

                                     

                                    Prisemut

                                      • Re: PiFace Digital 2 - setup and use
                                        urkraft

                                        The world is constantly evolving. Unfortunately i have not had time to learn about the new method of handling devices that has been introduced recently, but i believe that it was introduced because it is perceived as progressive. What was unfortunate, in my opinion, was that no fore-warning was given to the general public prior to its introduction (at least none that i managed to pick up on - and i check out raspberrypi.org almost daily) when existing drivers that are actively in use cannot work with the new method, and then this combination of events occurred simultaneously:

                                        • launch of the Raspberry Pi 2 B
                                        • release of the new kernel with the new device handling capability - and with the new method enabled by default thus requiring reconfiguration for the old drivers to function as expected
                                        • the blog sites with the necessary information were disabled in order to better handle the increased traffic due to the launch

                                        These changes had a great impact on all Raspberry Pi installations that were actively using the I2C and the SPI interfaces. Given that there are lots of Raspberry Pi's in existence using these interfaces for a very wide range of applications i am very much surprised (in a very negative way) about the way this was handled. I only hope that they have learned from this experience and take steps to make sure that it never happens in this way again. I very much prefer to find out about these things from the right sources and not from people guessing at what the correct solution is to the problems. I found that all of the suggestions were lacking and did not solve all of my problems. It was not until i stumbled upon the new raspi-config configuration function that all of my problems disappeared. A lot of problems did disappear when i used Daniele's suggestion, but one of my most important installations that i ran in headless mode and relied on ssh to access and control refused to accept ssh connections afterwards. That was totally unacceptable for my purposes. But, luckily i checked out for new functionality in the raspi-config tool and got lucky - that fixed absolutely every problem that i was experiencing.

                                         

                                        When i get some free time i would like to explore the benefits and capabilities of the new device handling system and learn how to configure them - most preferably with information directly from the source and not from hackers guessing at how things should be done. In the immortal words of Dijkstra: "Testing can only prove the presence of bugs - not their absence." And in this situation i believe that hacking our way to a solution can possibly be used to uncover what does not work, but cannot be relied upon to find out what is necessary in situations such as we have just experienced without in depth, detailed knowledge about exactly what has changed. Modern systems are far too complex to be able to anticipate all possible scenarios.

                                          • Re: PiFace Digital 2 - setup and use
                                            dhts

                                            I'm a complete newcomer to raspberry and piface though have a programming background if you go far enough back. I'm trying to get raspberry pi 2 to talk to the piface relay plus board. I don't know if my problems are related to the above or not but I've tried disabling device tree as suggested.

                                             

                                            When I try to run the sample program in the documentation with the relay board I get "no piface relay plus board detected (hardware_addr=0, bus=0,chip_select=0).

                                             

                                            I've added the following lines to my config.txt file:

                                            dtparam=i2c_arm=on

                                            dtparam=spi=on

                                            device_tree=

                                             

                                            in /dev spidev0.0 and spidev0.1 are present.

                                             

                                            any ideas please ?

                                              • Re: PiFace Digital 2 - setup and use
                                                urkraft

                                                It truly amazes me that people insist on following the advice of hackers and changing the configuration files instead of using the tools that are specifically supplied for fixing the problems that you are experiencing! Oh well, i guess you enjoy having unnecessary problems to solve and finding solutions to the problems you create that ensure that you will experience new "surprises" around the bend. The real solution to the problem is to use the raspi-config choice that i have explained in excruciating detail in different threads, but keep on hacking with the config.text and give yourself the thrill of unexpected surprises.

                                                  • Re: PiFace Digital 2 - setup and use
                                                    dhts

                                                    I was only asking....

                                                     

                                                    The changes I made to config.txt were as documented by a Raspberry Pi Engineer & Forum Moderator in the article on the Raspberry forum with the post entitled "I2C, SPI, I2S, LIRC, PPS, stopped working? Read this."

                                                     


                                                     

                                                    • Re: PiFace Digital 2 - setup and use
                                                      psh59

                                                      I have another question regarding the PiFace Digital 2. I have a program that uses the GPIO of the Raspberry Pi 2 B. The program works and has been tested and works at 900 kHz (frequency divider). I used 3.3 v digital signals for testing but need to use 5v in the actual application. I thought I could use the PiFace and just connect my signals to it and everything would be fine. The more I read about it, it appears that I need to ditch my GPIO setup / digital read/write code and use the new stuff for the PiFace Digital 2 in order to use 5 v TTL signals. Can anyone confirm this for me? Or, preferably just give me a pin mapping between the PiFace and GPIO.

                                                       

                                                      Thanks.

                                                      Paul

                                                        • Re: PiFace Digital 2 - setup and use
                                                          michaelkellett

                                                          Why bother with the PiFace - you could just use 3.3 to 5V level converters.

                                                           

                                                          MK

                                                          • Re: PiFace Digital 2 - setup and use
                                                            urkraft

                                                            Hello Paul,

                                                             

                                                            Firstly, i would like to point out that some information has been released after i made my original posting, and it can be found here: http://www.piface.org.uk/assets/docs/PiFace-Digital2_getting-started.pdf

                                                             

                                                            Next, i should also point out that i am having difficulty understanding exactly what you are trying to communicate but will attempt to reply nonetheless.

                                                             

                                                            If your concerns are about use of the inputs at the green connection blocks along the top of the board you should be aware that they appear to have been designed to work by being connected to and from the ground contact (refer to page 10 of the document at the link i have posted above). If you are planning on connecting circuits that switch between 5v and ground there you will most likely fry you circuits.

                                                             

                                                            Aside from that, i can inform you that i have not been using my PiFace Digital 2 card and the RaspberryPi that i had it mounted on for some months now, but i just fired them up and updated all software ("sudo apt-get update" followed by "sudo apt-get dist-upgrade" and "Y" to confirm that i wanted to update all approx. 50 packages that needed updating, then "sudo reboot" afterwards to start using the changes) and used the emulator to confirm that everything was still functional - which appeared to be the case.

                                                             

                                                            Hope this was helpful.

                                                             

                                                            Regards,

                                                            raymond

                                                  • Re: PiFace Digital 2 - setup and use
                                                    davekelley

                                                    After plugging along with all the other postings and finding things not working, I followed your directions and all is well with the world.  My PiFace is working like a charm!!  Thank you!!

                                                  • Re: PiFace Digital 2 - setup and use
                                                    ernyz

                                                    Hi Prise,

                                                     

                                                    I am not an expert but I did find some information googling for raspberry pi device tree overalys. In any case, if you put a line like:

                                                     

                                                    device_tree=

                                                     

                                                    in config.txt the firmware sould revert to old behaviour. I read on some topics that this function will be disabled in the future firmwares so this is only a temporary fix.

                                                    Please note that model B (without plus) overlay should be bcm2708-rpi-b.dtb

                                                    On my image, these files were located in /boot/ check if they are present!

                                                    There is also a debug mode (write a line with dtdebug=1) on config.txt

                                                     

                                                    I hope this help, maybe have a look here as well https://github.com/raspberrypi/documentation/blob/master/configuration/device-tree.md#32-pi-parameters

                                                     

                                                    Regards,

                                                     

                                                    Daniele

                                            • Re: PiFace Digital 2 - setup and use
                                              urkraft

                                              Please DO NOT use this command which is included in the documentation above:

                                               

                                              sudo rpi update

                                               

                                              The command invokes an experimental version of the kernel and is not meant for use by normal Raspberry Pi users. I apologize for including it in the documentation that i published. When i created the document i was not aware of it's true purpose. Unfortunately i am not allowed to edit my own document in order to correct it.

                                               

                                              Regards,

                                              raymond

                                              • Re: PiFace Digital 2 - setup and use
                                                santoshpanda

                                                Hi,

                                                I want to read a temperature sensor output in PiFace.

                                                Could you please help?

                                                 

                                                Regards,

                                                Santosh

                                                • Re: PiFace Digital 2 - setup and use
                                                  jplaraujo

                                                  Hello Raymnd.

                                                   

                                                  I'm using a RPi with the latest version of Raspbian, and three PiFace Digital 2 hooked up with 40 line ribbon cable. They are all correctly addressed and work OK through the emulator and by the python 3 editor and script.

                                                   

                                                  The only problem is when i power off the RPi and power on again, by opening the emulator it only works the board with the address 0. The boards with address 1 and 2 don't work.

                                                   

                                                  The only way I get all of them to work is setting all of the boards with address 0. By opening the emulator and activate the outputs, all of the board's ouputs work. Next, I'll close the emulator, set the jumpers back to the correct addressing, run the emulator and all is working OK.

                                                   

                                                  Have you came across this situation? Please help.

                                                   

                                                  Thank you.

                                                  • Re: PiFace Digital 2 - setup and use
                                                    urkraft

                                                    Hello Joäo,

                                                     

                                                    For some reason i do not have access to reply to you and am only allowed to reply to this discussion.

                                                     

                                                    Anyway, in reply to your question: No i have never come across the situation you have described. (I only have one PiFace Digital board and therefore have never needed to use the addressing jumpers to access extra PiFace Digital boards.) Furthermore, i have not used the PiFace Digital since shortly after my original contribution to this discussion - almost 2 years ago. I would have loved to try to help you, but unfortunately i have too much requiring my attention at this point in time. I did have a quick look at the documentation for the PiFace Digital2 to see if there was any information there that could explain what you are experiencing but nothing caught my eye other than the statement that it is important that the Raspberry Pi and the PiFace Digital2 must use the same power supply. I suggest you contact the company who designed it (Open LS SP Ltd). I believe that their web site is at this link: PiFace – Raspberry Pi Interface .

                                                     

                                                    Good luck!

                                                    • Re: PiFace Digital 2 - setup and use
                                                      barto_jg

                                                      Thanks for this.  I used it to set up the PiFace Digital 2 on the RasPi 3B and it is working well.

                                                       

                                                      A couple things I observed: 

                                                       

                                                      When configuring raspi-blacklist.conf :

                                                       

                                                      /etc/modprobe.d/raspi-blacklist.conf    <--  The file was there, but it was empty.  I added the line listed, preceded by '#'.  I thought the "#' is a comment indicator, so not sure if this is needed.

                                                       

                                                      the RaspiConfig 'SPI Enable'  setting is in a different menu location w. the Raspberry 3 Model B.

                                                       

                                                      Cheers,  - John

                                                       

                                                       

                                                        • Re: PiFace Digital 2 - setup and use
                                                          mjalafoo

                                                          Hi,

                                                           

                                                          I have kind of a similar problem.

                                                           

                                                          I have seen a number of posts on the Web from people who say that they are running PiFace 2 Digital with a Raspberry Pi.

                                                          I have also seen videos showing that the combinaton is working.

                                                           

                                                           

                                                          Following are the steps I followed:

                                                          - Newly formatted Sd Card

                                                          - Fresh Installation of Raspian (2017-09-07-raspbian-stretch)

                                                          - Updated Raspian (sudo apt-get update && sudo apt-get upgrade) "there was 0 zero updates"

                                                          - Selected SPI (sudo raspi-config)

                                                          - Failed to Install PiFace™ Digital 2 software (sudo apt-get install python3-pifacedigitalio), it gives an error "E: Unable to find... "

                                                          - Failed to Install PiFace™ Digital 2 Emulator software (sudo apt-get install python3-pifacedigital-emulator), it gives an error "E: Unable to find... "

                                                          - Rebooted Raspberry Pi

                                                           

                                                           

                                                          This file:

                                                          "sudo nano /etc/modprobe.d/raspi-blacklist.conf" is EMPTY

                                                           

                                                           

                                                          Can you please help?