multitasking arduino at set times of the day

Hello

i am very new to arduino so please forgive me for my lack of knowledge. and this is my first post ever.
i am manly interested working with lighting/ leds because of the job role im in, and have done a few projects of my own at home, but not all using arduino.

so this is what im trying to accomplish, if possible.

im wanting arduino to control my strip lights but at different times of the day, but not just that im after two different effects within that same 24 hours.

so for example from the hours of 6am to 6pm i want my strip lights to fade in and out like the mac power light. i can make the lights do as i wish just not with all the timing side of things and not working with the other effect.

and from the hours of 6pm to 6am im wanting them to be on at around 50% then pulse to imitate a heart beat so 50% jump up to 100% small gap while it drops back down to 50% then 100% before fading slowly back to 50% then repeat.

being able to adjust the time in the 50% range would be great.
ive been searching the web with no luck, im thinking i need to some how incorporate a RTC in to the mix or have some sort of timer circuit going before the arduino and then just run two of them, with each one controlling one effect each.

if anyone could please help or guide me in the right direction it would be much appreciated, like i said im a noob to the arduino and coding but ok at the circuit and practical side and not afraid to get stuck into new things.

Hello Bryan
A few things to help you on your way:
Have you read the stickies about posting/how to use the forum? if not have a look then post your existing code so everyone can see where you are at.
Post a circuit diagram of what you have you have
Provide info on what components you are intending to use with links so we can check it through.

I am no expert (more an enthusiastic amateur) but if i were to tackle this project I would start with a RTC (Real Time Clock), a potentiometer to adjust the 50% value and the appropriate driver to run the LED strips (needed as the Arduino will not switch that many LED's).
To adjust levels will use PWM so the Striplights need to be dimmable.

I would start with the example programs to get a feel for the coding required then draw up a flow chart to describe the steps and then look for more advanced examples to match those steps.
My "goto" start point is Planning and Implementing an Arduino Program

Have a look at the demo codes for several things at the same time, Blink without delay and using millisecond, these are also all good starting points.

Hi thanks for the reply.
i am new to all this forum stuff so apologies if posted in wrong place.
i didn't fill the need to send diagram as like you said its just a small strip of leds and a power transformer at the moment and the electronics side of things i have no problem with, its more about the code.
i have been playing around with different example codes and as i stated i have the lights doing as i want i just dont know how to incorporate timing into the mix.
i did have a little read of the blink without delay and millis but heard the timings not that precise and this is going to be a project thats never turned off.
At the moment i just want to know if its possible or would it be better/easier to do it the other way i said by using a separate timer circuit to control the on/off state of two arduino boards running an effect each.

Well if you post the code that works others will look at and suggest answers to the timing, without your code no one can help you.

Are you able to dim the LED's at the moment?

As for the 6am to 6pm etc that is very easy with an RTC: read time -> compare with preset value -> is time between 6am - 6pm? if yes then do option (case) 1 if no then option (case) 2.

All the rest of the timing/fading/pulsing/dimming is done using millis within the cases/functions.

bryan8040:
using a separate timer circuit to control the on/off state of two arduino boards running an effect each.

That would be wasteful, but it would also keep you from having to learn anything. Take the easy expensive route? Or do a little reading and learning and get this done with one board? It isn't hard. Beginner level stuff here. You need an RTC and you need to search for any of the thousands of examples of other projects using one to see how they go.

Hi thanks for the reply, I under stand what your saying and i do want to learn.
this coding stuff is very new to me but i know its also very useful and a must for the future, i wish i learnt it back when it started out.
i got a little stuck and just wanted to know, like i asked if it was possible, because if it was not i would have done plan B, so thank you for guidance.
a am very new to all of this so can you recommend a RTC to use? the one i have is the ds1302 i know its a very cheap one.
also i was probably being blind but could not find any example for the RTC in arduino ide,
any help would be much appreciated even if it is just to kick me though the right door...

thanks again.

Use the DS3231 RTC, as it keeps accurate time. If you buy that particular module, you should modify it as described in this blog, to correct some of the bad engineering. There is good advice in that article about code libraries, too.

Google "arduino ds3231" for a large number of project examples.

bryan8040:
im wanting arduino to control my strip lights but at different times of the day, but not just that im after two different effects within that same 24 hours.

This is all well within the capability of any Arduino.

As you are a beginner I suggest you start with a simple program that emulates what you want to do with an LED - that is, it makes the LED fade the way you want and do so at intervals.

To start with don't worry about precise timing and get things to happen at about 1 minute or 5 minute intervals rather than at daily intervals - so you don't have to wait long to see if things work.. Just use millis() to manage the timing as illustrated in Several Things at a Time and in the link in Reply #1

When you can create a program and get the effects you want it will then be straightforward to convert it to using a Real Time Clock (RTC) module and daily intervals.

...R

Thank you all so much for your help, i definitely need to start at the beginning and take it step by step but now i feel like im getting somewhere, now i have been told the right direction and where to read up on this i cant wait to get stuck in.
sometimes i think can spend too much time on google and probably asking the wrong questions, wish i came hear first as you have all pointed me to what im after.

Thanks again..

Two basic techniques that come back time and again are the millis() based timing (see the "several things at a time" thread), and the finite state machine, where your program behaves differently depending on the state it's in, and you set the states based on some external input such as the time.