I currently have a Pi 2B that I am using to control 8 relays. These relays control our (6 college juniors) living room lights, stoplight, and some Christmas lights. We currently have a Python script that listens to a port on our web server to control the lights via a php page.
We would like to use the Pi 2B with a touchscreen to use as a "control center" that just displays that web page in kiosk mode, which then talks to a new Pi 4 that is connected to the relays. The problem is, we would like to be able to switch between the LightShow Pi python script (so we can set the lights to be sound activated) (for academic reasons) and our normal "smart home" style script to turn the lights on and off during the day.
First question: Can you start and stop python scripts over http requests? I see a lot of posts about it with no definitive or "best case" solutions.
Second question: Is there an easier way to do this? Are we just overthinking it?
Tl;dr: We want to have buttons on a touchscreen to turn lights on and off, but also be able to have some of said lights flash with various frequencies of sound by pressing another button.
If you have full admin access to the server then your http requests can be made to do anything, providing of course that you have the programming skills/knowledge.
There are add-on Ethernet & Wi-Fi shields for the Arduino but if you wan to use it with your Raspberry Pi you'd end up writing applications for "both ends". And, networking is "software intensive" and it could potentially slow-down the "little Arduino" making any lighting effects less impressive. Also, if you run FFT (to get the frequency information), that's software-intensive and I doubt the Arduino could handle the networking at the same time (fast enough to work properly).
There is also a slick little chip called the [u]MSGEQ7[/u] that gives you 7-bands of frequency information. It puts-out a multiplexed DC voltage representing the intensities so I assume that can be used with the Raspberry Pi.
I am using to control 8 relays.
Regular electro-mechanical relays will "work" with sound-activated lights but solid state relays are faster, silent, and they don't "wear out". (To be fair, regular relays usually last a long-long time.)
If you use LEDs, you can control them with MOSFETs etc. But high-power LEDs usually require a special constant-current power supply which is expensive and/or hard to build yourself.
BTW - There are LOTS of advantages to a more-standardized home automation system. Just for example, an [u]X-10 dimmer switch like this[/u] is a drop-in replacement for a regular wall switch. It works locally/manually or remotely/automatically. And if you use one of the existing protocols it's easy to add more controllers & controlled lights, etc. But, they are not generally fast enough for sound activation if you wanted to combine the two systems you'd have to add the sound activates stuff at the light-end.