Skip to content

Commit

Permalink
HASP v0.35
Browse files Browse the repository at this point in the history
  • Loading branch information
aderusha committed Feb 7, 2019
1 parent 7f90adb commit 7907223
Show file tree
Hide file tree
Showing 48 changed files with 158,268 additions and 129,591 deletions.
Binary file modified 3D_Printable_Models/HASwitchPlate.skp
Binary file not shown.
27,652 changes: 27,652 additions & 0 deletions 3D_Printable_Models/HASwitchPlate_front_desktop.stl

Large diffs are not rendered by default.

60,142 changes: 30,064 additions & 30,078 deletions 3D_Printable_Models/HASwitchPlate_front_single.stl

Large diffs are not rendered by default.

49,184 changes: 49,184 additions & 0 deletions 3D_Printable_Models/HASwitchPlate_rear_desktop.stl

Large diffs are not rendered by default.

56,674 changes: 28,330 additions & 28,344 deletions 3D_Printable_Models/HASwitchPlate_rear_lcdmod.stl

Large diffs are not rendered by default.

Binary file modified Arduino_Sketch/HASwitchPlate.ino.d1_mini.bin
Binary file not shown.
285 changes: 173 additions & 112 deletions Arduino_Sketch/HASwitchPlate/HASwitchPlate.ino

Large diffs are not rendered by default.

31 changes: 26 additions & 5 deletions Documentation/03_Electronics_Assembly.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ If you are still testing the HASP before complete assembly, continue to the [Hom

### BOM

* [Mean Well IRM-03-5 AC to 5VDC Power supply](https://amzn.to/2MNF7Gx)
* [Nextion 2.4" LCD Touchscreen display](https://amzn.to/2DIpahB)
* [WeMos D1 Mini ESP8266 WiFi microcontroller](https://amzn.to/2Gc92Xs)
* [Mean Well IRM-03-5 AC to 5VDC Power supply](https://amzn.to/2MNF7Gx)
* [2N3904 NPN Transistor](https://amzn.to/2TBCBFH)
* [1k Ohm Resistor](https://amzn.to/2t7UFvF)
* [4pin 2.54mm JST-XH PCB header](https://amzn.to/2MFV15p) *(note that these are the knockoff 2.54mm versions of the 2.50 XH series from JST. What they lack for in authenticity they make up for in ubiquity and dirt cheap pricing)*
* [PCB](../PCB)
* [6" each of white and black 300V 18AWG stranded power cables](https://amzn.to/2SjXO9G)

> ## WARNING: do not connect AC power and USB at the same time, as there is a chance you could fry your USB ports. Always disconnect AC before connecting USB or serial to the ESP8266 and Nextion panel (or doing anything else to the device for that matter)
Expand All @@ -41,22 +44,40 @@ This is what your PCB should look like from the top before you've placed any of

### PCB Assembled

Now place the components, taking care to orient the WeMos D1 Mini and JST-XH header as shown in the image below.
Now place the components, taking care to orient the WeMos D1 Mini, Mean Well Power Supply, and JST-XH header as shown in the image below.

![PCB Assembled](https://github.com/aderusha/HASwitchPlate/blob/master/Documentation/Images/HASP_PCB_Front_Assembled.png?raw=true)

### Transistor soldering

The transistor and resistor act as a switch on the GND connection for the Nextion LCD. This allows the HASP to reboot the LCD in the event of a failed LCD firmware update. The pads on the transistor are a little close together, so take care when soldering here and use as little solder as possible. **The LCD will not power on until the ESP8266 code is flashed and running**, sending power to the "switch" to turn on the LCD. If you've flashed the ESP8266 code to the WeMos, you;ve connected the LCD, you can see the program running in the serial console, and the display isn't powering on... you almost certainly have a problem with the soldering job on the transistor. If you just can't make it work, that's OK! Simply cut the resistor out of the circuit (important!), and then you can bridge the 3 pads for the transistor together with a glob of solder. This will disable the power switch for the LCD, which might mean pulling the device out of the wall if an LCD firmware update fails but will not otherwise impact daily operation.

### High voltage AC cabling

The AC power cables should be at least 18AWG 300V stranded cable with a white jacket soldered to the `AC/N` pad on the PCB and a similar wire with a black jacket soldered to `AN/L`. These are fed through a [rubber push-in grommet](https://amzn.to/2G9y49I) mounted into the rear enclosure. I've had good luck stripping an existing 3 conductor power cord and using the black/white wires inside.
The AC power cables should be at least [18AWG 300V stranded cable](https://amzn.to/2SjXO9G) with a white jacket soldered to the `AC/N` pad on the PCB and a similar wire with a black jacket soldered to `AN/L`. These are fed through a [rubber push-in grommet](https://amzn.to/2G9y49I) mounted into the rear enclosure. I've had good luck stripping an existing 3 conductor power cord and using the black/white wires inside.

### Nextion LCD Modification

The Nextion LCD can be modified to give a little extra room around the screw lugs which may help with mounting in some work boxes. If you have the means to do so, you can use a hot air gun to remove the 4-pin JST XHP connector from the PCB and then use the `lcdmod` rear enclosure model for some extra room in your box. If you don't have hot air, some careful use of side cutters or a rotary tool may also do the job. Be careful not to lift any traces as it's easy to do when applying mechanical force the connector.
The Nextion LCD can be modified to give a little extra room around the screw lugs which may help with mounting in some work boxes. If you have the means to do so, you can use a hot air gun to remove the 4-pin JST XHP connector from the PCB and then use the [`lcdmod` rear enclosure model](../3D_Printable_Models/HASwitchPlate_rear_lcdmod.stl) for some extra room in your box. If you don't have hot air, some careful use of side cutters or a rotary tool may also do the job. Be careful not to lift any traces as it's easy to do when applying mechanical force the connector.

In any event, you're going to need to solder the cable harness included with the Nextion display directly to the pins as shown in the image below. This demonstrates a panel with the connector removed, but you also solder the cable harness directly to the legs of the existing connector with a simple soldering iron with little trouble. After soldering the cables in place and confirming everything works, I like to put a bit of epoxy over the wires to provide some measure of strain relief.
In any event, you're going to need to solder the cable harness included with the Nextion display directly to the pins as shown in the image below. This demonstrates a panel with the connector removed, but you also solder the cable harness directly to the legs of the existing connector with a simple soldering iron with little trouble. After soldering the cables in place and confirming everything works, I like to put a bit of hot glue over the wires to provide some measure of strain relief.

![Nextion_LCD_modification](https://github.com/aderusha/HASwitchPlate/blob/master/Documentation/Images/Nextion_LCD_modification.jpg?raw=true)

### DC Power Option

The [Mean Well IRM-03-5 AC to 5VDC Power supply](https://amzn.to/2MNF7Gx) can be substituted with any of the following [Mean Well SLC03-series DC-DC power supplies](http://www.meanwellusa.com/productPdf.aspx?i=786) if you'd prefer a low-voltage DC option. This should be suitable for use over existing Cat5 cables, speaker cables, alarm cabling, etc already in your wall. Check to confirm that the existing cable wire gauge will be safe for the load you will be putting on the system, and try not to put voltage down a wire where other expensive and flammable things might be connected which aren't expecting it.

| Model | Input Voltage Range |
|-----------|---------------------|
| SLC03A-05 | 9-18VDC |
| SLC03B-05 | 18-36VDC |
| SLC03C-05 | 36-75VDC |

These DC-DC supplies are smaller than the AC-DC supply and have a different footprint on the board. Position the supply as shown below.

![PCB_DC_Assembled](https://github.com/aderusha/HASwitchPlate/blob/master/Documentation/Images/PCB_DC_Assembled.jpg?raw=true)

### Schematic for protoboard assembly

This project was initially built on a [4x6 protoboard](https://amzn.to/2MEnxEy) and the enclosure should still accommodate this approach if you have boards on hand. Note that this approach is probably dangerous as 120VAC and protoboards are a bad mix.
Expand Down
3 changes: 3 additions & 0 deletions Documentation/05_Home_Assistant.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ Finally, you'll need to restart Home Assistant to apply your changes then contin

## First time setup

> ### NOTICE
> If you're running Lovelace (now the new default Home Assistant web UI), there [currently is no way for a project like HASP to add panels](https://community.home-assistant.io/t/lovelace-in-ha-package-files/92619). You'll need to switch to the "states" UI before proceeding. If your installation is accessed at `http://hassio.local:8123`, navigate to `http://hassio.local:8123/states` to access the states UI.

Upon startup the default HMI display file contains empty buttons with no text. Launch the Home Assistant web UI and look for a new tab with your chosen device name. Select that tab and look for the automation titled `hasp_<your_device_name>_00_FirstTimeSetup`. Select that automation and click "TRIGGER" to apply the basic configuration to your new device.

![Home_Assistant_FirstTimeSetup](https://github.com/aderusha/HASwitchPlate/blob/master/Documentation/Images/Home_Assistant_FirstTimeSetup.png?raw=true)
Binary file modified Documentation/Images/HASP_PCB_Front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Documentation/Images/HASP_PCB_Front_Assembled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Documentation/Images/HASP_PCB_Front_and_Back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation/Images/PCB_DC_Assembled.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
200 changes: 200 additions & 0 deletions PCB/HASwitchPlate-cache.lib
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
EESchema-LIBRARY Version 2.4
#encoding utf-8
#
# Device_R_US
#
DEF Device_R_US R 0 0 N Y 1 F N
F0 "R" 100 0 50 V V C CNN
F1 "Device_R_US" -100 0 50 V V C CNN
F2 "" 40 -10 50 V I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
R_*
$ENDFPLIST
DRAW
P 2 0 1 0 0 -90 0 -100 N
P 2 0 1 0 0 90 0 100 N
P 5 0 1 0 0 -30 40 -45 0 -60 -40 -75 0 -90 N
P 5 0 1 0 0 30 40 15 0 0 -40 -15 0 -30 N
P 5 0 1 0 0 90 40 75 0 60 -40 45 0 30 N
X ~ 1 0 150 50 D 50 50 1 1 P
X ~ 2 0 -150 50 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# HASwitchPlate-library_Conn_01x08-conn-HASwitchPlate
#
DEF HASwitchPlate-library_Conn_01x08-conn-HASwitchPlate J 0 40 Y N 1 F N
F0 "J" 0 400 50 H V C CNN
F1 "HASwitchPlate-library_Conn_01x08-conn-HASwitchPlate" 0 -500 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Connector*:*_??x*mm*
Connector*:*1x??x*mm*
Pin?Header?Straight?1X*
Pin?Header?Angled?1X*
Socket?Strip?Straight?1X*
Socket?Strip?Angled?1X*
$ENDFPLIST
DRAW
S -50 -395 0 -405 1 1 6 N
S -50 -295 0 -305 1 1 6 N
S -50 -195 0 -205 1 1 6 N
S -50 -95 0 -105 1 1 6 N
S -50 5 0 -5 1 1 6 N
S -50 105 0 95 1 1 6 N
S -50 205 0 195 1 1 6 N
S -50 305 0 295 1 1 6 N
S -50 350 50 -450 1 1 10 f
X Pin_1 1 -200 300 150 R 50 50 1 1 P
X Pin_2 2 -200 200 150 R 50 50 1 1 P
X Pin_3 3 -200 100 150 R 50 50 1 1 P
X Pin_4 4 -200 0 150 R 50 50 1 1 P
X Pin_5 5 -200 -100 150 R 50 50 1 1 P
X Pin_6 6 -200 -200 150 R 50 50 1 1 P
X Pin_7 7 -200 -300 150 R 50 50 1 1 P
X Pin_8 8 -200 -400 150 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# HASwitchPlate-library_IRM-03-5-HASwitchPlate-library
#
DEF HASwitchPlate-library_IRM-03-5-HASwitchPlate-library U 0 40 Y Y 1 F N
F0 "U" 400 250 50 H V C CNN
F1 "HASwitchPlate-library_IRM-03-5-HASwitchPlate-library" 400 -150 50 H V C CNN
F2 "HASwitchPlate:ACDC-Converter_MeanWell-IRM-03-x" 400 -250 50 H I C CNN
F3 "" 400 -350 50 H I C CNN
$FPLIST
ACDC?Converter?MeanWell?IRM?03?x*
$ENDFPLIST
DRAW
S 100 200 700 -100 0 1 0 f
X AC/L 1 0 100 100 R 50 50 1 1 W
X AC/N 2 0 0 100 R 50 50 1 1 W
X +Vout 3 800 100 100 L 50 50 1 1 w
X -Vout 4 800 0 100 L 50 50 1 1 w
ENDDRAW
ENDDEF
#
# HASwitchPlate-library_SLC03-series
#
DEF HASwitchPlate-library_SLC03-series U 0 40 Y Y 1 F N
F0 "U" 400 250 50 H V C CNN
F1 "HASwitchPlate-library_SLC03-series" 400 -150 50 H V C CNN
F2 "" 400 -250 50 H I C CNN
F3 "" 400 -350 50 H I C CNN
DRAW
S 100 200 700 -100 0 1 0 f
X -Vin 1 0 0 100 R 50 50 1 1 W
X -Vout 10 800 0 100 L 50 50 1 1 w
X +Vin 16 0 100 100 R 50 50 1 1 W
X +Vout 9 800 100 100 L 50 50 1 1 w
ENDDRAW
ENDDEF
#
# HASwitchPlate-library_Screw_Terminal_01x02-HASwitchPlate-library
#
DEF HASwitchPlate-library_Screw_Terminal_01x02-HASwitchPlate-library J 0 40 Y N 1 F N
F0 "J" 0 100 50 H V C CNN
F1 "HASwitchPlate-library_Screw_Terminal_01x02-HASwitchPlate-library" 0 -200 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Connector*Terminal*Block*:*
TerminalBlock*
$ENDFPLIST
DRAW
C 0 -100 25 1 1 6 N
C 0 0 25 1 1 6 N
S -50 50 50 -150 1 1 10 f
P 2 1 1 6 -21 -87 13 -120 N
P 2 1 1 6 -21 13 13 -20 N
P 2 1 1 6 -14 -80 20 -113 N
P 2 1 1 6 -14 20 20 -13 N
X Pin_1 1 -200 0 150 R 50 50 1 1 P
X Pin_2 2 -200 -100 150 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# HASwitchPlate-library_WeMos_mini-HASwitchPlate
#
DEF HASwitchPlate-library_WeMos_mini-HASwitchPlate U 0 40 Y Y 1 F N
F0 "U" 0 500 60 H V C CNN
F1 "HASwitchPlate-library_WeMos_mini-HASwitchPlate" 0 -500 60 H V C CNN
F2 "" 550 -700 60 H V C CNN
F3 "" 550 -700 60 H V C CNN
DRAW
S -300 450 300 -550 0 1 0 N
X 5V 1 -500 350 200 R 50 50 1 1 W
X A0 10 500 -250 200 L 50 50 1 1 B
X D0 11 500 -150 200 L 50 50 1 1 B
X D5 12 500 -50 200 L 50 50 1 1 B
X D6 13 500 50 200 L 50 50 1 1 B
X D7 14 500 150 200 L 50 50 1 1 B
X D8 15 500 250 200 L 50 50 1 1 B
X 3.3V 16 500 350 200 L 50 50 1 1 w
X GND 2 -500 250 200 R 50 50 1 1 W
X D4 3 -500 150 200 R 50 50 1 1 B
X D3 4 -500 50 200 R 50 50 1 1 B
X D2 5 -500 -50 200 R 50 50 1 1 B
X D1 6 -500 -150 200 R 50 50 1 1 B
X Rx 7 -500 -250 200 R 50 50 1 1 B
X Tx 8 -500 -350 200 R 50 50 1 1 B
X Rst 9 500 -350 200 L 50 50 1 1 B
ENDDRAW
ENDDEF
#
# HASwitchPlate-library_XH2.54-4P-HASwitchPlate-library
#
DEF HASwitchPlate-library_XH2.54-4P-HASwitchPlate-library J 0 40 Y Y 1 F N
F0 "J" 0 200 50 H V C CNN
F1 "HASwitchPlate-library_XH2.54-4P-HASwitchPlate-library" 0 -300 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Connector*:*_??x*mm*
Connector*:*1x??x*mm*
Pin?Header?Straight?1X*
Pin?Header?Angled?1X*
$ENDFPLIST
DRAW
S 34 -195 0 -205 1 1 6 F
S 34 -95 0 -105 1 1 6 F
S 34 5 0 -5 1 1 6 F
S 34 105 0 95 1 1 6 F
P 2 1 1 6 50 -200 34 -200 N
P 2 1 1 6 50 -100 34 -100 N
P 2 1 1 6 50 0 34 0 N
P 2 1 1 6 50 100 34 100 N
X GND 1 200 100 150 L 50 50 1 1 I
X RX 2 200 0 150 L 50 50 1 1 I
X TX 3 200 -100 150 L 50 50 1 1 O
X +5V 4 200 -200 150 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Transistor_BJT_S8050
#
DEF Transistor_BJT_S8050 Q 0 0 Y N 1 F N
F0 "Q" 200 75 50 H V L CNN
F1 "Transistor_BJT_S8050" 200 0 50 H V L CNN
F2 "Package_TO_SOT_THT:TO-92_Inline" 200 -75 50 H I L CIN
F3 "" 0 0 50 H I L CNN
$FPLIST
TO?92*
$ENDFPLIST
DRAW
C 50 0 111 0 1 10 N
P 2 0 1 0 0 0 25 0 N
P 2 0 1 0 25 25 100 100 N
P 3 0 1 0 25 -25 100 -100 100 -100 N
P 3 0 1 20 25 75 25 -75 25 -75 N
P 5 0 1 0 50 -70 70 -50 90 -90 50 -70 50 -70 F
X E 1 100 -200 100 U 50 50 1 1 P
X B 2 -200 0 200 R 50 50 1 1 I
X C 3 100 200 100 D 50 50 1 1 P
ENDDRAW
ENDDEF
#
#End Library
3 changes: 3 additions & 0 deletions PCB/HASwitchPlate-library.dcm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
EESchema-DOCLIB Version 2.0
#
#End Doc Library
16 changes: 16 additions & 0 deletions PCB/HASwitchPlate-library.lib
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,22 @@ X -Vout 4 800 0 100 L 50 50 1 1 w
ENDDRAW
ENDDEF
#
# SLC03-series
#
DEF SLC03-series U 0 40 Y Y 1 F N
F0 "U" 400 250 50 H V C CNN
F1 "SLC03-series" 400 -150 50 H V C CNN
F2 "" 400 -250 50 H I C CNN
F3 "" 400 -350 50 H I C CNN
DRAW
S 100 200 700 -100 0 1 0 f
X -Vin 1 0 0 100 R 50 50 1 1 W
X -Vout 10 800 0 100 L 50 50 1 1 w
X +Vin 16 0 100 100 R 50 50 1 1 W
X +Vout 9 800 100 100 L 50 50 1 1 w
ENDDRAW
ENDDEF
#
# Screw_Terminal_01x02-HASwitchPlate-library
#
DEF Screw_Terminal_01x02-HASwitchPlate-library J 0 40 Y N 1 F N
Expand Down
Loading

0 comments on commit 7907223

Please sign in to comment.