Raspberry Pi LED Light Schroeder Piano
LED (Light Emitting Diode) and LDR (Light Dependant Resistor, or photoresitor) arrays are used to play musical notes using the Raspberry Pi Pygame MIDI sequencer. There are 15 paris of LED & LDR (12 for a full octave of notes, 1 to go up and octave, 1 to go down and octave, and 1 for menu). When the light between LED and LDR is broken, music is played through the Pygame MIDI sequencer. When the light between the Octave Up or Down LED/LDR is broken, all the other notes are shifted up or down an octave. The Pygame MIDI supports over 75 musical instruments and 128 notes per instrument (10 octaves). The menu key can be used to switch instruments. The Raspberry Pi, breadboard, and speaker are within a 20 inch x 30 inch wooden piano that looks like a miniature grand piano.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Materials Needed
MATERIAL NEEDED :
1. Raspberry Pi. I used an older Model B, rev 2. Newer models have faster processors and more GPIO available that could expand the project 2. 15 pcs LED (Focus/Narrow light beam), bright 3. 2 pcs LED (generic) for status (optional) 4. 19 pcs 100 Ohm resistors 5. 15 pcs 47k Ohm resistors 6. 15 pcs LDR (Light Dependant Resistor) 7. 1 Breadboard 8. Wires to interconnect Raspberry Pi to breadboard, breadboad to LDR/LED/resistors 9. Piano Frame a. 20 inch x 30 inch 1/2” plywood b. 4 foot x 8 foot ⅛” hardboard c. 1 inch x 2 inch x 20 inch wood to mount LDR and LED (hardwood preferred) d. 2 inch x 2 inch x 40 inch internal posts e. ¾ inch x 15 inch dowel for legs
Step 2: Build Piano Frame
See attached Raspberry Pi LED Light Schroeder Piano - Frame.pdf for details.
❏ Side walls can be bent with wood glue (gorilla glue) and clamps if use ⅛” Hardboard
❏ Need 4’x8’ Hardboard sheet for long enough side
❏ Extra 4’x8 Hardboard can be used for Top and Base (needs multiple layers for strength)
❏ Base can be 1/2” Plywood
❏ 2”x2” posts screwed in from underside of base to hold bent hardboard sides
❏ Staples and cable ties under front of LDR mounts really help dress wires under frame to hole near breadboard
❏ Hardboard covers the base sides
❏ Use drill press for LDR/LED mount holes to make them straight to align across gap
❏ 15 holes (12 for Notes, 1 for Octave Up, 1 for Octave Down, 1 for Menu
Step 3: Build Electronics
See attached Raspberry Pi Light Schroeder Piano - Schematic.pdf for wiring schematic.
❏ 6” max distance with 1” spacing between LDR and LED with narrow beam LED as light bleeds between (1/4” tube to hold LDR and LED) placed in 1” whole of 1”x2” trim
❏ Dark background around LED helps remove ambient light
❏ <0.8 Volts with not light; >2.0 Volts with light
❏ 15 LED/LDR pairs (12 Notes for full Octave, 1 Octave Up, 1 Octave Down, 1 Menu)
❏ LED common ground resistor can tune LED brightness and current draw
❏ Do not enable pullup/pulldown on GPIO
❏ LDR >50k Ohm w/o light, <10k Ohm w/ light
❏ 5V of Raspberry Pi has more current/power to drive brighter LEDs
❏ Align LDR with Center of LED Light