fading 240v lights in vivarium (Safe method)

So basically I have a terrarium setup for a snake.

The Electrical setup for the snake includes day glo and night glo bulbs. To simulate a more realistic environment i wanted to be able to fade these bulbs at set times. idea being the following:

745am sunglo bulb begins to fade on
745am nightglo bulb begins to fade off
8am sunglow bulb reaches full on
8am nightglo bulb reaches full off

745pm sunglo bulb begins to fade off
745pm nightglo bulb begins to fade on
8pm sunglo bulb fully off
8pm nightglo bulb fully on

Now i understand the rather sevear dangers with 240v mains power and 5/9/12v home made circuits, and i've also noticed a few threads about here for controlling mains lights for fading but i had another solution that may not look so clean as some solutions but for things like vivariums, terrariums ect this could be an ideal solution but i need help from the awesome community.

Basically, programming an arduino or IC to control 2 servos. These servos are hooked up to dimmer switches you'd put on your wall by a link bar, so as the servo turns, it rotates the dimmer dial.

The help would be programming the servo and an effective clock. I'd much rather just run the servos off the arduino (Uno) rather than program an IC or something. that way i can have it all contained in 3 single back boxes for a cleaner look.

Where would be the starting point for this project? I've looked over the tutorial material for servo control but it makes no sense to me :frowning:

secretreeve:
Where would be the starting point for this project?

Get some servos.

Basically, programming an arduino or IC to control 2 servos. These servos are hooked up to dimmer switches you'd put on your wall by a link bar, so as the servo turns, it rotates the dimmer dial.

I don't like that idea at all!

Since you don't want to build your own solid-state circuits from scratch, I suggest you look into [u]Home Automation[/u] products. Note that there is a limitation with the X-10 system, in that if you program a light to go-on at 10% brightness, it will come-on at 100% and then dim-down to 10%. Then, if you send a 20% command, it will go to full-brightness again before fading to 20%. The INSTEON protocol doesn't seem to have that limitation.

i have the servos needed. just need to know where to start coding really.

It's not a case of liking the idea, its giving a manual control of the lighting as well as automated control. and the dimmers wont be on the wall, i just mean like the dimmers you'd normally find on your wall.

I like the servo-dimmer idea. Can’t get much safer than that! Try to find a dimmer that doesn’t require more than 180° of travel. If you need more than 180°, you’ll need to use “1-turn sail winches” instead of servos.

So. Study up on the two things you will need to interface with:

http://arduino.cc/en/reference/servo
http://playground.arduino.cc/code/time

You’ll run in a loop that keeps checking “what time is it now”. At specified times, you will send appropriate servo commands. The fade will be a little tricky, you’ll probably have something that looks like this pseudocode:

if ( time < 7:45am )
{
dayservo = 0;
nightservo = 180;
}
else if( time > 8:00am)
{
dayservo = 180;
nightservo = 0;
}
else
{
dayservo = 0 + ((8:00am - now) * 12);
nightservo = 180 - ((now - 7:45am) * 12);
}

or roughly something to that effect (as well as additional test cases for sunset).

When it comes time to buy your RTC, I recommend purchasing an accurate DS3231 based board, NOT an inaccurate DS1307.

thank you, thank you thank you!

now i have a starting point! will let you know how i get along.