SlideShare ist ein Scribd-Unternehmen logo
1 von 6
Raspberry Pi: a course in several parts
Part II: Lights and Sound
2-1: Lights
Objectives:
 Safety review
 Build a circuit
 Enhance that circuit
Set up the Pi kits, as per normal. Do connect the ribbon cable to the Pi, but leave the
breadboard disconnected. No software is needed for this part, so log in to the Pi or
not, but do not start the X Windows System.
Review electrical safety. Don't get zapped, don't fry the Pi, go home in the same
condition you came.
Start by building the same LED circuit as in session 1-2 – we will use this as a basis for
expansion. The basic connections are as follows:
 3.3V to +
 + to 160-ohm resistor
 Resistor to LED (long lead)
 LED (short lead) to -
 - to GND
Note that it's easier to leave the LED leads straight, just angle them slightly to that they
can be plugged into separate rows. Resistors, however, need to be bent, and are
best bent fairly close to the body so they don't take up much horizontal space. Also
note that resistors will conduct current in either direction, but LEDs, being diodes, will
only work in one direction. Attach the ribbon cable to the breadboard and watch it
glow.
Disconnect the ribbon cable from the breadboard. Now set up a second LED circuit
in similar fashion, but with a second resistor. The + and – bars can be reused.
 + to 160-ohm resistor
 Resistor to 2nd resistor
 2nd resistor to LED (long lead)
 LED (short lead) to -
Plug the ribbon cable into the breadboard and watch both LEDs glow. Note that the
second one is not as bright as the first. Unplug the ribbon cable from the breadboard
again.
Now let's add a button. The buttons included with the kit have rather short, sharp
fangs, and they can be very difficult to get in and out of the breadboard. They seem
to be easiest to remove when installed on the bottom rows, so that it is much easier to
get a fingernail under the component.
Position the button so its connections are in 28E, 30E, 28H, and 30H.
When the button is pressed, it completes the circuit. So, we want the button placed
in the circuit so it interrupts the flow unless it is pressed. Change the connections for
one of the LEDs as follows:
 + to 28A
 30A to resistor
Now plug in the breadboard. Notice that the LED no longer glows. Push the button,
and it should instantly come on!
Tricky bits: the white LED
If you have time, this can be fun to explore. The 4-pole white LED is actually a
combination RGB (red/green/blue) LED. The colors blend, so it visually can take on
most any hue when wired appropriately.
The poles have the following roles:
 Shortest (all the way on one end) = green input
 Longest (second, next to the shortest)= to GND – this is opposite of the single-
color LEDs
 Second longest (third, other side of the longest) = blue input
 Second shortest (all the way on the other end) = red input
Treat the colors as three separate LEDs. Wire three sets of + to 160-ohm resistor, and
wire each resistor to one of the red/green/blue inputs. Wire the long pole to -.
Connect the ribbon cable to the breadboard and it should glow white. Now
disconnect power, pull one of the red/green/blue input wires out, and reconnect
power. You should see a new color!
When you pack it up, disconnect the breadboard first, log in (pi, library), issue the
“sudo shutdown -h now” command, and when it's down, remove power from the Pi.
Make sure to straighten any bent leads for easier storage and inventory all the
components before calling it a day – each kit will need all of its LEDs and resistors for
future sessions.
2-2: Sound
Objectives:
 Create a circuit whose state can be detected
 Use Scratch to play a sound when the button is pressed
This session leverages ScratchGPIO and basic principles from
http://simplesi.net/scratchgpio/scratchgpio-1st-project. If you have not installed this
on the kits already, please do so.
Counting pins on the breakout board becomes important here. Start from the top left
(3V3, row 1) and count ACROSS then DOWN. 3V3 is pin 1, 5V on the other side is pin
2, SDA in row 2 is pin 3, the second 5V on the other side is pin 4, SCL is pin 5, GND in
row 3 is pin 6, and so on. There are 26 pins on the model B breakout.
Connect headphones to the Pi. Log on to the Pi, and start the X Windows System via
the startx command. Launch ScratchGPIO6. Start by making sure Scratch can play
a sound. Drag the “play sound” element to the script area, and click it. You should
hear the sound (meow by default).
Now let's create a circuit to control the sound. All we really need is a button.
 Wire pin 7 (which is confusingly labeled P4) to 28A
 Put a switch in 28E and 30E
 Wire 30A to -
 Wire – to GND (13A)
In order to tell what the button is doing, we need to check it periodically. Put the
following script together:
 Start with a “forever” from the Control category
 Inside the forever, place a “say … for 2 secs” from the Looks category
 Inside the say, place a “slider sensor value” from the Sensing category
 Change the “slider” in the sensor value to “pin7”
Click the forever to start it. It should say 1 when the button is not pressed, 0 when the
button is pressed. Now that we know how to detect what the button is doing, let's
connect the pieces together.
 Start with a “forever if” from the Control category
 Inside the condition of the “if … then” place a “< _ = _ >” operator from the
Operators category
 On one side of the equals operator, put the number zero.
 On the other side of the equals operator, put the “pin7 sensor value” from the
Sensing category
 Inside the body of the “forever if” place a “play sound” from the Sound
category
Customize the sound if you like. If you want a visual indicator as well, place a “say …
for 2 secs” from the Looks category in the body of the “forever if” block.
Congratulations, you have a working button that does something useful!
Tear down as normal. Make sure all the components stay with their kits.
2-3: Lights AND sound
Objectives:
 Build a bunch of LED circuits
 Use a software package to synchronize lights & sound
This session makes use of lightshowPi (http://www.lightshowpi.com/)for its
synchronized awesomeness. Make sure it is installed ahead of time, preferably in a
consistent, simple location, such as ~/lightshowpi as specified on their site, and
consider changing the default preshow delay from 30 to something smaller, like 10 or
3. Also, if you have other music that you wish to use (without violating copyright, of
course), put it in an appropriate location on the device. The sample directory
(~/lightshowpi/sample/music)is as good a place as any.
Set up the Pi kits as normal. Attach headphones. Do log in, but do not start the X
Windows System.
For this project, we are going to set 8 strings of Christmas lights … well, 8 LEDs, at
least … to music. There is plenty of room on the breadboard for this, although space
utilization will be important. Wire eight simple LED circuits, but instead of taking power
from +, we will take power from the various pins on the GPIO breakout.
 Pin to resistor
 Resistor to LED
 LED to -
 - to GND
Note that there is no need for the 3V3 or + in this project. It will be easier to correlate
the sounds with what the lights are doing if the LEDs are wired in a regular fashion, but
technically the order does not matter at all. Also note that the 4-pole RGB LED can
be substituted in for three of the channels. The GPIO pins to use, in order, are as
follows:
1. P17 (6A)
2. P18 (6J)
3. P27 (7A)
4. P22 (8A)
5. P23 (8J)
6. P24 (9J)
7. P25 (11J)
8. P4 (4A)
Now that the wiring is complete, double-check it to make sure that the connections
are correct. Since the breadboard probably has components close together, make
sure there are no bits of metal touching each other, since they could cause short
circuits.
Use the software to run a test. From the command prompt, assuming you have
installed the software per the instructions, do the following:
cd ~/lightshowpi
sudo py/hardware_controller.py –state=flash
Notice the tilde before the forward slash in the cd (change directory) command.
Also notice that the “state” flag has two dashes in front of it. These commands will
initiate a hardware test, causing each LED to flash in turn. If any LEDs do not light up,
or if they are not illuminating in the desired order, check your connections.
Ready for the real thing? Do the following:
sudo py/synchronized_lights.py –file=sample/music/<your choice of music>.mp3
Turn off the lights, put on your headphones, and enjoy the collective glowing fruits of
your labor!
It is worth talking about what else you could do with this. What if instead of LEDs, you
used relays that could turn real strings of lights on and off? The lightshowPi package
incidentally also allows SMS text message control of the light show, such as collecting
votes for the next song to be played from a playlist.
When you are satisfied with the rewards of this project, tear it down and pack it up.
Straighten all those bent leads for easier storage, and make sure to inventory
everything to make sure the kits stay whole.

Weitere ähnliche Inhalte

Kürzlich hochgeladen

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Kürzlich hochgeladen (20)

Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 

Empfohlen

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Empfohlen (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Course set two full notes

  • 1. Raspberry Pi: a course in several parts Part II: Lights and Sound 2-1: Lights Objectives:  Safety review  Build a circuit  Enhance that circuit Set up the Pi kits, as per normal. Do connect the ribbon cable to the Pi, but leave the breadboard disconnected. No software is needed for this part, so log in to the Pi or not, but do not start the X Windows System. Review electrical safety. Don't get zapped, don't fry the Pi, go home in the same condition you came. Start by building the same LED circuit as in session 1-2 – we will use this as a basis for expansion. The basic connections are as follows:  3.3V to +  + to 160-ohm resistor  Resistor to LED (long lead)  LED (short lead) to -  - to GND Note that it's easier to leave the LED leads straight, just angle them slightly to that they can be plugged into separate rows. Resistors, however, need to be bent, and are best bent fairly close to the body so they don't take up much horizontal space. Also note that resistors will conduct current in either direction, but LEDs, being diodes, will only work in one direction. Attach the ribbon cable to the breadboard and watch it glow. Disconnect the ribbon cable from the breadboard. Now set up a second LED circuit in similar fashion, but with a second resistor. The + and – bars can be reused.  + to 160-ohm resistor  Resistor to 2nd resistor  2nd resistor to LED (long lead)  LED (short lead) to - Plug the ribbon cable into the breadboard and watch both LEDs glow. Note that the second one is not as bright as the first. Unplug the ribbon cable from the breadboard again.
  • 2. Now let's add a button. The buttons included with the kit have rather short, sharp fangs, and they can be very difficult to get in and out of the breadboard. They seem to be easiest to remove when installed on the bottom rows, so that it is much easier to get a fingernail under the component. Position the button so its connections are in 28E, 30E, 28H, and 30H. When the button is pressed, it completes the circuit. So, we want the button placed in the circuit so it interrupts the flow unless it is pressed. Change the connections for one of the LEDs as follows:  + to 28A  30A to resistor Now plug in the breadboard. Notice that the LED no longer glows. Push the button, and it should instantly come on! Tricky bits: the white LED If you have time, this can be fun to explore. The 4-pole white LED is actually a combination RGB (red/green/blue) LED. The colors blend, so it visually can take on most any hue when wired appropriately. The poles have the following roles:  Shortest (all the way on one end) = green input  Longest (second, next to the shortest)= to GND – this is opposite of the single- color LEDs  Second longest (third, other side of the longest) = blue input  Second shortest (all the way on the other end) = red input Treat the colors as three separate LEDs. Wire three sets of + to 160-ohm resistor, and wire each resistor to one of the red/green/blue inputs. Wire the long pole to -. Connect the ribbon cable to the breadboard and it should glow white. Now disconnect power, pull one of the red/green/blue input wires out, and reconnect power. You should see a new color! When you pack it up, disconnect the breadboard first, log in (pi, library), issue the “sudo shutdown -h now” command, and when it's down, remove power from the Pi. Make sure to straighten any bent leads for easier storage and inventory all the components before calling it a day – each kit will need all of its LEDs and resistors for future sessions.
  • 3. 2-2: Sound Objectives:  Create a circuit whose state can be detected  Use Scratch to play a sound when the button is pressed This session leverages ScratchGPIO and basic principles from http://simplesi.net/scratchgpio/scratchgpio-1st-project. If you have not installed this on the kits already, please do so. Counting pins on the breakout board becomes important here. Start from the top left (3V3, row 1) and count ACROSS then DOWN. 3V3 is pin 1, 5V on the other side is pin 2, SDA in row 2 is pin 3, the second 5V on the other side is pin 4, SCL is pin 5, GND in row 3 is pin 6, and so on. There are 26 pins on the model B breakout. Connect headphones to the Pi. Log on to the Pi, and start the X Windows System via the startx command. Launch ScratchGPIO6. Start by making sure Scratch can play a sound. Drag the “play sound” element to the script area, and click it. You should hear the sound (meow by default). Now let's create a circuit to control the sound. All we really need is a button.  Wire pin 7 (which is confusingly labeled P4) to 28A  Put a switch in 28E and 30E  Wire 30A to -  Wire – to GND (13A) In order to tell what the button is doing, we need to check it periodically. Put the following script together:  Start with a “forever” from the Control category  Inside the forever, place a “say … for 2 secs” from the Looks category
  • 4.  Inside the say, place a “slider sensor value” from the Sensing category  Change the “slider” in the sensor value to “pin7” Click the forever to start it. It should say 1 when the button is not pressed, 0 when the button is pressed. Now that we know how to detect what the button is doing, let's connect the pieces together.  Start with a “forever if” from the Control category  Inside the condition of the “if … then” place a “< _ = _ >” operator from the Operators category  On one side of the equals operator, put the number zero.  On the other side of the equals operator, put the “pin7 sensor value” from the Sensing category  Inside the body of the “forever if” place a “play sound” from the Sound category Customize the sound if you like. If you want a visual indicator as well, place a “say … for 2 secs” from the Looks category in the body of the “forever if” block. Congratulations, you have a working button that does something useful! Tear down as normal. Make sure all the components stay with their kits. 2-3: Lights AND sound Objectives:  Build a bunch of LED circuits  Use a software package to synchronize lights & sound This session makes use of lightshowPi (http://www.lightshowpi.com/)for its synchronized awesomeness. Make sure it is installed ahead of time, preferably in a consistent, simple location, such as ~/lightshowpi as specified on their site, and consider changing the default preshow delay from 30 to something smaller, like 10 or 3. Also, if you have other music that you wish to use (without violating copyright, of course), put it in an appropriate location on the device. The sample directory (~/lightshowpi/sample/music)is as good a place as any. Set up the Pi kits as normal. Attach headphones. Do log in, but do not start the X Windows System. For this project, we are going to set 8 strings of Christmas lights … well, 8 LEDs, at least … to music. There is plenty of room on the breadboard for this, although space utilization will be important. Wire eight simple LED circuits, but instead of taking power from +, we will take power from the various pins on the GPIO breakout.  Pin to resistor  Resistor to LED  LED to -
  • 5.  - to GND Note that there is no need for the 3V3 or + in this project. It will be easier to correlate the sounds with what the lights are doing if the LEDs are wired in a regular fashion, but technically the order does not matter at all. Also note that the 4-pole RGB LED can be substituted in for three of the channels. The GPIO pins to use, in order, are as follows: 1. P17 (6A) 2. P18 (6J) 3. P27 (7A) 4. P22 (8A) 5. P23 (8J) 6. P24 (9J) 7. P25 (11J) 8. P4 (4A) Now that the wiring is complete, double-check it to make sure that the connections are correct. Since the breadboard probably has components close together, make sure there are no bits of metal touching each other, since they could cause short circuits. Use the software to run a test. From the command prompt, assuming you have installed the software per the instructions, do the following: cd ~/lightshowpi sudo py/hardware_controller.py –state=flash Notice the tilde before the forward slash in the cd (change directory) command. Also notice that the “state” flag has two dashes in front of it. These commands will initiate a hardware test, causing each LED to flash in turn. If any LEDs do not light up, or if they are not illuminating in the desired order, check your connections. Ready for the real thing? Do the following: sudo py/synchronized_lights.py –file=sample/music/<your choice of music>.mp3 Turn off the lights, put on your headphones, and enjoy the collective glowing fruits of your labor!
  • 6. It is worth talking about what else you could do with this. What if instead of LEDs, you used relays that could turn real strings of lights on and off? The lightshowPi package incidentally also allows SMS text message control of the light show, such as collecting votes for the next song to be played from a playlist. When you are satisfied with the rewards of this project, tear it down and pack it up. Straighten all those bent leads for easier storage, and make sure to inventory everything to make sure the kits stay whole.