Earlier this summer, I participated in a hackathon. It was an un-themed, free-for-all hackathon (my favorite kind), so, naturally, I asked myself — what if we could use technology to help animals play music?
Observation
I live with a herding breed dog. If you know anything about these kinds of dogs, you know they’re always staring at their people, waiting for something to do. They’re very smart and very active. If you too have lived with a herding breed dog, you know how easily they get bored and how much they rely on you to fix this for them. You also have probably developed some empathy for this situation and feel a little guilty when you do activities that don’t include them. Or maybe that’s just me, but that’s where this whole thing started.
I like to play music, but often when I sit down to play, my dog stares at me with her sweet puppy dog eyes and, instead of feeling happy about playing music, I feel sad that she can’t play too.
Question
What if it didn’t have to be like this? What if Penny (or Luna, the cat!) could join the band?
Hypothesis
- If I arrange a way for Penny and Luna to step on something that produces musical sound, they will choose to do this for a reward.
- The stepping can be done in a way that complements music being played by others.
Attempt #1
What happens when I try to convince them to play an instrument without technology? Maybe we don’t need tech after all. Let’s find out . . .
Materials
- Piano
- Tiny scoop of cat food
- Cat toy
Methodology & Results
Luna
- Attempt to lure Luna onto the piano with a scoop of food. -> No response.
- Attempt to lure Luna onto the piano bench with a toy. -> No response. Absolutely no interest in approaching the piano for any reason.
Penny
- Leverage previous trick experience to get Penny to put her paws on the piano bench. -> Success!
- Leverage “shake” cue to get Penny to put her paw on the piano keys. -> Somewhat successful . . . but the sound was not very pleasant and she looked physically uncomfortable in that position . . . and tbh I was concerned she would hurt the piano.
Attempt #2
What if we use a little bit of physics instead of tech? How much better is that?
Materials
- Small midi keyboard placed on the ground
- Some random hook that the person who owned my house before me left in the garage
- Could be anything you can turn into a lever though
- Box from an Amazon delivery
- Box cutter
Methodology
- Setup a midi keyboard to create a fun sound with the push of adjacent keys.
- Cut small pieces of cardboard for stacking.
- Create a simple machine (by placing the weird hook on pieces of cardboard) to concentrate the weight of the paw onto those specific keys (and simultaneously protect the keyboard from direct paw->key contact).
Results
Luna
Zero interest. Not good.
Penny
Not bad.
Attempt #3
Okay, let’s think more about the user experience here. What if there was something flat on the ground that could just be walked across to produce sound? Can we create a pressure sensor and somehow connect that to a music producing device?
Materials
- More cardboard from the Amazon box
- Aluminum foil
- Wire
- Wire strippers (or a knife, or a fingernail)
- Tape
- Raspberry pi
- Connected to a monitor, keyboard, and mouse
- Breadboard
- Breadboard jumper wires
- Resistor
- Optional
- Battery
- LED diode light
Methodology
- Follow steps 1-5 of this guide to create a DIY pressure sensor. It is shockingly straightforward.
Optional: to confirm the pressure sensor is working, connect the wires to a battery and lightbulb.
2. Follow this guide to connect the raspberry pi to the pressure pad. Choose the basic setup option with the resistor and, of course, the DIY pressure pad instead of a store-bought sensor. Strip the ends from the wires to insert them into the breadboard, just like when taping them to the aluminum foil previously.
3. The code is super simple. Use the RPi.GPIO library for the breadboard connection and the pygame library for the music. After trying several sound types, I left it on piano, which can be heard in the videos.
Results
Look at them go!!
Conclusion
This was a good MVP. I created a device that produced musical sound and that my users seemed to like.
Looking back at my hypotheses, I validated 1/2 of them. When I arranged a way for Penny and Luna to step on something that produced musical sound, they did in fact choose to do this for a reward.
The next steps for this project would then be validating the second hypothesis, which I sadly did not have time for during this hackathon: Configure the device to complement music being played by others. There are so many options for this! Can the animals play a chord at the right time? Can they play a series of recorded notes on a consistent beat? Could we time the reward dispensation to a pattern that facilitates this? Or maybe the animals could have their own versions of a guitar solo at a particular point in a song?
Some things to work out for this next phase are how to work with more advanced sounds in the code (I couldn’t get my own mp3 files to play, only the samples), how to automatically dispense the rewards, and how to keep the animals nearby and engaged when rewards are not being dispensed.