Smart Doorbell (2)

DRAFT

This is part 2 of the Smart Doorbell project.

Step 10. Get Microphone to Work

*** microphone needs to work from within script ***

amixer set Micro 50%

arecord -d4 --rate=44000 /home/pi/test.wav&

-d = duration, above is 4 seconds

--rate is sample rate

& execute and don't wait for it to finish

Only record when doorbell is pressed, motion is detected or sound is detected

stop recording when sound stops

https://stackoverflow.com/questions/892199/detect-record-audio-in-python/892293#892293

https://makersportal.com/blog/2018/8/23/recording-audio-on-the-raspberry-pi-with-python-and-a-usb-microphone

Step 11. Setup Camera

Step 12. Breadboard

Before I solder anything, I lay it out on a breadboard and ensure it all works. This requires jumper cables. I have a package of male-male, male-female and female-female in all kinds of colors.

For this project the breadboard is pretty simple. The Fritzing diagrm below gives a better representation then the picture at left.

Fritzing Diagram

Step 13. Motion Sensor

The motion sensor is not the best (poor angle and short distance). But is good enough for my doorbell and front porch. The front stoop is about 5x5, covered and enclosed. The sensor is smaller than the Adafruit one I normally buy, but it is low profile to fit in the case.

The wiring is straight forward:

  • + goes to 3V GPIO pin

  • - goes to ground

  • middle pin goes to GPIO 17 (pin 11)

Run the commands:

$ cd ~/. # change to home directory, usually /home/pi

$ wget "https://raw.githubusercontent.com/dumbo25/smart-doorbell/master/get.sh" # download code from github

$ sudo get.sh motion # get the script and service and start them running

I ran into issues with false positive motion detects. So, I went through several proposed solutions on the web until I found the one that works best for ny setup

Step 14. Low Profile, Normally Open, Momentary Push Button with Blue LED Ring

A low profile button is needed to fit between the front face plate and the wall where the doorbell is mounted. This button doesn 't have great tactile feel, but it works.

Blue LED Ring:

The white wires are for the LED.

Connect one wire to a GPIO ground pin.

Connect the other wire to GPIO 27 (pin 13)

Run the commands:

$ cd ~/.

$ sudo get.sh pb_led # get the script and service and start them running

Push Button:

The black wires are for the push button.

Connect one wire to a GPIO 3v pin.

Connect the other wire to GPIO 22 (pin 15)

Run the commands:

$ cd ~/.

$ sudo get.sh pb_bell # get the script and service and start them running

RaspiAudio MIC+ with pushbutton removed

RaspiAudio MIC+ with speaker clips/posts removed.

See them in the picture above?

Step 15. Prepare the RaspiAudio MIC+ to fit in the case

This step may destroy the RaspiAudio and is not recommended. (Ideally, replace the current box with one that is 1/2 inch longer)

  • Gently remove the yellow push button and then using a small scissors clip off the push button flush

  • Using a needle nose pliers and holding the board firmly, gently remove the speaker clips on both ends. Each block is composed of two clips or posts. Twist towards the end of the board and the clips should snap off

  • Using a dremel grinding bit, grind or cut off 3/16 inch from the microphone side of the board and over 15/16 of an inch. This cut allows the Blue LED Push Button to fit in the case. Since the speaker posts were twisted off in a previous step all the board does here is connect to those posts.

  • Clip off all unused GPIO header pins, or at a minimum cut them below the speaker height

Step 17. Why this project is hard

Normally, a Raspberry Pi project starts with the Pi and adds headers (i.e., a bottom up build). In this project, the doorbell must be built from the face plate down to the bottom of the box.

In addition, everything needs to be "see through". For example, I measured and drew the face plate, but the holes need to be drilled from the inside out for the face plate to stay unscratched. So, the template needs to be flipped. But it can just be flipped over, it actually has to be redone so it is from the inside out. Similarly, the solder also needs to be done on the bottom of the Raspberry Pi, so the Fritzing diagram needs to re-oriented from the bottom up.

Step 18. Hot glue camera board to face plate

Hot glue does not conduct electricity. It is actually a very good insulator.

Remove the camera cover. Remove the ribbon cable from the Raspberry Pi Zero.

Leave the 15 pin ribbon cable in the camera board.

Put the camera through the face plate hole.

Using hot glue, put enough hot glue on either side of the camera board to hold it in place, but not too much. You'll need to hold the camera in place until the hot glue sets (2-3 minutes).

Step 19. Insert LED push button

The hole should be large enough for the threaded part of the button to slide through. The large push button nut should sit fluish with the bottom of the case. Lightly grip the front of the button with a large needle nose pliers and gently tighten the nut.