Switch 3 positions

A lot of nonsense talked here.

The switch you cited in #7 has two positions, the centre terminal switches to either one or the other of the side terminals.

The switch ENNF cited in #12 looks the same but has a central "OFF" position in which the centre terminal switches to neither of the side terminals.

To determine its position you neither want nor need a connection for the middle position as you know it is in this position by logic when neither of the other connections is made. Just connect the centre terminal to ground and the side terminals to two inputs using INPUT_PULLUP. If one or the other input is LOW, you know the switch is turned to that side, if neither is LOW, then it is in the middle.

(If both are LOW, then something is broken! :astonished:)

So you are dead wrong! That is exactly the switch you want. :sunglasses:

1 Like

So, I picked a good switch, but I was mistaken in saying to power it because it should be low, not high?

Just clarifying.

Did someone call ?

As suggested in post #18, if the switch has 3 positions, one of which is centre off, then you can detect the 3 positions as described

Connect the common pin to GND, use INPUT_PULLUP on 2 Arduino pins connected to the other 2 contacts. If either pin is LOW then the switch is in that side position. If both pins are HIGH then the switch is in the centre position

2 Likes

Thank you for clarifying, Mr. Bob

LOL.

It was unclear to begin with whether @supermarie has an SPDT toggle with center off, or really a 3PST toggle or even rotary switch.

Surprisingly, the answers for awhile didn’t depend on which…

It is interesting to me that nowadays switches run logic; I am perennially fascinated by household wiring from the 20th and now into the 21th century - mains voltages and operating currents making trips all over the place to grab up fixtures or outlets or switches, one circuit we have has on/off function at four places…

So primitive. Electricians employment insurance and maybe the Dept. of Fire Control also. :expressionless:

a7

In my years of designing homes I had 3 different electricians work for me. They could all do the job well, but the first one was the best. Unfortunately his talents were too expensive for my little company and he rightly got hired away, but while he was there I got him to help me understand the proper use of single-pole, 3-way, and 4-way switches and how to incorporate them into my designs.
Many of the homes we performed renovations or additions on had electrical nightmares that hid just below the drywall. I had to add a clause to the contract that allowed for it.
IMHO it would be better if the wiring was more direct and switches were LV or wireless. It would certainly lower costs and probably be safer. If you want another switch you simply buy one and sync it, no need to call Sparky out to work on it.

I'm not overly fond of wireless.

Went to work at the clinic this afternoon, tried to log on to the department's computer (in fact, I also bring my own side by side, it's a pain but I retain my own records). First problem - I had a mental blank on my login ID and password - was a bit confused for a minute or so. It happens! :worried:

But I could not enter either into the login straight even when I managed to recall the correct details. Characters went missing, "Enter" did not work.

Flipped the keyboard, found the battery cover and extracted two "AAA" cells. Rubbed the terminals on my (Aldi - "work") pants and replaced them. Now we're in business!

OK, just imagine every remote switch in a house with a battery that will die sooner or later!

Classic tradeoffs.

At least the last electrician here had little metal widgets to put on the studs where he ran wires, to reduce the chance that a random drill or mail into a stud would catch a wire he’d run.

But that assumes evy’one is only going to be drilling or nailing where the studs are…

a7

Good points, granted. There are many options to mitigate those, but they are valid concerns regardless.
There are cheap LV wired options too, plus it's super easy to run extra cat-6 when the walls are open, or even to run a new one in existing walls. Certainly much easier than running a new 14/2. I built out an old courthouse into a new design firm with over 200 cubicles. The difference in the cost of running 4 cat-6 as opposed to 2 cat-6 to each cubicle was under 15% because the labor overlap was just about 100%.
As there are still many standards for wired and wireless AC control no one tech is getting all the attention that it disserves. I understand that a few hyper-global mega companies got together to define one for IOT. So hopefully, that one or one like it will go mainstream and get properly developed for open use. Then maybe we'll get switches with solar panels for cover plates.

It's sad to think of how much cool stuff there is coming I'm just not gonna be around to see.

On the other hand, I'll prolly not have to worry about the worst effects of global climate change.

Hmm…

a7

Swings and roundabouts.

But it is going to be - already is - extremely worrying for my kids!

And much of the supposed "cool stuff" turns out to be crap. :roll_eyes: Just look at for example, Windoze 10!

Not Cat 6, but my house of nearly 30 years is wired for LV control. Pity I never "got around" to completing the control system. :roll_eyes:

Gotta get yourself under control, Paul. JK
I'm sure we all know about unfinished projects. I have half an acre of tree to process and sell so I can build my garage, a forge waiting to be built, and a 1980 CJ7 waiting to be frame-off restored.

For a switch with three ACTIVE positions you will need something like this

This is how you wire it
http://info.ee.surrey.ac.uk/Teaching/Labs/docs/RotarySwitchHowTo.pdf

Take special note of this. It may not suit your requirements

Wait, you can finish projects?

a7

finish
[ˈfiniSH]
VERB
bring (a task or activity) to an end; complete.
"they were straining to finish the job" · [more]
synonyms:
completed · concluded · consummated · finalized · terminated · [more]
complete the manufacture or decoration of (a material, object, or place) by giving it an attractive surface appearance.
"the interior was finished with V-jointed American oak"
synonyms:
varnish · lacquer · veneer · coat · stain · wax · shellac · enamel · put a finish on · glaze · give a shine to · gloss · polish · burnish · smooth off
dated

It's one of these, but yes it is possible :grinning_face_with_smiling_eyes:

"terminated", not always by me, is about as close as I usually get. :expressionless:

a7

Hi, @supermarie
Welcome to the forum.

That is a 3 position switch, LEFT, CENTER and RIGHT.

Can you please tell us your electronics, programming, arduino, hardware experience?

This circuit diagram may help, the fact that you have no connections in the center position can be used to detect a center position.
Look at the table in the diagram of how the pins logic levels would be with each different position.


Some code for UNO or Nano.

int RPin = 5; //Assign pin names and number
int LPin = 3;
bool RState = 0; //Assign variables
bool LState = 0;

void setup()
{
  Serial.begin(115200);
  Serial.println("Test code for three position switch");
  pinMode(RPin, INPUT_PULLUP); //Setup input pins with pullup resistors ON
  pinMode(LPin, INPUT_PULLUP);

}

void loop()
{
  RState = digitalRead(RPin);  //read the input pins
  LState = digitalRead(LPin);

  if ( (RState == LOW) && (LState == HIGH)) //test for right position
  {
    Serial.println("Switch in Right position");
  }
  if ( (RState == HIGH) && (LState == HIGH)) //test for center position
  {
    Serial.println("Switch in Center position");
  }
  if ( (RState == HIGH) && (LState == LOW))  //test for left position
  {
    Serial.println("Switch in Left position");
  }
  delay(500);
}

If you open the monitor in the Arduino IDE and set its baud to 115200, you should see the monitor display the positions of the switch as you change them.

Hope this helps.

Tom... :smiley: :+1: :coffee: :australia:

1 Like

Do you actually need to test both pins at the same time to determine the switch position ?

int RPin = 5; //Assign pin names and number
int LPin = 3;

void setup()
{
  Serial.begin(115200);
  Serial.println("Test code for three position switch");
  pinMode(RPin, INPUT_PULLUP); //Setup input pins with pullup resistors ON
  pinMode(LPin, INPUT_PULLUP);
}

void loop()
{
  if (!digitalRead(RPin)) //test for right position
  {
    Serial.println("Switch in Right position");
  }
  else if (!digitalRead(LPin)) //test for left position
  {
    Serial.println("Switch in Left position");
  }
  else
  {
    Serial.println("Switch in Centre position");
  }
  delay(500);
}