Fun with Boolean Logic!

So have three inputs to a lightbulb. Each input has three states: null, closed or open.

The three states are "Manual", "Temporary Override" and "Auto"

The Manual state overrides all other states

The Temporary Override state overrides Auto, but is overridden by Manual

The Auto state does not override any other states.

Does anyone know how to accomplish this?

Thanks!

Edit: I should have specified- I'd like to do this with relays/transistors if possible.

#define Auto 1
#define Temporary_Override 2
#define Manual 3

#define Null_ 0
#define Closed 1
#define Open 2

int current_state = 3;
int operating = 1;

void ChangeLight(int lightstate, int operator)
{
  if (operating <= operator){ 
  current_state = lightstate;
  } 
}

Cheers

@ArduinoM-

Sorry, I should have been more specific:

How do I do this with switches/relays/transistors?

Each input has three states: null, closed or open.

What are these 3 states, physically? Most people would consider "open" to be a "null" state.

Plus, everyone I know considers "Boolean logic" to be confined to a domain with only two possible states.

@Ran Talbott

Sorry, these cold meds are really zonking me out.

I have a solid state relay that I'm controlling with this. The default state is off, but it has inputs for both on and off. (the "off" input is meant as an override.)

So my system has three inputs to the relay. A toggle switch, a timer relay, and the arduino. I want the arduino to be in control unless I need to override it with the timer relay. I would also like to override both of those using the toggle switch.

So technically, there are two possible states, but I'm just not lucid enough to describe them appropriately.

"null" is open, but it doesn't override anything, whereas "off" is open and will override.

You litterary want a boolean logic diagram?
or how to code this with input and output pins of the arduino?

David

@Ran Talbott, You can do boolean logic with 3 states, Had to do this on my last test. Have you not seen gates with 8 or more inputs :wink:

cheers

@ArduinoM:

I just want to know how one could use relays or transistor (or logic gate) to accomplish the aforementioned behavior.

I thought that using boolean logic would help, but perhaps I'm wrong.

Sorry!

Auto = NOR(Manual, Timer)
Timer = AND(NOT Manual, Timer)
Manual=Manual

Is your timer relay really "on/off"? Or is it "on/don't care"? I.e., do you want the SSR to work when either the Arduino or the timer is "on"? Or only when both are 'on"?

It seems like your toggle switch is actually 3-state, not binary: "force on", "force off", and "don't care". Is that the case?

@ Ran Talbott

I think you're correct.

So here's another description of my system now that I'm not all strung out on cold medicine:

I am controlling a solid state relay with three states: off, on, and force off. (kind of a break-before-make-before-break) It's normally off. If you close the "on" circuit, it goes on, but if you close the "on" and "off" circuits, it will go off.

Currently I have the "on" circuit jumpered, and I am controlling the "off" circuit with a SPCO switch.

The idea is that if the switch is open (center), then the relay is closed, if the switch is closed (up), then the relay is open, and if the relay is closed (down), then state is determined by a timer relay.

The timer relay I have is timed SPDT relay, but it kind of has a third state; off. I think perhaps I could put an OR gate on both L1 and L2 to determine whether to delegate to the Arduino.

The Arduino is the low man on the totem pole. If the relay is off and I haven't used the switch, then the Arduino should determine state.

Sorry, I know I'm being clear as mud here. Thanks for your input though!

I am controlling a solid state relay with three states:

That is the bit that still doesn't make sense, can you post a link to the data sheet of the controller you are using.

It depends on how this controller works, current, voltage and so on as to where the pull up and pull down resistors should be placed in the circuit.

But basically there should be a weak pull on the SSR input with a strong pull (in the other direction) on one of the switch poles with the other switch pole going to a driver circuit controlled by the arduino. The centre of the switch going to the SSR.

While on the subject of boolean logic. What do you have when you invert the signal named "S" ?

SNOT, of course. ;D

Sorry, the morning coffee just kicked in. :wink:

Lefty

To do this with Boolean logic, you should define 5 binary inputs:

  1. Switch up
  2. Switch down
  3. Relay NC contact
  4. Relay NO contact
  5. Arduino

Separating out the NO and NC contacts allows for the conditions where the relay isn't powered or the switch is centered: in those cases, both variables will be "0".

Then you can make a truth table to identify the action for all possible states (of which only 18, not 32, will be valid, because the relay and switch each have a "11" state which is theoretically impossible).