Password protected camera

So i just wrote some code while waiting for my camera to be delivered and i was thinking i could share that already.
So i’m gonna hang a camera in my room so i can play around with blynk while im not home and see how the hardware responds, but i did not want my brother to access the camera (we share a Blynk account). So i used the terminal to make it password protected. Basically you enter the password in the terminal widget and a relay will power up the camera. If the password is correct you will get a notification if its not you also will get a notification and an email that tells you someone tried to access it. When my camera and camera mount arrive i will share the extra code that will be used to control the servos to make the camera move. But until then i only have this to share. Im open to any questions. Enjoy !

#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = "xxxxx";
char ssid[] = "xxxxx";
char pass[] = "xxxxx";

WidgetTerminal terminal (V1);

BLYNK_WRITE(V1)
{
  if (String("YOUR PASSWORD HERE") == param.asStr()) {
terminal.println("Password accepted") ;
Blynk.notify("Warning, someone succesfully accessed camera controls");
digitalWrite (4, LOW);
  } else {
terminal.print("Password denied");
Blynk.notify("Warning, someone tried to access camera controls");
Blynk.email("YOUR EMAIL HERE", "Failed camera login", "Warning, someone tried to access camera controls");
terminal.write(param.getBuffer(), param.getLength());
terminal.println();
digitalWrite (4,HIGH);
  }
  terminal.flush();
}

void setup()
{
  pinMode (4, OUTPUT);
  digitalWrite (4, HIGH);
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  terminal.println(F("Blynk v" BLYNK_VERSION ": Hardware connected"));
  terminal.println(F("--------"));
  terminal.println(F("Type the password to access camera controls"));
  terminal.println(F("Anything else will result in authentication failure"));
  terminal.flush();
}

void loop()
{
  Blynk.run();
}

Some pictures

nice am exited to see the rest of the project
What are u using wemos mini or what ?
Also if ucan share the wiring and for ur project
Thank u

If someone sniffs it with a simple MITM attack this manner of using a password is completely useless to be honest. You need at least an SSL connection to your hardware if you want this to have any kind of security or do hashes/salts for the password instead of the actual password.

Just playing the Devil’s advocate here :wink:

1 Like

i have the wiring in my head at this point, still waiting for some hardware. And i am using an esp8266 12e dev for testing atm and afterwards im just gonna use a blank esp8266 12E. Il put some links below. Il will post everything once its finished.
The final esp8266-12E im gonna use
The one i use for testing

I’m not quite there yet :stuck_out_tongue: But yes i realise that is not secure. But it keeps my brother out of my camera ^^.
A password function made by Blynk itself would be better but until that happens i’m trying to do it myself.

That would be a very good suggestion though. I’d put that up in the ideas section if I was you :slight_smile:

Its there already :grin:

My practice for iot stuff is to block their access to the Internet :stuck_out_tongue: then I use a single pc as a server and gain access via the pc to my iot stuff