Deprecated: Assigning the return value of new by reference is deprecated in /home/nicholas/public_html/ggnew/components/libraries/cmslib/spframework.php on line 101

Deprecated: Assigning the return value of new by reference is deprecated in /home/nicholas/public_html/ggnew/components/libraries/cmslib/spframework.php on line 644
Electric Flute
Electric Flute
All News -> Projects
Written by Jeff Ledger   
Tuesday, 15 November 2011 15:08

Convert a child's toy to a digitial instrument with breath/blow sensor.


Ok, first.. Yes, this isn't really a "flute", It's actually a "recorder", but this project will allow it to make sounds like a flute, recorder, or even weird space noises. Kids love this project!

We'll turn a $1.00 recorder into an electric instrument complete with breath "blow" sensor!

A Propeller Platform running some synthesizer code provides the sound for this fun instrument.

You'll have a choice of converting the instrument to become fully electronic, or adding synth features to the existing instrument.


Here's what you'll need

  • A Propeller Platform (Gadget Gangster)
  • A Protoplus Module (Gadget Gangster)
  • Five 10K resistors (Radio Shack)
  • Four Tact switches (Radio Shack)
  • A Piezo Transducer (Radio Shack)
  • Some wire (Radio Shack)
  • A toy recorder (Local Discount Store)
  • A soldering iron & hot glue gun


We are going to create two different circuits for our instrument.


The switch circuit for our four tact "finger" switches, and a piezo circuit for our breath "blow" sensor.


The Connecting Cable:


You'll need to obtain some wire for seven connection points between the instrument and the Propeller Platform.

In my version of the project, I used some twisted pair network cable with the ends cut off.

* Note: if you use twisted pair cable as I have, you will want to reduce the resistors on the tact switches from 10k to 1.2k as the cable will have some internal resistance of it's own.


A Child's Recorder:


Start by obtaining an inexpensive child's recorder from your local dollar discount store.

I found this one for $1.00 at the local Dollar General


Recorder+ or Fully Electronic Instrument:


It's Decision Time!

At this point, you've got a choice...

1) Recorder+ You could attach the tact switches between the finger holes of the recorder. Doing this will allow the recorder to work as it was designed with the switches being available for electric sounds and effects.

2) Fully Electric Instrument In our design, I filled each of the finger holes down the front of the recorder with hot glue, then attached the tact switches over four of the original holes.


Adding the breath "blow" switch:


Using hot glue, attach the Piezo Transducer to the end of your instrument.  This will act as the breath or "blow" switch giving you an additional trigger.


Preparing the switches:


Using some solder, tin the switch connections ahead of time to make it easier to attach the wire.

Pay special attention to use connections which are "diagonal" from each other.  Using the top pin on one side, then the bottom pin of the other side of each switch.  Connections "straight" across with short out.


The power side of the switches:


Carefully solder one of the wires connecting to each of the pins on one side of the switches.   This line with be the 3v power side of each of the tact switches.  Be careful to connect to only the pin you prepared ahead of time.

If you are using twisted-pair cable, use ORANGE for this step.


Connecting the switch wires:


Using four other wires, solder each line to other side of each of the tact switches.

The code code I used was:

  • Switch 1 - BLUE
  • Switch 2 - BLUE/WHITE
  • Switch 3 - GREEN
  • Switch 4 - GREEN/WHITE


Connecting the Piezo Transducer:


Connect the black and red wires of the Peizo Transducer. I used some black tape to hold everything in place.

  • Piezoelectric Positive (red) - BROWN/WHITE
  • Piezoelectric Negative (black) - BROWN


The "pull down" resistors:


Each switch uses a resistor tied to ground as a "pull down". These resistors keep the switches from floating states.

Starting at P1, Insert and solder the 10k resistors into the Protoplus Module as shown.

Skip P0, P2, P4, P6, and P8 leaving plenty of room for each resistor.

(Reminder: If you used twisted pair, you may want to substitute P1,P3,P5 & P7 with 1.2k resistors)


Adding the ground wire:


Add a wire from the one side of the resistors to GND.


Connecting the switches to the ProtoPlus:


Strip and tin the other side of your cable.  Insert the other side of the switch connections into the ProtoPlus as shown.

  • P1 - BLUE
  • P3 - GREEN


Connecting the Piezoelectric to the ProtoPlus:


Now connect the two wires coming from the Piezo Transducer as shown below.


Also, connect the ORANGE wire to V33 (3.3v)


Build the rest of the ProtoPlus Module:



It's time to build the rest of the ProtoPlus Module.

Dig out the pins, resistors, caps, and RCA connectors and follow the instructions here to assemble the Audio/Video output of the module.

While you don't really have to build the video portion of the circuit for this project, we think it's a good idea as the "Electronic Flute" could easily become "Electronic Flute Hero" with a little video game coding.


Installing the Test Software:


Time to install some software!

Let's start with a little test program to see if all the switches and breath "blow" sensor are working correctly.

1) Download and Install Propeller Tool from

2) Download and unzip the test program as shown below.

Open "Electric Flute Test.spin" and use F11 to send it to your Propeller Platform.

Open Parallax Serial Terminal (installed with Propeller Tool) and select the COM port, and click Enable.  Switch presses and blows should be displayed on the screen.   This simple program allows you to easily debug your circuit, just in case something isn't connected quite right.


Playing the Electric Flute:


Once you are seeing good results from the test program, download the "Electric Flute" program and extract it.

Open "Electric Flute.spin" and send it to your Propeller Platform with F11.

Grab your instrument and start playing!

This version of the software plays notes C E G A when the buttons are pressed, and notes D F B C when the buttons are pressed and the instrument is blown.


Advanced Changes:



The audio magic behind "Electric Flute" is a synthesizer program running on the Propeller Platform called, SIDCOG.

The Commodore 64 computer had an amazing sound chip called the SID chip.  SIDCOG is a software emulation of the same chip.  By experimenting with the program settings, the SIDCOG software used in "Electric Flute", can be programmed to sound like anything from a piano, flute, violin, drums, or even crazy space sounds.

Here's how to change the sound settings:

The Octave of the instrument can be adjusted on line 25 of "Electric Flute.spin".  Simply change the 11 to another number between 1 and 15.

The other settings can be changed in the file "SIDSynth.spin", starting at line 25.

attack := 5
delay  := 5
sustain := 3
release :=1
volume : =5
cutoff := 200
PWN := 2048

Try these:

attack := 6
delay  := 0
sustain := 8
release :=0
volume : =5
cutoff := 200
PWN := 2048

attack := 10
delay  := 8
sustain := 10
release :=9
volume : =5
cutoff := 200
PWN := 2048

Each time you make a change, save the file, then jump over to "Electric Flute.spin" and re-upload to your Propeller Platform with F10.  Hint:  Play with the PWN and cutoff numbers for those crazy space sounds.

Have fun with this electric instrument!

Spin on!
Jeff Ledger





Other Stuff

Get Our RSS Feed

Cool Project