Arduino Bluetooth Camera is aimed to use the Camera shield with an ultrasonic to detect whether a stranger has entered our house. Then we capture a photo of him automatically once he gets into the area of the ultrasonic wave.
Of course, many security systems nowadays use open source hardware where you can develop your own security application according to your needs.
Thanks to Arduino platform and its based open source shields, you can now easily make your security systems which involve some security monitoring tools like alarm, laser, motion, distance, and camera.
Surely, the last one is the most important and popular one used almost in every security system. That’s because it’s the only way to recognize the penetration of the security from a stranger. And also it knows exactly who did that by capturing a photo of him.
In this tutorial, we are going to use Arduino Bluetooth Camera with the help of an ultrasonic to detect whether a stranger has entered our house and capture a photo of him automatically once he gets into the area of the ultrasonic wave.
Let’s talk about the idea behind the Security System using Arduino Bluetooth Camera …
The idea behind the Arduino Bluetooth Camera is to use 1Sheeld board with Arduino and the camera shield from the 1Sheeld App.
Simply, you will connect the App to the 1Sheeld via Bluetooth and hence we have an Arduino Bluetooth Camera!
This camera is ready to capture photos and store them into phones storage by one line of Arduino code!
We will also use the ultrasonic sensor with an obstacle in front of it on a certain distance (say 100 cm). Once anything comes in front of the ultrasonic sensor within the range of 10 cm or less, the system will consider this as a penetration.
Once a stranger has entered the house, the system turns on an alarm which is another shield (Buzzer Shield). Then the system captures a photo instantly to this stranger and saves it in the phone.
If this is your first time to deal with 1Sheeld or you want to learn more about it, I recommend checking this quick and easy getting started tutorial.
And if you haven’t tried ultrasonic before, I recommend checking this quick video.
Now, after you’ve become a little bit familiar with 1Sheeld, let’s start!
Step 1: Hardware components for the Arduino Bluetooth Camera Tutorial:
– Arduino Uno.
– 1Sheeld+ board.
– ultrasonic sensor HC-SR04.
– 4 * Male to female wires.
– Arduino USB cable or 9-12v battery.
– Android/iOS phone with 1Sheeld App installed on it.
Switch the 1Sheeld power to operate on 5v (Not the 3.3v):
1Sheeld have 2 modes: Uploading mode and Operating mode. You can switch between them using the switch close to the Digital pins and is called “UART SWITCH” on 1Sheeld and “SERIAL SWITCH” on 1Sheeld+.
Firstly, you slide the switch towards the “SWITCH” notation which turns the 1Sheeld board into the Uploading mode to let you upload the Arduino code.
Secondly, after you finish uploading the code, slide the switch towards the “UART” notation (or “SERIAL” at 1Sheeld+ board) which turns the 1Sheeld board into the Operating mode to communicate with your smartphone 1Sheeld App.
Finally, connect the Arduino via your PC using Arduino USB cable.
Step 4: Code:
I would recommend checking the Arduino Camera Shield documentation to know more about the Arduino Camera Shield functionalities and how to use them.
Now, switch the 1Sheeld board to the Uploading mode, upload this code:
Security System using Arduino Bluetooth Camera Project
This project shows an application on 1Sheeld's camera shield.
By using this project, you can track whether anything stranger
has entered your house and capture his photo by using camera
shield from 1Sheeld.
To reduce the library compiled size and limit its memory usage, you
can specify which shields you want to include in your sketch by
defining CUSTOM_SETTINGS and the shields respective INCLUDE_ define.
/* Include required shields */
/* A command which will be converted to speech */
constcharcommand="warning a stranger has entered your house";
/* Include 1Sheeld library. */
/* Define pins for the ultrasonic sensor */
/* Variable to save the measured distance from ultrasonic */
pinMode(trigPin,OUTPUT);// Sets the trigPin as an Output
pinMode(echoPin,INPUT);// Sets the echoPin as an Input
/* Start 1Sheeld communication. */
/* Get the current distance from the ultrasonic */
/* Print the distance on the Terminal shield */
/* Check if distance is less than 10cm which means that a stranger has entered the house */
/* Turn on the camera's flash while capturing */
/* Take a photo for that stranger using the phone's rear camera */
/* Also turn the alarm in form of a buzzer */
/* Delay for 2 seconds */
/* Turn the alarm off */
/* Use text-to-speech shield to announce a break into security orally */
/* Delay for 5 seconds to give the camera shield enough time for taking and saving the photo */
/* A function that makes the whole operation of the ultrasonic and returning the detected distance */
/* Variable to save the sound wave travel time in microseconds */
/* Variable to save the detected distance in cm */
/* Clears the trigPin */
/* delay 2 micro seconds */
/* Sets the trigPin on HIGH state for 10 micro seconds */
/* delay 10 micro seconds */
/* Sets the trigPin on LOW state */
/* Reads the echoPin, returns the sound wave travel time in microseconds */
/* Calculating the distance */
/* Returning the detected distance in cm */
Then, Switch the 1Sheeld board to the Operating mode then open the 1Sheeld app and connect it to the 1Sheeld board via Bluetooth.
Step 5: Run it:
Firstly, select the Camera, Buzzer, Terminal and Text-to-speech shields from the shields list.
I have used a 3D printed ship figure as a stranger. Once the ship cut the ultrasonic sensor range of 10 cm, the phone made a buzzer sound. Then it took a picture to the ship. Finally, the phone tells me with its speaker that a stranger has entered my house .. pretty cool, isn’t it 🙂
The ship photo was taken and stored:
Now we have done with this security system using the Arduino Bluetooth Camera.
You can add your own extra code lines to add more security warning features like what I mentioned at the beginning of this tutorial.
Hope you enjoyed this Arduino Bluetooth Camera tutorial!
If you have any question, please don’t hesitate to leave it in the comments down below.
Arduino makers …. you can connect your Arduino to MQTT brokers(servers) and launch your IoT with Arduino IoT Shield! It’s the 1Sheeld IoT shield that will do the job for you. It’s one of the most important but recent Arduino shields in 1Sheeld. Simply, it turns your Arduino into MQTT client where you can publish and …
Monitor my home environmental parameters remotely is one of the most desirable things I have ever wanted to make. It’s not about purchasing such a system that can get the job done for me. But, passion to create it myself. So, today, I am going to connect the popular DHT sensor to an online MQTT …
“Oh God! … It seems like I have forgotten the door lock open, again” … the normal saying whenever I am in hurry to go out! Have you encountered this problem before? It always confuses me since I may even think that I have left the door lock opened, and once I go back, …
Here I am with another IoT-based home automation project; Arduino IoT Fan Control. Every day, I get back from work tired and feeling hot. No air conditioner here and the fan takes much time to start cooling the room, sadly! So, I was thinking why not controlling the fan from outside my home with my …
Have you ever forgotten to turn your home lights off when you got outside? Sadly, it happens to me all the time. And this causes confusion once I get my bills! Furthermore, here is one secret about me; I am a lazy man. I always want to control my room lamp from my sweet bed. …
MQTT is one of the most commonly used protocols in IoT projects. It stands for Message Queuing Telemetry Transport. In addition, it is designed as a lightweight messaging protocol that uses publish/subscribe operations to exchange data between clients and the server. Furthermore, its small size, low power usage, minimized data packets and ease of implementation …