Skip to content

k-off/smart_socket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smart Socket

Remotely controlled WiFi extension cord with 5 independently switchable sockets, 3.5" display for in-person setup and an NFC reader for access restriction.

Depends on ILI9488 library

Add a secrets.h file next to the sketch and define ssid and password of the wifi the socket should connect to.

Feature State
Remote control
TFT
Touch
SD
RFID

photo preview

Components

8x Relay board with ESP32-Wroom

PN532 NFC Reader

3.5" TFT Display With Touch

5x Socket Extension Cord

230/5V 5W AC-DC module

Pinout

For up to date pinout check the '''Pins.h''' header.

ESP32 Pin Names and Functions

Name Number Default/Special Function Notes Mapping to socket peripherals
G0 0 GPIO, boot strapping pin Must be LOW to enter boot mode RFiD CS
G1/TXD 1 UART0 TX Default serial TX Touch CS
G2 2 GPIO, LED_BUILTIN Boot strapping, often onboard LED RFiD MISO
G3/RXD 3 UART0 RX Default serial RX ***TFT LED PWM brighness
G4 4 GPIO, RTC Boot strapping pin RFiD CLK
G5 5 GPIO, HSPI_CS0 Boot strapping pin TFT D/C: data(Hi) control(Lo)
*CLK 6 SDIO clk (flash) Reserved Reserved
*SD0 7 SDIO data 0 (flash) Reserved Reserved
*SD1 8 SDIO data 1 (flash) Reserved Reserved
*SD2 9 SDIO data 2 (flash) Reserved Reserved
*SD3 10 SDIO data 3 (flash) Reserved Reserved
*CMD 11 SD command (SDIO flash) Reserved Reserved
**G12 12 GPIO, HSPI_MISO Boot strapping pin Relay-3
**G13 13 GPIO, HSPI_MOSI Relay-4
**G14 14 GPIO, HSPI_CLK Relay-2
G15 15 GPIO, HSPI_CS, boot strap Must be HIGH during boot RFiD MOSI
G16 16 UART2 RX, GPIO TFT Reset
G17 17 UART2 TX, GPIO RFid Reset
G18 18 VSPI_CLK (SPI Clock) Default hardware SPI TFT + Touch + SD CLK
G19 19 VSPI_MISO (SPI MISO) Default hardware SPI TFT + Touch + SD MISO
G21 21 I2C SDA, GPIO TFT CS
G22 22 I2C SCL, GPIO SD CS
G23 23 VSPI_MOSI (SPI MOSI) Default hardware SPI TFT + Touch + SD MOSI
**G25 25 DAC1, GPIO Relay-7
**G26 26 DAC2, GPIO Relay-0
**G27 27 GPIO Relay-1
**G32 32 Analog, RTC, GPIO Relay-5
**G33 33 Analog, RTC, GPIO Relay-6
G34 34 Input only, Analog, RTC Touch IRQ
G35 35 Input only, Analog, RTC
G36/VP 36 VP / Input only, Analog, RTC AKA VP (SVP) analog and touch apps RFiD IRQ
G39/VN 39 VN / Input only, Analog, RTC AKA VN (SVN) analog and touch apps

(*) SD0/SD1/SD2/SD3, CMD, and CLK (GPIO 6-11) are used for onboard flash and should not be used for external peripherals

(**) G12-14, G25-27, G32, G33 used for relays 1-8

(***) Display LED can not be directly powered using an ESP pin. Intead, power should be drawn from one of the 3.3V pins on the relay board. See LED Brightness Control section for more details.

Relay Board Pin Layout Top View

For exact pin-relay index matching see the table above. Relays are indexed left to right from the top view.

Pin Layout

LED Brightness Control

In case TFT LED control is required, a control switch should be used to draw power from one of the relay board's 3.3V pins and regulate it using ESP32 pin with PWM. A switch consists of an NPN transistor up to two resistors. The transistor must be capble of passing through at least 200mA. A (current limiting) resistor of at least 200 Ohm (R01) should be inserted between esp pin and the gate of the transistor. The second (pull down) resistor of at least x10 times higher value than R01 could be inserted between the gate of the transistor and the ground to ensure that the LED is switched off when no signal is coming from the MCU.

led_switch

Wiki

Relay board

ESP32 datasheet

3.5" Display User Manual

ILI9488 Specification

PN532 NFC Reader

About

ESP32 based extension cord with 5 independently switchable sockets

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published