Connection detection? - Page 1
Forum section: electronics / projects

author: void_error
author_rank: Frequent Contributor
timestamp: May 13, 2015, 08:55:18 am
content: I have 12 banana sockets and I need to detect which two are connected via wires with two banana plugs on the ends.This also has to be reprogrammable so I'm thinking of using a MCU's ADC.Any ideas?

author: cyr
author_rank: Frequent Contributor
timestamp: May 13, 2015, 09:04:46 am
content: Is that the only purpose of these sockets, or do they carry some other signal already?With an MCU I would place pulldown resistors on each socket, drive one high at a time and sample all the other ones.

author: Jeroen3
author_rank: Super Contributor
timestamp: May 13, 2015, 09:16:42 am
content: Maybe you can try capacitive sensing if your banana plug sockets do not have a detection pin.

author: void_error
author_rank: Frequent Contributor
timestamp: May 13, 2015, 09:28:36 am
content: Quote from: cyr on May 13, 2015, 09:04:46 amThat's the only purpose of the sockets.There are going to be 12 sockets and 6 wires which will have to be plugged in in a certain way which is the correct one, defined in software.Say the twelve sockets are A,B,C,D,E,F,G,H,I,J,K,L.I need to be able to detect which pairs are connected with all of the sockets populated and be able to reconfigure them in software.

author: cyr
author_rank: Frequent Contributor
timestamp: May 13, 2015, 10:00:04 am
content: My method should work to detect any permutation.Loop through all 12 pins. Set one of them as an output, high. Read back all other pins (set as inputs with pulldowns), if they are high they are connected.As a result you get a 12x12 (symmetric) matrix of bits showing all the connections.

author: SL4P
author_rank: Super Contributor
timestamp: May 13, 2015, 10:35:17 am
content: If nothing else is happening, add a tiny RC at the far end sockets... put a high pulse on the port pins, turn the port around and read it back (immediately)...With luck, you'll see the caps before they discharge!

author: Rerouter
author_rank: Super Contributor
timestamp: May 13, 2015, 11:12:27 am
content: defiantly (protected) micro pins, either pulled up or pulled down, you drive a single pin to another state, reading in the port registers, and store, iterate this through for each pin, and you end up with 12x 16 bit words, that decode directly out to the connection logic, e.g. if pin 3 on a port was high while pin 1 was driving high, then there is a connection between 1 and 3,

author: SL4P
author_rank: Super Contributor
timestamp: May 13, 2015, 11:16:53 am
content: Or get tricky, and send a uniquely coded byte serially down each wire... Put a micro at the other end to acquire and reply with info about which 'input' it arrived on!

author: void_error
author_rank: Frequent Contributor
timestamp: May 13, 2015, 12:11:05 pm
content: Nah, it just has to work, it's not for me.Thanks for the replies

author: Fungus
author_rank: Super Contributor
timestamp: May 13, 2015, 12:27:11 pm
content: Quote from: void_error on May 13, 2015, 12:11:05 pmGet an Arduino. This sort of thing is what they're best at."12" just happens to fit perfectly leaving a couple of pins free to talk to the PC (or whatever).

author: PA0PBZ
author_rank: Super Contributor
timestamp: May 13, 2015, 12:34:39 pm
content: Trying to cheat at Electro? Really?

author: void_error
author_rank: Frequent Contributor
timestamp: May 13, 2015, 12:49:31 pm
content: Quote from: Fungus on May 13, 2015, 12:27:11 pmAn Arduino* would greatly exceed the materials price idea of the (tight-arse) person (with a degree in management - yuk) I'm making this thing for.I've already got a PICkit 3 and I can get a micro from the local electronics store plus the rest of the parts.*(which I see as a bit of a joke, don't make me start my rant on the Arduino Uno board, someone else has already done one)

author: SL4P
author_rank: Super Contributor
timestamp: May 13, 2015, 12:54:40 pm
content: A PIC with 12 pins,or 2x 595 shift reg... and a 5v source. There are half a dozen ways for a BOM cost of less than $5Think laterally

author: void_error
author_rank: Frequent Contributor
timestamp: May 13, 2015, 03:53:40 pm
content: Since I also need to drive three 7-segment displays I'll need more than 12 pins, that's an extra 7, using a 4511 (4 input pins) to drive the segments and 3 more pins for the common pins. I can use even less pins if I reuse the 12 pins for the connection detecting, it'll be interrupt driven anyway.

author: matseng
author_rank: Frequent Contributor
timestamp: May 13, 2015, 04:02:21 pm
content: Quote from: SL4P on May 13, 2015, 12:54:40 pmI really can't see how to solve this with SIPO shift registers since you by definition can't get any readings back to the microcontroller using them... But maybe I don't think enough outside of the box... ;-)

author: void_error
author_rank: Frequent Contributor
timestamp: May 13, 2015, 04:18:47 pm
content: Hmm... PIC16F628A - 18 pins - 3 of which are power/reset - that leaves me with 15. Why did I choose this crappy micro? On stock at the local electronics store.12 for the wires, 3 for a 4094 shift register connected to a 4511 7 segment driver. Problem solved. 3 pins needed to drive as many as 4 digits - clock, data, output enable.

author: SL4P
author_rank: Super Contributor
timestamp: May 13, 2015, 10:12:23 pm
content: Sorry, I didn't see the 7-see reference earlier.You can still do it, just needs a bit of applied thinking.As for shift registers, again, think like an Asian manufacturer on the design.One pin sense of OR-ed returns, while toggling whichever output bit takes your fancy.If the input is shaking, then that's the one you're looking for.Listening.

author: matseng
author_rank: Frequent Contributor
timestamp: May 14, 2015, 02:37:48 am
content: Hmmmm. Either I'm blur and cannot brain today, or we are trying to solve two different sets of requirements.I can't figure out a way to detect 6 random connections between 12 connectors using two 8-bit SIPOs and an input pin - not even with a handful of discretes thrown in for good measure.You need to elaborate you solution a bit more for me to figure it out..

author: SL4P
author_rank: Super Contributor
timestamp: May 14, 2015, 03:11:10 am
content: OK - let's get a clearer spec / definition of the problem.Trickle feed is not doing it for meYou are expecting -3 x 7-seg displays (8 pins with muxing... more detail later)12 banana sockets at LOCAL end.12 banana sockets at REMOTE end.6 (more/less?) leads between local & remote.Possibly cross-wired in no particular order.No connection between - other than the banana leadsSmallest / cheapest solution possibleGOAL:You want to identifywhichLOCAL banana socket is connected to which REMOTE banana socket.(Some may not be connected at all)(Are 'shorts allowed? One local to two or more remotes? Vice-versa?)Is that correct?Does this gadget serve any other purpose than to check if leads are present and connected?If yes - that will add a burden of not interfering with other signal traffic... harder!There may be several strategies, scanning of the bananas is one - there may be others.If this is correct, then I'll sketch out a first thought. You will have to do some coding!Will try to avoid a micro at remote end - but will require at least two leads in place.This sounds like a cable tester (!)

author: matseng
author_rank: Frequent Contributor
timestamp: May 14, 2015, 03:39:19 am
content: Ok, now I see the reason for the confusion. I've interpreted the requirements of the OP as follows:A box with 3pcs of 7-segment displays, a total of 12 jacks and a set of 6 cables with banana plugs in both ends.It sounds more like a logical game to me. The player will be given hints on the display of how close the current pairing of the plugged in cables are to the correct set selected at random by the microcontroller.Almost like the game of Mastermind that I played as a child 40 years ago.http://en.m.wikipedia.org/wiki/Mastermind_%28board_game%29

author: SL4P
author_rank: Super Contributor
timestamp: May 14, 2015, 03:40:51 am
content: Let's see what OP says.

author: void_error
author_rank: Frequent Contributor
timestamp: May 14, 2015, 05:27:06 am
content: Quote from: matseng on May 14, 2015, 03:39:19 amYou got it right this far. It'll display the number if the 6 banana plug cables are inserted correctly, with all 12 sockets populated.Uses a micro because it has to be reprogrammable. May put a few 'easter eggs' in there just for the laughs...Sheesh, this topic went south...

author: SL4P
author_rank: Super Contributor
timestamp: May 14, 2015, 05:31:43 am
content: Waay much easier to make.12 local sockets that may be cross plugged any way you like.What do the three digits display? 00--12 ?

author: void_error
author_rank: Frequent Contributor
timestamp: May 14, 2015, 05:53:05 am
content: Quote from: SL4P on May 14, 2015, 05:31:43 amHow the user finds out which is the correct way to cross plug the 12 sockets is not my problem. There will most likely be some other game which gives the clue.If I'm using 3 digits it's not because I need to display a 2 digit number, is it?

author: SL4P
author_rank: Super Contributor
timestamp: May 14, 2015, 06:04:30 am
content: So no answer to my revised summary (two up)...?Until we know exactly what you're aiming at, there's no point trying to solve it!All you've said is the three digits have nothing to do with the plugs & sockets.Still looking at two shift regs, with input (parallel load) and output capability... Possibly diodes to OR the received states as needed.Maybe something low end like a PIC 16F628A or 16F88. --- small with enough pins and cheap. Arduino + proto shield if you don't want to make the board.

author: void_error
author_rank: Frequent Contributor
timestamp: May 14, 2015, 06:15:07 am
content: Actually the problem was solved quite a while ago,see aboveandhere. The only thing I didn't know how to do is detect which two sockets are connected together.

author: SL4P
author_rank: Super Contributor
timestamp: May 14, 2015, 06:21:12 am
content: Ok, so you're good. (Sorry I missed post #15)Post your block schematic and we can add / comment on your plan.What you need to be prepared for is using pins for BOTH in and out at different times - or spring for a larger pinout package.

author: void_error
author_rank: Frequent Contributor
timestamp: May 14, 2015, 10:08:31 am
content: Quote from: SL4P on May 14, 2015, 06:21:12 amNo need to, I've tested it and it works. Already done writing the code for it. Next step is designing a PCB. Did I mention this has to be 2xAA battery powered? Using a MCP1640 to boost the voltage.Quote from: SL4P on May 14, 2015, 06:21:12 amEasy. Used the TRIS registers to change pin direction when needed.