# How to cheaply switch between two sets of 7-input-wires?

I am trying to make a water level sensor.

I want to use a single circuit for two water tanks. For this I need to be able to switch between two sets of 7-wire-inputs to the circuit (the 7 wires that are in the water tank in the diagram below.

What is an simple/elegant/cheap/easy way to do this without having to use 7 switches?

Circuit diagram:

UPDATE:

Thanks for all the answers! Some clarfications:

• I will using a 9V battery source, not mains.
• I thought of one more solution: the circuit inputs will be connected to a CAT5 socket, and the input wires (CAT5 cables) from the two tanks will have connectors. So I can simply switch cables and use the one circuit.
-
Have you drawn collector and emitter of your transistors the correct way? –  motoprogger Mar 25 '14 at 4:45
I don't know really. I haven't vetted the diagram yet, or build a prototype; currently just thinking of what I need to do. I might mention that I am a complete noob at this. –  Zabba Mar 25 '14 at 5:05

## 5 Answers

Truly horrifying circuit, by the way. The transistors are drawn backwards (he managed to get them right on the one he built for himself).

It will also cause electrolysis of the probes if you leave it on all the time since he's using DC to detect conductivity. But it is simple.

Frankly, I think it would be easier to build two of these than it would be to switch the probe lines. Or you could wire the probes to something that fits a switch box.

If you insist, it can be done with three 74HC4053 triple analog multiplexers (that will handle up to 9 lines). Increase the resistors to 1K from 33R and put one on each probe input to give the chips a chance of surviving when bad things happen at the probes, and put the chips in sockets so you can replace them when they inevitably get fried.

Ground E (/Enable) and $V_{EE}$ (and GND, of course), $V_{CC}$ is your 5V supply, connect all the $S_i$ together with a 10K pullup to +5, and a switch to ground to control the analog switches simultaneously. Common from each switch goes to a transistor base, and the other two inputs go through resistors to the probes.

If you run this crap outside, not only could you kill the muxes at the first electrical storm but you might invite Mr. Lightning in for a visit.

-
Thanks! Got a bunch of reading to do about this. –  Zabba Mar 25 '14 at 18:14

Amazing that everyone hates your circuit but no-one seems to have suggested the obvious re-design of using a simple float connected to a potentiometer - these are widely available as they are used in boat / camper van water tanks and very similar parts are used in vehicle fuel tanks (and would likely be ideal for the job as long as you keep the resistive element out of the water). You could make one using a potentiometer and a toilet/water tank ballcock float & arm.

Then you only need TWO wires to measure the resistance, and only need to switch ONE wire to measure the other tank.

Display could be done with am LM3914 10-segment bar-graph driver IC, or comparators, or read by the ADC input on a microcontroller / Raspberry Pi.

I second / third the numerous comments above about safety & reliability too; DO NOT design your own mains PSU, 5v wall-warts (AKA any old phone charger) are throwaway and likely to be a better option. Be aware of the risks around electricity + water, as well as less obvious factors like corrosion.

I realise this does not answer your question but hopefully it goes further towards solving (one of) your problems.

-
This sounds like a nice idea. Will read more about this, thanks. –  Zabba Mar 25 '14 at 18:13
VDO sell senders and gauges, although they can be a bit spendy. Knock-off copies are widely available though. –  John U Mar 25 '14 at 18:35

What is you water tank here ? A Bath?

If the answer is yes: Don't use a home made power supply! Done correctly, it would be ok, but you stated that you are new on this field. A failure in the power supply, may cause the main voltage to be applied to your water tank. And I am never very confident to rely on my circuit breaker to stay alive.

What I suggest, as an addition to what has already been told, is to use a battery to power everything that can be in contact with the water. This includes the probes and the sensors. Then you may use galvanic isolation between this sensor part and the LEDs/buzzer part. The latter being powered by the main. You may use opto-couplers, but the LED inside would be powered by the battery, this is not good for your battery life. Or, use use new digital isolation techniques, such as the iCoupler from Analog Devices. Very low power consumption, and still providing true galvanic insulation.

-
Thanks, but was not planning on using mains - will use a 9V battery. –  Zabba Mar 25 '14 at 18:13

I second the opinions stated in other answers: this is a horrible circuit, and don't even think of powering this from the mains (no, not even with a transformer).

The easiest and cheapest way to switch is to include a diode in series with each 33 Ohm resistor, connect the probes/resistors/diodes of the two tanks to the one transistor, and to switch the 'power' lead to the two tanks with a single pole dual throw switch.

-

Use a digital CMOS multiplexer or build one of logic gates. It should be easy to find an 8-bit 2-channel multiplexer.

Connect the sensor wires directly to the multiplexer inputs and pull them down with resistors. It should be better to light LEDs with a low-power MOSFET than with a BJT since most CMOS chips can't source that much current to drive a BJT.

-
Thanks, but that sounds a bit complex for me at this stage –  Zabba Mar 25 '14 at 18:14