ST + Arduino + 4 Channel Relay for Home Theater

Hi Everyone!

I’ve been lurking here in the forums learning a lot about SmartThings but seem to have gotten myself stuck on my current project. I have reached out to @ogiewon seeking some help as I have noticed he has done some Arduino work but I didn’t want to drop my whole project in his lap without his invitation.

I am in way over my head and hoping someone can help. I have been setting up our smart home over the last month and have been adding locks, dimmers, outlets and switches to ST. I have also been working on my first custom project which is motor control for a 120v motorized projector screen and a 12v linear actuator that lowers the projector from the ceiling. The idea is to create a routine “Turn on Theater” triggered either by a smartphone or voice with an Amazon Echo that lowers both the projector and screen and turns on the projector and bluray player. When the movie is done, one command “Turn off Theater” turns everything off and lifts everything back into the ceiling.

I have already cut all the holes in the ceiling and installed my screen and projector “lift” (I don’t know why they call it a lift when it actually lowers the projector :wink:). I purchased my first Arduino for this project, a ST shield and a 4 channel relay. I also bought the Arduino starter kit and have been going through the examples learning how to build circuits and code Arduino.

Learning Arduino and putting everything together is fun, but very time consuming and I really just need a solution that works as soon as possible. I know the code is simple for someone who knows what they are doing. Unfortunately, that someone just isn’t me yet! My wife has been very patient with all the holes in the ceiling of our brand new house, but we also have a toddler that needs constant attention and it has been made clear that this project needs to be wrapped up as soon as possible!

I feel comfortable wiring the relays to the projector lift and screen but am at a total loss when it comes to writing the code. Like I said, I think I just bit off a little more than I can chew at this point in time.

I also wanted to mention I am using an Arduino Uno R3 for this project

I’ve been working on the SmartThings side of things using the Alexa Helper SmartApp to create all the virtual switches. I have an Alexa Switch (Virtual On/Off) called “Theater”. I have set a Scenario within Alexa Helper named Theater that reacts to the switch both On and Off. Turning the theater switch on activates a ST routine called “Turn on Theater”. The ST routine turns on an Aeon Labs SmartStrip (should always be on anyways) as well as the following virtual switches:

Projector Power (vOn/Off) -> Need to find a way to link to child switch #1 on SmartStrip…
Receiver Power (vOn/Off) -> Need to find a way to link to child switch #2 on SmartStrip…
Lower Projector Screen (vMomentary)
Lower Projector (vMomentary)

When the Theater switch is turned off it triggers a ST routine called “Turn off Theater” which turns off Projector Power and Receiver Power and activates Raise Projector Screen (vMomentary) and Raise Projector (vMomentary).

The projector screen takes approximately 10 seconds to raise or lower and the projector itself takes approximately 5 seconds. I’d like the momentary input to activate a timed output on the relays so that the relays aren’t constantly energized with the motors at their limit switches. I also want to ensure that the raise and lower relays cannot be engaged at the same time.

I hope this is all making sense and is something someone may be interested in helping me with. Thanks so much to everyone in advance! Even though it’s my first post, I am so grateful to the community that has already helped me so much!

I have a home theater with projector and motorized screen.

I control this using SmartThings, Arduino, and Smart / Thing Shield, 433Mhz RF signal to the screen up/down control and RS-232 to the Projector on/off control.

Ummm… I could explain how I did everything in detail, but don’t have the time at the moment.

Let me see if my code is in GitHub so I can link it here and maybe that will give you enough clues to reduce it to a few questions?

Here is the Device Type Handler (I then add a few Virtual Buttons and a simple linking SmartApp so that Alexa can be used to turn everything on / off).

NB: The code below is for reference as an example only. It’s sloppy… but does the job just fine.

And here is the Arduino Sketch:

1 Like

Thank you so much for the help! I have absolutely zero background in coding except for the few sample projects I have done with the Arduino starter kit and the good old CTRL+C, CTRL+V into the SmartThings IDE.

I feel like I could cobble something together that would work with just the arduino and relays, but adding triggers from SmartThings is where I go cross eyed. I’ll research some more and try and understand what you’re code is doing! :confused:


1 Like

By the statement above, I think you’ll have best luck by focusing on my Arduino code first… then look at how the Device Type Handler interacts with it.

As a bonus: Frankly, I think my Ardunio code is pretty clean and commented! Just haven’t provided a wiring / fritzing diagram.

Feel free to ask questions along the way; private messages also welcome. I just can’t guarantee reponse time.

Virtual Switches are the icing on top, and, really, the easiest part. I’ll paste the Virtual Switch & Linking SmartApp when you’re ready for that step. Virtual Switches are only needed if you want to control the system from standard SmartApps like SmartTiles, Rule Machine or Alexa which won’t understand the special Commands and Attributes in the custom Projector-Screen Arduino based hybrid Device Type Handler.

You are absolutely correct, the Arduino code makes a LOT more sense to me, mainly because it is very well commented! If I’m reading the code correctly, you use an IR transmitter for the screen and projector. My screen and projector lift don’t have IR receivers,but both will be hard wired into the relays. However, I will need a way to turn on (and off) the projector and bluray receiver and am thinking that an IR transmitter may be the best way to go.

My projector does not have a 12v trigger, but it does have an option for directly powering on with AC power so hopefully, I can integrate the Aeon Labs SmartStrip. The projector can also power off when it loses signal, which is preferable to cutting the power to the strip so that the fan will have time to run and cool down the lamp.

At this point, though, I think I will need someone to write the code for me. I am happy to compensate someone for their time on this project. I just don’t have the time to learn to code to then write the code to make this project work. If I do it myself, I’m afraid I’ll need more time and hand holding to get it done than if I just had someone write the code from the beginning. If anyone is interested in taking on this project, please let me know. Thanks!

I can do this for you, but Private Message me to discuss the terms, etc.

Are you sure the projector doesn’t have an Ethernet, WiFi or RS-232 control port?

Regardless… IR will be a good option if you can do the Arduino build and at least tweak the code aa necessary when we get to that stage (or consider an IR interface like Logitech Harmony).

Cutting power to the projector was my original thought, but it’s considered really risky for bulb life. Timeout on signal losd isn’t bad… But slow and hope we can do better.

So the screen is rely only? No remote control provided?