How to activate a relay on a frequency for a certain duration ?

Dear all,

First of all, i would like to apologize if this project has already been done ? I made some search, perhaps without the good words...

I am quite a newbie regarding arduino (and electronics). I have some basis with linux terminal, html, python, raspberry... And i am really interested in arduino (but don't even know a bit of code, i just start to dive inside...). Seems a very cost effective system for my use.

I am planning to build a small controller which will have:

  • 2 x rotating switch for the user to fix manually 2 values A & B
  • 1 x output for a relay
  • 1 x input for an immediate manual start
  • 1 x additionnal switch for a master/student relation between 2 controllers
  • 1 clock

Rotating switch for value A will fix a frequency (every 1min, 5min, 10min, 20min etc...)

Rotating switch for value B will fix a duration (for 10s, 30s, 60s, 120s etc...)

When i start the controller i would like that:

  • it starts to check the time
  • after 1 frequency passed (value A) it shut on the relay for a certain duration (value B)
  • if first input is activated it forget the time and launch a run for the relay with value B
  • if the switch is activated, it forget the time for ever and only listen for input 1 to launch a duration

Can you please help me to decide:

  • what is the smallest arduino that can accept this small process ?
  • if you can just take 2 minutes to give me some guidelines or starting point ?

Many thanks in advance for your help

All the best

Bari

PS: this is my first post here. Excuse me if i forget t make a presentation somewhere or something like that. And also, i apologise if i make a lot of mistakes when i write my post but i learned english after school. Just by talking with international colleagues. It's when you need it that you realise that oh fuck, i should have worked a bit more at school haha

after 1 frequency passed

Can you rephrase this or tell us what you mean by "1 frequency" ?

It means for exemple:

  • Frequency is set at 1 min and duration 30s
  • i start the controller at 00h00
  • at 00h01, the controller will switch on the relay for 30 secondes
  • so at 00h01 and 30 secondes, it shut off the relay and memorize the time
  • then at 00h02 and 30 secondes, it will switch on again the relay for 30 secondes

etc...

how to handle A: every 1 minute B: on for 5min?

knut_ny:
how to handle A: every 1 minute B: on for 5min?

Like the way you make it short ! Cool. Thanks.

  • Frequency is set at 1 min and duration 30s
  • i start the controller at 00h00
  • at 00h01, the controller will switch on the relay for 30 secondes
  • so at 00h01 and 30 secondes, it shut off the relay and memorize the time
  • then at 00h02 and 30 secondes, it will switch on again the relay for 30 secondes

So what you want is the relay to turn ON every time A elapses and you want it to stay ON for Time B.
Is this correct example: A is set to 1 minute and B is set to 120 seconds?
1min 120sec 1min 120sec
Start ---- Relay turned ON -------- Relay turned OFF ---- Relay turned ON -------- OFF---- etc.

How many positions are there for each rotary switch?

The uno is the common starting point for most beginner and intermediate project. Physical speaking the pro mini is the smallest "arduino product", but it requires an external programmer to communicate with the computer. Looks like you need maybe a dozen I/o pins which is fine for the uno. Memory is rarely problem. Programming - wise you should work through some the examples like blink without delay. You can set interval and run times using a two potentiometers on analog pins. Arduino comes with a built in clock and timers.

LarryD:

  • Frequency is set at 1 min and duration 30s
  • i start the controller at 00h00
  • at 00h01, the controller will switch on the relay for 30 secondes
  • so at 00h01 and 30 secondes, it shut off the relay and memorize the time
  • then at 00h02 and 30 secondes, it will switch on again the relay for 30 secondes

So what you want is the relay to turn ON every time A elapses and you want it to stay ON for Time B.
Is this correct example: A is set to 1 minute and B is set to 120 seconds?
1min 120sec 1min 120sec
Start ---- Relay turned ON -------- Relay turned OFF ---- Relay turned ON -------- OFF---- etc.

How many positions are there for each rotary switch?

Thanks ! I need 10 positions on each rotary switch. If this switch take too much pins, i am open to another way to set this 2 values.

seanz2003:
The uno is the common starting point for most beginner and intermediate project. Physical speaking the pro mini is the smallest "arduino product", but it requires an external programmer to communicate with the computer. Looks like you need maybe a dozen I/o pins which is fine for the uno. Memory is rarely problem. Programming - wise you should work through some the examples like blink without delay. You can set interval and run times using a two potentiometers on analog pins. Arduino comes with a built in clock and timers.

Thanks for the guidelines. I will investigate in the example of the sites like blink without delay.

Will try also with the UNO, and then, if it works, will try to use it with the pro mini.

Thanks !

You may connect a 10 position rotaly switch to an anlog input if you add 11 resistors..

knut_ny:
You may connect a 10 position rotaly switch to an anlog input if you add 11 resistors..

Thanks for the advice ! Sounds good. :slight_smile: