7016b2a1a1c97471995eb1772c983573f8b985cb
[miniband.git] / README.md
1 # Code Club - Mini Band Project
2
3 Make your own mini band!
4 You and your friends can form your own finger-sized band and rock out using Raspberry Pi and Arduino.
5 Learn how to build circuits with sensors and outputs and write a simple programme to control your instruments.
6
7 ## You will make:
8
9 * A guitar
10 * A set of drums
11 * A pair of maracas
12
13 ## You will need:
14
15 * 1 x Raspberry Pi (plus monitor and power supply)
16 * USB hub
17 * 2 x Arduino Uno boards (with USB cables)
18 * 1 x strip potentiometer
19 * 2 x tilt sensors
20 * 4 x piezo buzzers (the type in greetings cards, easy to get from Maplin)
21 * 10K resistors
22 * Bread boards (1 per instrument)
23 * Card
24 * Sugru (or some other modelling material)
25 * Electrical tape
26 * Plastic drinking straw
27 * Pencil
28 * Coloured pens (optional)
29
30
31 ## Software requirements:
32
33 * Scratch
34 * IDE developer environment for Arduino
35 * Py Serial library
36
37
38 ## Useful links:
39
40 * [Pictures](http://bit.ly/codeclubminiband)
41 * [Ardunio code](https://github.com/KatJoyWhite/miniband/tree/master/arduino)
42
43
44
45 ## Pull-down Resistors
46
47 You’ll find your analogue inputs receive signal when you don’t expect them to.
48 This is because there’s electricty floating around in the system, or something like that.
49
50 To fix this, you need to wire each input to ground, through a 10KΩ resistor.
51
52 A better explanation can be found [here](http://arduino.cc/en/Tutorial/DigitalPins).
53
54
55
56 ## Drum Kit
57
58 <img src="http://farm9.staticflickr.com/8074/8257699966_7585ca06e7.jpg" width="375" height="500" alt="Code Club Miniband"><
59
60 ### 1. Make your drums
61
62 Take your 4 piezo buzzers and attach a ring of Sugru (or other modelling material) as shown in the picture.
63 This will increase the flexibility and resonance of the sensors. Let the sugru set.
64
65 <img src="http://farm9.staticflickr.com/8353/8256628815_6c3872d3ac.jpg" width="500" height="375" alt="Code Club Miniband">
66
67
68 ### 2. Connect the circuit
69
70 Piezo buzzers generate a small charges when you tap them, so they don’t need a power source.
71 Connect one lead from your buzzer to one of your analogue inputs, and connect the other lead to ground.
72 Repeat for each of your drums. It is easiest to use a bread board for making your circuit.
73 Look at the picture for an example.
74
75 <img src="http://farm9.staticflickr.com/8081/8256628955_f65a76b6fb.jpg" width="500" height="375" alt="Code Club Miniband">
76
77 ### 3. Program the Arduino
78
79 Find the appropriate code from the respository and upload to your Ardunio board.
80
81
82 ### 4. Set up in Scratch
83
84 Find four different drum sounds (or whatever sounds you'd like your drums to make!). Upload the sounds to Scratch.
85
86
87 ## Guitar
88
89 <img src="http://farm9.staticflickr.com/8070/8257698984_8471e4cf57.jpg" width="500" height="375" alt="Code Club Miniband">
90
91 ### 1. Make your guitar
92
93 Grab your strip potentiomater, a piece of thin card, and a pencil.
94 Lightly draw round your potentiometer on the card and then use this as a guide to draw out your guitar shape.
95 (The potentiomater will be the fret board of your guitar).
96 Cut out and colour in the guitar and stick down the potentiomater.
97 Tape a pencil or stick to the back of the guitar to make it stiffen the fret board.
98
99 ### 2. Connect the circuit
100
101 The potentiomater strip adjusts resistance, so you will need to feed it some electricity.
102 Run +5V into one of the strip’s outer pins, and ground into the other outer pin.
103 It doesn’t matter which way around you connect these, but it will affect which the direction
104 the fretboard runs (high and the top, low at the bottom or vice-versa).
105
106 Signal will come from the centre pin, so connect that to one of your analogue inputs and you should be good to go.
107
108 <img src="http://farm9.staticflickr.com/8363/8257699194_a2645e0e06.jpg" width="500" height="375" alt="Code Club Miniband">
109
110 ### 3. Program the Arduino
111
112 Find the appropriate code from the respository and upload to your Ardunio board.
113
114
115 ### 4. Set up in Scratch
116
117 Find five different guitar sounds and upload to Scratch.
118
119
120 ## Maracas
121
122 <img src="http://farm9.staticflickr.com/8346/8257698652_4a99ee24b4.jpg" width="500" height="375" alt="Code Club Miniband">
123
124 ### 1. Make your maracas
125
126 Cut 2 short lengths of drinking straw for your maraca handles.
127 Using Sugru (or other modelling material), make 2 maraca heads by rolling it up into balls.
128 Push the maraca heads onto the straws and mold into a maraca shape.
129 Connect lengths of wire to the connectors of the 2 tilt sensors and then push each sensor into a straw until it presses into the Sugru.
130 Leave the Sugru to set.
131
132 <img src="http://farm9.staticflickr.com/8222/8256627511_118192e52f.jpg" width="500" height="375" alt="Code Club Miniband">
133
134 ### 2. Connect the circuit
135
136 Connect the +5V port on the Arduino board to one of the pins on the tilt switch (it doesn't matter which way round).
137 Connect the other pin to an empty digital input on the board.
138
139 <img src="http://farm9.staticflickr.com/8348/8257698572_4157db0b20.jpg" width="500" height="375" alt="Code Club Miniband">
140
141 ### 3. Program the Arduino
142
143 Find the appropriate code from the respository and upload to your Ardunio board.
144
145
146 ### 4. Set up in Scratch
147
148 Find a maraca / shaker sound and upload to Scratch.
149
150
151 ## Connecting to the Raspberry Pi
152
153 Set up your Raspberry Pi with a power supply and monitor.
154 Connect all your Ardunio boards (it's easiest to have one per instrument!) to the Raspberry Pi using USB.
155 You will probably need a USB hub.
156
157
158 ## Python glueware
159
160 Download the music-maker-hander.py file from the repository. Run it with
161 python music-maker-handler.py
162 This program sets up a listener for each instrument. When it detects that an instrument has been played, it sends a couple of signals to Scratch.
163 The first signal appears in Scratch as a sensor value and is the volume (for drums), pitch (for the guitar), or ignored (for the maracas).
164 The second signal is a broadcast message that makes Scratch play the sound in the instrument.
165
166
167 ## Scratch front end
168
169 The Scratch file, music-maker, makes the sounds. It responds to the signals from the Python handler above by playing the appropriate sounds. It also does some visual feedback for the insturments.
170