How to program output (relay) on/off sequence w/ delays

JonW

Senior Member
I'm having a hard time trying to program a relay output to cycle a sequence of on and off for a specific period of time.

Here's the background: I have an espresso machine that I want to control via relay closure to automatically turn on and off at specified times as well as to be able to do it via a "Button".

Here's the options for being able to control it via the contact closure:
Contact closure for 1 second = turn machine off
Contact closure for 4 seconds = turn machine on (if already in off state)
Contact closure for 4 seconds = enter programming mode (if already in on state)

Now, I can't simply close the contacts for 4 seconds as I need to first turn it off (in case it was on) so that I don't put it into programming mode.

My psuedo code would look like this:
1. Output off (in case it was on)
2. Output on for 1 second (this turns the machine off in case it was already on)
3. Output off for 1 second (delay before trying to turn on)
4. Output on for 5 seconds (this is to turn it on)
5. Output off (make sure we are back in the off state).

Now, in the OmniPro, I tried this:
WHEN Button - Espresso On
          THEN Espresso Relay Switch OFF
          THEN Espresso Relay Switch ON FOR 1 SECOND
          THEN Espresso Relay Switch OFF FOR 1 SECOND
          THEN Espresso Relay Switch ON FOR 5 SECONDS
          THEN Espresso Relay Switch OFF

Unfortunately, this runs through all lines immediatly turning it off/on/off/on/off without waiting the specified # of seconds. I now realize the controller does these actions immediately and schedules the corresponding off/on after the delay.

How can I get the controller to do the on/off sequence with the proper delay between steps?
 
You need FLAGS as triggers and a bunch of individual commands that trigger when the FLAG is ON/OFF or time expires. Need to break kout those events into individual commands. Examples....

WHEN FLAG 1 on, THEN Expresso ON for 1 second
When Expresso OFF,
THEN FLAG 1 OFF
THEN FLAG 5 ON
WHEN FLAG 5 ON, THEN Expresso ON for 5 seconds
etc
etc
 
Thanks, I got it now. I used a single flag as a delay in between the two contact closures.

WHEN Button-Espresso ON
      THEN Relay-Espresso ON FOR 1 SECOND
      THEN Flag-Espresso OFF FOR 3 SECONDS

WHEN Flag-Espresso ON
      THEN Relay-Espresso ON FOR 5 SECONDS
      THEN Flag-Espresso OFF



I know the last flag command is not needed. This should work well, but I may end up also wiring into the machine to tap a power lead and get a positive feedback as to whether or not it is on.
 
Back
Top