# LiHoCo Yard Gate PCB v1.0

In order to make the system reliable and easy to install, I started to design a PCB.

The following circuit board has been realized with the help of [EasyEDA](https://easyeda.com/) software:

![Image of front and rear pcb model in EasyEDA](/.assets/images/front_rear_pcb_v1.0.png)

![Image of the electronic circuit diagram](/.assets/images/schematic_yard_gate.png)

## Materials required:

- 1x raw PCB ([Gerber file of the PCB](/hardware/PCB/Gerber_PCB_yard_gate.zip))
- 1x ESP32 DevKit v1 ([ESP-WROOM-32](https://fr.aliexpress.com/item/1005001929935550.html))
- 1x 433MHz EV1527 receiver module ([RX480E](https://fr.aliexpress.com/item/33005839512.html?spm=a2g0o.order_list.order_list_main.24.2cd35e5blSNIk3&gatewayAdapt=glo2fra))
- 3x relays ([Songle SRD-05VDC-SL-C](https://www.lcsc.com/product-detail/_Ningbo-Songle-Relay-_C35449.html))
- 1x 433MHz EV1527 receiver module ([RX480E](https://fr.aliexpress.com/item/33005839512.html))
- 1x 230VAC to 12VDC transformer ([HI-LINK HLK-5M12](https://www.lcsc.com/product-detail/_HI-LINK-_C209908.html))
- 2x 230VAC to 5VDC transformers ([HI-LINK HLK-5M05](https://www.lcsc.com/product-detail/_HI-LINK-_C209907.html))
- 6x 5.1kΩ resistors ([MF1/4W-5.1KΩ±1%T52](https://www.lcsc.com/product-detail/Through-Hole-Resistors_Huaxing-Mechanical-Elec-MF1-4W-5-1K-1-T52_C714010.html))
- 3x 330Ω resistors ([MFR-25JT-52-330R](https://www.lcsc.com/product-detail/Through-Hole-Resistors_YAGEO-MFR-25JT-52-330R_C176501.html))
- 3x 1kΩ resistors ([MFR0W4F1001A50](https://www.lcsc.com/product-detail/Through-Hole-Resistors_UNI-ROYAL-Uniroyal-Elec-MFR0W4F1001A50_C57435.html))
- 3x LED ([204-10SURD/S530-A3-L](https://www.lcsc.com/product-detail/_Everlight-Elec-_C99771.html))
- 3x diode ([R5000](https://www.lcsc.com/product-detail/_SUNMATE-Elec-_C424519.html)) --> a bit overkill but it works
- 3x NPN transistors ([2N2222A](https://www.lcsc.com/product-detail/Bipolar-Transistors-BJT_Foshan-Blue-Rocket-Elec-2N2222A_C358533.html))
- 3x pptocoupler ([PC817C](https://www.lcsc.com/product-detail/Optocouplers-Phototransistor-Output_UMW-Youtai-Semiconductor-Co-Ltd-PC817C_C3008368.html))
- 1x DIP switches (5 switches) ([DSWB05LHGET](https://www.lcsc.com/product-detail/DIP-Switches_DongGuan-KINGTEK-Industrial-Co-LTD-DSWB05LHGET_C126889.html))
- 4x female connectors 2.54mm 15pin ([KH-2.54FH-1X15P-H8.5](https://www.lcsc.com/product-detail/Female-Headers_Shenzhen-Kinghelm-Elec-KH-2-54FH-1X15P-H8-5_C2932676.html))
- 1x female connectors 2.54mm 5pin ([DM254R-11-07-85](https://www.lcsc.com/product-detail/Female-Headers_DEALON-DM254R-11-07-85_C2935978.html))
- 9x 2 screw terminals 1.5mm² ([KF301-5.0-2P](https://www.lcsc.com/product-detail/Screw-terminal_Cixi-Kefa-Elec-KF301-5-0-2P_C474881.html))
- 4x 2 screw terminals 2.5mm² ([DB128V-5.08-2P-GN-S](https://www.lcsc.com/product-detail/Screw-terminal_DIBO-DB128V-5-08-2P-GN-S_C2915639.html))
- 1x 3 screw terminals 2.5mm² ([DB128L-5.08-3P-GN-S](https://www.lcsc.com/product-detail/Screw-terminal_DIBO-DB128L-5-08-3P-GN-S_C395869.html))

## Components

All the components can be ordered from [LCSC](https://www.lcsc.com/) or from [Aliexpress](https://fr.aliexpress.com) but I had some components in my stuff so I didn't order them all on this site. I put a link for each component so you can order them anyway.

## PCB printing

I used [JLCPCB](https://jlcpcb.com/)'s printing services to make my printed card because the [EasyEDA](https://easyeda.com/) software came with it.

## Results

![Image of front and rear of the printed PCB](/.assets/images/PCB_result_front_rear.png)

## It's working !

By powering the PCB with 230V, and implementing the ESPhome firmware, everything started and works perfectly.

![Picture of the PCB powered on](/.assets/images/PCB_powered_on.png)

## Points of improvement

Of course, we can find different points of improvement concerning the printed circuit, nevertheless, as it is, it is functional. It is therefore a good basis for making adjustments

We can quote for example:
- The lack of a mounting hole to screw the plate
- The gap between the terminals to be screwed could be eliminated and thus reinforce the solidity of the soldered component when screwing a cable tightly
- The DIP switch allowing the choice of the code (of the button of the remote control) to activate the gate could be removed and connected each of the signals to GPIOs of the ESP32 and thus be able to execute different actions depending on the button.