48 resistors in parallel with switches

Hello - I am looking at another option on my tank level project that I think might be more reliable and not need calibration with different fluids and temperatures. I have looked at ultrasonic, IR, and pressure and they each have their drawbacks such as humidity, temperature, calibration, and dew. This is made worse since the fluids are acids. So, recently I came across a forum where a user made a tube with hall switches in it and a magnetic float. I have purchased some halls sensors and multiplexers to give it a try. I need to measure 48 inches and plan on spacing at 1 inch apart. This should work but there will be 50 wires (48 readings, 1 positive and 1 ground) coming up from the system into the 3 multiplexers.

I was thinking another option would be to use reed switches where I make a ladder with resistors as the steps on the ladder and the switches on one of the rails of the ladder. As more resistors are added to the ladder the difference in resistance value keeps going down. For example, between the first two legs on the ladder there is 50% difference in value and the last ones between 45 and 46 it is only 2% difference. Even though the resolution of the analog pin is 1/1024 0.1%, in practical application I have seen posted the accuracy is only 1.5% to 2% with the proper reference resistor.

So, the question is there a better way to measure resistance, should i break the ladder into 2 or 3 parts to max out the resistors at 24 or 16, or stick with hall sensors?

Give me your thoughts, thank you,

Anthony

aiannar974:
For example, between the first two legs on the ladder there is 50% difference in value and the last ones between 45 and 46 it is only 2% difference

That suggests a poorly designed ladder. What resistance values have you in mind?

If you have a float on the liquid why not attach a string to it and run the string over a rotary encoder?

...R

I had all the resistors being the same value. Your right I could decrease their value as more rungs are added. I was hoping to keep them the same since it would be a simple formula but with changing values I think I will need to reference an array and that would work.

Can you explain the encoder and the string a little? Do the make encoders with spring loaded bobbins to roll the string up? I was planning on only turing the unit on once per day since it will be battery operated. I know how to keep track of the encoder during power off but I cannot thing of a way of knowing on power up if the volume changed significantly. If the volume gapped more then one revolution of the encoder the Arduino would not know that.

Thank you,

Anthony

I had all the resistors being the same value.

Unless I have misunderstood your description that would not work as the magnet would only be close to 1 reed switch at a time, so only 1 reed switch would operate and the resistance would always be the same. Each resistor needs to be a different value. With 48 resistors you need to give careful thought to what those values are so the measured value is unique for each reed switch. 1024 / 48 is 21.3, call that 20 for simplicity. Aim for the voltage from your resistor chain producing outputs that vary in steps of 20.

I should have mentioned, I was planning on normally closed reed switches. That way as the float rose, it would open a reed switch effectively cutting the circuit off at that point. So, the resistors would be in parallel and the switches would be in series between each resistor. So it would look kind of like this and with my soldering maybe actually like this.

V5+ GND
| |
ReedS |
| |
----Res---
| |
ReedS |
| |
----Res---
| |
ReedS |
| |
----Res---

aiannar974:
Can you explain the encoder and the string a little? Do the make encoders with spring loaded bobbins to roll the string up?

I suspect not, but I don't know. Making a bobbin should not be too difficult. However I had been assuming that the string would run over the encoder wheel and fall down towards the floor.

I was planning on only turing the unit on once per day since it will be battery operated. I know how to keep track of the encoder during power off but I cannot thing of a way of knowing on power up if the volume changed significantly. If the volume gapped more then one revolution of the encoder the Arduino would not know that.

I had been assuming the Arduino would be working all the time. You could probably arrange for an encoder pulse to wake it up. And you can get absolute encoders, though they are more expensive.

...R

aiannar974:
I should have mentioned, I was planning on normally closed reed switches. That way as the float rose, it would open a reed switch effectively cutting the circuit off at that point. So, the resistors would be in parallel and the switches would be in series between each resistor. So it would look kind of like this and with my soldering maybe actually like this.

V5+ GND
| |
ReedS |
| |
----Res---
| |
ReedS |
| |
----Res---
| |
ReedS |
| |
----Res---

Hmmm. I guess I should congratulate you on your effort in trying to produce a neat diagram like that....but I am struggling to follow it, sorry! A photograph of a hand drawn diagram might be better!

Have you actually bought the reed switches and are therefore stuck with using NC ones? I think at this stage you should be working it out on paper, then building a simplified version on your desk / bench, with maybe 10 switches and resistors. Get that right then up scale to 48.

That's good food for thought. The product will mostly be used near the end of the day for cleanup so the unit will still be off most of the time.

Thank you,

Anthony

aiannar974:
I should have mentioned, I was planning on normally closed reed switches. That way as the float rose, it would open a reed switch effectively cutting the circuit off at that point. So, the resistors would be in parallel and the switches would be in series between each resistor. So it would look kind of like this and with my soldering maybe actually like this.

V5+ GND
| |
ReedS |
| |
----Res---
| |
ReedS |
| |
----Res---
| |
ReedS |
| |
----Res---

Normally closed reed switches have magnets attached that keep the switch closed. Your magnet would need to bias the switch magnetism to zero so the switch can open. If you have identified those switches, a Link to them would be very informative.

Paul

Please see attached picture. I have bought 5 reed switches and 5 hall switches to test out. I think each one was only $0.40. I was then planning on picking a route and buying more of the needed parts.

reed switch circuit.jpg

6babce1f9d8814ea80a9a9ea723c9855e0508d3c.jpg

Posting images on here is a pain, see 'How to use this forum - please read' item #9 for how to do it.

I think you are on the right lines but I think you need higher value resistors, 48 * 100 ohm resistors in parallel is just over 2 ohms. Maybe 100k ohm might be better.

Another idea to think about.

48 reed switches each with a diode attached in series. 8 Arduino digital pins connected to the switches with a cat5 cable could read each one (up to 56, in fact). It's known as a charlieplexed switch matrix.

These are the reed switches

Magnets:
https://www.aliexpress.com/item/10pcs-10-x-4-mm-N35-Strong-Neodymium-Magnets-10mmx4mm-Automobile-Engine-Oil-Filter-Strong-Magnet/1000007116062.html?spm=a2g0s.9042311.0.0.7c184c4d7obXyb

This is how you post links correctly on the forum

These are the reed switches

Magnets

I would think rectangular magnets roughly the same size as the reed switches would work better than round ones.

Something like this should suffice, but I'd personally go for a capacitive sensor.

Its going to take me a while to digest charlieplexing. Very creative person.

I considered capacitance sensors but making my own seemed beyond my scope especially when adjusting to the large swings that can happen with temperature. Buying them was real expensive for the length I needed and to withstand the acid. Beyond what I wanted to spend for proof of concept.

If you could find an acid resistant material perhaps this would work.

I was oping to build something but the price of that is pretty right. I will call them.