In this lab, you familiarizie yourself with a simple portable computing device, with input and output that can be operated while walking, jogging, or waiting in line at the registrar's office.
You will choose some aspect of this device, such as designing, building, testing, programming, or otherwise involving a simple portable computing device, with input and output that can be operated while walking, jogging, or waiting in line at the registrar's office.
The device is a portable music player, that allows the user to play and compose music while standing or walking.
The concepts learned in this lab can, of course, be extended to visual body-borne computing, as well as audio, and computing with audio feedback (e.g. typing without looking at the screen).
For simplicity, the musikeyer device has a keyer (See a list of keyers) that has only 12 keys. The keys can be pressed individually to play single notes, or they can be pressed in combination to play chords. The single notes comprise the A natural (minor) scale from A to A (songs like "Summertime", "The Ants Go Marching", and Tarantella Dance), followed by sufficient notes to play a C major scale from C to C (songs like Baa baa black sheep), a D dorian scale mostly from D to D (songs like "What Shall We do With the Drunken Sailer", and "Scarborough Fair"), and an E phrygian scale from E to E (flamenco music, and the like is often played in phrygian mode).
A team-oriented approach will allow those who are better at physical building to collaborate with those who are better at programming, etc..
For the first lab groups will simply arrange 12 switches, and supply 12 wires, with a banana plug on each one, as well as a common wire (common to all the switches), for a total of 13 banana plugs. The rest is taken care of by a "bluebox" that has 12 or more analog inputs. For the first lab, the bluebox will be provided by the instructor, and you will simply plug your keyer into the bluebox.
For typing the first 12 letters of the alphabet, the individual notes correspond to these letters. For letters that are further in the alphabet, chords can be mapped to those letters. For now, we will consider only the music player, and then later, it can be expanded to type the full set of ASCII text characters and more.
Your music player should use 12 switches arranged as follows:
A E b B F c C G d D a einto a hand grip (shown facing away from the user). This layout corresponds to the Handykey Twiddler, so you can look at the Handykey product to see how you should make the hand grip, and some form of strap to hold it to the hand.
You will be graded on your engineering (mechanical and ergonomic layout), but for the first lab, there is no programming required.
You may recognize the "A,E,B" tuning of the musikeyer as something similar to a discrete violin tuning (i.e. that you move a perfect fifth up in pitch as you move across to the next row), rather than like that of a guitar (where you would move a perfect fourth from all but the G-B of the EADGBE strings). Other instruments with the same tuning as the musikeyer (i.e. tuned apart in perfect fifths) include the banjolin (banjo-violin), the mandolin, the fiddle, and viola.
When used with a standard bluebox, the 12 keys of the musikeyer will correspond to the white keys of a piano or organ, e.g. the frequency, in Hertz, when each one is pressed should be as follows:
The first octave will be the natural scale (also known as the natural minor scale), from A to a, i.e. from 220 Hertz to 440 Hertz:
(I computed 220*2..^((0:12)/12) and took out the semitones)A = 220.00 x = 233.08 B = 246.94 C = 261.63 x = 277.18 D = 293.66 x = 311.13 E = 329.63 F = 349.23 x = 369.99 G = 392.00 x = 415.30 a = 440.00Unused frequencies are denoted by "x".These 8 notes can be used to play many songs that are on a natural scale (also known as natural minor scale, or "aolean mode").
Letters may also be associated with numbers, i.e. A=1, B=2... H=8, etc..
I Don't Play Loud Music After Lectures
Some songs are also in a major key (ionian mode), while others are often in a dorian or phrygian mode. Thus the musikeyer has, in addition to the natural scale from A to A/H, the four extra notes B, C, D, and E, to obtain a total of 12 frequencies, in Hertz, as follows:A = 220.00 B = 246.94 C = 261.63 D = 293.66 E = 329.63 F = 349.23 G = 392.00 a = 440.00 b = 493.88 c = 523.25 d = 587.33 e = 659.26Additionally, this expanded range can be used to play many songs that use more than the one octave range (e.g. "House of the rising sun" which is bounded by the range from A to d (traditional version) or A to e (version by Eric Burdon, The Animals).These are the "white" notes from the following list:
octave:7> 220*2..^((-1:19)/12)' 207.65 220.00 233.08 246.94 261.63 277.18 293.66 311.13 329.63 349.23 369.99 392.00 415.30 440.00 466.16 493.88 523.25 554.37 587.33 622.25 659.26I Do Play Loud Music After Lectures
Now these 12 switches can be connected to a standard bluebox. You can make your own bluebox, or use one in the lab. If you would like to make your own bluebox, consider, for example, using a PC, in particular, using the parallel port of a PC. Alternatively you may wish to use one or more Atmel STK 500 AVR development boards (much smaller than a PC --- it can even fit into a shirt pocket), or an even smaller home-built circuit board with one or more AVRs on it. For example, the Atmega 48 AVR has six analog inputs, so using two Atmega 48 AVRs allows a circuit to be built that will fit right inside the hand grip, and will accept continuous analog voltage input (pressure-sensitive keys that play the notes louder when you squeeze them harder, or that type, for example, capital letters when you press a letter key harder, etc.).If you wanted to make your own bluebox (not required for lab 1), you could make the audio output be generated by turning on and off one of the outputs of the AVR at the correct number of times per second, while a key is pressed.
If you want to have some fun with this on the AVR, be sure to program the PC (parallel port) or AVR using the GNU Linux tools, and not AVR studio (i.e. don't use any of the ms-win-based utilities).
If you're using a PC parallel port, use the pins 2-9 (data pins) for the first octave. If you're using the AVR/STK500, use PORTA for the first octave:
A, B, C, D, E, F, G, a,starting from lowest to highest.For the PC implementation, use four of the status lines for the remaining 4 notes. If using the AVR/STK500, use the least significant nibble of PORTD for:
b, c, d, eIf you are using a PC, use the PC's sound production capability for the audio output. You may either using an existing music synthesis program in GNU Linux or write your own simple sound-generation program(s). If you're using the AVR, use the most significant nibble of the PORT D for audio output; 2 choices:
Note that you can use part of a port for input and part for output by appropriate setting of the Data Direction Register (DDR).
Pin connections for the STK 500 AVR might, for example, be as follows:
A0=A A1=B A2=C A3=D A4=E A5=F A6=G A7=a D0=b D1=c D2=d D3=e D4 D5 D6 D7=output
The choice of porta and portd is because they are right beside one another so you can split a 16 conductor ribbon cable into a siamese connection if you like.
Ideally you should use color coded wires for the switches, using the color scheme as follows:
Brown =1=A Red =2=B Orange =3=C Yellow =4=D Green =5=E Blue =6=F Violet =7=G Grey =8=A/H White =9=B/I Black =0=C/J Tan =1/11=D/K Pink=2/12=E/L
This is a standard color code that I and many other electrical engineers use (just like the resistor color codes) for cable, wiring, colors.
The best approach for wiring is to get four to six feet of flexible multicolor ribbon cable (which they have at Supremetronics) which starts at brown, and periodically cycles through the 10 colors (just use a second brown and a second red in the cycles). If you peel off the first 12 conductors that will work well, and you'll know which brown and which red are which because they are in order in the cable.
I usually use banana connectors (male for the switches and female for the computer), so you can re-arrange the connections, etc..
(note the color-coded banana plugs, plugged into the waterproof enclosure for the computer; this model features analog to digital converters with voltage supply to each of 12 input sensors; last 2 wires are striped brown and striped red, with the stripes on a white background wire color.)
In my original design (back when 12 volts rather than 5 volts was the norm) I had it so connection of +12 to any of the note wires would sound that note at maximum volume. If you stay with that convention it will work with my old equipment to test (for testing purposes). It may be easier, however, to use +5 volts for the PC parallel port implementation for the AVR, but the same wiring (that way you can test your AVR rig with my keyer, or someone else's).
If you are making your own bluebox (not necessary at this point), be sure not to overload the PC or AVR output, e.g. use an approriate series resistor, or voltage divider into an audio amplifier.
Your portable music player will properly play chords, when you press multiple keys at the same time. For example, if the A, C, and E are pressed together, your music player will play an A minor chord.
Bonus marks for implementing bluebox, thumb keys for sharps, flats, ADSR change, portamento, etc..
Next write a device driver to receive input from the keyer and type text at a login prompt. You should be able to login, and type commands using your keyer.
Hint: pick a simple login username like "CCGGAAG" that's easy to remember, type, and sounds familiar!