PComp Project 1 Final Documentation

Aidan Massie
6 min readOct 7, 2021

--

Title: Pedals of Nature

Description: A project where users can experience something in an unorthodox way — creating sounds with their feet instead of their hands. By using foot pedals that are synced to certain elements of nature, users will be able to immerse themselves in the sounds of nature with the tap of their foot.

For the first project of the course, Eddie and I drew the body part “foot.” We began by brainstorming ways that users could interact with something with their foot only. We landed on a few different ideas, but ultimately shot for using foot pedals that could create music. Shortly after, we transitioned to the idea of creating sounds of nature that can transport users to different areas of the globe. The sounds would be: fire, wind, rain/thunderstorm, ocean waves, city noise, and forest/birds chirping/etc.

We found foot pedals on SparkFun that were essentially a fancy case for a button that had a positive and negative wire. So, we ordered six of these for the six different sounds!

We began by stripping the 1/4 inch audio jack plug off the other end of the foot pedal for just one of them to test it out and see if it worked. We began by making a circuit with a light, replacing a normal push button with the foot pedal acting the same way. Below is a video of said circuit in use.

Once we knew the pedals worked, we stripped all of the audio jack plugs off and soldered pins on the positive and ground wires in order to plug them directly into the breadboard. On the breadboard, each pedal has its own digital pin (pins 2–7, correlated to pedals 1–6), a connection to the 5-Volt positive line, and a 1K resistor connecting the ground from the Arduino to the ground wire of the pedals. See below the photo of the setup.

Once the pedals were all plugged in and ready to go, the Arduino code was formed. Each pedal was given its own variable named “PedalX,” with X being the number of the pedal. Additionally, each pedal was set up for its own digital pin. In the code, one massive if statement is running the operation, essentially telling Arduino that if any pedal 1 through 6 is pressed (aka turns on aka becomes a “1” in value rather than a “0”), send the number corresponding to the pedal being pressed to the serial port. And it worked! See the code below:

The serial port was then picked up by the p5.serialcontrol application, sending the numbers from the Arduino serial monitor to p5 so it could be registered and initiate the playing of the sound. The data was being sent and printed in the console log of p5 with no problem. But, this is where we ran into issues. Take a look at the p5 code first.

As stated, the data is being sent from Arduino to P5 and it is indeed printing in the console log. The sounds are loaded up and work (they were tested on their own using the sound1.play(); command), the p5 serial control code page was set up, the library was uploaded, etc. Yet, we just could not figure out what the connection between the two needed to be. Aidan spent a good chunk of two days scouring the internet for possible answers, but couldn’t find anything that worked. See below a video of the data printing in the console log of p5 from the pedal switch.

Thankfully, on the morning the project was due, and when all hope was lost, dear friend David came to the rescue. David pointed out to Aidan that in the gotData() function in p5, we were looking for a string/line of data, not necessarily a number. By calling for a number instead of a string, p5 would be able to find the data we wanted it to look for (currentNumber). So, we made the below changes to the code:

After we made this change, the program started to work, with just a minor problem. The data coming in was repeating, meaning that when the first pedal was pressed, around twenty 1’s came through the serial port, causing the sound files to continuously start until the pedal wasn’t being pushed down. This caused the files to sound a little distorted and spooky, rather than the original files we were going for. The ButtonState lab in Arduino would’ve been the solution to this, but we ran out of time to add it before the project was due. In fact, in the middle of debugging, Aidan put that in the code but was looking for a solution to playing the sound in general, not playing it just once, so after it didn’t play the sounds, he took it out! Nonetheless, the project worked to some degree! See below some documentation of it in its purest form!

Aidan: I was really looking forward to getting this to work. I was really happy with the way our progress was looking, as well as the presentation we had going — the foot pedals are super nice and are probably one of the nicer and more professional-looking components of a project I’ve purchased at IMA. I really struggled figuring out the code. I’m no code expert and am several years removed from my in-depth learning of p5, but it still bugged me I couldn’t figure out the problem with our code. I think of myself as a pretty determined and persistent person, and the thought that I couldn’t finish this project on time and get the final idea working was going to bother me for a while. Thankfully we got it to work out with about half an hour to spare, even if it wasn’t the most incredible user experience. All in all, happy with the work we did, and reminded of how much I hate debugging code!

Eddie: Same excitement for me to get into this project, and I really appreciate Aidan’s efforts in debugging the code so that we can have such wonderful progress and presentation. We were not ready to present even 1 day before the class since we cannot load mp3 files on the computer using P5 and Aidan did struggle with it a lot. I tried using other software to interact with Arduino like Processing and it took me a long time to figure it out. Though David helped us to make our P5 code running successfully on the present day before the class (and we really appreciate that), I felt truly happy when I clicked the button on Arduino and the music file is playing in P5 (this means we can apply it into our installation and the problem is solved.) I look forward to participating more in the code progress in my next project while preparing all the hardware, files, soldering works. I love this project in all!

--

--

Aidan Massie
Aidan Massie

Written by Aidan Massie

Student at New York University. Passionate about visual art and the intersection between technology and sports.

No responses yet