bobsparkes
Posts: 8
Joined: Fri Dec 27, 2013 7:26 pm

PiFace not working

Sat Jan 11, 2014 9:42 pm

I have three PiFaces connected to the RPi via the PiRack. Board 0 works perfectly, both with python3 and with "piface-emulator".
With python3, it isn't possible to address the other boards (and, yes, I have changed the Junction connections appropriately). When I do "p.digital_write(1,1,2)", the RPi says it can't understand what the third ("board number") digit is for. When I use the emulator, there is no option called "View" to allow me to change from one board to another. OK. I must therefore have the older software, so I do the update and upgrade commands and then try to install the latest piface and piface-emulator software, only to be told that I already have the newest software in both cases. I've tried a dozen times, with the same results every time. Even more disturbing is that my requests to cs.man.ac.uk don't produce any answers. Where can I get the help I need?

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: PiFace not working

Sun Jan 12, 2014 2:44 pm

bobsparkes wrote:Where can I get the help I need?
http://www.piface.org.uk/ or https://github.com/piface/pifacedigitalio/issues :?:

User avatar
DougieLawson
Posts: 38883
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: PiFace not working

Sun Jan 12, 2014 2:54 pm

Have you installed the latest version of pifacedigitalio?
sudo apt-get install python{,3}-pifacedigitalio
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

bobsparkes
Posts: 8
Joined: Fri Dec 27, 2013 7:26 pm

Re: PiFace not working

Mon Jan 13, 2014 3:48 pm

I appreciate that people are trying to help, but, so far, their advice has not been helpful.
Dougie says I need to install the latest version of pifacedigitalio. I did this with:
sudo apt-get install python3-pifacedigitalio
and received the message: ““python3-pifacedigitalio is already the newest version”.

Andrew refers me to the PiFace Guides. These give instructions for updating Raspian, Enabling Raspian, Installing Piface Digital Modules, Fitting PiFace Digital and Testing your Piface, etc.; all of which I did and all of which worked as stated. None of these, however, told me how to address more than one board, but I’ll come back to this later. Continuing with the Guide, it next explains how to use the Piface-emulator:
“To install the PiFace Digital software run the command:
sudo apt-get install python3-pifacedigital-emulator
Enter Y when prompted.”
When I did this (again, many times!), I got the message “python3-pifacedigital-emulator is already the newest version”. However, when I open the emulator, I get a version which does not have the option “View” (only the option “Enable”), i.e. it does NOT look like the one shown in the Guide. The Guide says: “If you have the older version of the emulator it may not look like this below.”, so why does my RPi say I have the newest version of the emulator, when I clearly do not?

Coming back to my problem of addressing Boards 1and 2, I have now found out where I was going wrong. My initial problem was being unable to address anything other than Board 0. I used
p.digital_write(pin_number, value, board_number)
p.digital_read(pin_number, board_number)
but, when I initially tried to address Pin 1 of Board 1, with p.digital_write(1,1,1), or examine Input 1 on Board 1 with p.digital_read(1,1)
I got the error message “There is no PiFaceDigital with hardware addr 1”
I checked to ensure that I had got the jumpers correct on Board 1, and they were absolutely correct. The problem lay in the jumper connections on the PiRack itself, because I had positions 1, 2 and 3 set to "Powered from an external supply" but Board 0 to "Powered from the Raspberry Pi". When I set all the board positions to "Powered from the Raspberry Pi", then I was able to address each the boards using python3. I think I would have wasted far less time if this information had been given in the PiRack Guide itself, instead of just on the sheet that accompanied the PiRack.

I'm still left with the problem of my Emulator not allowing me to address boards other than board 0.

While I am recounting my frustrations, I find that the scratch handler instructions in the Guide don’t help either. My version of Scratch does not produce the option to “Host Mesh” or “Join Mesh” when I shift-click the Share option. Instead I get “Stop Hosting Mesh” so, again, I assume I have an earlier version of Scratch, even though the RPi assures me I have the newest version. I cannot therefore configure the control instructions to talk to the PiFace at all (not even to Board 0) . Could someone please tell me what to try next?
Last edited by bobsparkes on Mon Jan 13, 2014 4:52 pm, edited 1 time in total.

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: PiFace not working

Mon Jan 13, 2014 4:11 pm

bobsparkes wrote:I appreciate that people are trying to help, but, so far, their advice has not been helpful.
:(
Andrew refers me to the PiFace Guides.
I also referred you to the github project - normally when people have problems with a particular project it's best to file an issue directly with the project, as there's no guarantee that the piface developers regularly read all posts on the (rather busy) Raspberry Pi forums.
When I did this (again, many times!), I got the message “python3-pifacedigital-emulator is already the newest version”. However, when I open the emulator, I get a version which does not have the option “View” (only the option “Enable”), i.e. it does NOT look like the one shown in the Guide. The Guide says: “If you have the older version of the emulator it may not look like this below.”, so why does my RPi say I have the newest version of the emulator, when I clearly do not?
I obviously can't say for certain, but quite often what happens is that people update the software first, and then only later do they update the documentation (or sometimes they forget to update the documentation). I.e. it's possible that your software is up to date, it's simply the guide that is old :|


I also suspect there are very few people with mulitiple PiFace boards and a PiRack, which may be why you're not getting the help you expected here? :?

bobsparkes
Posts: 8
Joined: Fri Dec 27, 2013 7:26 pm

Re: PiFace not working

Mon Jan 13, 2014 5:40 pm

Andrew

Thank you for responding and trying to help. I did look at the github project, but it seemed to be frequented by geeks, talking well beyond my understanding, and I never found anywhere where raw beginners could be helped. However, I'll try again.

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: PiFace not working

Mon Jan 13, 2014 6:07 pm

It should be as simple as going to https://github.com/piface/pifacedigitalio/issues then clicking on the "New Issue" button, and then describing your problem. Of course you may need to create a github account if you don't have one already.

User avatar
DougieLawson
Posts: 38883
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: PiFace not working

Mon Jan 13, 2014 7:05 pm

Can you post your whole script and a transcript of trying to run it?

Stick every thing in [code][/code] tags.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

bobsparkes
Posts: 8
Joined: Fri Dec 27, 2013 7:26 pm

Re: PiFace not working

Mon Jan 13, 2014 8:00 pm

That's beyond me, Dougie, I'm not "with it" to the extent of knowing how to copy the dialog on my screen.

At the moment my problem is no longer with how to use python3 to talk to the different PiFaces (I solved that one, it was a hardware problem, not a software problem). My problem now is why I have an emulator which looks different from the one in the Guide. That one has the option "View" to allow me to switch between the different PiFaces. My version has no such option, so it might be an old version, yet, when I enter

sudo apt-get install pifacedigital-emulator

I get the message that I already have the newest version. How do I get the version pictured in the Guide?

User avatar
Douglas6
Posts: 4853
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: PiFace not working

Mon Jan 13, 2014 8:22 pm

I have no experience with the Piface or its software, but it's just possible that the 'newest version' has not yet been merged with the Raspian repositories, which is where apt-get 'gets' from. You MAY need to download the source from Github and build it yourself. A little daunting for a beginner (like me) but really just a matter of carefully following the instructions on Github.

User avatar
DougieLawson
Posts: 38883
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: PiFace not working

Mon Jan 13, 2014 10:59 pm

I don't have a PiFace but I know the theory behind it.

To get a transcript use PuTTY on a Windows machine and connect to your RPi with ssh.
http://the.earth.li/~sgtatham/putty/0.6 ... ig-logging

You can put that on pastebin and post a link here.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: PiFace not working

Tue Jan 14, 2014 1:03 am

Douglas6 wrote:I have no experience with the Piface or its software, but it's just possible that the 'newest version' has not yet been merged with the Raspian repositories, which is where apt-get 'gets' from. You MAY need to download the source from Github and build it yourself. A little daunting for a beginner (like me) but really just a matter of carefully following the instructions on Github.
I decided to do a bit of quick digging... ;) :geek:

Github (i.e. where the PiFace software is developed) says that the latest version of pifacedigital-emulator is 2.0.1 https://github.com/piface/pifacedigital ... /CHANGELOG

The Raspberry Pi Foundation's Raspbian repository (i.e. where (some of) the software you 'apt-get install' comes from) also says that 2.0.1 is the latest available version http://archive.raspberrypi.org/debian/p ... -emulator/

You can also check this on your own Pi with:

Code: Select all

dpkg -l pifacedigital-emulator

sunilvb
Posts: 5
Joined: Sun Feb 02, 2014 2:54 am

Re: PiFace not working

Sat Jun 21, 2014 1:41 am

bobsparkes wrote:I have three PiFaces connected to the RPi via the PiRack. Board 0 works perfectly, both with python3 and with "piface-emulator".
With python3, it isn't possible to address the other boards (and, yes, I have changed the Junction connections appropriately). When I do "p.digital_write(1,1,2)", the RPi says it can't understand what the third ("board number") digit is for. When I use the emulator, there is no option called "View" to allow me to change from one board to another. OK. I must therefore have the older software, so I do the update and upgrade commands and then try to install the latest piface and piface-emulator software, only to be told that I already have the newest software in both cases. I've tried a dozen times, with the same results every time. Even more disturbing is that my requests to cs.man.ac.uk don't produce any answers. Where can I get the help I need?
Hello - I have the same problem. I have 2 Piffaces connected to RPi via PiRack. I am trying to light up the LEDs on the two boards one after the other. Board 0 work fine but not the second. Actually the LEDs on both the Pifaces light up when j=0 and none when j=1 or 2 or 3.
Were you able to solve you problem of addressing multiple pifaces ?

I am using the following test C program :

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "pifacedigital.h"


int main( int argc, char *argv[] )
{
uint8_t j = 0; /**< piface location iterator */
uint8_t i = 0; /**< Loop iterator */
uint8_t inputs; /**< Input bits (pins 0-7) */
int hw_addr = 0; /**< PiFaceDigital hardware address */



for (j = 0; j < 4; j++) {
/**
* Open piface digital SPI connection(s)
*/
printf("Opening piface digital connection at location %d\n", j);
pifacedigital_open(j);

/**
* Read each input pin individually
* A return value of 0 is pressed.
*/

for (i = 0; i < 8; i++) {
const char *desc;
if (i <= 1) desc = "pin with attached relay";
else desc = "pin";

/* Turn output pin i high */
printf("Setting output %s %d HIGH\n", desc, (int)i);
pifacedigital_write_bit(1, i, xOUTPUT, j);
sleep(1);

/* Turn output pin i low */
printf("Setting output %s %d LOW\n", desc, (int)i);
pifacedigital_write_bit(0, i, xOUTPUT, j);
sleep(1);
}

/**
* Close the connection to the PiFace Digital
*/
pifacedigital_close(j);
}
}

Return to “Troubleshooting”