Hardware Reference
In-Depth Information
Notice the structure of the code. There is a data structure in a list called seq ; it is the values
in this list that control what is displayed on the screen, and what is output to the lights.
Any changes are made to this list and then the list is used to change the display as well as
providing the output. Note that the screen display is not used to hold data - only reflect it.
This is an important principle and is used whenever you try and write a nontrivial piece
of code.
The Lights
The next step is to control some lights rather than the LEDs that are on the PiFace board.
While these LEDs are good for testing they are not going to be very impressive in a disco.
The buffer on the PiFace board is capable of switching voltages up to 40V with currents up to
half an amp. Now while it can do this on any output it cannot do this on all the outputs at the
same time. That is, there is a collective sum total of current the buffer can switch without
getting too hot; this is about 650mA. This works out at about 80mA per output if you are to
allow for all outputs to be on at once. What you are going to do is drive an LED strip off each
output by using a 12V external power supply. There are two types of LED strips, those that
have electronics embedded along the strip so that you can control individual lights in the
strip, and those where the whole strip lights up at the same time when you apply voltage to
it. You are going to use the latter type, which fortunately is cheaper as well.
These LED strips can be cut up at a point every third light, and every three lights consumes
20mA. Therefore you can tailor the amount of current drawn by simply cutting the appropri-
ate length of strip. Some places sell these by the meter and others by the group of three. The
absolutely cheapest place to get them is from the Far East through eBay, although the quality
you get can be a bit hit and miss. There will be plenty of stockists that carry them in your
home country.
In this project you have two options when it comes to powering these strips. The first is
where the length of strip is restricted to 12 LEDs - that is about 130mm. The second is where
you can power a strip length up to 0.7 of a meter, but more on that later. First you will look
at the 130mm option.
Before you start you will have to configure the PiFace board by removing some of the links.
This involves removing jumpers JP4, JP5, JP6 and JP7; this disconnects the internal 5V sup-
ply from the PiFace board's output devices and disables the relays. See Figure 3-3 for the
position of these on the PiFace board. It is important you do this before connecting anything
else up.
Search WWH ::




Custom Search