Multi Instrument Flute

by ZoeHorwitz in Circuits > Arduino

955 Views, 9 Favorites, 0 Comments

Multi Instrument Flute

Untitled_Artworkk.png
WhatsApp Image 2022-06-14 at 12.12.22 AM.jpeg
baabcf9fdf488dae78af80c6b293a301--pan-mythology-fairies-mythology.jpg

Hi i'm Zoe and i made this flute that lights up and plays music when you blow in it. I got inspired by Fauns, these magical creatures are very friendly and play music on their "pan flute". Fauns guide lost people. I wanted to make a flute that lights up the moment you blow in it ‎and plays a music tone.
It started with flute MP3's and then i started to add all other kinds off sounds, like guitars and a bells.

Why Did I Choose This Concept?

image00002.jpeg
Untitled_Artwork 2.png

Personally i like listening to music but i cant necessarily play it. So i thought it would be nice to make a flute that is controlled by blowing and plays music for you. you still have power over the order but you don't need the skills to play the right tones.

The lights in the flute show you in witch tube you blew. when you blow in a tube the color code of the others will change this way you can also make a little light show.

my ultimate goal was making a Simon says game with the flute, but my coding skills got in the way. So that is my next goal.

Electronical Components

th.jpg
image00003.jpeg
image00016.jpeg

- DF player

-Arduino Uno

-Speaker

-SD card

-4 WS2812B leds

- Wires

- Network Cable

Non Electronical Components

image00023.jpeg

- Big PVC tube

- Tape

- Isolating Tape

-Solder

-aluminum

Tools

image00001.jpeg
image00018.jpeg

- Solder machine

-Saw

-Scissors

-File

-Hot glue gun

How to Make It?

systematisch.png
image00023.jpeg
image00021.jpeg
image00022.jpeg

to make the flute you need to make a switch that functions the same way as a button does.

Take some aluminum and fold it 4 times and glue it shut. Cut a lollipop kind of shape. do the same but make it a strip. repeat this 4 times.

Cut the Tube in 4 pieces and make 1 slit on each side. One for the lolly pop shape and one for the strip. repeat this for every tube.

stick the lollipop shape in the higher slit and the strip in the lower one.

connect the strips to each other with wires and connect them to one of the cat cable wires., then connect the wire too the ground pin.

connect all the lollipop shaped aluminium all separately to a cat cable wire and put them in the pins of the Arduino.

Next solder the female end of the wires tot the cat cable ends, so that its easier to put them in the Arduino.

Solder 4 lights to each other, connect them to the cat cable wires, one for the pin number, one ground and one for voltage.

Drill a long tunnel horizontally through the tubes, and pull the leds through it.

Hot glue and tape the wires to the tubes so that they stay in place.

The Code

#include
#include 
#include 
#ifdef __AVR__
#endif
#define PIN 4 // pin nuber Led
#define NUMPIXELS 4 //how many leds used
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
static const uint8_t PIN_MP3_TX = 11;
static const uint8_t PIN_MP3_RX = 10;
SoftwareSerial softwareSerial(PIN_MP3_RX, PIN_MP3_TX);
DFRobotDFPlayerMini player;
const int BUTTON_PIN1 = 13;
const int BUTTON_PIN2 = 9;         //pin nuber lollipop shaped switch
const int BUTTON_PIN3 = 6;
const int BUTTON_PIN4 = 3;
int lastState1 = HIGH;
int lastState2 = HIGH;
int lastState3 = HIGH;
int lastState4 = HIGH;
int currentState1;
int currentState2;
int currentState3;
int currentState4;
int v1; //value 1
int v2; //value 2       
int v3; //value 3
int v4; //value 4
void setup() {
  Serial.begin(9600);
  randomSeed(analogRead(0));
  pixels.begin();
  pinMode(BUTTON_PIN1, INPUT_PULLUP);
  pinMode(BUTTON_PIN2, INPUT_PULLUP);
  pinMode(BUTTON_PIN3, INPUT_PULLUP);
  pinMode(BUTTON_PIN4, INPUT_PULLUP);
  Serial.begin(9600);
  softwareSerial.begin(9600);
  // Start communication with DFPlayer Mini
  if (player.begin(softwareSerial)) {
    Serial.println("OK");
    player.volume(30);
  } else {
    Serial.println("Connecting to DFPlayer Mini failed!");
  }
}
void loop() {
  // read the state of the switch/button:
  currentState1 = digitalRead(BUTTON_PIN1);
  currentState2 = digitalRead(BUTTON_PIN2);
  currentState3 = digitalRead(BUTTON_PIN3);
  currentState4 = digitalRead(BUTTON_PIN4);
  
 FluteSounds();           // plays the flute sounds function
 //GuitarSounds();             //uncomment these to play other kinds of music
// ClockenSpiel();
//  TrippySounds();
  lastState1 = currentState1;
  lastState2 = currentState2;
  lastState3 = currentState3;   // saves last states
  lastState4 = currentState4;
}
void FluteSounds() {
  if (lastState1 == LOW && currentState1 == HIGH) { //if there is  a connection made by blowing in the flute the music plays and the light will show
    player.playMp3Folder(1); //plays mp3 0001
    Tube3(); //turns on the light in tube 3
    v1 = random(0, 255); //generating random number between 0 to 255
  }
  if (lastState2 == LOW && currentState2 == HIGH) {
    player.playMp3Folder(2);
    Tube2();
    v2 = random(0, 255);
  }
  if (lastState3 == LOW && currentState3 == HIGH) {
    player.playMp3Folder(3);
    Tube1();
    v3 = random(0, 255);
  }
  if (lastState4 == LOW && currentState4 == HIGH) {
    player.playMp3Folder(4);
    Tube0();
    v4 = random(0, 225);
  }
}
void ClockenSpiel() {
  if (lastState1 == LOW && currentState1 == HIGH) {
    player.playMp3Folder(5);
    Tube3();
    v1 = random(0, 255); //generating random number between 0 to 255
  }
  if (lastState2 == LOW && currentState2 == HIGH) {
    player.playMp3Folder(6);
    Tube2();
    v2 = random(0, 255);
  }
  if (lastState3 == LOW && currentState3 == HIGH) {
    player.playMp3Folder(7);
    Tube1();
    v3 = random(0, 255);
  }
  if (lastState4 == LOW && currentState4 == HIGH) {
    player.playMp3Folder(8);
    Tube0();
    v4 = random(0, 225);
  }
}
void GuitarSounds() {
  if (lastState1 == LOW && currentState1 == HIGH) {
    player.playMp3Folder(9);
    Tube3();
    v1 = random(0, 255); //generating random number between 0 to 255
  }
  if (lastState2 == LOW && currentState2 == HIGH) {
    player.playMp3Folder(10);
    Tube2();
    v2 = random(0, 255);
  }
  if (lastState3 == LOW && currentState3 == HIGH) {
    player.playMp3Folder(11);
    Tube1();
    v3 = random(0, 255);
  }
  if (lastState4 == LOW && currentState4 == HIGH) {
    player.playMp3Folder(12);
    Tube0();
    v4 = random(0, 225);
  }
}
void TrippySounds() {
  if (lastState1 == LOW && currentState1 == HIGH) {
    player.playMp3Folder(13);
    Tube3();
    v1 = random(0, 255); //generating random number between 0 to 255
  }
  if (lastState2 == LOW && currentState2 == HIGH) {
    player.playMp3Folder(14);
    Tube2();
    v2 = random(0, 255);
  }
  if (lastState3 == LOW && currentState3 == HIGH) {
    player.playMp3Folder(15);
    Tube1();
    v3 = random(0, 255);
  }
  if (lastState4 == LOW && currentState4 == HIGH) {
    player.playMp3Folder(16);
    Tube0();
    v4 = random(0, 225);
  }
}
void Tube0() { // green light
  pixels.setPixelColor(0, pixels.Color(v1, v2, v3));
  pixels.setPixelColor(1, pixels.Color(0, 0, 0));
  pixels.setPixelColor(2, pixels.Color(0, 0, 0));
  pixels.setPixelColor(3, pixels.Color(0, 0, 0));
  pixels.show();
}
void Tube1() { // red light
  pixels.setPixelColor(0, pixels.Color(0, 0, 0));
  pixels.setPixelColor(1, pixels.Color(v2, v3, v4));
  pixels.setPixelColor(2, pixels.Color(0, 0, 0));
  pixels.setPixelColor(3, pixels.Color(0, 0, 0));
  pixels.show();
}
void Tube2() { // blue light
  pixels.setPixelColor(0, pixels.Color(0, 0 , 0));
  pixels.setPixelColor(1, pixels.Color(0, 0, 0));
  pixels.setPixelColor(2, pixels.Color(v1, v4, v2));
  pixels.setPixelColor(3, pixels.Color(0, 0, 0));
  pixels.show();
}
void Tube3() {   // yellow light
  pixels.setPixelColor(0, pixels.Color(0, 0, 0));
  pixels.setPixelColor(1, pixels.Color(0, 0, 0));
  pixels.setPixelColor(2, pixels.Color(0, 0, 0));
  pixels.setPixelColor(3, pixels.Color(v2, v2, v3));
  pixels.show();
}

image00002.jpeg
WhatsApp Image 2022-06-14 at 12.12.22 AM.jpeg

It took me 3 prototypes to get me tho my final results. I had to learn how every component worked on its own. I figured out the flutes ground wires could be connected to one. This helped a lot because it saved space. I leaned how color coding worked and how i could tell the Arduino witch light i wanted on. Making the switches wasn't that easy. First I just used a single aluminum foil but that was to weak when you blew on it. then i did aluminium and paper, but that got moist and started to deform. Cardboard was to strong. The one that worked best was folding a foil 4 times and gluing it shut. Here i learned that testing all kinds off ways and failing is very crucial an valuable in the process of designing.

I did not expect the light to shine through the tube, but i am very happy i did, it looks so beautiful because it fully light up.

Coclusion

image00017.jpeg
Untitled_Artworkk.png

I learned a lot of this project, how to solder, code, use WS2812B , realize a concept, documenting, using a DF player and of course how to use a Arduino.

it took a lot of work, but at the end i had a lot of fun making it, the excitement when something works is really nice and i am really proud of my first made electronic product ever.

I also gained more insight in how long it is going to take to realize a concept.

Zoe Horwitz(17 y/o)

Interaction Designer at HKU

The Flute in Action!!

Here you see all the different sounds it can play. I would like to add a button that switches the kind of music it plays. For now i have to change it in the code.