ESP32 Cupboard Lock With Blynk

by mecinios in Circuits > Arduino

848 Views, 9 Favorites, 0 Comments

ESP32 Cupboard Lock With Blynk

Zrzut ekranu 2021-05-30 o 18.31.46.png

This is an easy cupboard lock using ESP32's WiFi, solenoid and Blynk app.

Supplies

  • ESP32
  • smartphone (to use Blynk)
  • jumper wires
  • breadboard
  • solenoid
  • arduino uno (to supply 5 and 12V) or a breadboard power supply and voltage converter
  • n-channel MOSFET (30n06l)

Wiring

neqw schems.png

Wire everything as schematics shows. You can use a power supply and voltage converter to supply 5V and 12V (I don't have those so I used Arduino to supply 5 and 12V). Remember to connect 10k resistor between data line of ESP32 and MOSFET.

Code

Copy and paste this code. Use your WiFi's pass and ssid (you'll get auth while setting Blynk app).

download library from here.

#define BLYNK_PRINT Serial
#include

#include

#include

char auth[] = "---";

char ssid[] = "---";

char pass[] = "---";

void setup() {

Blynk.begin(auth, ssid, pass); }

void loop() {

Blynk.run();

}

Blynk Setup

lock Blynk

1.Download Blynk apps from Play Store or App Store.

2. After the download is done, open the apps and create an account. If you already create an account, you may log in.

3. After you successfully create an account, start by creating a new project.

4. Create a project name and choose a device by ESP32 Dev Board and choose connection type by WiFi.

5. After press the "Create" button, a window will pop up "Auth token was sent to....". You can open your email to check your authentication key.

6. Then, tap anywhere on the canvas to open the widget box. All the available widgets are located here. Now choose a button.

7. Tap on the widget to change the setting. Select the LED pin to Digital- gp23.

8. When you are done with the setting, press the PLAY button. This will switch you from EDIT mode to PLAY mode where you can interact with the hardware. While in PLAY mode, you won’t be able to drag or set up new widgets, press STOP and get back to EDIT mode.

Make sure to copy the authentication code and paste it in your code: char auth[] = "paste it here";

Make Sure Everything Is OK

cupboard lock

Make sure everything works properly.

Additional Step: Put Cover for Electronics

Lock4

You can print the cover for electronics. Here you've got a file for cover which I made in Tinkercad. Also here's the video showing how to put the cover together.

Put Solenoid and Electronics Into Cupboard

jped.jpeg

Put electronics and solenoid in. Plug Arduino (or breadboard power supply) to battery or outlet. Attach solenoid to the front side (from inside) of the cupboard so that you can close it but not open it with the solenoid's steep part pointing in inside(PLUG ELECTRONICS IN FIRST OR YOU WON'T BE ABLE TO OPEN IT!).

Voilà!

Zrzut ekranu 2021-05-30 o 18.31.46.png
ESP32 solenoid Blynk cupboard lock

Finally, you have a safe place to keep important things in!