Skip to content

vintlabs/BananaPiano

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BananaPiano

Use an ESP32 and some bananas to make a piano!

What you will need:

Steps:

  1. Gather materials Required Materials

  2. Make the connections:

  • IO4 connects to Banana0
  • IO2 connects to Banana1
  • IO27 connects to Banana2
  • IO32 connects to Banana3

Connections Banana Connection

  1. Load the sketch into the Arduino IDE, set debug = true to test and get values so that you can calibrate the touch sensitivity: Set Debug

  2. Be sure to set the board type - I use "DOIT ESP32 DEVKIT V1" for mine. Also check the port and baudrate. Setup IDE

  3. Run the sketch with debug = true, touch each banana in series to see the values for touched/untouched. Here is my example today:

VintLabs Banana Piano!
>> 26 35 40 26
>> 32 35 40 25
>> 31 35 40 25
>> 30 35 40 26
>> 10 33 41 26
0
>> 10 33 41 26
>> 31 23 41 27
>> 32 34 41 27
>> 32 34 41 27
>> 31 1 41 27
1
>> 31 12 41 27
>> 31 12 41 27
>> 33 35 40 27
>> 33 35 13 26
2
>> 33 35 13 26
>> 33 35 13 26
>> 33 35 37 27
>> 33 36 40 26
>> 33 36 40 7
3
>> 34 36 40 7
>> 34 36 40 7
>> 34 36 41 26
>> 34 36 41 27
>> 34 36 42 27
>> 34 36 42 27
>> 34 36 42 27

After it started I touched each banana one at a time for about a second each and I can see that the "untouch" values are at least 25 for each, and the "touched" values are 13 or less. We want to leave a bit of tolerance, so I'll set touchHigh and touchLow as follows:

int touchHigh = 22;
int touchLow = 17;

bool debug = false;     // Set to true to output touch values to console - must be false for your big performance!

Note that I also set debug to false.

  1. Test on the serial console:
VintLabs Banana Piano!
2
0
2
0
0
0
1
2
3
3
3
2
0

You should see a number on the console that corresponds to the banana that you touched. (Expect that there will be some anomalies... this is just a simple example!)

  1. Test with the python script to hear your wonderful banana music! (be sure to close the serial console in the Arduino IDE first)
pvint@nautilus ~/Arduino/BananaPiano [1]$ python play.py 
3
Playing WAVE './wav-piano-sound/wav/f1.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo



0
Playing WAVE './wav-piano-sound/wav/c1.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo



2
Playing WAVE './wav-piano-sound/wav/e1.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo



0
Playing WAVE './wav-piano-sound/wav/c1.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

If all went well, you should hear piano notes C, D, E and F for bananas 0 through 3!

About

Use an ESP32 and some bananas to make a piano!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published