# Water Level Indicator Using Magnets

12,597

118

18

## Introduction: Water Level Indicator Using Magnets

I have been thinking and researching about measuring water because I needed it for my next projects.

Most common way is using the water as a conductor, so if there is water between 2 wires you will get the close circuit, but main problem on conductive indicators is the water must have salts cause that's what gives the water the conductivity and that wasn't working for me because one of my projects was to have an alarm inside my disposal bottle of my air conditioner when it was full but since that water is from condensation it has no conductivity at all :(

A mechanical way is another option; we all have seen that inside our bathrooms, almost every toilet flush system works with a mechanical switch which consist in a buoy that closes the water entry. This method was a good approach but I wanted to keep my current simple bottle without having to create huge modifications on it by cutting it out and then having to seal it.

That's when I came across those simple buoy switches that uses Reed Sensors inside; keeping in mind that I wanted a simple solution I came up with this concentric pipe which holds reed switches inside it and has a moving buoy with magnets attached.

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: How Does It Work?

First thing to understand: what is a Reed Switch?

The reed switch is an electrical switch operated by an applied magnetic field.

A buoy (which has magnets inside it) will float in water which means it will be keeping magnets at water level and since we have a Reed Switch (at some specific height inside the pipe) it will be activated (closing or opening the circuit) and if we know how many liters are at that height we know how much water is in the bottle.

An important thing, there is cap at the bottom of the pipe because we don't want water to be inside the pipe, the main idea of this method is to not use the conductance of the liquid to measure. Having water inside the pipe could lead into false indications by bypassing a reed switch.

I went a little overkill here with the amount of reed switches, my first idea was to test this method by placing a reed switch per liter (distance of 5 cm in that bottle) and I could tell the half state by getting 2 sensors activated at same time, so in short I could know every half liter the water level.

You don't need to go that precise, you can put 1 or 2, at bottom and top to know if is full or empty, the cool thing is you can get a switch at any level you want without destroying the bottle!

## Step 2: What You Need

Bottle

Check the buoy size first cause it has to go through the bottlemouth - this buoy has a 30 mm outer diameter

Normally a family bottle of water should work (5 or 6 liters). A drum is another option but I suggest you to get a transparent one for simplicity of testing it.

Pipe

For this 3d printed buoy it has to be smaller than ~14 mm outer diameter.

Since you need to place reed switches inside so for this 3d printed cap to work in needs ~11 mm inner diameter but you can seal it with any other thing really.

Length doesn't matter, I would say to be bigger than your bottle height.

I've got my pipe from a local store buying a cheap and crappy toilet universal flush system (attached photos of them)

3D Printed parts

1. Buoy (it has 2 equal parts)
2. Cap

Here are the parts and how to print them: https://www.thingiverse.com/thing:2541017

Electronics

1. Reed Switches I used NormallyOpen (NO): get as many as you want but get a couple more of what you need cause they may break by manipulation
2. LEDs (5 mm) these are mainly for easy testing signals but you can use an arduino or anything you want
3. Resistors (330 ohms) - if you go with leds you're gonna need protective resistors (so one for each led)
4. Cable, I recommend you to use Cat5 cable, its the commonly known as networking cable. It has 4 pairs inside and they are pretty rigid so they work well for this reed-switches-inside-a-pipe application

Magnets

Well here is more a try an error really, I don't have the math for a good magnet vs reed switch ratio.

The only restriction is size cause it has to fit inside the buoy which has 4 places of size 2 mm x 10 mm x 15 mm height. If you're buying magnets I recommend you to have the buoy in your hand first.

I used magnets taken from an old hard drive breaking just one will give you the 2 magnets needed here which I later split each at half having a total of 4.

A note: notebook HDD magnets didn't work for me I guess they don't have enough strength, so use a desktop pc HDD magnets

Tooling

• Hot glue gun for gluing + sealing (if you have a better solution for this please put a comment!)
• Solder iron, soldering tin and some isolation tape or heat shrinkable for reed switches connections inside the pipe

## Step 3: Tying Reed Sensors Together

Connections here are pretty straight forward, one common cable for all reed switches and another on each end, if you choose to use 5 reed switches you will end up having 6 cable ends.

What I did was to get a network cable and took 6 cables from inside (they have 8 in it). Measure the height you want to get your reed switches at and solder them like the picture trying to keep them vertical along with the cable, so it will be easy to insert into the pipe.

For my experiment I've used 5 switches at 5 cm of distance from each since for this Bottle each liter is 5 cm of height.

## Step 4: Building the Buoy

I have placed instructions on each pic here, the most important thing is to seal the buoy since we need air inside for it to float so don't be cheap on the hot glue and fill every gap on outside

## Step 5: Building the Pipe

Placed instructions on each pic, here some tips:

• It's a good idea to do 2 holes in the bottle cap so you can put and take water to test.
• Pipe cap may not be necessary, I think a good amount of glue will do the job BUT the cap also works as a trap-end for the buoy so take that into account
• Since the pipe will have air inside water will push it up which will take it away of the bottom. To fix this I used a rubber that came with the flush system kit from where I took the pipe, another option would be to fix it to the bottle cap using glue

## Step 6: Getting Some Test Signals - LEDS

Our final step is to get a visual signal for testing the device, it can be anything I've chosen leds cause it's the easier and faster way of doing it, but normally this is a first step to a bigger project where we will be doing something with that signal and a led won't help much in there.

## Step 7: Testing It All Together

So here we are, a simple level indicator using magnets. From here there are countless things you can do with it, the only thing I do not recommend is to drink this water since it will be in contact with glue and 3d printed plastic, but there are many other things to try and play, I'll be working on some projects using this, if they make sense to share I'll be creating a second instructable.

If you build one yourself, please share it on the comments with a photo. Any questions and ideas are welcome!

Participated in the
GIFs Challenge 2017

Participated in the
Plastics Contest

31 2.2K
1 1.2K
6 1.9K

## 18 Discussions

Hey Guys,

I really liked the idea set forward here. I have a concrete underground (rain)water tank of 10000 liters (total height around 2.5m), covered by a pretty heavy concrete slab. In very dry periods one typically wants to know how much water reserve there's in the tank - and being me, I'd like to know the answer to be somewhat more detailed than "still good enough" or "nearly gone".

So far I had considered a pressure-based mechanism, but there my main worry was whether clumsy me could get the needed pipe-to-sensor connection to be air-tight to get decent measurement.

I also considered an ultrasonic distance measurement, which works great in my experiments, but the "heads" of the module would have to be exposed to the inside of the tank and I'm worried corrosion will then play a significant role. In addition some statements on difference in speed of sound depending on the humidity levels also made me wonder about accuracy inside the tank.

Then I came across this page. I love the idea of using inexpensive reed switches and a float with some magnets on, but having a separate wire per reed switch would be problematic if you want to measure a high number of levels.

So, I'm considering a variation, where each reed switch can feed a voltage from a common line into the receiving line, with an additional resistor added between each two reed switches. The idea is that in this way the total resistance indicates the "highest" reed switch that is shorted (if we for now forget about resistance of the wires, which should be limited compared to the resistors used).

I also intend to make the common line driven by a data pin, so that I can make it float and instead output a voltage via one of the two other outputs shown in the schema. This would allow me to determine the actual minimum and maximum voltage that could occur at the IN pin, which would be approximately the same as respectively shorting the "lowest" and "highest" reed switch. A voltage between those limits would hence indicate which reed switch the float with the magnets would be at and hence the waterlevel. The measuring of the max. voltage is to account for any resistance in the wires from the uP to the tank. After some math I think that with N+1 reed switches (so N resistors between them), x/N = (Vmin/(Vmax-Vmin)) * ((Vmax/V) - 1).

The idea is to put this chain of reed switches and resistors inside a PVC conduit (D = 2cm, ex. https://www.hubo.be/nl/p/pvc-buis-20mm-3m/318168.h...) somehow closed watertight at the bottom end (which should be much more easy than making something air-tight) and likely also with some weight attached at that end to keep it close to the bottom of the tank. At the top of the pipe, I'd just have something closing it up to keep out moist and crawling stuff.

I've ordered the needed reed switches, magnets and resistors for a couple of \$ on ebay, which will take some time to arrive, so I haven't started any real testing of this idea yet, but what do you guys think?

Thanks in advance for any remarks or tips,
K.

yeah that's a great idea! using resistors and an analog input would work much better than having N cables with a digital input it would also require only one GPIO which makes the whole project much smaller.

About the pipe; yours sounds like a bigger setup I would put concrete at the bottom of the pipe to add weight, since you have air inside the pipe water will push it out and I think the bigger you go the stronger the force you need to get the pipe go deep through (just a thought I may be wrong tho)

Thanks for sharing that cool stuff I would love to see it when you get it working ;)

Just wondering if only one switch and light are being at atime why are there so many resisters required? one resister for all the circuits

yeah that's a good point. That circuit is only for testing purposes and it's not efficient at all but for this specific setup you can have 2 leds on when buoy is in middle of 2 reed switches (half liter mark) although you are right it can be simplify with just one resistor for all leds.
Thanks for notice it!

This is a great idea thanks! We have large rainwater tanks attached to various shed and barn rooves in an off road area of Australia: I can see that a modification of this with a tiny solar panel would be very useful!

Oh and from your comment in that post, it's a pretty solid idea using a mechanical pivot with a rotary encoder/ potentiometer but I feel I'll have to modify the bottle. Anyway I'm gonna think about tho, if is small it could be easier to calibrate (with this instructable is a matter of positioning each reed switch at an specific height, with yours could just be changing the code that reads that potentiometer value).

thanks, great post. I also thought about an Ultrasonic solution but I wanted something more straight forward, cause it was water only but I get your point, this could stop working after some time, including degradation of the 3d printed parts too.

If this were encased in stainless steel, it would be a great "Keg-O-Meter" for measuring the remaining beer in a 5-gallon keg of homebrew!

haha yeah I definitely wanna get my hands on some metal work

Hi pjnovas,

I think you will like this subject: Google: "magnetostrictive level sensor"

thanks!, I didn't knew that even existed, I'll look into it

How hard would it be to modify this to detect changes to specific gravity? I am looking for homebrew beer specific gravity sensor to use with an arduino.

If the float floats then it will work with that liquid. So potentially you could have a number of floats' n rods and adjust the effective density of the various floats by adding a grain of sand or two so that it sinks one specific density and floats in another. It wouldn't be a linear scale of density but could be used as a yes/No for a couple.

As long as the float ,floats it will work in any density of liquid...

That's a completely different thing which I really don't know anything about it, sorry.

You just built a standard reed fuel sensor circuit. That is the exact way a reed fuel sensor works. I have tried to duplicate such a reed switch with mixed results. But I too used reed switches that would turn on a circuit that had a resistor installed to add on to the total and then a standard fuel gauge could read the resistance and know exactly how much fuel you had remaining. Nice project and bravo for making it work like you wanted it to.

oh man, I haven't thought about that application it's awesome!.
I'll look more into it but I don't think I'm gonna be playing with fuel for now xD.

Thanks, I appreciate it