Tales along the way in my quest to Integrate Everything.

Sensing Salt With Sound

I have a water softener installed in my house. It is a wonderful appliance, and with the hard water in this area it is a must for anyone who does not love scraping calcium off of any surface water touches. The water softener itself is maintenance free, but you need to keep it full of salt so that it can do it’s job. I always forget to check it, and it’s usually not until I start noticing the glass shower door getting pasty that I remember to check the tank (which by now is almost certainly empty.) If only there was a way to monitor the level of the salt in the water softener, and get some warning when it is getting low. This next project will attempt to solve that problem using an interesting type of sensor – sound.

As human beings, we use our eyes to judge distance to objects. By having two eyes set apart, our brains can utilize the information received from both eyes and determine with relative accuracy how far away the object we are looking at it from our current position;  I can look into the water softener tank and see how full of salt it is. Accomplishing the task using computer vision is remarkably more complicated. However, there is another technology that has been around for decades and in fact used by some animals (bats, for example) since their inception. Sound travels much slower (comparatively) than light, and so by sending out a burst of high pitched sound, listening for that same sound to echo off an object and return to us and then measuring the time it took for this to happen, we can determine with a simple mathematical formula how far away an object is. Anyone whose used one of those electronic measuring tapes found at most hardware stores is using this technology. I bought 10 ultrasonic range finders from Aliexpress for about a dollar apiece (including shipping!) and thought this might be a good application of such a sensor.

The Plan:

I’m going to mount the ultrasonic range finder on top of the water softener, aimed down at the bottom of the tank. With the tank empty, I plan on taking a distance measurement with the sensor as an “Empty” reading. (Remember, the sensor only tells us the distance between itself and the closest object that reflects the sound it sends out. It is up to us to determine what that data means.) Then, I will fill the tank with water softener salt and take another measurement as the “full” reading. By polling the sensor periodically and calculating the distance it reports relative to our “full” and “empty” distance measurements, we should be able to determine how much salt is in the tank is at any given time.

Step 1: Determine a good location. I removed the lid of the water softener and found lots of room inside for all sorts of devicery. I picked a spot that should give a pretty reasonable reading of the salt level and drilled a pair of holes. Here you can see the sensor sitting beside the holes it will be mounted into:

02_holes_cut_in_water_softener_for_ultrasonic_range_finder

Next, I placed the sensor in the holes. I used a step bit to get the second hole just the right size  so that the sensor fits snugly into it. In fact, it should actually hold the sensor in place.

03_ultrasonic_range_finder_mounted_in_water_softener

You can see from the bottom (inside the tank) what the sensor looks like:

04_ultrasonic_sensor_from_inside_water_softener

 

And lastly, here is the whole water softener, tank and sensors in the same shot:

05_water_softener_with_salt_level_sensor

Lastly, I need to connect the sensor to a board that can trigger it and interpret the response, and send that data back to Venturii. I’ve started working on the code that will get merged into the VDAC (Venturii Data Acquisition and Control) firmware tree, and I think my prototype VSAC board will make a good candidate for connecting these types of sensors to since we don’t need very many samples from this thing – one per minute (or maybe even one per hour) is probably plenty. Once I get that done, I will take the samples (conveniently, the tank is practically empty at the moment.) This might also be a good time to get out the wet vac and empty the bottom altogether. It’s never been cleaned since I’ve been in the house – perhaps even a good hose down might be in order. I’ll post back in a few days and report on the progress – and hopefully results!

Comments on: "Sensing Salt With Sound" (1)

  1. Today after quite a bit of work I figured out what was wrong with the sensor. For all my tinkering, I’m [somewhat] kicking myself now, but perhaps it’s just as well I went through the exercise and learned the lessons I did. As it turned out, the sensor was only getting 3.4 VDC, not nearly enough. An article I read where someone reverse engineered this sensor explained the theory of operation, and showed how the clever engineers that designed it use the MAX232 IC to pump the 5VDC VCC to 10V to drive the ultrasonic pulse out of the transmitter. Of course, giving it only 68% of it’s designed voltage, things go awry quickly. Actually it takes about 10 minutes. What I was finding was that sensors seemed to work for about that long before they would start to exhibit [strange behavior]. However, with the input voltage now fixed, I’m getting solid readings from the unit, and am ready to begin testing for full and empty conditions to create a formula for determining “percent full” numbers for the unit. From that I suspect there will be some further computation to allow for some sort of chart depicting how much salt we go through in each month. Venturii can dispatch an email once the salt level gets below a certain point, reminding me to pick up more next time I’m in a Home Depot. Regeneration cycles will also be interesting to observe from a sensor data perspective! In any case, this one appears to be a success, another unusual device integrated successfully with Venturii!

Leave a comment for: "Sensing Salt With Sound"

You must be logged in to post a comment.