Detect wire connections (was: I have a puzzle for me)

I’ve been working on a puzzle and I was wondering if anyone here might have suggestions.

Its basically two groups of four wires: A B C D and 1 2 3 4. The objective is to connect the proper pairs: A must go to 1, B to 2, C to 3, and D to 4. Correct pairs should light individual LEDs and any incorrect connections should have no result (or, even better - some sort of negative result, like lighting a 5th “incorrect” indicator). It would be nice too if there is some way to give incorrect results if someone is cheeky and attempts to connect multiples together at the same time.

I have an arduino uno handy as well as a DMX shield. Having it send out triggers for DMX when connected correctly would be the next level of useful.

3 Likes

An analog strategy: Put different voltages on A, B, C, and D. Put window comparators on 1, 2, 3, and 4, with an LED on each that lights up if the voltage is within the window. Set up the windows to be in a narrow range around each of the voltages used on A–D. Put resistors on A–D so they will passively mix their voltages if two or more are connected. By choosing suitable voltages, window limits, and resistance values you can make it so any combination of two or more of A–D will produce a voltage falling outside any of the windows. You could use logic (maybe even just diodes and a transistor) to light up a fifth LED if none of the 1–4 LEDs is lit.

2 Likes

I might give this a try on breadboard!

If memory serves there is an ethernet cable tester strategy that does what you need for 4 pairs of wires. Keep me posted.

2 Likes

There’s also this

though it doesn’t quite do (my interpretation of) what you asked: “If there is a break in any of the conductors none of the LEDs will light. If there is a short between conductors the LED between those conductors will not light.”

2 Likes

As much as I appreciate the beauty of doing things with analog or logic circuits, if the ultimate goal it to send DMX, I don’t a reason not to just implement it on an Arduino. Simply scan the connections and check against the correct solution. Then light up LEDs accordingly. I have quite some experience sending and receiving DMX via Arduino, and it works a charm.

2 Likes

With Arduino 4 out put and 4 input digital pins

in sequene set a output high and read all 4 inputs.

or am i missing something?

1 Like

Yeah but sometimes it’s fun to be able to say “look mum, no Arduino”.

3 Likes

Also, please keep in mind that I cant really code.

I can change values and copy and paste all day long - but when it comes to actually generating new code I am useless.

1 Like

I am a hoarder of useful code, macros and batch type files and trickery, most pasted into ‘autocorrect’ substitutions (some dynamic in vscode Changing some shortcut label to ‘paste in’ code I know works. I don’t think I’ve written original code since my Borland days in the 80’s

Just remember it’s not plagerism, it’s research! {ref. Lobochevsky.V arr. Lehrer.T}

Something like this should sort of work
Pair 1 being pins 2-6
Pair 2 being pins 3-7
Pair 3 being pins 4-8
Pair 4 being pins 5-9

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(2,OUTPUT);
  pinMode(3,OUTPUT);
  pinMode(4,OUTPUT);
  pinMode(5,OUTPUT);
  pinMode(6,INPUT);
  pinMode(7,INPUT);
  pinMode(8,INPUT);
  pinMode(9,INPUT);
  digitalWrite(2, LOW );
  digitalWrite(3, LOW );
  digitalWrite(4, LOW );
  digitalWrite(5, LOW );
  
  
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(2, HIGH );
  if (digitalRead(6 == HIGH ))  { Serial.println("Pair 1 conneted");}
  if (digitalRead(6 == LOW ))   { Serial.println("Pair 1 Not conneted");}
  if (digitalRead(7 == HIGH ))  { Serial.println("Pair 1 missconnected to pair 2");}
  if (digitalRead(8 == HIGH ))  { Serial.println("Pair 1 missconnected to pair 3");}
  if (digitalRead(9 == HIGH ))  { Serial.println("Pair 1 missconnected to pair 4");}
  digitalWrite(2, LOW );

  digitalWrite(3, HIGH );
  if (digitalRead(6 == HIGH ))  { Serial.println("Pair 2 missconnected to pair 1" );}
  if (digitalRead(6 == HIGH ))  { Serial.println("Pair 2 connected" );}
  if (digitalRead(7 == LOW  ))  { Serial.println("Pair 2 Not conneted");}
  if (digitalRead(8 == HIGH ))  { Serial.println("Pair 2 missconnected to pair 3");}
  if (digitalRead(9 == HIGH ))  { Serial.println("Pair 2 missconnected to pair 4");}
  digitalWrite(3, LOW );

  digitalWrite(4, HIGH );
  if (digitalRead(6 == HIGH ))  { Serial.println("Pair 3 missconnected to pair 1");}
  if (digitalRead(7 == HIGH ))  { Serial.println("Pair 3 missconnected to pair 2");}
  if (digitalRead(8 == HIGH ))  { Serial.println("Pair 3 connected"); }
  if (digitalRead(8 == LOW  ))  { Serial.println("Pair 3 Not conneted");}
  if (digitalRead(9 == HIGH ))  { Serial.println("Pair 3 missconnected to pair 4");}
  digitalWrite(4, LOW );

  digitalWrite(5, HIGH );
  if (digitalRead(6 == HIGH ))  { Serial.println("Pair 4 missconnected to pair 1");}
  if (digitalRead(7 == HIGH ))  { Serial.println("Pair 4 missconnected to pair 2");}
  if (digitalRead(8 == HIGH ))  { Serial.println("Pair 4 missconnected to pair 3");}
  if (digitalRead(9 == HIGH ))  { Serial.println("Pair 4 connected");}
  if (digitalRead(9 == LOW  ))  { Serial.println("Pair 2 Not conneted");}
  
  digitalWrite(5, LOW );

  delay(10000);

  
}
2 Likes

In this case, I would add a 1k series resistor to the output pins, and a 10k pull down resistor to the input pins

1 Like

Yeah, was thinking the pull downs just to ensure a floating input does not cause oddity.

I appreciate the responses - I have just been busy repairing drywall the last few days. In the mean time I have been diving into QLC+ to learn the ins and outs of setting up and controlling a fairly complex custom lighting & effects rig. My project leader has big aspirations and I’m crazy enough to attempt to come up with ways of executing them.

Which QLC, I found 5 to be less easy to use than 4 and gave up… that was a while back mind.

@twinturbo Sorry to hijack your thread! I was wondering if you happened to have the kicad footprint/schematics you did for the PB86 buttons

So far QLC seems pretty straightforward. Its like a new language since I am learning DMX in parallel. I am afraid I’ll soon be asking it to do things that it isn’t capable of.

Having no idea what DMX is I tried googling it. LOL. Can’t be done.

In my uninformed opinion it seems like “budget MIDI”.

Yeah, I looked it up on Wikipedia.