7
\$\begingroup\$

REVISED: I have a master controller PCB with four bus bars (+, -, and two signal lines), see image below. I have module PCBs A-C (or could be 10 or 15 of them), each with MCUs and unique identifiers, that plug into the sockets in an unknown order (and may or may not all be present). How could the module PCBs communicate with the master controller so that the master controller would know the ordering of the module PCBs. (In the digram it would be [C, A, B].) The two "signal" lines drawn could be reconfigured (or additional components/circuitry added).

enter image description here

ORIGINAL: I have a master controller PCB with sockets 0-5. I have module PCBs A-F (these are also the unique IDs, either through an MCU or other means) that plug into the sockets in an unknown order (and may or may not all be present). I am wondering if there is a simple way for the master controller to know the ordering of the module PCBs. (In the digram it would be [C, E, A, B, F, D].) There is one "signal" line drawn but additional ones could be added (or additional components/circuitry).

Controller bus with card modules

\$\endgroup\$
22
  • 1
    \$\begingroup\$ You need something more than just a single bus on the socket. \$\endgroup\$
    – DKNguyen
    Sep 11, 2019 at 14:31
  • 2
    \$\begingroup\$ Generally you do this either by having dedicated lines (possibly from a MUX) to each slot which you can use to read an identity resistor, parallel collection of jumpers, or one-wire or I2C type identity number chip, or you have a daisy chain signal where you can address items by their position in the chain and read out a digital identity (ie, something similar to JTAG, though using actual JTAG for JTAG-ish purposes between cards is a bad idea as long chains are slow and unreliable for intense operations) \$\endgroup\$ Sep 11, 2019 at 14:34
  • 1
    \$\begingroup\$ More info please. Does card C "know" it is card C? Does card F "know" it is card F? Or are the cards identical? Can the master read each slot individually? Or do the slots share common signal lines? \$\endgroup\$
    – scorpdaddy
    Sep 11, 2019 at 14:40
  • \$\begingroup\$ 6 cards, so 3 bits of data identification on each card will work for the master to ID each one. Assuming it can address each socket independently. \$\endgroup\$
    – rdtsc
    Sep 11, 2019 at 15:32
  • 1
    \$\begingroup\$ How many backplane pins have you got and how many can you dedicate to the identification function? \$\endgroup\$
    – TonyM
    Sep 11, 2019 at 16:34

7 Answers 7

1
\$\begingroup\$

In the comments you say:-

The master controller would likely not be powered when the cards were plugged in

If cards will not be inserted or removed when the controller is powered then it only needs to check their order on startup. This can be done with a signal line that is split at each slot, with each card passing the signal on to the next slot once it been identified. Slots that do not have cards in them must also pass the signal on.

Here's how it could be done with logic gates.

schematic

simulate this circuit – Schematic created using CircuitLab

Each slot has an AND gate on the backplane, with a pullup resistor on the 'Done' input so the 'ID' signal will be passed through to the next slot even if no card is present. When initially powered up all the boards pull their 'Done' outputs low, preventing the ID signal from getting to the next slot. Each board then waits for its 'ID in' signal to go high, which indicates that the controller wants to identify it.

The controller pulls the 'ID' signal up on the first slot, then talks to whichever card responds. Once the card has been identified it makes its 'Done' output go high and then ignores further ID requests, letting the next card respond. This continues until no card responds. Then the controller knows that all the cards are accounted for, and the order of the cards is the order that they were identified.

The 'ID' signal could also be one of the normal signal lines, so you might only need one extra pin per slot. If you have hundreds of cards then gate delays might be a problem, in which case you will need 2 extra pins per slot (which could perhaps be on opposite sides of the board). The AND gate could be a 74LVC1G08, which costs ~US$0.1 in 100 up quantities.

\$\endgroup\$
1
  • \$\begingroup\$ Note: this won't work if a card slot is left empty for whatever reason - any cards after the empty slot will not be enumerated. \$\endgroup\$ Jun 3, 2020 at 4:02
1
\$\begingroup\$

If you could add another line with high resistance per length you could connect one end to positive power supply and other to negative power supply in this case each card can measure its position and report it to master.

Other possibility would be that at master that line is connected to positive power supply with known resistance and when card is inserted it would connect negative power supply at the line at its position, master can then measure position itself and then tell card to disconnect from that line.

\$\endgroup\$
4
  • \$\begingroup\$ seems like a clever solution. What would be the level of precision of such a system (or what would be the factors that played into it)? If the high resistance line were 100mm long could two cards 10mm from each other be reliably read in the right order? Is the precision in such a system linear along the length? Is this current measurement? Sorry if these are basic questions and thanks for the thoughts. \$\endgroup\$ Sep 12, 2019 at 12:55
  • \$\begingroup\$ Also, I was trying to read up about resistance per length. Can this be achieved with just having narrow traces on the PCB? \$\endgroup\$ Sep 12, 2019 at 13:12
  • \$\begingroup\$ @ZacharyRussellHeineman I cannot answer most of your questions as I didnt try to make this myself. I guess most of problems would come from electrical interference. You measure voltage as this line is basically variable resistor in voltage divider. You dont need whole system to be linear if you only want relative position of cards, but that same position has same resistance over time. I guess that for high enough resistance per length you would need other material than copper such as carbon. \$\endgroup\$
    – Rokta
    Sep 12, 2019 at 13:39
  • \$\begingroup\$ Thanks @Rokta. I found a link regarding resistive traces: eevblog.com/forum/projects/how-to-get-resistive-traces-on-pcb. I'm thinking that the master doing the measurement is probably the way to go, with each card having the circuitry to shut down the pin after it does its measurement. \$\endgroup\$ Sep 12, 2019 at 13:57
1
\$\begingroup\$

Each socket has a socket ID - connector 0 has pins 1,2,3 grounded, connector 1 has only 2 & 3 grounded etc.

The plug in module has I2C and a unique I2C address and can sense the ID pins. There are pull up lines on ID sense pins.

The master sends a message to all possible I2C address. If it gets no response, that module is not plugged in. If there is a response, the module can reply with the socket ID. Now you know which module is in which socket.

A possible device, without a micro-controller on each module, is to use a device like the PCF8574 and some jumpers to identify the module.

You'll need 2 pins for the I2C and log2(Number of boards) pins for the socket IDs.

(Another option is to have a resistor divider to identify the socket - as a voltage - and have an I2C ADC on each module to identify the position) - 3 pins total required.

\$\endgroup\$
5
  • \$\begingroup\$ This of course needs a lot more backplane pins but is certainly workable. To provide the ID pins (3) and I2C clock/data (2) will means a total of 5 pins. \$\endgroup\$ Sep 13, 2019 at 16:09
  • \$\begingroup\$ @JackCreasey more pins is a possibility \$\endgroup\$ Sep 13, 2019 at 18:25
  • \$\begingroup\$ Thanks for the answer, @D Duck. \$\endgroup\$ Sep 13, 2019 at 18:26
  • \$\begingroup\$ Is the resistor divider solution similar to @Rokta's answer above? \$\endgroup\$ Sep 13, 2019 at 19:26
  • \$\begingroup\$ Key is to code the position by voltage and have the module use a readily available I2C ADC part and a way to ack if a device is present. \$\endgroup\$
    – D Duck
    Sep 13, 2019 at 20:42
0
\$\begingroup\$

This sort of problem (board identification and placement order) is a very common one to have to solve.

You need to provide more information for the best advice:

  1. Are all the cards ALWAYS plugged in?
  2. Do ALL the cards have unique ID/Functions?
  3. Will you have boards with the same function but different ID#'s

However, you could look at this answer which proposes using small MCUs to provide the information serially.

enter image description here

Note here that if you leave a card out, then the chain is broken (but you don't know where).
I have fixed this in some projects (supermini days) by adding a reed relay across each board position and a small magnet on each board. If the card is plugged in the magnet holds the reed contact open, If the card is removed then contact is closed and shorts out that positions in and out signal.

\$\endgroup\$
1
  • \$\begingroup\$ Comments are not for extended discussion; this conversation has been moved to chat. Any conclusions reached should be edited back into the question and/or any answer(s). \$\endgroup\$
    – Dave Tweed
    Sep 13, 2019 at 19:13
0
\$\begingroup\$

One way is to have each card have a port full of jumper pins that run to a socket that plugs into the motherboard. These jumper pins gets connected between each other by hardwired connections on the motherboard which are unique for each socket position. That way, each board automatically knows what socket it is plugged into and you can work out some way for the master to collect that information from the cards. If you only have a few slots this is probably the simplest and most reliable.

-

Another way is to have lines that ONLY run between adjacent cards so the cards can play telephone and count themselves in, but that won't work with skipped slots. This method requires something to jump start the count-in process, such as a master or a card that "knows" it is the first card (maybe a jumper that gets connected when plugged into the motherboard board's first slot or just a jumper you manually connect on the card itself if there is no motherboard).

You also need for the last card to know it is the last card. You can use either by one of the two jumper methods just mentioned, but you can also just use time outs to determine the last card (i.e. if the current board tries to communicate with the next board and receives no response and it times out, it can assume it is the last card).

This method works best when you have a continuous sequence of cards of a very large or arbitrary number. I used this method in a project so I can stack as many identical PCBs (no motherboard, just board-to-board connectors so I could continually stack PCBs on top of each other) as I want and they all count themselves in and know exactly where they are in the stack.

This method is also a no brainer if you already have a dedicated serial connection that exclusively runs between adjacent cards since it requires no additional hardware.

-

And yet another (theoretical) way is to use two signal lines from the master that drop off into each socket as it passes by. One line is undelayed while the second line has a delay line between the drop off into each socket. The master sends a pulse down both lines at the same time and each card measures the time difference between the delayed line and undelayed line. This lets it know how far down it is and therefore lets it know what socket it is located in. From there then cards can used pre-determined timing information to know where they are on the line or they can just blurt out out far down the line they are to the master and the master can sort out their actual sequence (if the distances or delays are uncertain for whatever reason). This method probably takes the fewest pins on the socket (just two). The main problem I think is actually finding a suitable delay line component. You probably want one that is at least tens of microseconds.

The main advantage of this method is that you can skip sockets and still only need 2 extra socket pins for a very large number of cards (limited by the accumulated timing error due to the variations in delay blocks as you get farther and farther down the chain.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
4
  • 1
    \$\begingroup\$ What about using LEDs and detectors so that the master tells one board to flash and then sees which board receives the flash then that board flashes and so on? \$\endgroup\$ Sep 12, 2019 at 4:26
  • \$\begingroup\$ @ZacharyRussellHeineman You can do that too, but if you have electrical connections then you might as well just run a open-collector OR line common to all cards back to the master so the they can respond, plus a unique signal from master to to each socket so the master can call each individual card to attention. \$\endgroup\$
    – DKNguyen
    Sep 12, 2019 at 4:32
  • \$\begingroup\$ Similarly, you can play an optical telephone game as well instead of an electrical one where each card flashes an adjacent card, but you would only use LEDs and detectors if this was an application where the boards were physically separated or discrete modules (like pucks at a restaurant to tell you when your table is available) \$\endgroup\$
    – DKNguyen
    Sep 12, 2019 at 4:34
  • \$\begingroup\$ @ZacharyRussellHeineman I was thinking the same thing when you mentioned LEDs+phototransistors. It may also be worth looking into hall-effect switch sensors, if you can find a way to mount magnets on your PCB. \$\endgroup\$ Sep 13, 2019 at 17:34
0
\$\begingroup\$

Updating with solution 3

Solution 1:

You could use an actuator that carries a probe(spring type) across the whole bus bar. This actuator motion would be similar to an actuator on CD ROM drive if you can imagine, thus controllable by the "Master controller"

The probe carried by the actuator would be an active high(or an active low) signal, and each card when probed would send a signal back to "Master controller", which eventually will log all the cards order.

An Actuator with probe

The level of stacking depends upon how fine the pitch of screw of your actuator is and your motors step size. I came across this challenge you were facing, on Upwork. Hope this helps.

-

Solution 2:

With the same probing mechanism, you could as well create a cylindrical stack instead of flat wall. That way instead of an actuator you could directly use a motor(stepper) carrying a probe perpendicular to its axle

To imagine, the length of the bus is equal to circumference of the cylinder Slightly less complex than above.

A cylindrical stack of bus

Solution 3:

Since there was a comment about this being inaccurate, the below should be much more apt without a motor quotient.

This one is based on limit switches on a single signal line. Every time a card is inserted, the line is broken by the limit switch, but is connected back by passing it through the card.

The card would read the signal from terminal "X", and then allow it to propagate through its terminal "Z". Terminal "Y" is a non metal contact to open the switch. Then same would happen for the next card in the line.

The slots on your bus and the terminals on your cards must be altered and designed keeping below contact points in mind.

Contact points of terminals and switch states

\$\endgroup\$
2
  • \$\begingroup\$ This feels somewhat impractical and prone to errors, though it is a nice out-of-the-box solution! There may well be situations where this is the best way to do it. \$\endgroup\$
    – Hearth
    Jun 2, 2020 at 15:17
  • \$\begingroup\$ I have now added a 3rd solution, which should be more robust with limit switches \$\endgroup\$
    – saikumar
    Jun 2, 2020 at 15:48
0
\$\begingroup\$

Wow... so many ideas! Here is another one. It is basically a variant of @DDuck answer here.

First, I am postulating that if you are concerned with an order of the cards their unique bus IDs are redundant. If so, then "Socket #" can be used as their bus address, eliminating the need to set up unique IDs in every module MCU in advance, which carries huge potential for mistakes and overlapping.

How you key the slots is irrelevant. You can have voltage divider resistors mounted on main PCB during manufacturing and ADC them in the modules. Or you can have additional pins hard-wired on the PCB for binary address. The former is a bit more expensive but requires only one pin. The latter is more reliable but needs more pins.

So, you insert the card and it reads slot # which then becomes its bus address. When master MCU wakes up it simply sends requests to all slots and if it gets response it knows there is a card there.

In fact, it can always send requests to every single slot. Unless you have hundreds of modules this will not take much time but would allow you to dynamically insert and remove modules at any time.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.