D

DIY Electronics

— Building circuits, programming microcontrollers, and making things blink
49 members Created Jun 2026

Designing a PCB antenna for 2.4GHz WiFi — lessons learned

i.imgur.com/photo.jpg

Home Automation PCB for a Smart Switch

Designed a custom PCB to retrofit mains switches with smart control. Safety note: this project involves mains voltage (120/240V AC). If you are not comfortable with mains-side wiring, use a commercial module instead.

The design uses a HiLink HLK-PM01 isolated mains-to-5V module, which provides a compact, certified, isolated supply from mains. This eliminates the need to design your own transformer or SMPS — important for safety and regulatory compliance. A BTA16 TRIAC controlled by an MOC3021 optocoupler provides zero-crossing switching of the load. The ESP8266 sits on the low-voltage side, entirely isolated from mains.

Creepage and clearance: IPC-2221 specifies minimum 3mm creepage for 250V in a home environment. My PCB has 6mm between any mains-side trace and the ESP8266 circuit. I conformal-coated the finished boards.

0

Report thread

Why are you reporting this thread?

Restore the redacted content?

This will make it visible to everyone again. The clear action is logged in the mod log.