In my Physical Computing class, we were starting to work with analog input data. Therefore, we were assigned to create a musical instrument that played with these different inputs and generated sound.

I am really excited with the idea of integrating dancing with physical computing as dance has always been a great way to express myself and let go. I think that further on it opens possibilities to develop art performances and mainly to create toys and learning tools for kids. But for now, the main idea was to prototype and have fun trying to make a hula hoop more interactive, transforming it into a musical instrument as proposed in the assignment.

Trial #1 —> Fail

Having in mind that my goal was to collect different inputs from the hooping (spinning) movement, and trying to avoid attaching many things to the hoop, my first idea was to work with infrared light. This would work in the following way: I would attach a battery and a series of infrared LED’s in the hoop, while the Arduino, with an infrared light sensor and a speaker, would be placed in a table and connected to a power source. Every time the distance from the infrared LED’s in the hoop and the infrared sensor in the table would vary, I would assign a specific note for it to play. This was a very practical and nice idea in theory, but it didn’t work in real life. In the following video you can check out why.

As you can see in this prototype version in the bread board, I was simulating the hoop movement to try to understand the variables I would be able to get from this sensor. Probably you noticed that actually the opposite from what I expected happened: the sensor data numbers, instead of increasing as I brought the LED’s light closer, decreased to a constant “0” (zero).  With this input I was not gonna be able to generate a proper sound and integrate as I wanted. Besides, I needed to bring the infrared LED’s super close to my Arduino and this wasn’t functional to my idea.

Trial #2 —> Success 

So I had to change my approach. I decided to work with an accelerometer. As I didn’t have the time to learn how to work to send bluetooth sensor data to the Arduino I had to embrace doing a very prototype-ish version of my idea and have the speaker and the Arduino placed in the Hula Hoop. My solution to minimize that was to get a smaller Arduino, so I ended up getting an Arduino MKR 1000. I also purchased the Adafruit_BNO055 accelerometer sensor.

To be able to work with  Adafruit_BNO055 accelerometer I had to download its documentation library. I only used its basic functions that enable be to get X,Y,Z variables. I chose to proceed with the X variable for now, as it sensed the 360 degrees movement.

So i had the sensor working (check!) and I identified the variables (check!). Now it was time to use the pitch.h library to attach the different variable inputs to notes (through if/else statements). You can check the code below:

#include <utility/imumaths.h>
#include "pitches.h"

Adafruit_BNO055 bno = Adafruit_BNO055(55);

int analogInput;

void setup(void)
{
Serial.begin(9600);
Serial.println("Orientation Sensor Test"); Serial.println("");

/* Initialise the sensor */
if (!bno.begin())
{
/* There was a problem detecting the BNO055 ... check your connections */
Serial.print("Ooops, no BNO055 detected ... Check your wiring or I2C ADDR!");
while (1);
}

delay(1000);

bno.setExtCrystalUse(true);

}

void loop(void) {
/* Get a new sensor event */
sensors_event_t event;
bno.getEvent(&event);

/* Display the floating point data */
Serial.print("X: ");
Serial.print(event.orientation.x, 4);
Serial.print("\tY: ");
Serial.print(event.orientation.y, 4);
Serial.print("\tZ: ");
Serial.print(event.orientation.z, 4);
Serial.println("");

delay(100);

int frequency = map(event.orientation.x, 0, 360, 100, 880);

if (event.orientation.x > 2 && event.orientation.x <= 5) { tone(8, NOTE_C4); } else if (event.orientation.x > 5 && event.orientation.x <= 10) { tone(8, NOTE_F6); } else if (event.orientation.x > 10 && event.orientation.x <= 20) { tone(8, NOTE_G3); } else if (event.orientation.x > 20 && event.orientation.x <= 30) { tone(8, NOTE_A3); } else if (event.orientation.x > 30 && event.orientation.x <= 40) { tone(8, NOTE_B3); } else if (event.orientation.x > 40 && event.orientation.x <= 50) { tone(8, NOTE_C4); } else if (event.orientation.x > 50 && event.orientation.x <= 60) { tone(8, NOTE_G3); } else if (event.orientation.x > 60 && event.orientation.x <= 70) { tone(8, NOTE_A3); } else if (event.orientation.x > 70 && event.orientation.x <= 80) { tone(8, NOTE_B3); } else if (event.orientation.x > 80 && event.orientation.x <= 90) { tone(8, NOTE_C4); } else if (event.orientation.x > 90 && event.orientation.x <= 100) { tone(8, NOTE_G3); } else if (event.orientation.x > 100 && event.orientation.x <= 110) { tone(8, NOTE_A3); } else if (event.orientation.x > 110 && event.orientation.x <= 120) { tone(8, NOTE_B3); } else if (event.orientation.x > 120 && event.orientation.x <= 130) { tone(8, NOTE_C4); } else if (event.orientation.x > 130 && event.orientation.x <= 140) { tone(8, NOTE_G3); } else if (event.orientation.x > 140 && event.orientation.x <= 150) { tone(8, NOTE_A3); } else if (event.orientation.x > 150 && event.orientation.x <= 160) { tone(8, NOTE_B3); } else if (event.orientation.x > 160 && event.orientation.x <= 170) { tone(8, NOTE_G3); } else if (event.orientation.x > 170 && event.orientation.x <= 180) { tone(8, NOTE_A3); } else if (event.orientation.x > 180 && event.orientation.x <= 190) { tone(8, NOTE_B3); } else if (event.orientation.x > 190 && event.orientation.x <= 200) { tone(8, NOTE_C4); } else if (event.orientation.x > 200 && event.orientation.x <= 210) { tone(8, NOTE_G3); } else if (event.orientation.x > 210 && event.orientation.x <= 220) { tone(8, NOTE_A3); } else if (event.orientation.x > 220 && event.orientation.x <= 230) { tone(8, NOTE_B3); } else if (event.orientation.x > 230 && event.orientation.x <= 240) { tone(8, NOTE_C4); } else if (event.orientation.x > 240 && event.orientation.x <= 250) { tone(8, NOTE_G3); } else if (event.orientation.x > 250 && event.orientation.x <= 260) { tone(8, NOTE_A3); } else if (event.orientation.x > 260 && event.orientation.x <= 270) { tone(8, NOTE_B3); } else if (event.orientation.x > 270 && event.orientation.x <= 280) { tone(8, NOTE_C4); } else if (event.orientation.x > 280 && event.orientation.x <= 290) { tone(8, NOTE_G3); } else if (event.orientation.x > 290 && event.orientation.x <= 300) { tone(8, NOTE_A3); } else if (event.orientation.x > 300 && event.orientation.x <= 310) { tone(8, NOTE_B3); } else if (event.orientation.x > 310 && event.orientation.x <= 320) { tone(8, NOTE_G3); } else if (event.orientation.x > 320 && event.orientation.x <= 330) { tone(8, NOTE_A3); } else if (event.orientation.x > 330 && event.orientation.x <= 340) { tone(8, NOTE_B3); } else if (event.orientation.x > 340 && event.orientation.x <= 345) { tone(8, NOTE_A5); } else if (event.orientation.x > 345 && event.orientation.x <= 350) { tone(8, NOTE_C4); } else if (event.orientation.x > 350) {
tone(8, NOTE_G3);
}
}

 

With that, the only remaining challenge was to attach the battery, Arduino, accelerometer, and speaker to the Hula Hoop in a way people could still hoop with it. So I imagined it would be better to balance out placing the 9V battery with the on/off button in a side and attach the rest in the other side of the Hula-Hoop. As it was a really prototype-ish version, i attached the Arduino/Accelerometer/Speaker with paper, and soldered it together. I also put the wires throughout the hoop as you can check in the images below.

* as you can see in the last image I added a resistor near the battery to avoid short circuit.

So as I turned on, now my Hulla-Hoop could emit noises with motion.

It is still not the best sound. Next step would be definitely adding a bluetooth integration from the accelerator to the Arduino. With that, I will place it inside the hoop and make it way better designed. Also, I have to work a lot on the code, to enable more control over the tunes when the user is hooping. It was a fun project for a first trial, but in order to be able to create performances I need to take it to the next level.

 

 

Share this Post

Leave a Reply

Your email address will not be published. Required fields are marked *