Method for detecting what sensor is plugged in?

Thread Starter

Mahonroy

Joined Oct 21, 2014
406
Hey guys,
I have a microcontroller with multiple 5 pin connectors wired up to it. I also have a bunch of different sensors. I am hoping to have all of the sensors use the same plug, and be able to be plugged into any of the connectors (even though they each operate differently).

What is the best method for the microcontroller to detect which sensor is present by using an additional wire used only for this purpose?

For example... should each sensor have its own resistor value, so the first thing that happens when the sensor is plugged in is that the microcontroller reads the analog voltage created by the resistor to determine what it us?

Then I was slightly worried that what if the wires are longer/shorter that it might change the resistance on that wire...

Is there a better method for doing this?
 

crutschow

Joined Mar 14, 2008
34,432
A different resistor value should work if you don't have a lot of different sensors (say more than 10).
The resistor values should be large enough so that the wire resistance is negligible when compared to the resistor values.
One way to read the resistor value is to have a constant current source from the micro end driving the sense line. Then the voltage is directly proportional to the resistor value.
 
Top