EEVblog Electronics Community Forum

Electronics => Projects, Designs, and Technical Stuff => Topic started by: void_error on May 13, 2015, 08:55:18 am

Title: Connection detection?
Post by: void_error on May 13, 2015, 08:55:18 am
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?
Title: Re: Connection detection?
Post by: cyr on May 13, 2015, 09:04:46 am
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.
Title: Re: Connection detection?
Post by: Jeroen3 on May 13, 2015, 09:16:42 am
Maybe you can try capacitive sensing if your banana plug sockets do not have a detection pin.
Title: Re: Connection detection?
Post by: void_error on May 13, 2015, 09:28:36 am
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.
That'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.
Title: Re: Connection detection?
Post by: cyr on May 13, 2015, 10:00:04 am
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.
Title: Re: Connection detection?
Post by: SL4P on May 13, 2015, 10:35:17 am
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!
Title: Re: Connection detection?
Post by: Rerouter on May 13, 2015, 11:12:27 am
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,
Title: Re: Connection detection?
Post by: SL4P on May 13, 2015, 11:16:53 am
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!
Title: Re: Connection detection?
Post by: void_error on May 13, 2015, 12:11:05 pm
Nah, it just has to work, it's not for me.

Thanks for the replies :)
Title: Re: Connection detection?
Post by: Fungus on May 13, 2015, 12:27:11 pm
Nah, it just has to work, it's not for me.

Thanks for the replies :)

Get 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).
Title: Re: Connection detection?
Post by: PA0PBZ on May 13, 2015, 12:34:39 pm
Trying to cheat at Electro? Really?

(http://assets.catawiki.nl/assets/3/1/d/a/1dadcc00-7c66-012c-c7e9-0050569439b1.jpg)

 >:D
Title: Re: Connection detection?
Post by: void_error on May 13, 2015, 12:49:31 pm
Get 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).
An 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)
Title: Re: Connection detection?
Post by: SL4P on May 13, 2015, 12:54:40 pm
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 $5

Think laterally
Title: Re: Connection detection?
Post by: void_error on May 13, 2015, 03:53:40 pm
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.
Title: Re: Connection detection?
Post by: matseng on May 13, 2015, 04:02:21 pm
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 $5

Think laterally

I 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... ;-)
Title: Re: Connection detection?
Post by: void_error on May 13, 2015, 04:18:47 pm
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.
Title: Re: Connection detection?
Post by: SL4P on May 13, 2015, 10:12:23 pm
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.
Title: Re: Connection detection?
Post by: matseng on May 14, 2015, 02:37:48 am
Hmmmm. Either I'm blur and cannot brain today  :P , 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..
Title: Re: Connection detection?
Post by: SL4P on May 14, 2015, 03:11:10 am
OK - let's get a clearer spec / definition of the problem.
Trickle feed is not doing it for me
You are expecting - GOAL:
You want to identify which LOCAL 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 (!)
Title: Re: Connection detection?
Post by: matseng on May 14, 2015, 03:39:19 am
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 (http://en.m.wikipedia.org/wiki/Mastermind_%28board_game%29)
Title: Re: Connection detection?
Post by: SL4P on May 14, 2015, 03:40:51 am
Let's see what OP says.
Title: Re: Connection detection?
Post by: void_error on May 14, 2015, 05:27:06 am
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.
You 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...
Title: Re: Connection detection?
Post by: SL4P on May 14, 2015, 05:31:43 am
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 ?
Title: Re: Connection detection?
Post by: void_error on May 14, 2015, 05:53:05 am
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 ?
How 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? :palm:
Title: Re: Connection detection?
Post by: SL4P on May 14, 2015, 06:04:30 am
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.
Title: Re: Connection detection?
Post by: void_error on May 14, 2015, 06:15:07 am
Actually the problem was solved quite a while ago, see above (https://www.eevblog.com/forum/projects/connection-detection/msg672633/#msg672633) and here (https://www.eevblog.com/forum/projects/connection-detection/msg672447/#msg672447). The only thing I didn't know how to do is detect which two sockets are connected together.
Title: Re: Connection detection?
Post by: SL4P on May 14, 2015, 06:21:12 am
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.
Title: Re: Connection detection?
Post by: void_error on May 14, 2015, 10:08:31 am
Ok, so you're good. (Sorry I missed post #15)
Post your block schematic and we can add / comment on your plan.
No 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.
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.
Easy. Used the TRIS registers to change pin direction when needed.