Switching Between an Analog Sensor and a Digital Sensor

analogsensorswitchesuart

I am working on a project that reads sensor data from multiple sensors. I am trying to come up with a universal solution for connecting these sensors, and have decided to go with a 4P4C Modular Jack since I need a minimum of 4 lines. Some of the sensors communicate via UART, and some are simply analog.

These are the cases I need to cover:
NC = Not Connected

  • +5V, GND, TX, RX
  • +3.3V, GND, TX, RX
  • +5V, GND, Analog, NC
  • +3.3V, GND, Analog, NC
  • NC, GND, Analog, NC

Is there an IC that I can use to switch between +5V, +3.3V, and NC. Then also switch between TX/RX, and Analog/NC?

Edit: I am using a BeagleBone Black to record the data that comes from the sensors, and I am designing a cape/shield to go on top of it, so the space I have is limited.

Best Answer

I would highly recommend avoiding a voltage switching scheme for the power, if only to add some level of idiot proofing. If 5v is accidentally provided to a 3.3v sensor, the sensor could easily be damaged. Voltage switching might be OK if there was a very reliable method of determining what the required voltage is while no power is applied, e..g. a short between two pins or a resistor between two pins that can be measured.

As for the actual signals to the sensor, you can use CMOS switches. However, you want to make sure you're not going to accidentally apply a voltage to a signal line to something that can't handle it. This can be mitigated by series current limiting resistors, but this can affect signal integrity and serial communications speed. Also, CMOS switches can have a relatively high ON resistance.

I would recoomnd a 6P6C connector like so:

  • +5
  • sense res
  • +3v3
  • RX/analog-
  • GND
  • TX/analog+

where sense_res is a resistor to GND that you can build a voltage divider around and then use to determine what sensor is connected.

It might be a better idea to just go ahead and use 8p/8c as that is a standard Ethernet cable. In this case, I would recommend something like:

  • +5v
  • GND
  • TX
  • RX/Analog+
  • Analog-
  • Sense res
  • GND
  • +3v3

This also takes advantage of the twisted pairs in a standard ethernet cable. +5v and GND are twisted together, as well as +3v3 and another GND. Analog + and analog - are twisted together so differential signals have good performance. TX and RX are not twisted togther to prevent crosstalk. This also prevents accidentally connecting TX to an analog sensor output.