top of page
Writer's pictureElise Guay

enchanted objects // tutorial

I wasn't sure what to ask when coming into this tutorial, I feel like I had an overwhelming amount of questions, but what I came to realize was that a lot of what I needed to do were things I needed to work out on my own, as is my way of learning best. My main questions were about set up than anything else. One of the things I kept confusing was the difference between a capacitive sensor and a push button.

A push button is more like a switch, where when there is a break in the circuit, it either starts or stops an action (for example lighting an LED or making a noise.) Depending on what the sensor is set to in the code, whether it's LOW or HIGH determines which direction is goes. So for example within my project, the sensor in the jaw of the raptor is set to HIGH so when the jaw opens, the sound begins. It didn't make much sense to have the sensor set to LOW, which would play when the mouth was closed. My other option was to place a capacitive sensor on a hand or a foot or even on top of the head, that when touched would activate the sound. I liked the idea of having it be more interactive than simply touching a sensor. I wanted more engagement with the object, especially if it were marketed for actual use. I feel that in today's world, it has been made very easy to simply tap things on a screen and get a reaction. In this project, I wanted to get away from that type of simplicity, while simultaneously keeping the interaction simple but also enjoyable and fulfilling.

The original plan was to have the dinosaur, Frank, as I have so lovingly named him, play the Jurassic Park theme song, fittingly enough. This is where I hit my first snag. I spent no less than two hours sifting through every corner of Google trying to find the simplest version of the melody. I even attempted to convert sheet music into code which was WAY above my pay grade. I tried my damndest to convert even the notes on the sheet music to the notes in the pitch library, but with exactly zero experience with sheet music or even recognizing the difference between the notes and what they mean, this effort proved...tuneless. One of my classmates suggested running the question through Google's AI feature, Gemini. I did this and got multiple, unhelpful answers back. What I came to discover, however, was that, according to Gemini, it is far too complex to run through an Arduino and a simple piezo, and that you would need a far more powerful set up, and a custom written code along with the correct sheet music and note durations. Scrap that.

This is a screen shot from one of my many attempts at asking Gemini to assist me. AI isn't as clever as it thinks it is, or conversely I'm not as clever as I think I am, and didn't ask Gemini in the proper way. Either way, as someone who has a slight disdain for AI, I will go the human route moving forward.

I sat back, took a deep breath, and asked myself what my next step could be. I remembered a site that I had found earlier in the process of trying to find specific songs that people had played on their piezo. It was actually and Arduino forum, where someone had posted a bunch of codes in relation to simple melodies, such as the Simpson's theme song like we learned in class, and the Super Mario Brothers theme song. I grew up playing various games from the Mario world, and dredged up an image in my memory of a skeleton from one of the games. In my mind, the raptor skeleton had to

be relevant. It couldn't just be a random skeleton that played a tune because I wanted it to. I scoured the internet once again, and found the exact image I was looking for. This still is from a YouTube walk through of Yoshi's World. Although there are some differences between Frank and Skelesaurus, they're close enough. And Yoshi is within the Mario Brothers realm so it made sense in the end.

The next challenge was getting the code to do what I needed it to do and sound like I needed it to sound. The code had more lines than I was comfortable using, so I ended up taking the first 25 notes, enough to make the melody recognizable but not too many that it was overwhelming. Another observation of humans in the current environment is that we have a wildly short attention span. I've noticed from my own social media posts that anything longer than 20 seconds doesn't hold attention, but 10 seconds is plenty, which is just about the duration of my notes.

The code I found even had the note code worked into it, which made my life infinitely easier – briefly. In this code, there were 0s in between the notes which I'm assuming are rests of sorts. What I couldn't figure out was how to make them work. I changed the numNotes number in my code from 25 to say 30 to account for the 0s. However, it threw errors at me. I tried moving things around in the code and trying to write my own function, but that didn't work either. So I opted to just have the notes and hope it sounded right.

My next challenge was getting the note duration to the proper length. I went back in my Workshop notes to figure out that the lower the number, the longer the duration. For example, 2 would represent a half note, which is a long duration, whereas a 8 would represent an eighth note, which is much quicker. So I sat and listened. And listened. And listened. Before I knew it, a couple more hours had gone by. I listened to each note, and in my head figured out how long the duration for each was, simply by listening. It isn't anything more complicated than that, there's no secret formula, I literally just listened to each individual note and figured out how to time it in my head. The Super Mario Brothers theme song will haunt my dreams for weeks to come, but, the important thing is that I figured it out.

The last step for this particular day was assembling the Arduino, piezo, and push buttons to be sure they worked. And, by the power of Grayskull, they did. I simply followed the setup from Workshop 2 and ran my code through it. Realistically, I didn't change much of the original code structure, but what did change was drastic enough to feel good about it.






TO BE CONTINUED...



3 views0 comments

Recent Posts

See All

Comments


bottom of page