
Build 8: Doorbell + LCD
Doorbell + LCD
This is a system with two doorbells, front and back, and a LCD display that displays which doorbell is pressed. Each doorbell produces a different sound.
Here is the video of the build: https://youtu.be/DBxDI6xqp18



For this build, I kept the same arrangement for the LCD as I did in the previous build. I added the two buttons that acted as the front and back doorbell, and a piezzo buzzer. It was a bit difficult to have space for everything on a small breadboard, but I managed to fit everything.
Initially, I could not get the two doorbells to work properly because the buttons were not connected correctly. Since I did not use the INPUT_PULLUP, I could not just connect the pushbuttons to the pin output then back to ground. I had to add the 5V input to the two buttons as well.
The next problem I ran into was with tone(pin, frequency, duration), delay and noTone functions. For the piezzo buzzer to stop sounding, I thought, in my logic, that I had to use the noTone functions. However, that was not necessary because it would automatically stop playing when button state was not high. On the other hand, I wanted the frequency I specified to play for a certain duration of sound. First, I solely used the delay function to do that. However, I later found out that a combination of the tone function and delay would produce sounds of individual notes, with a 100 milisecond gap of silence in between. The duration in the tone function runs at the same time as the delay, so 300 in duration and 400 in delay would yield me 300 miliseconds of sound and 100 miliseconds of silence.
Additionally, I had weird noises play at the end of my sound. Turns out it was because I used a for loop for playing the tunes and had the size of the frequencies in an array I wanted to play as my variable. Each integer in the array is actually 2 bytes — so I had to divide everything by 2 to obtain the correct length of times to play.
After making all the fixes, the system finally worked! Now that I could see real life uses of the systems I am building, I’m more excited about all the projects I can do in the future!