Skip to the content
2 layersExtension Cord, the printed circuit board in 3D

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

IoT_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
QtyValueFootprintReferences
8R_SmallResistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P5.08mm_HorizontalR10, R11, R20, R21, R30, R31, R40, R41
6Conn_01x02_MaleConnector_PinSocket_2.00mm:PinSocket_2x01_P2.00mm_VerticalJ1, J2, J3, J4, J5, J6
4CCapacitor_THT:C_Disc_D5.0mm_W2.5mm_P2.50mmC1, C2, C3, C4
1NodeMCU1.0(ESP-12E)kicad-ESP8266:NodeMCU1.0(12-E)U1

Similar boards

  • 2 layers43.9 × 27.7 mmTcd1304-4v, the printed circuit board in 3D

    Tcd1304-4v

    OpnTec/open-spectrometer-hardware

    Open source VIS spectrometer

    19 parts1.5k
  • 2 layers50 × 60 mmDebate Device, the printed circuit board in 3D

    Debate Device

    hackclub/OnBoard

    💡 Join 1,000 teenagers and make your first PCB with a $100 grant!

    19 parts915
  • 2 layers102.9 × 96.7 mmISA adapter, the printed circuit board in 3D

    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 mmPs2usb, the printed circuit board in 3D

    Ps2usb

    rasteri/HIDman

    Adapting USB devices to work on old computers

    19 parts432
  • 2 layers70.1 × 43.2 mmIaq device, the printed circuit board in 3D

    Iaq device

    nkitanov/iaq_board

    IAQ Board is a DIY (Do-It-Yourself) device for measuring internal air quality

    19 parts396
  • 2 layers80 × 80 mmGB BRK CPU G1, the printed circuit board in 3D

    GB BRK CPU G1

    Gekkio/gb-hardware

    Game Boy -related custom hardware by gekkio

    19 parts379CC-BY-4.0
  • 2 layers25.4 × 25.4 mmIna169, the printed circuit board in 3D

    Ina169

    Ardumower/ardumower

    Develop an open source robotic lawn mower (HW+SW reference platform)

    19 parts282
  • 2 layers58.4 × 28.6 mmNew rele, the printed circuit board in 3D

    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.