Create a timer via web

Good morning guys !!

Well, I need a little help with a project I'm working out.

I am creating a pump connected to a relay, in which we already have the function on and off via ethernet.

So we thought of putting a TIMER to switch on the pump, for example, from 12:00 until 13:00, but we have no idea where to start.

The function on / off is connected via JavaScript, which is connected to the Arduino code. We would need something like that, but with one TIMER.

If anyone can shed some light, I would be grateful.

Thank you !

Is this the same urgent problem posted in the Italian and Portuguese sections of the forum?

Yes

That is a bad idea to cross post...

Well you can add à RTC on the arduino side and use that to trigger locally or use a computer to schedule a task at a given time by sending on or off through the internet

J-M-L:
That is a bad idea to cross post...

Well you can add à RTC on the arduino side and use that to trigger locally or use a computer to schedule a task at a given time by sending on or off through the internet

You just tell me the obvious, now how I do it? I already have the RTC in hand, I need a light with codes.

Well it’s not obvious to us what you have and the way you want to do it, so be clear in your questions. If you want help, behaving the right way helps…

Do you know how to connect the RTC and read the time?

If so do something like

const unsigned int startTime = 60*12+0; // nb minutes since midnight for 12h00
const unsigned int endTime = 60*13+0; // nb minutes since midnight for 13h00

in your loop just get the hour and minute from RTC and do

unsigned int currentTime = 60*hour+minute;
if ((currentTime >= startTime) && (currentTime <= endTime)) {
// switch on
} else {
// switch off
}

Probably good to memorize status you are in

Pelilo:
You just tell me the obvious, now how I do it? I already have the RTC in hand, I need a light with codes.

First mention of an RTC.
Anything else you think you need to tell us?

Pelilo:
Well, I need a little help with a project I'm working out.

I am creating a pump connected to a relay, in which we already have the function on and off via ethernet.

So we thought of putting a TIMER to switch on the pump, for example, from 12:00 until 13:00, but we have no idea where to start.

The function on / off is connected via JavaScript, which is connected to the Arduino code. We would need something like that, but with one TIMER.

If anyone can shed some light, I would be grateful.

Thank you !

I'd leave out Javascript and create an Arduino webserver serving HTML pages, which can handle five reuests

"/" main HTML page showing information about current pump state and timer settings and links to 4 more
requests:
"/pump-on" (this request will set the pump manually toON, no matter about time and timer settings)
"/pump-off"(this request will set the pump manually to OFF, no matter about time and timer settings)
"/pump-timer" (this request ill set the pump to switch accordingly to RTC time and current timer settings)
"/settings-page" (this request will respond with an HTML form which shows some data entry fields for timer data entry)
"/save-settings" (this request will save the data, sent from the settings-page, to Arduino EEPROM
Each request will send some visual HTML response to show what's going on

Currently the timer switch is just for one switching channel (pump), or how many switching channels /relays)?

And how many ON/OFF switching times do you want to have (per day)?

What's the actual hardware to be used?

  • Arduino UNO
  • "Ethernet shield!) with LAN cable
  • RTC DS3231
  • mechanical or SSD relay module

Or different?

What about the current Arduino code you have now?
Is it modular code and easily extendable?

What do you think?
Your Arduino-programming skills are very limited, or what?
What about your HTML skills, creating HTML forms and such?Sufficient?
Or would you need help with HTML, too, besides of help with Arduino-coding?