0

I have a main PCB with a microcontroller on it with lots of connectors on it to connect to many other (peripheral) PCBs which have sensors and report data to the MCU on the main PCB.

I wanted to detect using just code if one of the external (peripheral) PCBs is connected to the main PCB, and I want to light an LED via an I2C RGB LED driver using the MCU (say "yellow" if PCB detected.)

JRE
  • 67,678
  • 8
  • 104
  • 179
  • Just a reminder that it should only be cold-plugged, not hot-plugged. Hotplugging things into the board without hardware coordination is [generally not safe](https://electronics.stackexchange.com/questions/340202/why-does-hot-plugging-blow-stuff-up-and-how-to-prevent-it). For example, if an I/O signal line is connected first before Vcc, while you're plugging the board in, many types of chips can be destroyed. – 比尔盖子 May 19 '20 at 08:33
  • 3
    It's guesswork without an interface specification or circuit diagrams. – Andy aka May 19 '20 at 08:36
  • Hello Andy, irrespective of schematic planning all i want to do is to implement a generic method of detecting if a PCB is plugged in (consider a device detection if it is plugged in or not) thats it :) Thanks – Coppers Copernicus May 19 '20 at 08:39
  • 3
    An appropriate answer will highly depend on what sort of communication interface exist between the devices. A generic answer is just a single word: "polling". Any more details on how to implement this polling will vary based on the interfaces given. – Vicente Cunha May 19 '20 at 10:20

1 Answers1

1

A quick method which is followed to solve this is by making a pin as pull-up and reading if it is high or low. You can make a logic that if the pin is LOW, then the peripheral is connected. On the other side, the MCU on peripheral side just drives the pin LOW.

More advanced ways, use PWM signals or a signal pattern with consensus for better communication and authentication across controller.

Little Sophisticated method : One-Wire protocol.

Narashiman
  • 84
  • 4
  • Thanks for the reply Narashiman. Actually there are no other MCUs on any peripheral PCBs but only one main MCU on the main PCB (Just edited in the question too). So I just want to detect the insertion of PCBs using MCU (code). Say if I have 3 peripheral PCBs, if I insert 2nd PCB into the Main PCB connector, then led 2 should glow, if i insert 3rd PCB 3rd LED..and so on. – Coppers Copernicus May 19 '20 at 08:21
  • 2
    @NikhileshKaranam you are expanding your question from one external PCB to several AND, now that you have an answer to your original question, if you altered that question to more clearly state what your requirements are then you might invalidate the answer above and people coming along might think the answer is weak and down-vote it. Do not evolve a question without a good reason. – Andy aka May 19 '20 at 08:40
  • Hey @Andyaka. No I am not evolving the question. I am just making it clear. I still dont have an answer to my question though. Its simple and straight forward. I just want my helpers to get exactly what i am asking for. Thanks – Coppers Copernicus May 19 '20 at 08:42
  • The dilemma is that ideally you should put all relevant details in the question and not leave that detail hanging around in comments BUT you already have an answer so I would recommend that you politely ask the guy who made the answer if he doesn't mind you altering the question. – Andy aka May 19 '20 at 08:49
  • I understand it @Andyaka. I believe this is what I exactly did. I let the answerer know that I have made changes in the question for avoiding such confusions in the future. On top of that there is nothing new that I added to the question but just refining it with the same purpose of finding an answer to my question. Thanks. – Coppers Copernicus May 19 '20 at 08:55