My Smart Home Build

The “Output L” and “Output R” are RCA outputs. They plug into the input of an amplifier. The speakers plug into the amp output. So it goes: Input audio device (chromecast, tv, etc) > RCA switcher > amp > speakers.

The “input 1” and “input 2” can be any audio device that uses RCA. In my case, input 1 is a Chromecast device (chromecast device is plugged into an HDMI > Audio extractor) and input 2 is the TV in my garage.

You could “Y” the output L and output R into multiple amp inputs then hook the speakers into those amp channels. For example, I use this amplifier. Each channel handles 1 speaker and there are 2 channels per zone. So, if I wanted two speakers in the garage and two speakers in the living room to always play the same thing I would “Y” the output L and output R cables from the RCA switch box into zone 1 and zone 2 input. Then I would hook the garage speakers to zone 1 and living room speakers to zone 2. Or, in the case of my amp I linked to, it has 2 Bus inputs. So I could hook my output L and output R to the Bus 1 in on the amp then set zone 1 and zone 2 to use bus 1 as the input source.

1 Like

This was great to read. Thank you for sharing your journey and definitely giving me ideas of what to do next. It took me 5 years to make my home smart, slowly and gradually buying different things. Please keep sharing your updates or if any of the things you used didn’t work out. I am actually thinking about buying few of the hard-wired sensors you used.

Also how long did it take you to set all the things you mentioned? I am very curious.

Incredible work Brad thanks for sharing.
One little question, when connecting your esp32 to the relay board aren’t you using a shift level? The esp32 outputs are 3.3V and the relay board is fored with 5V signals, I’m I right?

It’s hard to put an exact time frame on it, mostly because it’s a work in progress and always will be. I’d say the system was 95% operational within 4 months of moving in. But, I was also preoccupied with moving in, working full-time, and helping my wife raise a 3-month-old and 3-year-old.

During construction, it took me 9 full days to pull all the wires and conduit. It took two and half more full days to terminate all the wires at both ends. After that, a lot of the implementation into HA was a couple of hours at night for several weeks. I already had the ESP/Opto-coupler boards built and code written, so that helped.

I’d say if the wires are all pulled and all that was left was to terminate them and add everything to HA it could be done in 40 hours.

The ESP32 boards have a 5v output. I’m using that.

Yeah no I meant the digital outputs of the esp32. You will be driving each relay in your relay board with the 3.3V digital outputs, ex GPIO23, 22, 21, etc. So wouldn’t you need a level shifter to convert to 5V?

I’ve never needed one. I just hook the 5v and gnd from the ESP to the relay board then hook a GPIO to each relay. It’s been working great.

I did accidentally hook the 3.3v from the ESP to a relay once. It would sometimes flip the relay and sometimes not. Once I realized I had it hooked up wrong and I correctly hooked it to the 5V on the ESP it has always worked.

Strange, I always have to put a shift level, otherwise the 3.3V output from the nodemcu board is not enough to trigger the relays. Must be related to your relay board model.
To avoid this I recently changed my relay board to this model: LILYGO® T Relay ESP32 5V Relay Module 8 Channel With Optocoupler Isolation Wireless Development Board WIFI Bluetooth For Arduino| | - AliExpress

Hi Phillips, Nice writeup and thanks you so much, my question is do I have to use Optocoupler? I was thinking if I can use ESP32 internal pulup voltage for 20 door and windows contact, is it possibible?

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.