I have a retractable socket at home. Seeing that the space inside is relatively large, I drew this board and used esp32_solo_1 (which I removed from the light panel of Wang Bao’s house and wanted to use it) to control five relays to achieve five-way control. I used hlw8012 Perform power statistics. The power supply part refers to the circuit of @shj162 and finally uses a power module... The socket has a physical switch and is connected to the key board through a pin header. There are 6 keys and 6 indicator lights. The key board schematic is in another project. There are currently 3 ways to connect the keypad:
1: Use the i2c io expansion chip, so that only 4 pin lines are needed to the key board.
2: Use esp32 io direct connection, 13pin line.
3: The button uses ADC to determine the resistance value. The button has 2 pin wires, and the LED light is directly connected to the 6 pin wire, a total of 8 pin wires.
I finally spent a huge sum of 2.6 yuan to buy a PCF8575TS from a certain treasure to implement the first method...
Power module: A Bao Preda 3.5 yuan ac-dc plus 3.7 yuan HLK-1D0505 DC isolation power module (power supply for hlw8012).
It is not cost-effective to buy parts to make ac-dc non-isolated when making just one board.
Plug strips like this. If you have the same type of socket at home, you can try plugging it in as well.
If you have the same type of socket at home, you can also try it with a board. The approximate code of esphome is uploaded in the attachment.
All reference designs on this site are sourced from major semiconductor manufacturers or collected online for learning and research. The copyright belongs to the semiconductor manufacturer or the original author. If you believe that the reference design of this site infringes upon your relevant rights and interests, please send us a rights notice. As a neutral platform service provider, we will take measures to delete the relevant content in accordance with relevant laws after receiving the relevant notice from the rights holder. Please send relevant notifications to email: bbs_service@eeworld.com.cn.
It is your responsibility to test the circuit yourself and determine its suitability for you. EEWorld will not be liable for direct, indirect, special, incidental, consequential or punitive damages arising from any cause or anything connected to any reference design used.
Supported by EEWorld Datasheet