Doorbells are often overlooked, but think about it, the doorbell is the very first interaction between you and someone visiting your home. Shouldn't your doorbell be something more? Something that brings a smile to the face of your visitor?
That's why I made this beautiful looking and sounding doorbell that looks like a miniature piano. It has five individual, fully functional piano keys. Each key, when pressed, plays a distinct note, sampled from a real piano.
Imagine the surprise and delight on your visitor's face when they're greeted by this beautiful doorbell. The keys are designed to feel like genuine piano keys, with actual key travel that provides a satisfying, responsive feel. And for you, it’s a gentle, musical tone instead of a jarring ring of a standard doorbell.
Design and 3D printI started designing the doorbell in Fusion 360. I came across this doorbell design on Pinterest that I used as a reference. However, that design appeared to have all the keys joined together as a single button. But I wanted five distinct, individually playable keys. So my design has separate keys.
With the designs finalized, I sent them off to be 3D printed using standard PLA filament.
The raw 3D-printed PLA, had a somewhat dull, grainy appearance. The white wasn’t really the piano white I was looking for.
The solution to this was quite simple. A nice coat of spray paint! I opted for a glossy white spray paint to achieve a polished finish.
I applied three coats of the spray paint, allowing 10 to 15 minutes of drying time between each. After about 12 hours of drying, the keys looked smooth, and shiny just like a real piano.
Part of this project was sponsored by JLCMC. If you’re a creator like me, you know how challenging it can be to find the right mechatronic parts for your projects. That’s where JLCMC comes in.
Why Choose JLCMC?
- A Name You Can Trust: Built on the strong foundation of JLC services—a global leader in PCB manufacturing and prototyping—JLCMC upholds the same dedication to quality and customer satisfaction in their mechanical parts offerings.
- Unmatched Prices: Continuing the JLC tradition, JLCMC provides mechanical parts at competitive, industry-leading prices, allowing you to stay within budget without sacrificing quality.
- Extensive Product Range: Whether you need precision-engineered components or custom solutions, JLCMC offers a comprehensive selection to support your projects—perfect for both hobbyists and professionals.
- Worldwide Reliability: With a legacy of trust from millions of makers globally, JLCMC extends the same dependable service to mechanical parts, ensuring consistent quality you can rely on.
If you sign up now, you’ll get a $19 coupon and monthly MC coupons to help save even more. Check out jlcmc.com for more!
How the piano keys operateNow, let's talk about how the piano keys will work. While we could simply place push buttons underneath each key and call it a day, I wanted the keys to feel more like a real piano, with authentic key travel. For this, I decided to use some micro limit switches.
These switches offer smooth, extended travel with a satisfying soft click at the end exactly what we need for this application!
Build the limit switch circuitOne challenge is dealing with the number of keys. The simplest solution would be to connect each limit switch to a separate pin on the microcontroller. However, I didn’t want to run five wires and an extra ground wire through the walls into the speaker box.
To solve this, there’s a clever trick that reduces the number of wires from six to just two.
The goal is for the microcontroller to distinguish between the five switches. To achieve this, we can create a resistor ladder. The ladder is connected between 5V and a GPIO pin on the microcontroller.
When the first switch is pressed, the GPIO pin receives the full 5 volts. Pressing the second switch will cause the voltage at the GPIO pin to drop, due to the 10kΩ resistor in line. With the third switch, the voltage drop will be caused by two 10kΩ resistors in series, giving a 20kΩ resistance. The fourth switch adds 30kΩ, and the fifth switch adds 40kΩ resistance.
By reading these unique voltage drops, the microcontroller can tell exactly which switch is pressed. The only caveat is that this method won’t work if multiple switches are pressed at the same time, but that’s perfectly fine for our application.
Assembling the piano sideWith the piano side ready, it’s time to assemble it. First, I screwed the two black keys into place and used some glue to secure them permanently. Next, I attached the keys to the frame, again using screws and some glue.
For the circuit, I used double-sided tape to stick it to the base plate. I also soldered a long black wire, which will later connect to the speaker side.
Finally, I secured the base plate to the rest of the casing.
Now we need to gather some data. We've built our resistor ladder, but we need to know the specific voltage readings for each key. For this, I used a mini breadboard and plugged in the microcontroller. I added a 10 kΩ resistor between D2 and ground. Then, the two wires from the piano key assembly were connected to D2 and 5v.
I wrote a simple program for the microcontroller. This code just reads the voltage on pin D2 and prints it to the serial monitor. We can upload this code and start pressing each key, one by one, noting the values we see. This data will be useful later, so save it somewhere.
My original plan was to use a micro-SD card module for Arduino. The idea was to store recordings of individual piano tones on the SD card and then have the microcontroller play the appropriate sound file based on which key was pressed. But the SD card I wanted to use was damaged.
After exploring different methods (with the help of ChatGPT), I finally found one that delivered surprisingly decent audio quality. Now, to be honest, I don’t completely understand the code.
But, it looks like the core concept involves converting the audio files into a specific format that can be directly embedded within the microcontroller's program code. Essentially, we're turning sound into data that the microcontroller can directly 'read' and output.
I assembled the circuit on a mini breadboard. Mainly because this will allow me to upgrade it with an SD card later.
You can refer to the diagram to make your connections. But I recommend going the SD card route if you can. The sound quality will be much better.
Now, it's time to upload the main code to the microcontroller. In this code, we use the voltage readings from each limit switch to determine which key is being pressed. Once a key is pressed, the corresponding piano tone is played using the code I mentioned earlier. After that, there’s a 2-second delay before the process repeats.
To use the code, you'll need to first convert your audio to “.raw” in audacity. We'll first convert stereo to mono.
Then, we'll change the sample rate to 16000.
We'll now normalise the audio.
Finally, export the audio with the settings shown on below.
Now, we need to convert the raw audio into a “.h” format. I've written a python script to do this which you can find in the attachments.
Once all the tones are converted, we can place them in the same folder where the Arduino code is present. We need to include these header files in the script as shown here.
If you’re willing to go the SD card route, which I highly recommend you do, you can find the procedure in one of my previous projects.
Assembly and installationWe can now power up the circuit and test it to make sure everything’s working properly.
I placed everything inside a casing I made and finished it off with a thin circular piece of sponge to cover the speaker.
Now we can carefully mount the piano key assembly outside, beside the door.
The speaker assembly finds its home inside, making sure to route the connecting wire neatly and between the two.
Finally, we power the entire circuit with a 5V power supply.
And there you have it! With everything connected and powered up, you can now enjoy the unique and satisfying experience of your new piano doorbell. The tactile feel of the keys, the beautiful piano tones, and the fact that you built it yourself – it's a very rewarding feeling.
To be honest, I still have a preference for using an SD card for audio playback. And the connecting wire between the indoor and outdoor units is another area I'd like to refine – a truly wireless solution remains the ultimate goal.
But, even with those future improvements in mind, I'm very happy with how it turned out. And I'm confident that it will bring a smile to the face of anyone who visits.
Feel free to go through the code and suggest updates. Any ideas for improving the project is always welcome!
Comments