How to program a simple "if-then" program that triggers relays from pairs.

I have (4) 12v relays already controlled thru DMX. I have (8) new channels I need triggered by the 8 possible combinations of the first 4 relays. I've attached a PDF detailing each of the 8 events.

Motion Air bags (relays 1-4) Air blast (channels A-H)

1 Forward 1,2 AB 2 Back 3,4 EF 3 Left 1,4 HG 4 Right 2,3 CD 5 FL 1 AH 6 FR 2 BC 7 BL 4 FG 8 BR 3 DE

I'm a beginner to say the least - but I'm thinking I'll need some kind of an IF - THEN kind of program. So the "air bag" column will be the IFs and the "air blast" column will be the THENs.

Does this make sense? Is there a better method that will achieve the same results?

And can someone point me in the right direction (or even to a similar example) of what the code would look like?

Any help or thoughts would be much appreciated! Thanks in advance!

Sorry - the formatting is messed up and I can't the attachment to work. But the info should still be understandable.

If you put a space before the closing ) the smiley will go away.

I'm not sure how to interpret this

1 Forward 1,2 AB 2 Back 3,4 EF

5 FL 1 AH

Does it mean, for example that you want to turn on Relay's 1 and 2 and also channels A and B.

Or is something external (what?) switching the relays and the Arduino needs to detect their states and if both relays 1 and 2 are on it should set channels A and B on?

And what do the words Forward and Back and FL signify.

A series of IF statements, or a cascade of IF ELSE statements should be suitable

...R Planning and Implementing a Program

Thanks, response was on point.

Yes - the arduino will have:

  • 4 INPUTS from 4 air valves

  • 8 OUTPUT to 8 relays which control other air valves

I just need the signal In to be a trigger to energize a specific pair of relays.

FL = Forward Left BR = Back Right Etc.

Left, Right, Up, etc are directions a drop floor can drop to. Each of its 4 corners is controlled independently by air bags 1-4.

So the table you asks about is basically just a explanation of their configuration/numbering.

Thanks. Much appreciated

Update - I'll only need 4 outputs instead of 8. Scrapping the 4 diagonal channels (LR, BR, etc). So there will only be 4 in and 4 out.

I'm looking into your recommendations and the solution is definitly in these sections, thanks.

Do the inputs and outputs being balanced now dictate if one route may be the simpler solution?

Or maybe a simpler solution would be to bypass the arduino now, and just run a wire between relays of in and out so it will automatically energize?

The only obstacles in this case would be: - the ins are 12v and outs are 24v - each of the 4 outs have to be triggered only when the corresponding PAIR of INs is energized.

Kind of thinking out loud here..

Logic systems based solely on relays have been common for decades. You should see the controls of a complex older model railway system. And just think what the telephone system was like that had abandoned all the relays that the model railway club uses :slight_smile:

You could use a 24v relay to trigger another relay to trigger the 12v for the 12v relay (Heath Robinson / Rube Goldberg at their best).

You could use a transistor to sit between the different voltages but it would probably reverse the logic.

A simple resistor would probably be sufficient to drop the 24v to 12v - just do your Ohm’s law calculations