Difference between revisions of "ECE597 Fall 2014 Project Bonekey Bonekey"

From eLinux.org
Jump to: navigation, search
(All together)
m (to Fall 2014)
 
(46 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:ECE597 |P1]]
+
[[Category:ECE497Fall2014]]
 
{{DISPLAYTITLE:ECE597 Project BonekeyBonekey}}
 
{{DISPLAYTITLE:ECE597 Project BonekeyBonekey}}
 
{{YoderHeadDeb}}
 
{{YoderHeadDeb}}
Line 10: Line 10:
  
 
<pre style="color:red">
 
<pre style="color:red">
00 Executive Summary
+
09 Executive Summary
00 Installation Instructions  
+
09 Installation Instructions  
00 User Instructions
+
08 User Instructions
00 Highlights
+
08 Highlights
00 Theory of Operation
+
10 Theory of Operation
00 Work Breakdown
+
09 Work Breakdown
00 Future Work
+
10 Future Work
00 Conclusions
+
09 Conclusions
00 Demo
+
10 Demo
00 Late
+
10 Not Late
Comments: I'm looking forward to seeing this.
+
Comments: Nice project.  Thanks for fixing up the wiki.
  
Score:  10/100
+
Score:  92/100
 
</pre>
 
</pre>
 
<span style="color:red">(Inline Comment)</span>
 
  
 
== Executive Summary ==
 
== Executive Summary ==
We got the idea from Makey Makey which is a invention-kit to use everything to be Keyboard. like banana, water, even cat. For this project, we created a Bonekey Bonekey to play with sound. Our Bonekey Bonekey uses banana as keyboard to play piano tones. This design is consisted of a main microcontroller, a PCB board, a USB sound card, and an audio player. We use Beaglebone to get the different input informations and produce corresponding tones to the audio player. One of human's wrist is mounted by reference ground and human can use either figure to touch bananas  to produce different tones. Our Bonekey Bonekey will not only use bananas as inputs but also apples, water and everything.
+
We got the idea from Makey Makey which is a invention-kit to use everything to be Keyboard. Like banana, water, even cat all can be keyboard. For this project, we created a Bonekey Bonekey to play with sound. Our Bonekey Bonekey uses banana as keyboard to play piano tones. This design is consisted of a main microcontroller, a PCB board, a USB sound card, and an audio player. We use Beaglebone to get the separate input informations and produce corresponding tones to the audio player. One of human's wrist is mounted by reference ground and human can use either figures to touch bananas  to produce different tones. Our Bonekey Bonekey will not only use bananas as inputs but also apples, water and everything.
 
 
== Packaging ==
 
If you have hardware, consider [http://cpprojects.blogspot.com/2013/07/small-build-big-execuition.html Small Build, Big Execuition] for ideas on the final packaging.
 
  
 
== Installation Instructions ==
 
== Installation Instructions ==
Line 46: Line 41:
  
 
SV3 - middle pin connect to power and the two side pin connect to ground.
 
SV3 - middle pin connect to power and the two side pin connect to ground.
 +
 +
==== BOM====
 +
{| class="wikitable"
 +
|-
 +
! Qty !! Value !!  Parts
 +
|-
 +
| 7 || 1M ||  R1, R2, R3, R4, R5, R6, R7
 +
|-
 +
| 7 || 2N2222 || T1, T2, T3, T4, T5, T6, T7
 +
|-
 +
| 7 || 4.7M ||  R8, R9, R10, R11, R12, R13, R14
 +
|}                     
  
 
==== USB Sound Card====
 
==== USB Sound Card====
  
Since the beagle bone don't have the audio output we need to add a USB sound card to the bone.
+
Since the beagle bone doesn't have an audio output we need to add a USB sound card to the bone.
  
 
We have tested two USB sound cards
 
We have tested two USB sound cards
Line 59: Line 66:
 
==== All together====
 
==== All together====
  
[[File:BonekeyBonekey-All-Together.JPG|640]]
+
[[File:BonekeyBonekey-All-Together.JPG|640px]]
  
 
=== Software ===
 
=== Software ===
 
+
==== Build CSound from source ====
 
Build Csound from source Beaglebone. The BonekeyBonekey need CSound6 but the apt-get version is still CSound5
 
Build Csound from source Beaglebone. The BonekeyBonekey need CSound6 but the apt-get version is still CSound5
  
Line 79: Line 86:
 
  bone$ '''cd cs6make'''
 
  bone$ '''cd cs6make'''
  
 +
==== Clone BonekeyBonekey Repository ====
 +
 +
  bone$ '''git clone https://github.com/MikuZZZ/BonekeyBonekey'''
 +
 +
==== Disable HDMI ====
 +
 +
Follow [http://elinux.org/EBC_Disabling_HDMI this link] to disable HDMI, and make some GPIO pins available.
  
 +
==== Make the USB sound card as the default output ====
  
MakeyMakey github link https://github.com/MikuZZZ/BonekeyBonekey.  
+
copy the asoundrc file from the [https://github.com/MikuZZZ/BonekeyBonekey Github] repository to your home folder.
  
 +
bone$ '''cd asoundrc ~/.asoundrc'''
  
 
== User Instructions ==
 
== User Instructions ==
  
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.
+
# Follow the installation instruction to make sure you got the hardware and software installed.
 +
# Connect SV1 on the PCB borad to beaglebone P8-7, 9, 11, 13, 15, 17.
 +
# Wire up seven bananas to the 7 inputs to SV2 of the PCB board.
 +
# Connect the USB sound adapter to the beaglebone, and also connect a headphone or speaker.
 +
# Run the Bonkey program.
 +
 
 +
  bone$ '''python BonkeyBonkey.py'''
  
When everything is installed, we can play with Makey,
+
Then you can play the bananas.
Firstly connect the USB sound and the audio player to beaglebone.
 
Then connect the 7 input wires into 7 bananas,  and wire the reference ground to one of your wrist.  
 
Use your hand to touch bananas to play sound!
 
  
 
== Highlights ==
 
== Highlights ==
  
Here is where you brag about what your project can do.
+
Bonekey Bonekey is project that can turn almost every conductors into a music keyboard, such as fruits, water or people.
 +
 
 +
The idea come from [https://www.kickstarter.com/projects/joylabs/makey-makey-an-invention-kit-for-everyone MakeyMakey] by Jay Silver in Santa Cruz, CA
 +
 
 +
[[File:PlayBananas.png|thumbnail|none|Playing Bonekey Bonekey]]
 +
 
 +
Please watch our video and have fun.
  
 
https://www.youtube.com/watch?v=SFFVrcGGZdw
 
https://www.youtube.com/watch?v=SFFVrcGGZdw
  
 
== Theory of Operation ==
 
== Theory of Operation ==
 +
<pre style="color:red">
 +
Wow, that's much clearer.  Thanks...
 +
</pre>
 +
===Hardware===
 +
====Input====
 +
* First we disabled the internal pull-up resister of the GPIO, because we need a very large pull-up resistor.
 +
* All the GPIO pins we used have a 4.7MOhm pull up resistor, and connected to a banana.
 +
* The resister of human skin is about 10K-100KOhm, so when we touch the bananas, the GPIO pins are grounded.
  
1- Input
+
====Voltage level====
 +
* The GPIO pins on the beaglebone detect the voltage higher than 2.6V as high, but when we use a 4.7MOhm resistor, the voltage level can not reach 2.6V.
 +
* We use a 2N2222 general purpose transistor as a switch to make the voltage level reach 2.6V.
 +
[[File: BonkeySimGND.png |500px|thumb| Simulation result when grounded]]
 +
[[File: BonkeySimPullUp.png |500px|thumb| Simulation result when pulled up]]
  
* The bananas are the inputs of Bonekey Bonekey
+
===Software===
* By touching the banana, the input will be shorted to ground.
+
====Python====
 +
The flow chart of the python program.
  
2 - Transistor Switch
+
[[File: BonkeyPythonFlowChart.jpg | Python program flow chart]]
* We uses transistor 2N2222, 4.7M and 1M resistor.
+
====Csound====
[[File:- schematic-.png]]
+
* Csound has an internal function to generate piano like sounds
* The base of transistor is connected to bananas, and once transistor's base grounded, the emitter of transistor will drop down to 0V.
+
* We just need to set up a Csound instrument and send a frequency message to it.
3 - GPIO Interrupt
 
  
4- Csound
+
Piano instrument definition. Documentation for [http://csounds.com/manual/html/prepiano.html prepiano]
 +
instr 1
 +
aa,ab prepiano p7, 3, 10, p4, 3, 0.002, 2, 2, 1, 5000, -0.01, p5, p6, 0, 0.1, 1, 2
 +
outs aa*.2, ab*.2
 +
endin
  
 +
Initialize score.
 +
f1 0 8 2 1 0.6 10 100 0.001
 +
f2 0 8 2 1 0.7 50 500 1000
  
Give a high level overview of the structure of your softwareAre you using GStreamer?  Show a diagram of the pipeline. Are you running multiple tasks?  Show what they do and how they interact.
+
Then the python program will send a note to csound dynamically when the GPIO interrupt is activated.
 +
  perfThread.InputMessage("i1 0.0 0.5 1 0.9 200 " + freq[0])
  
 
== Work Breakdown ==
 
== Work Breakdown ==
 +
'''PCB design'''
 +
 +
We did PCB design together. We tried to use several values of the pull-up resistor, however there was not low enough voltage value for GPIO reading as 0. Finally we decided to use transistor as a switch to pull down the voltage once the base of transistor connect to ground.
 +
 +
'''GPIO Read Input'''
 +
 +
Jiayu did the GPIO read input part in python. The GPIO will read high voltage as 1, and low voltage as 0. And also using javascript to disable internal pull-up and pull-down resistor.
 +
 +
'''Csound Play Sound'''
  
* PCB
+
Zizhao did the Csound play part. In python, the .sco and .orc Csound files are created, Csound options are set, and the tones are played by Csound.
* GPIO read in
 
* Csound play sound
 
  
List the major tasks in your project and who did what.
+
'''Hardware Parts'''
  
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.
+
Zizhao bought the resistors and transistors, Jiayu bought the bananas.
  
 
== Future Work ==
 
== Future Work ==
  
Suggest addition things that could be done with this project.
+
* Use serial port for input so that we can add more input keys and make a real midi device
 +
* Optimize CPU usage in csound so the BeagleBone can generate more notes at the same time
 +
* Add some more instrument tones, and use a push button to select them
  
 
== Conclusions ==
 
== Conclusions ==
  
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.
+
In this project, we designed a banana midi piano, which is consist of a BeagleBone, a PCB, USB sound card and a audio player. So far we can only play very easy songs with these seven piano notes. In the future, we may add more features, like add more inputs or add different tones to play more songs. As well we may optimize CPU usage to play more notes simultaneously and Coherently.  
  
 
{{YoderFoot}}
 
{{YoderFoot}}

Latest revision as of 04:13, 10 August 2015


thumb‎ Embedded Linux Class by Mark A. Yoder

Openlogo-50.png


Team members: Jiayu Guo, Zizhao Wang

Grading Template

I'm using the following template to grade. Each slot is 10 points. 0 = Missing, 5=OK, 10=Wow!

09 Executive Summary
09 Installation Instructions 
08 User Instructions
08 Highlights
10 Theory of Operation
09 Work Breakdown
10 Future Work
09 Conclusions
10 Demo
10 Not Late
Comments: Nice project.  Thanks for fixing up the wiki.

Score:  92/100

Executive Summary

We got the idea from Makey Makey which is a invention-kit to use everything to be Keyboard. Like banana, water, even cat all can be keyboard. For this project, we created a Bonekey Bonekey to play with sound. Our Bonekey Bonekey uses banana as keyboard to play piano tones. This design is consisted of a main microcontroller, a PCB board, a USB sound card, and an audio player. We use Beaglebone to get the separate input informations and produce corresponding tones to the audio player. One of human's wrist is mounted by reference ground and human can use either figures to touch bananas to produce different tones. Our Bonekey Bonekey will not only use bananas as inputs but also apples, water and everything.

Installation Instructions

Hardware

PCB

Bonkey.png

The board and the schematic files can be found in the Github repository.

SV1 - Connect to the beagle bone from P8_7 to P8_17.

SV2 - Connect to bananas.

SV3 - middle pin connect to power and the two side pin connect to ground.

BOM

Qty Value Parts
7 1M R1, R2, R3, R4, R5, R6, R7
7 2N2222 T1, T2, T3, T4, T5, T6, T7
7 4.7M R8, R9, R10, R11, R12, R13, R14

USB Sound Card

Since the beagle bone doesn't have an audio output we need to add a USB sound card to the bone.

We have tested two USB sound cards

USB 2.0 EXTERNAL 2.1 SURROUND SOUND ADAPTER

CREATIVE SOUND BLASTER X-FI GO! PRO

All together

BonekeyBonekey-All-Together.JPG

Software

Build CSound from source

Build Csound from source Beaglebone. The BonekeyBonekey need CSound6 but the apt-get version is still CSound5

bone$ sudo apt-get build-dep csound
bone$ sudo apt-get install cmake git
bone$ cd ~
bone$ mkdir csound
bone$ cd csound
bone$ git clone https://github.com/csound/csound.git csound
bone$ mkdir cs6make
bone$ cd cs6make
bone$ cmake ../csound
bone$ make -j2
bone$ sudo make install
bone$ sudo ldconfig
bone$ cd cs6make

Clone BonekeyBonekey Repository

 bone$ git clone https://github.com/MikuZZZ/BonekeyBonekey

Disable HDMI

Follow this link to disable HDMI, and make some GPIO pins available.

Make the USB sound card as the default output

copy the asoundrc file from the Github repository to your home folder.

bone$ cd asoundrc ~/.asoundrc

User Instructions

  1. Follow the installation instruction to make sure you got the hardware and software installed.
  2. Connect SV1 on the PCB borad to beaglebone P8-7, 9, 11, 13, 15, 17.
  3. Wire up seven bananas to the 7 inputs to SV2 of the PCB board.
  4. Connect the USB sound adapter to the beaglebone, and also connect a headphone or speaker.
  5. Run the Bonkey program.
bone$ python BonkeyBonkey.py

Then you can play the bananas.

Highlights

Bonekey Bonekey is project that can turn almost every conductors into a music keyboard, such as fruits, water or people.

The idea come from MakeyMakey by Jay Silver in Santa Cruz, CA

Playing Bonekey Bonekey

Please watch our video and have fun.

https://www.youtube.com/watch?v=SFFVrcGGZdw

Theory of Operation

Wow, that's much clearer.  Thanks...

Hardware

Input

  • First we disabled the internal pull-up resister of the GPIO, because we need a very large pull-up resistor.
  • All the GPIO pins we used have a 4.7MOhm pull up resistor, and connected to a banana.
  • The resister of human skin is about 10K-100KOhm, so when we touch the bananas, the GPIO pins are grounded.

Voltage level

  • The GPIO pins on the beaglebone detect the voltage higher than 2.6V as high, but when we use a 4.7MOhm resistor, the voltage level can not reach 2.6V.
  • We use a 2N2222 general purpose transistor as a switch to make the voltage level reach 2.6V.
Simulation result when grounded
Simulation result when pulled up

Software

Python

The flow chart of the python program.

Python program flow chart

Csound

  • Csound has an internal function to generate piano like sounds
  • We just need to set up a Csound instrument and send a frequency message to it.

Piano instrument definition. Documentation for prepiano

instr 1
aa,ab prepiano p7, 3, 10, p4, 3, 0.002, 2, 2, 1, 5000, -0.01, p5, p6, 0, 0.1, 1, 2
outs aa*.2, ab*.2
endin

Initialize score.

f1 0 8 2 1 0.6 10 100 0.001
f2 0 8 2 1 0.7 50 500 1000

Then the python program will send a note to csound dynamically when the GPIO interrupt is activated.

perfThread.InputMessage("i1 0.0 0.5 1 0.9 200 " + freq[0])

Work Breakdown

PCB design

We did PCB design together. We tried to use several values of the pull-up resistor, however there was not low enough voltage value for GPIO reading as 0. Finally we decided to use transistor as a switch to pull down the voltage once the base of transistor connect to ground.

GPIO Read Input

Jiayu did the GPIO read input part in python. The GPIO will read high voltage as 1, and low voltage as 0. And also using javascript to disable internal pull-up and pull-down resistor.

Csound Play Sound

Zizhao did the Csound play part. In python, the .sco and .orc Csound files are created, Csound options are set, and the tones are played by Csound.

Hardware Parts

Zizhao bought the resistors and transistors, Jiayu bought the bananas.

Future Work

  • Use serial port for input so that we can add more input keys and make a real midi device
  • Optimize CPU usage in csound so the BeagleBone can generate more notes at the same time
  • Add some more instrument tones, and use a push button to select them

Conclusions

In this project, we designed a banana midi piano, which is consist of a BeagleBone, a PCB, USB sound card and a audio player. So far we can only play very easy songs with these seven piano notes. In the future, we may add more features, like add more inputs or add different tones to play more songs. As well we may optimize CPU usage to play more notes simultaneously and Coherently.




thumb‎ Embedded Linux Class by Mark A. Yoder