Introduction: NeRDDOOR

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...

Step 1: Materials Needed

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

Step 2: Program the ESP12-E

Change variables like WiFi SSID and Password for your own

Attachments

Step 3: Print the PCB

Step 4: Print the Door Package

Step 5: Assemble!

Step 6: 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

Step 7: 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

Step 8: 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;

Step 9: Install SQL Add-on to Node-RED

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

Step 10: Create and Configure the Flows

Configure as shown on the pictures

Step 11: Test It !