An interesting idea was invented and implemented by a master with the nickname carolinebuttet1.
In the world there are about 770 million surveillance cameras. Some of them do not have a password or there is a default password. This makes them easily accessible to anyone with an internet connection.
This virtual peephole, which was invented by a master device for monitoring some of these unprotected cameras. The choice of camera is random, i.e. each time you close and reopen the eye, you can see the image from another, randomly selected, video camera.
To implement this idea, the master used the following equipment:
-Arduino Micro
Photoresistor
-Raspberry Pi 3 Model B
- Raspberry Pi screen
-Wooden box
-Peephole
-Drill
-Screwdriver
The virtual peephole consists of two distinctive parts: the Raspberry Pi (with a small screen) and Arduino Micro. The Raspberry Pi is connected to the Internet and to a website that broadcasts one random channel from the camera.
There is a light sensor inside the eye to determine if it is open or closed. Whenever the peephole is closed, the signal is sent to the Raspberry Pi (via Arduino Micro) and the website switches to another camera. The camera data that the wizard used for this project was taken from the site Insecam , which registers more than 73,000 unprotected cameras.
Website to display.
For her virtual peephole, the wizard created a website with the data she collected from insecam. You can do without creating a site and use this the link (it changes the webcam each time you press the spacebar)
Configure Raspberry Pi.
Make sure your Raspberry Pi is up and running (see This guideif you are new to Raspberry Pi). Connect the LCD screen to the Raspberry Pi. You need to configure your Raspberry Pi so that it starts up with a web page. How to do this, you can see here.
Arduino setup.
Note: in order to do this project, your Arduino board must support a keyboard library. As mentioned on library page:
Supported models - motherboards based on 32u4 and SAMD (family of Leonardo, Esplora, Zero, Due, and MKR)
Connect your light sensor to Arduino
Download the code on Arduino.
The code first starts the calibration for 5 seconds (during which the minimum and maximum values for the photosensor will be recorded), and then sends a space bar signal whenever the light value is lower than the value (that is, the eye is closed).
CODE START
previousMillis = 0
// because light always varies, we will calibrate the photosesor at each boot.
long calibrationtime = 5000;
long startMillis = 0;
// the max value for an analog sensor is 1024
int sensorMin = 1024;
int sensorMax = 0;
int average = 0;
int threshold = 5;
bool lastState = true;
bool isClosed = true;
void setup () {
Serial.begin (9600); // open the serial port
Keyboard.begin (); // start the keyboard library
startMillis = millis (); // start the counter
}
void loop () {
// stabilize the reading in the first 5 seconds
// then, detect a variation in the stabilization.
unsigned long currentMillis = millis (); // set millis as the current time
int sensorValue = analogRead (A0); // read the sensor
if (currentMillis-startMillis & lt; calibrationtime) {
// as long as we are in the calibration time
// during this calibration time, open and close the peephole to calibrate it.
int elapsedtime = currentMillis - startMillis;
Serial.println (elapsedtime);
Serial.println (sensorMin);
Serial.println (sensorMax);
if (sensorValue & lt; sensorMin) {// register the max and min value for the sensor
sensorMin = sensorValue;
average = (sensorMin + sensorMax) / 2;
}
if (sensorValue & gt; sensorMax) {
sensorMax = sensorValue;
average = (sensorMin + sensorMax) / 2;
}
delay (100); // delay
}
else {// if the calibration is done
if (sensorValue & gt; average + threshold) {// detect if the peephole is open or closed
isClosed = false;
if (lastState! = isClosed) {
}
}
else {
isClosed = true;
if (lastState! = isClosed) {
Keyboard.print (""); // send a key signal if the peephole is open
}
}
lastState = isClosed;
delay (100);
}
}
END OF CODE.
Next, you need to install the equipment in the box.
Drill a hole in the door peephole to install the photosensor (it will determine if your peephole is open or not closed, and then activates the webcam change). Drill a hole in the box. Before the door peephole, fasten the Raspberry screen (the master used Velcro).
Connect Arduino:
Connect the photo sensor to the Arduino
Route the USB cable between the Rpi and the Arduino. Arduino will act as a keyboard and send a space bar to the Raspberry Pi.
After everything is mounted, you can start the virtual peephole.
Place the device on the wall
Connect your Rapsberry Pi to power
Now you will have 5 seconds to calibrate the photosensor located in the doorway, you need to open and close it several times.
Now the virtual peephole should work!
In my opinion a great idea and implementation. Of course, you can install the device in another case, it can be finalized the code and make a list of cameras with a preferred connection, but everyone can do this on their own.