I’m a software engineer who has a small amount of experience coding for arduinos but not much experience on the hardware side. I’m working on a personal project that will require me to turn a servo motor a certain amount based on how much a dimmer switch is turned (the dimmer switch will also need to control a lightbulb). For example, I may want to map a 270° servo rotation to the entire range of the dimmer switch.
From my research it appears that connecting and controlling a servo motor is fairly trivial. However, I’m having difficulties figuring out how to connect the dimmer switch and read the voltage (especially with modern dimmers that seem to cut up the voltage based on time as opposed to just lowering it). Also not sure if it would be easier to use an existing dimmer switch (preferable as this minimizes the changes to the existing design), or build that functionality into the Arduino.
Are we talking mains dimmers? That would not make it a trivial task and I would suggest to read a fair bit about isolation etc. Mains is not something to just mess with.
If we're talking low voltage dimming (for example led strips) things get a lot easier.
Runt8:
especially with modern dimmers that seem to cut up the voltage based on time as opposed to just lowering it).
However, I'm having difficulties figuring out how to connect the dimmer switch and read the voltage (especially with modern dimmers that seem to cut up the voltage based on time as opposed to just lowering it).
Virtually all dimmers use a "phase controlled" TRIAC. You can use a [u]Variac[/u], and I've seen motor-controlled Variacs, but of course they use a heavy-duty servo. (Or, they can just have a geared-down motor and you control it with an up/down switch.) And, they are bulky and expensive.
You can rectify & filter the voltage if you want to read it. If you want to read it with the Arduino, you should use a step-down transformer to isolate the Arduino, yourself, and your low-voltage from the dangerous voltages. (And, you might need some kind of protection circuit in case the voltage doesn't get stepped-down enough, or in case of an unexpected spike on the AC line.)
Also not sure if it would be easier to use an existing dimmer switch (preferable as this minimizes the changes to the existing design), or build that functionality into the Arduino.
It's not "easy' with the Arduino because you need an isolated zero-crossing detector, an isolated TRIAC-controlled output and the appropriate software. But, it can all be done electronically and your software will "know" the (average) voltage so you won't have to read it.
DVDdoug:
You link seems to be missing.
Virtually all dimmers use a "phase controlled" TRIAC. You can use a [u]Variac[/u], and I've seen motor-controlled Variacs, but of course they use a heavy-duty servo. (Or, they can just have a geared-down motor and you control it with an up/down switch.) And, they are bulky and expensive.
You can rectify & filter the voltage if you want to read it. If you want to read it with the Arduino, you should use a step-down transformer to isolate the Arduino, yourself, and your low-voltage from the dangerous voltages. (And, you might need some kind of protection circuit in case the voltage doesn't get stepped-down enough, or in case of an unexpected spike on the AC line.)
It's not "easy' with the Arduino because you need an isolated zero-crossing detector, an isolated TRIAC-controlled output and the appropriate software. But, it can all be done electronically and your software will "know" the (average) voltage so you won't have to read it.
Looks like I should start by researching step-down transformers.
septillion:
Thing is, I would not suggest to start with mains at all...
Is it an option to place a LDR (light sensor) near one of the bulbs? This would make it easier and saver to start with.
PS, remove the quotes around the link in your post.
Thanks for the suggestion - unfortunately, a LDR isn't an option in this case. All the hardware needs to be hidden away and there are potentially multiple light sources other than the one connected to the dimmer.
I'm also considering some sort of clamp sensor - seems safer and easier for a novice. I've found references to a couple but haven't been able to actually find where to buy one.
There seems to be some confusion. I think some responses are thinking you want a servo to control the AC dimmer, but I read it as you want the servo to mirror the setting of the manually-turned dimmer knob.
Which is it?
If I'm correct, where turning the knob to the halfway point, the servo would then move itself to 90°, can you share what the point of it is? Is the servo then operating another knob, or moving a flag, or what?
INTP:
There seems to be some confusion. I think some responses are thinking you want a servo to control the AC dimmer, but I read it as you want the servo to mirror the setting of the manually-turned dimmer knob.
Which is it?
If I'm correct, where turning the knob to the halfway point, the servo would then move itself to 90°, can you share what the point of it is? Is the servo then operating another knob, or moving a flag, or what?
You are correct, the servo should mirror the dimmer knob. The servo will be attached to a needle on a gauge - hence the need to be able to map different ranges from the dimmer to the servo (as the values printed on the face of the gauge will vary).
Mm, step down transformer after a phase cutting dimmer might be the safest idea but it will mess a bit with the waveform etc.
Runt8:
Thanks for the suggestion - unfortunately, a LDR isn't an option in this case. All the hardware needs to be hidden away and there are potentially multiple light sources other than the one connected to the dimmer.
You might have a valid reason not to but those two are not You can fix both by using a dummy bulb in the box. That you have multiple light connected to the same dimmer isn't a problem. They just act the same.
Runt8:
I'm also considering some sort of clamp sensor - seems safer and easier for a novice. I've found references to a couple but haven't been able to actually find where to buy one.
That might be a saver option. Just use the current as a source for the timing. With only bulbs that can work pretty good
Runt8:
EDIT - Looks like here is a good place to start.
I wouldn't trust a website with Fritzing-messes for mains...
Runt8:
You are correct, the servo should mirror the dimmer knob.
Mm, that might be, but what you could also do is connect a second servo/motor to a dimmer and move both at the same time.
I'm not against making mains circuits. But I do think it makes for a terrible first circuit. Just very easy to mess up.
At first I thought adding a second hidden light was crazy, but the more I think about it the more it’s growing on me. Assuming it would have to be a very small, low power LED that didn’t generate much heat. How sensitive are the light sensors? Are they able to differentiate different intensities or is it more an on/off thing?