Home Creators Posts Import Register Favorites Logout

Content

This post contains links to the patrons-only resources to accompany the Connect the Wires puzzle at  https://www.patreon.com/posts/15900367

Arduino Code

https://drive.google.com/open?id=1mQ4jEjC6hso7xl_nmwYXqUFapI4gaWag

Fritzing Project

https://drive.google.com/open?id=12bBh4MKT1_R9n3qns9g6t_tUAur_wPJG

Wiring Diagram

https://drive.google.com/open?id=19KSk2nuL0rG3-RfVVoc0Nv8_eXbrtyO-

Additional Documentation

https://drive.google.com/open?id=1SaVm_cEq3vMoy2oMe--CLy1i5-Z64z4Z

Comments

Danny Gavord

I dont understand how this works. Are the other end of the stereo cables connected to ground or something? Or are there wires going back to ground on ardrino from the sockets to act as a connection when the cable is inserted? You make it appear as if you just have cables laying around and by inserting them it works as intended. Maybe I am missing something?

Keith Coleman

I have this hooked up but it is not triggering my cabinet lock. Could someone share the code with me on how to get this to trigger once the puzzle is solved. The cabinet lock is NO and once the puzzle is solved I need it to sent power to make it NC for a few seconds. Thanks!

Allison Cianci

We got the puzzle to work too, but can't figure out how to code it to get a relay to work. This code up here doesn't seem to be working when I add it in. Can you let me know what I'm missing? Thanks.

Skyler Haupt

Hi Alastair! Creating this puzzle but not using the LEDs. Probably a dumb question, but I'm new to tech... where do I put the ground wire if not connected to LEDs?

Robert Davis

How much of the code will I have to change to use a Mega2560? I wanted 12 connections (6 wires). It will deactivate a 12v mag lock.

James Sheahan

Hi Alastair. I have made a version with 4 pairs of terminals. When the Arduino is plugged into my PC's USB, it works fine. However, when plugged into an external 5V power supply, the puzzle solves when I am holding the second end of the final cable to be plugged in, i.e. I am about to plug in the final connector. I can see from the serial monitor that the first 3 pairs of terminals are connected and the final pair are not. Plugging in the first end of the final cable does not change this, but then it changes to connected (and so solved) when grasping the final cable even though not yet plugged in (and holding the plastic cover). Any thoughts why it may be doing this? I've tested it in many ways and it's definitely only when using the external power supply and only the 4th cable (no matter which of the 4 cables is used or 4 pairs of connectors is the final one being connected).

Robert Davis

You rock. I'll post a link to the video when I finish the puzzle. Can't wait to make some more of your designs. this is fun.

Robert Davis

is this the only line of code I need to add to send a signal to relay to deactivate mag lock?

Robert Davis

// This pin will be driven HIGH when the puzzle is solved const byte lockPin = A0;

Robert Davis

void onSolve() { #ifdef DEBUG Serial.println(F("The puzzle has been solved!")); #endif digitalWrite(lockPin, LOW); puzzleState = Solved; } /** * Called when the (previously solved) puzzle becomes unsolved */ void onUnsolve(){ #ifdef DEBUG Serial.println(F("The puzzle is no longer solved!")); #endif digitalWrite(lockPin, HIGH); puzzleState = Running; }

Robert Davis

i added a cycle low to high code when solved to watch the voltage. so it is cycling when i solve. but its not enough to activate the 5v relay. low voltage is always 4.2 and high is 4.6.

Robert Davis

I added a few pictures. I should not that I deleted all the code and ran a basic on/off code for pin 2 and it activated the relay. I also unhooked the LED on your code to see if they were causing the problem. Bit stumped at the moment.

Robert Davis

the relay is activating now. I added in this code pinMode(lockPin, OUTPUT);

Robert Davis

pinMode(lockPin, OUTPUT);{}otyro

Jeff Danevich

Alastair, can you please send me the full code to activate the relay? Not a 100% sure where to add Roberts code.

Jeff Danevich

Rober Davis, Keith Coleman or Allison Cianci can you help with the missing code for the relay to work?

Mitchell Noltimier

I've spent hours trying to figure this out... add this code pinMode(lockPin, OUTPUT);{}otyro right here... // Set the flag to show the state of the puzzle has changed stateChanged = true; // Update the stored connection state lastState[i] = currentState; } // If any connection is incorrect, puzzle is not solved if(currentState == false) { AllWiresCorrect = false; } } pinMode(lockPin, OUTPUT); IT WORKS!!!!

Brian Shaffer

Hey Alastair. I've tried the above solutions but I'm not getting any response from the relay to the maglock on solve everything else is working great! Can you please help. I'm using the the standard 2 channel 5v relay modules (for some reason 2 channels are cheaper than single channels locally) Thank you!

Kody Liston

Hi Alastair. How would I go about removing the LED lights completely from the code and puzzle and simply implement a maglock for when the puzzle is complete? Thanks in advance!

NetteB

Hi Alastair. How would I change the code to make the first pin light up when it is connected, and then have the 2nd of the pair light up when it is connected? I have 15 sockets - and I would like to have the first of the pair light up. Thanks so much!!

Kilian Alonso Arce

Hi Alastair. I dont know why, but when i touch one of the wires and make ground with something, the leds go on without making the puzzle... Can you help me please?

Richard

HI everyone.. i have been trying to make this work with 4 wires (8 plugs) and 2 winning out puts (1 always powered until solved on A0 and 1 that powers when solved on A1). i finally figured it all out from the snippets of info that you all provided.

Richard

here is my working code.../** * Connect the Wires Puzzle * * This puzzle requires the player to use a number of wires to * join correct pairs of terminals together. * Once all terminals have been correctly connected, the puzzle is solved. * * Demonstrates: * - Use of inbuilt pull-up resistors * - pinMode, digitalWrite, digitalRead */ // DEFINES // Flag to toggle debugging output #define DEBUG // CONSTANTS // The total number of possible sockets from which connections can be made const byte numSockets = 8; // The array of pins to which each socket is connected const byte signalPins[numSockets] = { 13, 12, 11, 10, 9, 8, 7, 6 }; // The pins of the LEDs corresponding to each of those connectors const byte ledPins[numSockets] = { 5, 5, 4, 4, 3, 3, 2, 2 }; // The total number of connections required to be made const byte numConnections = 4; // The connections that need to be made between pins, referenced by their index in the signalPins array const byte connections[numConnections][2] = { {0,1}, {2,3}, {4,5}, {6,7} }; // This pin will be driven low when the puzzle is solved const byte lockPin = A0; // This pin will be driven high when the puzzle is solved const byte lockPin1 = A1; // GLOBAL VARIABLES // Track state of which output pins are correctly connected bool lastState[numConnections] = { false, false, false, false }; // Track state of overall puzzle enum PuzzleState {Initialising, Running, Solved}; PuzzleState puzzleState = Initialising; void setup() { // Initialise the pins. When wires are disconnected, the input pins would be // floating and digitalRead would be unpredictable, so we'll initialise them // as INPUT_PULLUP and use the wires to connect them to ground. for (int i=0; i

Richard

void setup() { // Initialise the pins. When wires are disconnected, the input pins would be // floating and digitalRead would be unpredictable, so we'll initialise them // as INPUT_PULLUP and use the wires to connect them to ground. for (int i=0; i

Richard

well it wont post.... i tried!

Richard

then i tried to put the code on a Nano... only to find out that pin 13 will now trigger all other pins... it works great on the uno only had the issue on the nano... i have since discovered that the led on the nano is slightly different somehow... so i un-soldered it and the problem was solved. im sure there was a better solution but this has worked for me. thanks alastair and others for posting your issues. it all helps

Nathan Bekker

Great stuff, exactly what I need. Do you have a suggestion on wire gauge needed to connect the jack sockets to arduino?

Nathan Bekker

I am getting a random inconstancy when running the code. Here is the output from my serial monitor. Pin#13 - Pin#12 : CONNECTED Pin#11 - Pin#7 : CONNECTED Pin#10 - Pin#8 : CONNECTED þSerial communication started Pin#13 - Pin#12 : CONNECTED Pin#11 - Pin#7 : CONNECTED Pin#10 - Pin#8 : CONNECTED þSerial communication started Pin#13 - Pin#12 : CONNECTED Pin#11 - Pin#7 : CONNECTED Pin#10 - Pin#8 : CONNECTED Pin#9 - Pin#6 : CONNECTED The only modification I made was to increase the number of jacks and corresponding variables.

Nathan Bekker

Just noticed that the inconstancy goes away when I comment out this code pinMode(maglock, OUTPUT); //set maglock pin for output