NeRDDOOR

by NeRD-AETTUA in Workshop > Home Improvement

503 Views, 2 Favorites, 0 Comments

NeRDDOOR

PHOTO-2021-03-04-20-26-43 (2).jpg

All files required for the project are available on https://github.com/NeRDAETTUA/NeRDDOOR

For more detailed instructions you can also watch our workshop: https://www.youtube.com/playlist?list=PLARUXQ9f6QR...

Materials Needed

PHOTO-2021-03-04-20-26-43 (1) (1).jpg

You will need :

- ESP12-E

- FTDI (to program the ESP12-E)

- Copper board (to print the pcb)

- A way to print a pcb

- A 5V charger with power jack

- 3D printer

- Servo Motor

- RC522 RFID reader

Program the ESP12-E

Change variables like WiFi SSID and Password for your own

Downloads

Print the PCB

IMG_20201022_232759 (3).jpg

Print the Door Package

Assemble!

IMG_20201030_191334 (2).jpg
IMG_20201030_191312 (2).png

Install a MQTT Server With Node-RED and a SQL Database

To install mqtt:

- sudo apt-get install mosquitto mosquitto-clients

To install MariaDB:

- sudo apt-get install mariadb-server

To configure MariaDB:

- sudo mysql_secure_installation

To install Node-RED:

- sudo apt-get install curl software-properties-common

- curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -

- sudo apt-get install nodejs npm

- sudo npm install -g --unsafe-perm node-red

- sudo npm install -g pm2

- pm2 start /usr/bin/node-red

- pm2 save

- pm2 startup

- Copy/Paste the command printed out by pm2

Create a User on MQTT for the Door ESP

To create a user on MQTT:

- sudo mosquitto_passwd -c /etc/mosquitto/passwd user (substitute user by the username pretended)

- insert the password you want

Disable anonymous logins:

- sudo nano /etc/mosquitto/conf.d/default.conf

- Write "allow_anonymous false

password_file /etc/mosquitto/passwd"

Restart MQTT:

- sudo systemctl restart mosquitto

Create the Database and Tables for the Door

To enter the MariaDB Database:

- sudo mysql -u root -P

To create the Database and Tables for the door:

- CREATE DATABASE users_rfid;

- USE users_rfid;

- CREATE TABLE rfid(id int(8) AUTO_INCREMENT PRIMARY KEY NOT NULL, name TINYTEXT NOT NULL, rfid TINYTEXT NOT NULL);

To create a user for Node-RED:

- CREATE USER 'nerddoor'@'localhost' IDENTIFIED BY 'pwd'; (insert the password instead of pwd)

- GRANT ALL PRIVILEGES ON users_rfid.rfid TO 'nerddoor'@'localhost';

- FLUSH PRIVILEGES;

Install SQL Add-on to Node-RED

installsql1.png
installsql2.png

Go to menu > Manage palette > Install, search for sql and install the add-on "node-red-node-mysql"

Create and Configure the Flows

Flow.png
config.png
function1.png
function2.png
mqtt out.png
Rfid in.png
sql config.png
switch.png

Configure as shown on the pictures

Test It !