Newbi need some help please

Hi (I cant post in the home automation tread)

I need help please before I commit and buy.. I am disabled and would like to automate so tasks in my room.

I have some electric knowledge, not allot. I am a pc Tech but no programing.

The things I want to do: 1. Close the blind at specific time (I would like to add a light sensor to open and close the blind on light condition as well) 2. I have some 12v LED downlights that I would also like to control via the light sensor. 3. Have a push button on off switch to override everything (switch of the lights and close the blinds)

I have a 12v power supply (an old UPS) That is it for now.

I am looking to get this: 2 x

The step i want the code to take this: At certain time in the morning or when i press the button or when it gets light open the blinds If it gets darker switch on the lights and close the blinds halfway at night close or when i press the button the blinds and switch of the lights (if i can make the lights go of say 3min after the blinds closed it will work nice. Give me time to get into bed

Can the parts i want to get do this, do i need something extra and would someone help me with the coding please.

Thank you

Disclaimer! I am an Arduino newbie. I just did 'Hello World' last night. Proceed with caution!

To control the lights based on time of day I think you'll need some sort of real time clock. Perhaps you can use something like one of these:

I also found this which looks like you can get time of day without adding RTC hardware:

I suggest that you look for projects that people have done that are similar to what you are trying to do. This may be helpful:

I like Jeremy Blum's Arduino tutorials. Very newbie friendly.

Thank you I have been searching for a straight forward blind control without the HTML GUI with no luck It looks like everyone is building some robot or some other complicated stuff i just need my blinds to open .. i will even skip the LED's and the light sensor. Can someone help me or just point me in the right direction?


After some reading I got the lights figured out but I need some advice with the blinds. I am still waiting for my arduino so I have nothing to test on at the moment.

Here are my thoughts:

The LED’s

The led connected to a button connected to the light sensor. ( same as the night light with motion sensor just with a button) So when it gets dark and the button is pressed switch on the led That is all I need with the led

Now the blinds:

DC motor connected to a light sensor and a DPDT toggle switch When it gets light open the blinds, when it get dark close them Toggle is active whatever the reading is from the light sensor (kind of like a Manuel backup)

[u]Problem[/u]: If I use the toggle to close the blinds during the day will the light sensor just open them again and if so how do I prevent this, same for the night

DC motor connected to a light sensor and a DPDT toggle switch

A "switch" implies manual intervention - do you mean "relay"?

If I use the toggle to close the blinds during the day will the light sensor just open them again and if so how do I prevent this, same for the night

Two light sensors? One inside the blinds, one outside. A timer?


I will redo my blinds controller with two light sensors, did not think of it :)

I thought you can connect a toggle switch without a relay?

Sorry, I assumed the switch was there to control the motor direction.

AWOL advice please

If i use a timer. say the blinds open at 6:30 and close at 19:00 will i have control with the toggle between those times?

If you want it, yes, of course. It is just a matter of either allowing the software to have an override, or wiring it so you have a physical override (my preferred method)

Thank you :)

I'm reasonably confident that the features you're describing could be achieved using commercial off-the-shelf products. I guess it may work out a lot cheaper to build your own solution, and of course it's a fun and satisfying project in its own right, but have you considered the 'buy' rather than 'make' option?

Hi Peter

I know it can be done with some commercial thing, but like i stated in the OP am disabled and have allot of time and this subject interest me allot, apart from that i don't really have the finances to just go out and buy.

BTW is there some newbie friendly tutorial that show how to control DC motors with a timer? I just need the syntax for .. if time is xxx then set pin y to HIGH But all i get is ppl making a alarm clock or something weird

Hi kimbo001,

There is a delay() function that can get you started, but I would suggest maybe a Real Time Clock circuit.

If you want to test the motor with the delay function, then you can try this. Delay(Seconds * 1000); this will convert your Seconds into actual time seconds. or if you want minutes and hours, then you need to use what is known as a nested loop.

int seconds, minutes, hours = 0;

while( hours != 1 /*the number of hours you want to set*/ ) 
 while(minutes != 60)
    while(seconds != 60)

Thank you

I bought a RTC for my arduino, what i am looking for is just the code to make to motor turn at certain time

At 6:00 turn motor1 for 20 secs forward .. something like that

I apologize for my newbie'ness but i thought i will get some sample i can just adapt but all Google give me is ppl building alarm clocks with LCD display, if that is not all most of these ppl don't even give you the code they just put a video on youtube with the result.

I understand that the norm is to let the newbi try first and then help him/her from there so just show me some small piece or point me to a sketch the control dc motors with RTC and when i have something to show i I'll ask from there please

Oh ok well if your using a motor then you might need a H-bridge to run the motor, if you didn't already know that.

umm, what you can do is use that nested loop (just the seconds part) and set the delay as delay(20 * 1000); is 20 seconds and during that time you set your motor.

while(delay(20*1000) != 0) { digitalWrite(motorForPin, HIGH); //on for 20 seconds } // when the delay is done, motor off digitalWrite(motorForPin, LOW);

something like that. Im getting a RTC for myself, for right now I just use the nested loops, but I try to avoid them.

while(delay(20*1000) != 0)

If you’re going to post uncompiled pseudo code, can you please make it clear?

Tx HazardsMind

It is me and the drawing board now, i will post a sketch when i have something.

Edit: HazardMind, was looking at the code you gave again. Were do you actualy read the time from the RTC?

My bad.

boolean EndTime = false;
while(EndTime != true)
   digitalWrite(motorForPin, HIGH); 
   delay(20*1000);//motor on for 20 seconds
   EndTime = true;
digitalWrite(motorForPin, LOW); // when the delay is done, motor off

What is the while loop for?

My code doesn't use the RTC for the 20 seconds, in fact im not sure if the RTC can put out the time your looking for. I dont have one yet, but maybe someone else knows how it works.

My guess is that the RTC puts out a pulse, and you need to use an interrupt pin to get that pulse and with some code, make an actual timer. Like a stop watch. I need to look more into the RTC myself.

The code I posted is just for you to test a motor that will be on for a certain time delay. BTW, the delay function is in milliseconds, so 1000 milliseconds = 1 second. So if you want 20 seconds, then you multiply 20 and 1000 milliseconds to give you 20 seconds.