My Smart Home Build

I originally tried that and I had some issues with false triggers. I think the long wires were picking up interference and messing with the GPIO inputs.

Thanks for your quick reply, the Optocoupler should be Output PNP or NPN?

I used an NPN

https://www.aliexpress.com/snapshot/0.html?orderId=8142150791363875

Thank! I will get NPN
The link you sent does not work maybe it is country restricted?

That’s odd. Here’s a screenshot of the board

As long as the VCC and GND of the relay boards are connected to 5V then the inputs to trigger the relays work fine at 3.3V because the relay boards have their own input circuitry to sort it out.

1 Like

Hi Brad
Thank you for sharing your project. I like what you did and am interested in following your idea having my existing / old alarm “talking” to HA. I am a novice when it comes to optocouplers (OC) details but understand the concept of what the intent is with an OC. My question is with respect to the OC & ESP, the O/P 3.3V to ESP. Must the OC output 3.3v towards the ESP or is it a matter of the ESP via its GPIO just doing the switching?

I have searched some of our local electronic places and found an OC but due to the lack of this type of integration, I need some advice. Unfortunately, the shop could not help with the question.
https://www.robotics.org.za/MCI8174PC?search=Optocoupler%20board

Appreciate any feedback.

Take a look at post 8, it has a wiring diagram for the optocoupler. It looks like the OC you linked to will take 3.6v-24v for the input. I’d just get a 12v 1 amp power supply. Hook the + from the power supply to each + on the OC input ports. Then run a - wire from the 12v power supply to each door sensor then from the door sensor back to the OC - terminal. The door sensor just acts as a switch. When the door is closed the circuit is complete and the OC sees 12v power. When the door is open the circuit is stopped and the OC does not see 12v power.

You use a separate power supply (I just used a regular USB Micro power supply) to power the ESP32.

Thanks Brad.
What threw me was the 12v → 3.3v between OC & ESP. So, I still have to step down the 12V to a 3.3V, typical Buck Converter and the OC out is just a switch as you said.

Thanks a million.

1 Like

This post (and its predecessor) have been extremely helpful as I’m embarking on much the same journey currently. Appreciate the details!

1 Like

Glad to hear you got some benefit from it! I’m very happy with my final product. If you have questions send me a PM.

you use opto isolation input board for ESP32? Is it 12V? I simple direct connect input to ESP32 pin (for door /window magnetic switch) and it works.

Yep, it’s 12V.

I started off with a direct connection, but some people warned me that the long wires (some are more than 100 feet (30 meters) long) could act as antennas and cause false triggers. The opto-isolator seemed like a better solution that would prevent any of that. I’d classify the optoisolator as not required but preferred.

1 Like

Brad is a really nice house & an inspiring example of HA project. Thanks for a enjoyable reading experience.

2 Likes

@bphillips921 what is the reason you didn’t connect the tablets’ power supply to be always on and instead use more complex solution that turns on and off the power?

If you leave a tablet plugged in it will overheat the battery and “blow up” the battery.

However, I found a feature built into the Lenovo Tab M10 that will monitor the battery and turn charging on/off. So now i leave it plugged in and let the tablet manage its charging.

Any reason why you didn’t choose a PoE tablet?

I couldnt find one when I was planning it.

Hasn’t happened to my tablet in 4 years…

I have exhausted the battery from two tablets. And the iPad I had the battery replaced and it is again bad because of it being constantly on (Not for HA, but other streaming apps).
However, I am in the process of advancing my Home Assistant by building my own dashboard display. The several learning curves discussed on this forum have influenced and helped me in the decision making. (I can learn from others mistakes as well as their successes.) It’s all about the research of reviews. Here is my thread that influenced my $350 project decision. When you get right down to it, it is all about what you put into it; myself I choose not to use a screwdriver for a prybar or hammer. Get the tool that you can afford and are comfortable with.