A way that has been suggested here on a number of threads, is to use one of these. Unless you have the experience to dabble with the mains side of the relay, it's probably best to go for an off-the-shelf solution.That said, we're not the house-wiring-police, so yes it's feasible to use an SSR or even a mechanical relay. This tutorial shows a coil relay and needs a diode across the coil, and a transistor to provide enough current for the relay to trip. Make sure, of course, that your relay is rated for the appropriate AC voltage and current....E&OE. YMMV....
Do you just want to turn the power on, and off, when the sound level changes ?Or do you want to control the power level in some way ( for example flashing lights ormaking them brighter or dimmer ), when the sound level changes ?These are actually different questions and the best ( and safest, when dealing with mainspower ) answer depends on what you are trying to do.
I just wanted to turn the power on and off when sound level changes. If I remember correctly, you need special lights that can dim? I'd prefer dimming if its not going to cost me a fortune but other than that just blinking. Thanks
QuoteI just wanted to turn the power on and off when sound level changes. If I remember correctly, you need special lights that can dim? I'd prefer dimming if its not going to cost me a fortune but other than that just blinking. ThanksWell there are plenty of lights that you can dim, but thats not really the point.You can use a relay to turn AC on and off. But that's it. On or Off, and not very often because the relay will wear out.But if you want to vary the "level" of the AC ( whatever that is actually supposed to mean ?? voltage ? current ? duty cycle ? ) , it's not actually that simple and you need a different sort of electronic device all together - such as a "dimmer".So you just want to turn the power on and off - well that is clarified then. The next question is, what do you mean by "when the sound level changes" ? Do you want to turn the power on and off for every "doof" of your doof-doof music ? Or do you want to turn it on when there is heavy traffic on the nearby freeway, and off when there isn't ?If you want this device to operate very often, you want to avoid a relay, because they will wear out quickly. You want to consider some kind of solid state relay, which usually costs more.
First it was about "toggling", but now it's to work like a VU (signal) meter?"Toggling" is one matter, but the other is considerably more complicated.
Now I am more interested in a Vu meter.
Solid state relays are not difficult to wire-up (4 wires), but they are not that cheap either. This type can handle just about anything you can plug-in, and the screw-terminals make it easy to connect-to. And it's relatively safe, because you just have to make sure AC goes to the AC terminals, and DC goes to the DC terminals.This type is a bit cheaper, but this one can only handle 2 Amps and it has to be soldered. The least expensive solution would be to build your own solid state relays with optical isolators especially designed to drive a TRIAC. This is a bit more risky, since there is more wiring/soldering of the high-voltage circuitry, and more possibility of making an error that could harm you or your Arduino.... The datasheet for the opto-isolator will show you how to wire it to the TRIAC and the AC voltage & AC load. I'm just starting a project that will have 4 TRIACS & 4 opto-isolators built-into an electrical outlet box (the kind of electrical box that's normally inside your wall).QuoteNow I am more interested in a Vu meter.A VU meter with AC lamps??? I suggest you take one step at a time... Start with LEDs and then add the AC lamps and associated circuitry. Or, at least program your Arduino to blink an LED with the beat/loudness before messing with the AC stuff. I'm just finishing-up a "Giant VU Meter Effect" that uses 24 high-brightness LEDs spaced a few inches apart in an 8-foot black plastic pipe. (To keep things interesting, it randomly does some other blinking/sequencing effects, and the meter can be reverses amd/or invertes, and switches between "bargraph" and "dot" modes.)