

Extension Cord
A simple IoT device based on NodeMCU with ESP-8266.
- Copper layers
- 2
- Thickness
- 1.6 mm
- Parts
- 19
- Nets
- 34
- Pads
- 66
- Tracks, vias
- 33, 0
- Routed
- Yes
- KiCad
- KiCad 6 (file 20211014)
- Created
- 1 Jan 2023
- Updated
- 1 Jan 2023
Overview
Extension Cord is an open-source printed circuit board by szabogabriel, from the szabogabriel/IoT_PowerSocketOutlet repository on GitHub. It is a 2-layer board with 19 parts on 34 nets, routed with 33 tracks and 0 vias.
Its parts include 8 resistors, 6 connectors, 4 capacitors and 1 IC. It belongs with the home automation and IoT boards and the ESP8266 boards of this library.
README
README.mdIoT_PowerSocketOutlet
A simple IoT device based on NodeMCU with ESP-8266.
The aim of this project was to test out several concepts and technologies, like IoT with MQTT communication and embedded computing via Node MCU (ESP-8266).
The wiring diagrams were done using KiCad.
Functionalities
The device has four power socket outlets. Every socket has an LED indicator whether it is turned off or on and also a switch to turn it on or off. The software connects to an MQTT server, where it can be controlled (turn specific power sockets on or off) and request the status of the ports.
Hardware
The main computing is performed by the Node MCU (ESP-8266) microcomputer. It is paired with a 4-way relay module and a power supply module (220V AC to 5V DC).
The only custom wiring is a low pass filter for the push buttons and was done on a prototyping board. I prefer a low pass filter for the debounce instead of a software implementation, altough, it is not a perfect solution.
The indicator LEDs are connected to the relay module's selector input. This way there is no need to maintain separate ports for the LEDs and the selectors.
The external power supply is connected both to the Node MCU (via the VIN and G ports) and the relay board. The relays need 5V to be able to operate, and the Node MCU is only able to provide 3.3V which is sufficient for the switching impulse, but not for powering the relays.
Software
The software was done via the Arduino IDE. It uses the PubSubClient and the ESP8266WiFi libraries. The code builds upon the PubSubClient example. It holds the state of the ports (on/off) thus eliminating unneccessary digitalWrite() calls.
Node MCU needs to maintain the HTTP stack in the background. This is made sure via the yield() function, which is implicitely called each time before entering the loop() function. A problem occures, when the computation takes too long (for example because of delay() calls). In that case, the Node MCU reaches a timeout and performs a reset. To omit this, the code is 'polluted' with explicit yield() calls.
Protocol
A simple protocol based on MQTT was implemented. There are two separate topics persent:
- /cord/update
- /cord/status
/cord/update
This topic is used to send commands to the software. The possible commands consist of the following convention: [port] [ON|OFF] or the STATUS command. After each update the status of the device is published.
/cord/status
Used by the device to publish its current status in a JSON format.
Test environemnt
The device was tested by using a Mosquitto server running on an OpenWRT router on a separate IoT WiFi network.
Todo
The communication protocol isn't a standardized format. It produces a JSON for the status message, but it doesn't accept one.
Should two separate messages be fetched in a short period of time, it sometimes hangs. Thus a delay of a few hundred milliseconds between command messages is a must.
Parts
19| Qty | Value | Footprint | References |
|---|---|---|---|
| 8 | R_Small | Resistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P5.08mm_Horizontal | R10, R11, R20, R21, R30, R31, R40, R41 |
| 6 | Conn_01x02_Male | Connector_PinSocket_2.00mm:PinSocket_2x01_P2.00mm_Vertical | J1, J2, J3, J4, J5, J6 |
| 4 | C | Capacitor_THT:C_Disc_D5.0mm_W2.5mm_P2.50mm | C1, C2, C3, C4 |
| 1 | NodeMCU1.0(ESP-12E) | kicad-ESP8266:NodeMCU1.0(12-E) | U1 |
Similar boards
- 2 layers43.9 × 27.7 mm

- 2 layers50 × 60 mm

Debate Device
hackclub/OnBoard
💡 Join 1,000 teenagers and make your first PCB with a $100 grant!
19 parts915 - 2 layers102.9 × 96.7 mm

ISA adapter
polpo/picogus
Emulation of ISA sound cards and CD-ROM on Raspberry Pi Pico (GUS, SB/Adlib, MPU-401, Tandy, CMS, Panasonic CD-ROM) with USB mouse/joystick support
19 parts805 - 2 layers60 × 39 mm

- 2 layers70.1 × 43.2 mm

Iaq device
nkitanov/iaq_board
IAQ Board is a DIY (Do-It-Yourself) device for measuring internal air quality
19 parts396 - 2 layers80 × 80 mm

- 2 layers25.4 × 25.4 mm

Ina169
Ardumower/ardumower
Develop an open source robotic lawn mower (HW+SW reference platform)
19 parts282 - 2 layers58.4 × 28.6 mm

New rele
zmaker/arduino_cookbook
gli sketch del nuovo progetto Arduino Cookbook e dei video di YouTube
19 parts269
Questions
What parts does the Extension Cord use?
19 parts. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
Where can I download the Extension Cord KiCad files?
From the szabogabriel/IoT_PowerSocketOutlet repository on GitHub, at the commit this page was made from: the board is wiring/Extension-Cord.kicad_pcb and its schematic wiring/Extension-Cord.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
Can I use the Extension Cord design in my own project?
Its repository states no licence, so its author keeps all rights: ask szabogabriel before reusing the design.