

I ran into an issue where the weight of the camera was causing the base to tilt, so I solved this by making a cardboard cylinder just tall enough to fit loosely between the motor and the camera. Lastly, I used another screw to attach the servo motor to the piece where the camera will sit. Next, I drilled a couple of holes in the base with my Dremel and then attached the servo motor with a couple of screws. And by that I mean, break it into as many parts as I can before it’s gone. I took my pliers to the black part in the center to remove it. It also came with 4 removable rubber ‘feet’, which helps to give the camera a little more grip when the motor moves. The back piece was a flat, sturdy plastic disc that eventually came off in one piece (after a little persuasion from my screwdriver), so that worked out great for a place to seat my camera.

I failed to take a ‘before’ picture, so the image on the right is the only remaining one that I could find online. I used an old Memorex cd labeler for the servo housing and the surface for our Arduino Security Camera to sit on. Now try uploading the code for the Arduino Security Camera. Uploading the Code for the Arduino Security Camera You'll know the motor is trying to move too far when it makes a grinding noise at the last PIR sensor position. So modify the code accordingly if your motor differs.
Arduino camera opencv full#
One thing to note about servo motors is that not all have a full 180º range of motion. Before powering the Arduino, make sure to connect a 100♟ capacitor between the power and ground of the motor to help protect the board from the power surges that occur when the motor moves. Using the pinout for your motor, connect one pin to power, another pin to the Arduino digital input 7, and the last pin to ground. The servo motor is attached to the stand where the camera sits, and rotates the camera to align with the active PIR sensor. You will connect each PIR sensor to the corresponding LED light in the code uploaded later.

If you are using the same PIR sensor as me, you can (carefully) pop off the cover and the pins are marked underneath. These modules will help us detect and recognize objects (face tracking in this case).
Arduino camera opencv install#
First, open CMD and type the following codes: >pip install serial >pip install opencv-python >pip install numpy Install each of the modules one by one. Each PIR sensor needs to be connected to a digital input (2-6) on the Arduino, 5V power, and ground. Install ‘pyserial’, ‘OpenCV and NumPy in Python To install these modules we will use use pip install. I used the HC-SR501 model PIR sensors for this project. Simply connect each LED to a separate digital input (9-13) on the Arduino and ground them through a 220 ohm resistor. Each LED responds to a different PIR sensor and will light up anytime it detects motion. I used a mini breadboard to keep the LED lights separate from the rest of the circuitry in order to allow for easier removal if needed.
