In the last section we saw where the components used in this project wil be connected - now lets start putting this into practice.
You may recall that in Section 2, ( Required Components ), I mentioned about using a 4 gang light switch to simulate the float switches being operated ...... far much better than running into the Garden and getting your hands wet.
Below you can see how the light switch and the PiFace Digital inputs should be connected.
As you can see I have used a common household four gang light switch to simulate the high level and low level float switches in Tank 1 and Tank 2.
As we look at the picture, opposite, all four switches are currently in the ( C ) closed switch state which will indicate that all four float switches have been activated, the water tanks are full and the mains water solenoid valve is closed.
Now lets look at the connections on the back of the switch. All four common terminals on the switches are looped together (the blue cable) - with a link from the last common terminal back to the PiFace input terminal ( 0v )
You will also note that four brown cables are connected to the L1 terminals on the switches - these need to be connected as shown below;
Tank 1 H/L connect to PiFace Input Pin 0 | Tank1 L/L connect to PiFace Input Pin 1
Tank 2 H/L connect to PiFace Input Pin 2 | Tank 2 L/L connect to PiFace Input Pin 3
When all connections have been made you should have something resembling this.
You have probably noticed that we have not yet connected anything to the output changeover relays. Rather than getting overloaded with information at this early stage we will be dealing with outputs a bit later. The first Python code that we run will deal specifically with monitoring the float switches and reporting their switch state.
When it comes to connecting up our float switches at the end of this project you will notice that there is virtually no difference to what we have just carried out above.
If you have previously installed PiFace Digital as described in Section 3b and have made all the connections detailed above you are now ready to see some action in the PiFace Emulator
In the Linux Terminal at the command prompt;
type : $ piface/scripts/piface-emulator
If all is well the PiFace Emulator should execute as shown in the video below.
On the left hand side of the emulator enable the check box labelled 'Keep Inputs Updated', Providing that all of the switches are in the closed position you should see the four inputs highlighted as shown. Now toggle the switches on and off and the emulator will update the switch state.
If you keep your eye on the output changeover relays whilst toggling the input switches on and off you will notice that nothing is happening with the relays. This is to be expected as we have not yet initiated our Python code to instruct the relays to switch over.
Now head over to the right hand side of the emulator and click on 'Override Enable'. You will recall in the last section that I mentioned we would be using code to activate Output Pin 0 and Output Pin 1 - click on each of these and you will see how the relays switch over from the (n/c) terminal to the (n/o) terminal.
In the next section we will explore Python ( IDLE and Interactive Mode ) and run the code for monitoring our float switches



