crgarcia12 / electronics-homeassistant-lightscontroll

18 stars 2 forks source link

Home automation lights controller - ESPHome & Home Assistant compatible

This circuit controls home lights following these rules:

  1. Safe: Safety is first and is not traded in any decision
  2. Fail safe: If this device fails, the ligts are still controllable using the mechanical switches
  3. Follows standard instalation: This device does not require you to wire your house for it
  4. It can be installed centrally

    Following those rules and using as a reference a multi-switch light controlled with a mechanical latching relay, this is the wiring idea:

alt text

A normal circuit sends all push buttons to the latching relay, which controlls the lights. This circuit (ESPHome) is a side-car to the latching relay acting as an standard push button, but also sensing the output of the latching relay to detect if the lights are on or off.

This device is extensible:

This device has several security measurements:

There are two versions of the board, one with four channels and another with eight channels. Latest versions use ESP32-S3, which is a very powerful microcontroller with a lot of features.

Version 24: Eight channels

Compared to version 22:

Version 23: Eight channels

Compared to version 22:

Bugs

board-schematics board-pcb board-pcb board-pcb board-pcb

Version 22: Four channels

Detailed information

Since Version 17:

board-schematics board-pcb board-pcb-3d board-pcb-3d board-pcb-3d board-pcb-3d board-pcb-3d board-real-image board-real-image board-real-image board-real-image

How does it work?

Section under development.

Mains sensing

Section under development.

In here there will be a detailed description on how Mains is sensed.

Few teaser pictures that show how optocouplers with darlington behave. This allows the board to use very large resistors, very little current, and hence small fuses. All that improves safety and lowers the board consumption: oscilloscope-sensing-mains-1 oscilloscope-sensing-mains-2 oscilloscope-sensing-mains-3

Relays

Section under development. In here there will be a detailed description on why SSR with snubber relay was selected

This picture shows standard relays. Those have very large spikes oscilloscope-relays-mechanical

This picture shows SSR relays with snubber. Spikes still exist, but they are much smaller and more isolated, reducing noise-related issues oscilloscope-relays-ssr

Simulate mains sensing cirquit

The mains sensing circuit can be simulated online at lushprojects.

$ 1 0.000005 30.13683688681966 70 5 50 5e-11
v -96 368 -96 80 0 1 50 230 0 0 0.5
w 48 80 48 144 0
d 48 144 112 208 2 default
d 48 272 112 208 2 default
d -16 208 48 144 2 default
d -16 208 48 272 2 default
w 48 272 48 368 0
w 48 368 -96 368 0
w -16 208 -16 304 0
w 112 208 160 208 0
w -16 304 224 304 0
r -96 80 48 80 0 300000
x 633 351 750 354 4 20 ESP32\sGPIO
407 448 208 528 208 1
w 224 240 224 304 0
v 752 272 752 208 0 0 40 3.3 0 0 0.5
w 624 208 544 208 0
r 624 272 752 272 0 50000
w 544 240 544 272 0
c 624 208 624 272 0 0.0000049999999999999996 0.08913507182464649 0.001
w 544 272 624 272 0
w 624 208 752 208 0
s 272 208 336 208 0 0 false
r 624 320 752 320 0 1000000
w 624 272 624 320 0
w 752 272 752 320 0
x 209 185 404 188 4 20 Mains\sSensing\sSwitch
w 448 208 336 208 0
w 272 208 160 208 0
w 448 240 224 240 0
o 0 64 0 4099 320 0.00078125 0 2 0 3
o 17 64 0 4099 5 0.00009765625 1 2 17 3
o 23 64 0 4099 5 0.00009765625 2 2 23 3

How to order from JLCPCB:

how-to-order-from-jlcpcb

Development notes

Generating fabrication files for JLCPCB

  1. Plot PCB Gerber + Drill + Map:

    screenshot screenshot

  2. Bom files screenshot screenshot

    Command: python3 "C:\Program Files\KiCad\bin\scripting\plugins/bom_csv_jlcpcb.py" "%I" "%O.csv" screenshot

  3. Drill files screenshot screenshot run the python script to rotate the components screenshot

    PS C:\...\smt-assembly> python3 .\kicad-to-jlcpcb-pos.py .\hamodule-top-pos.csv .\hamodule-top-pos-jlcpcb.csv

Generate documents

schematics: screenshot

PCB: Print to PDF, and use a high-resolution PDF to JPG converting website like: https://pdf2jpg.net/

Older versions: 21

board-schematics board-pcb board-pcb-3d board-pcb-3d board-pcb-3d board-pcb-3d

Older versions: 20

Detailed information

Since Version 17:

board-schematics board-pcb board-pcb-3d board-pcb-3d board-pcb-3d board-pcb-3d

Older versions: Version 19

Detailed information

Since Version 17:

board-schematics board-pcb board-pcb-3d board-pcb-3d board-pcb-3d board-pcb-3d

Older versions: Version 17

Detailed information

Since Version 13 there were many changes:

board-pcb-3d

The enclosure compared with a DIN relay. Size is perfect :) board-pcb-3d

Older version: Version 16

Size comparison between V16 and V13:

board-pcb-3d

Older versions: Version 13

This version was minimized by:

Security additions:

Stability:

Others:

v2-board-schematics v2-board-pcb v2-board-pcb-3d v2-board-pcb-3d

Older versions: Version 9

Device schematics (under development)

v1-board-schematics v1-board-pcb v1-board-pcb-3d v2-board-pcb-3d

Older versions: Versions 1

I have no clue what I was thinking when I did this. I guess I put it here to show how much I had to learn :)

v1-board-schematics v1-board-layouts