Is there Timer in Arduino

I have a motor that is controlled by the Arduino to do the forward and reserve direction. is it possible to set a timer to make my motor start working from 4 am to 7 pm?

yes timer is there

If you mean is there a clock then the answer is no, but there may be ways round that

How accurate do you need the clock to be over say a week ?

Which Arduino are you using ?

i have a project where the motor needs to start working at 4 am till 7pm. it must be operational everyday. im using an arduino uno.. hw can i set my clock?

Using the Time library you can set variables to hold the time and maintain it but it will not be very accurate over a period. How accurate do you need it to be ?

The TimeAlarms library would allow you to use the time to create alarms to trigger events but will be dependant on the accuracy of the time

If you need accurate time then a Real Time Clock (RTC) would be a simple way to maintain accurate time

Which Arduino are you using ?

if i am using the Real Time Clock, do i have to include coding for the timer?. i have never used Real Time Clock

im using the Arduino Uno

Some RTCs, such as the 3231 have built in alarms but of course you have to program them to be set to the right time and to react when the alarm is fired

It is often easier not to use the alarms and just test the time data yourself


if (hour >= 4 && hour <= 19)
  //do something
  //do something else

can you tell me where to pin the Real Timer in Arduino!! please.

Have you got an RTC and if so, what type is it ?

If not, then I don't know what you mean by "Real Timer"

I mean the Real Time Clock. Ill have to make a simulation first. i will use the tinkercad software to make the simulation then will buy my equipements.

Is there an RTC available in TinkerCad ?

Just checked, there is not RTC but I could see timer 555 and duel timer 556!!

If you used those then you might just as well use the millis() timer on the Arduino itself

My advice would be to get a DS3231 RTC and do it for real

at the moment I would not be able to buy these equipment.. but I could have made a simulation to show these methods can be used. but I'm just stuck on the clock. I already did a simulation to show how my motor is connecting with the arduino and show how the motor will do forward and reverse but I just need to set my clock from 4 am to 7 pm.

What Arduino board do you have? Some have built in RTC

Take a look at the example sketch that comes with the TimeAlarms library, assuming that is available in TinkerCad

im using the arduino uno

where will i get the TimeAlarms library?

Mr. Google is your friend

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.