ESP32 security system
A security RFID system that is controlled via the web!
Created by
mavory
Tier 4
4 views
0 followers
m0.hid ⚡
approved ESP32 security system ago
Tickets awarded: 220 tickets
Tier: 4
Great work on this! I love the finished case of your nfc reader, it makes everything look a lot cleaner
CAN ⚡🚀
submitted ESP32 security system for review ago
mavory
submitted ESP32 security system for review ago
mavory
added to the journal ago
ESP32 security system Completed
After about +- 26.5 hours I have finished this project and I am very proud of it. I was able to create my first project with ESP32!

How it works:
The RFID reader waits for the UID, if it is enabled in the system, the motor will turn, if not, it will not let you in. Turning the buzzer on or off can be controlled via a website running on the IP address.
After 10 attempts, the reader is blocked for a while to prevent unknown cards from being tried over and over again.
- Host mode: It can temporarily grant permission to a card for 2 minutes, and it can be extended or canceled
- Lockdown mode: You can turn this mode on manually or set a time when it will turn on and turn off later. When it is on, the card cannot be scanned at that time and I cannot add a new card.
- Scan new tag: You can add a tag permanently and change its name or remove it
- Release latch: You can open the door manually
- You can also turn on/off the LED, buzzer, reader,...
Here is a youtube video where you can see how it works: Link
Wiring:
RFID Reader (MFRC522)
- SDA (SS): GPIO 21
- SCK: GPIO 18
- MOSI: GPIO 23
- MISO: GPIO 19
- RST: GPIO 22
- 3.3V: 3.3V
- GND: GND
Stepper Motor (ULN2003 Driver)
- IN1: GPIO 32
- IN2: GPIO 33
- IN3: GPIO 27
- IN4: GPIO 14
- VCC: 5V (External)
- GND: GND
RGB LED Indicator
- Red: GPIO 25
- Green: GPIO 26
- Blue: GPIO 4
- GND: GND
Buzzer
- Pin: GPIO 2
- GND: GND
Technical Notes
- Power: The RFID module must be powered by 3.3V. Using 5V will damage the chip!
Scripts
The entire script is only one and has about 300 lines, so just upload it via Arduino IDE and everything should work.
Libraries:
- MFRC522.h
- ESPAsyncWebServer.h
- AsyncTCP.h
- Stepper.h
mavory
added to the journal ago
Putting things in the case
I finished the last part - the case. It took me a while to remove the supports, cut off the gaps and I really like this design! The cable to the motor runs from the side and the power cable that powers the ESP32 runs from the back!
I glued the top with normal super glue and put the buzzer close to the hole so that it would be better heard, but I decided that I would still edit the code in the end to fine-tune the RFID, but mainly to increase the "volume" of the buzzer, because it was not audible before.

mavory
added to the journal ago
GitHub editing
So I started 3D printing the case, but I decided to print it in white and the top in black! In the meantime, I continued to write and upload things to GitHub to make sure everything met the requirements.
I'm very excited that I got through all the hurdles, because at first I thought I just couldn't do it.
For now, I've made a BOM, I've also uploaded the completed code, I've uploaded the Circuit diagram and some information to make it easier to connect.

mavory
added to the journal ago
Remaking a 3D model
How to say it.... I started putting all the things in the box, everything fit except for one SMALL THING... CABLES
I made the box too short, so I can't close the cables and so on with it anymore. So I had to redo the case again and hopefully it will be good.

mavory
added to the journal ago
Exporting files
I'm very close to the end, just need to finish a few wiring things and I think it'll be ready! I already have the last part printed, but the supports were harder to remove, so I had to spend 30 minutes cutting the plastic to make it fit properly!
I've also started exporting the files, which I'll later upload to GitHub, where everything is! I still have to finish the information and connections, so I still have a long way to go.
.jpg)
mavory
added to the journal ago
Final code for the website
I have to say it with joy, but I already have a finished web interface, which looks very good to me! There are buttons to turn off the buzzer, RGB diodes, readers,...
It all took me a lot of time and I have to say that it was worth it. The code is about 330 lines, so it's not that long. I also modified the homepage to match the new design.
Home page:

Admin page:

mavory
added to the journal ago
Printing 3D models
I'm already printing the first part! Hopefully it will work and everything will fit.
Unfortunately, I've found a problem that when I want to scan the UID, the reader doesn't work at all, so I have to try to find the problem and solve it as quickly as possible!
.jpg)
mavory
added to the journal ago
Circuit diagram!
I remembered that I still need to finish the Circuit diagram to show how it's connected. So I opened my favorite program - KICAD!
I started creating, but for example, for ESP32 I didn't know which model to use, I did some research and had to download some libraries to make it as similar as possible, but I managed it quite quickly, in my experience, in about an hour and a half.
The hardest part for me was probably finding what symbols to use, for example, I didn't know what symbol to use for the motor, but I guess I got the hang of it.
Circuit diagram:

mavory
added to the journal ago
2. Web interface
Once I had the models ready, I went back to coding the website. There were some errors there, so I had to fix them. Sometimes the button wouldn't work for me or sometimes "Host mode" wouldn't work for me, so I fixed all that.
Unfortunately, I still have to redo the code, probably one more time, because I want to add some very interesting things!

mavory
added to the journal ago
Making all parts of the case
It took me a while, but I've finished both parts of the case. There's a hole on the top for the RGB diode that signals the status, and there's also a marked hole for the RFID!
Here is the top view:

Here is the bottom view:

Hopefully it will all work out!
mavory
added to the journal ago
How to hide an RFID module?
I got my filament today, so I can start modeling the case! But first I have to measure everything so that everything fits in the case.
I had to measure mainly the RFID module so that they could make a smaller space for it to fit in there.
I thought for a while about how I would do it and came up with a solution: I would make a holder for the top part to hold it so it wouldn't be visible, but it should work.

mavory
added to the journal ago
A moment for quick coding
I had nothing else to do, so I started redesigning the web interface. It took me a while, but I still wasn't satisfied... At least it was a black and white look and minimalist.
Some buttons just didn't work properly, so I had to redesign it again later, but at least I knew where it was going.

mavory
added to the journal ago
Case design for everything
I took a break from programming for now and started thinking about how I would put everything in the case to make it look good!
My favorite and easy program to learn is Tinkercad. I normally use Fusion, but this is faster for me. When I started making some designs, I didn't notice that I was supposed to add a little space, so I fixed that. I had the sketch ready and suddenly I remembered that I was out of filament, so I ordered some new ones and hopefully they will arrive in the morning!

mavory
added to the journal ago
My dream look
I wasn't at all satisfied with how the temporary web interface looked, so I started reworking the code to get my dream look.
It took me a lot of effort, I tried a lot of options, but again I encountered an error that I had been solving for a long time, but after about half an hour it was solved and I could continue!
After some time, I decided that a modern and minimalist look with just a black and white theme would be best.

mavory
added to the journal ago
1. Web interface
Coding was probably the hardest part for me, even though I made a lot of mistakes elsewhere. Coming up with a nice, but functional web interface was beyond my skills.
I tried to make just an admin panel without security, but that seemed strange to me, so I also tried to make a page for the public where they can see statistics and then I tried to make an admin page, which I didn't succeed at all. Either it wouldn't load at all or I couldn't connect the website to the ESP32.

mavory
added to the journal ago
Coding a script for ESP32
After this bug, I finally started coding and I have to say that it was terrible, my server crashed several times, it wouldn't load (as you can see in the photo) and I didn't know what to do.
Well, I tried different methods, but after a while I still ended up with the IP address.

mavory
added to the journal ago
A new beginning - for now
Well... I started coding again. Everything went pretty well, except for one thing. The SD card reader suddenly stopped working, so I tried to make a code for it to see if it would work now, and unfortunately, it didn't.
But I researched this bug for a long time because I couldn't figure it out.
This way, I was forced to remove the micro SD reader and live without it. I rewrote the entire code to make it work without the reader.

mavory
added to the journal ago
Big mistake for me
I thought everything would be fine, but after redoing the wiring, everything fell apart, the SD card reader and RFID reader didn't work, the RGB diode didn't light up properly, so I had to disconnect everything again and slowly start over.
I connected some pins and suddenly everything started working - for now...
( I didn't know I would have to do it again 💀 )

mavory
added to the journal ago
First steps to working code
Then I started coding. At first I tested if everything worked and I had to read some articles about how ESP32 works, because that was my first project with this microcontroller.
It took me about half an hour, but then I found out that it is very similar to Arduino!
So then everything went like clockwork (that's what I thought...) - Unfortunately, I had a lot of problems with the micro SD card reader, then with RFID,... but I managed it

mavory
added to the journal ago
Connecting things is my passion..
So when I solved this problem, I started wiring all the components, I have to say it was terrible.
I had to redo the whole layout a few times just to make sure everything fit on the breadboard.
I managed it and then I moved on to the next part!

mavory
added to the journal ago
Oh no! Breadboard problem
When my brain was ready, I started taking things apart and adjusting things on the breadboard!
I thought it would be fun, but it wasn't at all...
The ESP32 didn't fit on my breadboard and unfortunately I don't have another one, so I spent some time thinking about how to solve this problem.
Unfortunately, I struggled with this problem for quite a long time, because I was looking for other solutions, such as trying to solder it, but I backed away from that.
I came up with a solution, which is to put the ESP32 aside and thus have to use 2x more jumpers.

mavory
added to the journal ago
The beginning of my project!
I wanted to create an Arduino RFID system first, but later I decided to remake it and make it on my new ESP32!
I had to start from scratch, so I thought about how everything would work. I thought I could put a motor as a door and everything would be controlled via the web. When I had everything ready, I started taking things apart.
So it took me about 1.5 hours, because I had to dismantle the old project and think about the new one.

mavory
started ESP32 security system ago
1/1/2026 10:41 PM - The beginning of my project!
I wanted to create an Arduino RFID system first, but later I decided to remake it and make it on my new ESP32!
I had to start from scratch, so I thought about how everything would work. I thought I could put a motor as a door and everything would be controlled via the web. When I had everything ready, I started taking things apart.
So it took me about 1.5 hours, because I had to dismantle the old project and think about the new one.

1/1/2026 10:47 PM - Oh no! Breadboard problem
When my brain was ready, I started taking things apart and adjusting things on the breadboard!
I thought it would be fun, but it wasn't at all...
The ESP32 didn't fit on my breadboard and unfortunately I don't have another one, so I spent some time thinking about how to solve this problem.
Unfortunately, I struggled with this problem for quite a long time, because I was looking for other solutions, such as trying to solder it, but I backed away from that.
I came up with a solution, which is to put the ESP32 aside and thus have to use 2x more jumpers.

1/1/2026 10:52 PM - Connecting things is my passion..
So when I solved this problem, I started wiring all the components, I have to say it was terrible.
I had to redo the whole layout a few times just to make sure everything fit on the breadboard.
I managed it and then I moved on to the next part!
1/1/2026 11:00 PM - First steps to working code
Then I started coding. At first I tested if everything worked and I had to read some articles about how ESP32 works, because that was my first project with this microcontroller.
It took me about half an hour, but then I found out that it is very similar to Arduino!
So then everything went like clockwork (that's what I thought...) - Unfortunately, I had a lot of problems with the micro SD card reader, then with RFID,... but I managed it

1/1/2026 11:09 PM - Big mistake for me
I thought everything would be fine, but after redoing the wiring, everything fell apart, the SD card reader and RFID reader didn't work, the RGB diode didn't light up properly, so I had to disconnect everything again and slowly start over.
I connected some pins and suddenly everything started working - for now...
( I didn't know I would have to do it again 💀 )

1/1/2026 11:16 PM - A new beginning - for now
Well... I started coding again. Everything went pretty well, except for one thing. The SD card reader suddenly stopped working, so I tried to make a code for it to see if it would work now, and unfortunately, it didn't.
But I researched this bug for a long time because I couldn't figure it out.
This way, I was forced to remove the micro SD reader and live without it. I rewrote the entire code to make it work without the reader.

1/1/2026 11:21 PM - Coding a script for ESP32
After this bug, I finally started coding and I have to say that it was terrible, my server crashed several times, it wouldn't load (as you can see in the photo) and I didn't know what to do.
Well, I tried different methods, but after a while I still ended up with the IP address.

1/1/2026 11:37 PM - 1. Web interface
Coding was probably the hardest part for me, even though I made a lot of mistakes elsewhere. Coming up with a nice, but functional web interface was beyond my skills.
I tried to make just an admin panel without security, but that seemed strange to me, so I also tried to make a page for the public where they can see statistics and then I tried to make an admin page, which I didn't succeed at all. Either it wouldn't load at all or I couldn't connect the website to the ESP32.

1/1/2026 11:42 PM - My dream look
I wasn't at all satisfied with how the temporary web interface looked, so I started reworking the code to get my dream look.
It took me a lot of effort, I tried a lot of options, but again I encountered an error that I had been solving for a long time, but after about half an hour it was solved and I could continue!
After some time, I decided that a modern and minimalist look with just a black and white theme would be best.

1/1/2026 11:53 PM - Case design for everything
I took a break from programming for now and started thinking about how I would put everything in the case to make it look good!
My favorite and easy program to learn is Tinkercad. I normally use Fusion, but this is faster for me. When I started making some designs, I didn't notice that I was supposed to add a little space, so I fixed that. I had the sketch ready and suddenly I remembered that I was out of filament, so I ordered some new ones and hopefully they will arrive in the morning!
1/2/2026 12 AM - A moment for quick coding
I had nothing else to do, so I started redesigning the web interface. It took me a while, but I still wasn't satisfied... At least it was a black and white look and minimalist.
Some buttons just didn't work properly, so I had to redesign it again later, but at least I knew where it was going.

1/2/2026 12 PM - How to hide an RFID module?
I got my filament today, so I can start modeling the case! But first I have to measure everything so that everything fits in the case.
I had to measure mainly the RFID module so that they could make a smaller space for it to fit in there.
I thought for a while about how I would do it and came up with a solution: I would make a holder for the top part to hold it so it wouldn't be visible, but it should work.

1/2/2026 1:18 PM - Making all parts of the case
It took me a while, but I've finished both parts of the case. There's a hole on the top for the RGB diode that signals the status, and there's also a marked hole for the RFID!
Here is the top view:

Here is the bottom view:

Hopefully it will all work out!
1/2/2026 1:47 PM - 2. Web interface
Once I had the models ready, I went back to coding the website. There were some errors there, so I had to fix them. Sometimes the button wouldn't work for me or sometimes "Host mode" wouldn't work for me, so I fixed all that.
Unfortunately, I still have to redo the code, probably one more time, because I want to add some very interesting things!

1/2/2026 3 PM - Circuit diagram!
I remembered that I still need to finish the Circuit diagram to show how it's connected. So I opened my favorite program - KICAD!
I started creating, but for example, for ESP32 I didn't know which model to use, I did some research and had to download some libraries to make it as similar as possible, but I managed it quite quickly, in my experience, in about an hour and a half.
The hardest part for me was probably finding what symbols to use, for example, I didn't know what symbol to use for the motor, but I guess I got the hang of it.
Circuit diagram:

1/2/2026 4 PM - Printing 3D models
I'm already printing the first part! Hopefully it will work and everything will fit.
Unfortunately, I've found a problem that when I want to scan the UID, the reader doesn't work at all, so I have to try to find the problem and solve it as quickly as possible!
.jpg)
1/2/2026 5 PM - Final code for the website
I have to say it with joy, but I already have a finished web interface, which looks very good to me! There are buttons to turn off the buzzer, RGB diodes, readers,...
It all took me a lot of time and I have to say that it was worth it. The code is about 330 lines, so it's not that long. I also modified the homepage to match the new design.
Home page:

Admin page:

1/2/2026 6:23 PM - Exporting files
I'm very close to the end, just need to finish a few wiring things and I think it'll be ready! I already have the last part printed, but the supports were harder to remove, so I had to spend 30 minutes cutting the plastic to make it fit properly!
I've also started exporting the files, which I'll later upload to GitHub, where everything is! I still have to finish the information and connections, so I still have a long way to go.
.jpg)
1/2/2026 6:35 PM - Remaking a 3D model
How to say it.... I started putting all the things in the box, everything fit except for one SMALL THING... CABLES
I made the box too short, so I can't close the cables and so on with it anymore. So I had to redo the case again and hopefully it will be good.

1/2/2026 9 PM - GitHub editing
So I started 3D printing the case, but I decided to print it in white and the top in black! In the meantime, I continued to write and upload things to GitHub to make sure everything met the requirements.
I'm very excited that I got through all the hurdles, because at first I thought I just couldn't do it.
For now, I've made a BOM, I've also uploaded the completed code, I've uploaded the Circuit diagram and some information to make it easier to connect.

1/2/2026 10 PM - Putting things in the case
I finished the last part - the case. It took me a while to remove the supports, cut off the gaps and I really like this design! The cable to the motor runs from the side and the power cable that powers the ESP32 runs from the back!
I glued the top with normal super glue and put the buzzer close to the hole so that it would be better heard, but I decided that I would still edit the code in the end to fine-tune the RFID, but mainly to increase the "volume" of the buzzer, because it was not audible before.

1/2/2026 11 PM - ESP32 security system Completed
After about +- 26.5 hours I have finished this project and I am very proud of it. I was able to create my first project with ESP32!

How it works:
The RFID reader waits for the UID, if it is enabled in the system, the motor will turn, if not, it will not let you in. Turning the buzzer on or off can be controlled via a website running on the IP address.
After 10 attempts, the reader is blocked for a while to prevent unknown cards from being tried over and over again.
- Host mode: It can temporarily grant permission to a card for 2 minutes, and it can be extended or canceled
- Lockdown mode: You can turn this mode on manually or set a time when it will turn on and turn off later. When it is on, the card cannot be scanned at that time and I cannot add a new card.
- Scan new tag: You can add a tag permanently and change its name or remove it
- Release latch: You can open the door manually
- You can also turn on/off the LED, buzzer, reader,...
Here is a youtube video where you can see how it works: Link
Wiring:
RFID Reader (MFRC522)
- SDA (SS): GPIO 21
- SCK: GPIO 18
- MOSI: GPIO 23
- MISO: GPIO 19
- RST: GPIO 22
- 3.3V: 3.3V
- GND: GND
Stepper Motor (ULN2003 Driver)
- IN1: GPIO 32
- IN2: GPIO 33
- IN3: GPIO 27
- IN4: GPIO 14
- VCC: 5V (External)
- GND: GND
RGB LED Indicator
- Red: GPIO 25
- Green: GPIO 26
- Blue: GPIO 4
- GND: GND
Buzzer
- Pin: GPIO 2
- GND: GND
Technical Notes
- Power: The RFID module must be powered by 3.3V. Using 5V will damage the chip!
Scripts
The entire script is only one and has about 300 lines, so just upload it via Arduino IDE and everything should work.
Libraries:
- MFRC522.h
- ESPAsyncWebServer.h
- AsyncTCP.h
- Stepper.h