Basic Timing Control Of Multiple Relays For Fire Station Alerting System

Hello,
I would like to start of by saying that I am new to Arduino but have worked with controls and contact closures for years. In the past I used PICO controllers to handle applications where I needed multiple relay closures with different timings. I am hoping the Arduino route is a more cost effective and hands on way to accomplish the same task.

I have an UNO and an 8 relay board that activates when a pin is brought low. This works great but the problem i have is figuring out a script to do the following:

PIN 2 = INPUT

PIN 13 = OUTPUT - Relay 1
PIN 12 = OUTPUT - Relay 2

The logic is that upon giving 5 volts to PIN 2 I would need Relay 1 to close for 5 Seconds and Relay 2 to close for 120 Seconds.

This would translate to a Bell ringing for 5 seconds and LED's that are mounted in the station to be activated for 120 Seconds.

The issue that I have seen in everything that I have read is that using DELAY will only allow one function to happen which would not work for me in this case. If somebody could point me to some documentation, or provide some code to get started on this I would be very grateful. It seems as though the logic is very simple but maybe I am just looking way to deep into this.

Steve

In the IDE examples you will find the "blink without delay" example. This method will let you time multiple events in a non blocking way. In the File menu, Examples, Digital,

Thank you,
I did start with that example prior to posting here, but I do not understand how to actually have the function occur for the time set. In that example, they use long interval = 1000 as a time to compare a value to. When that value is above that 1000 then the led changes states if on then it goes off and vice versa. How can I take that interval value and apply it to my function... For example, could I do something like:

digitalWrite(ledPin, interval)

or something similar? I imagine I am probably way off target here on this. I do appreciate your reply.

stevecast2024:
Hello,
I would like to start of by saying that I am new to Arduino but have worked with controls and contact closures for years. In the past I used PICO controllers to handle applications where I needed multiple relay closures with different timings. I am hoping the Arduino route is a more cost effective and hands on way to accomplish the same task.

I have an UNO and an 8 relay board that activates when a pin is brought low. This works great but the problem i have is figuring out a script to do the following:

PIN 2 = INPUT

PIN 13 = OUTPUT - Relay 1
PIN 12 = OUTPUT - Relay 2

The logic is that upon giving 5 volts to PIN 2 I would need Relay 1 to close for 5 Seconds and Relay 2 to close for 120 Seconds.

This would translate to a Bell ringing for 5 seconds and LED's that are mounted in the station to be activated for 120 Seconds.

The issue that I have seen in everything that I have read is that using DELAY will only allow one function to happen which would not work for me in this case. If somebody could point me to some documentation, or provide some code to get started on this I would be very grateful. It seems as though the logic is very simple but maybe I am just looking way to deep into this.

Steve

I don't want to be rude.
I would not trust an Arduino for implementing a real fire station alerting system, unless you are just researching or experimenting. But you know these kind of products need to be robust against failure, certificated, guaranteed and all that stuff.

You can just use delay. When you detect a signal on pin 2 use digitalWrite to set your two outputs LOW. Delay for five seconds then set the bells back to high. Delay for 115 seconds, set the led relay high.

This method is useless if you need the arduino to be doing other stuff at the same time, but for your stated requirement, it will do the job.

I wrote an extended demo of the blink without delay technique in the first post of this Thread

I agree with @wildbill that using delay() is fine if it meets your needs.

And I share @mart256's caution.

...R