Did you know that you can enjoy many members-only features simply by quickly registering (no CAPTCHA!)?
Registering gives you access to our giveaways, forum features, increased search performance, access to our Download Library, create your own blog & gallery, and more!
Once you have registered, stop by in 'Hello World', and introduce yourself.
Categories See All →
Updating Ubuntu 14.04 and Ubuntu 16.04 video to work with Kodi 17.4
pete_c - Oct 08 2017 07:56 AM
How to use a AS3935 Lightning sensor with a Raspberry Pi
pete_c - Jul 03 2017 07:14 AM
[How-To] Measure Salt Level in Your Water Softener (OLD SCHOOL METHOD)
As the string is extended or retracted, it turns a multi-turn potentiometer so its change in resistance is proportional to the distance of string extended from the unit. If one were to apply a voltage to this device the amount of string extended would see a proportional voltage change from the potentiometer.
This potentiometer's voltage would then be measured by an existing analog to digital converter. In my case, I used a PH-Anderson 10-Bit A-D converter, but the Elk also has this capability of converting an input into an analog zone.
A typical off the shelf string potentiometer is shown below:
Unfortunately, these devices can cost upwards of $150 which makes it cost prohibitive for typical home automation enthusiasts.
This How-To will show you a method to make your own string pot for about $20 and will have a measurement distance slightly under three feet!
This idea was derived from THIS YouTube video, where the user used a retractable key-chain/badge holder to turn a ten turn potentiometer by incorporating a pulley on the potentiometer's shaft. To incorporate this device for measuring salt level in a water softener the measurement capable distance would have to be increased. Also, it would be nice if 'machining' a pulley was not required.
A search was performed to find a heavy duty retractable holder that had a longer distance, and THIS product seemed to match these requirements. It has a heavy duty rating plus 40 inch pull length (I need a measure capability of approximately three feet for my particular water softener).
I planned on using THIS ten turn potentiometer from Bourns as they are of very high quality and the shaft can easily turn (with hardly any resistance). Note there are cheaper multi-turn potentiometers out there, but the aggravation of using them isn't worth the five bucks you will save, unless you happen to have them around and their shafts easily turn. I choose a value of 10KOhms as it would draw little current using a five volt excitation supply (the maximum measurement capability of my analog to digital converter).
The real hassle came when trying to find an off the shelf pulley to mount on the shaft of the potentiometer. The retractable holder has a string pull out distance of 40 inches, which would be incorporated into as many turns of the potentiometer as possible (for good accuracy/resolution). So one turn of the potentiometer would require using about four inches of the holder's string distance (40 inches / ten turns of the potentiometer).
Using the formula Circumference = 3.1416 * Diameter and substituting 4 inches for the circumference yields a needed pulley diameter of 1.27 inches (4 / 3.1416) or roughly 1 1/4 inches. Now one would think that with the vast information available by Al Gore's Internet that this would be an easy accomplishment, but it was far from it.
To make a long story short, an optimal pulley was found in a local Hobby Store, no, not in the plastic pulley section, but in their vast selection of model wheels! A model wheel was found that, with the tire portion removed, the 'pulley' was a nice 1.2 inches in diameter!
A pulley with a smaller groove would be optimal, but this would have to do for now.
If your local hobby store does not carry these model wheels they can be purchased from Amazon.
Shown below are all the main components that were used for this project:
The center hole of the wheel/pulley was drilled so it fit tightly over the potentiometer's shaft. The potentiometer, pulley, and retractable holder were mounted on a small thin aluminum plate.
Note the way the string from the holder was placed over the pulley. This was proven to be the optimal (minimal slippage) routing as it contacted nearly the full circumference of the pulley while not getting tangled between the lines entry and exit from the pulley.
A small grommet was mounted on an angle bracket and the string feed through it to prevent the line from running into the pulley when retracted.
HERE is a YouTube video showing the finished product's performance. The final measurement capability turned out to be 2' 10" due to the pulley's actual diameter and cutting off some amount of string from the badge holder in order to feed it through the grommet (and retie it).
The linearity between the resistance and the distance of string extended was tested and graphed as shown in the diagram below:
Note that these tests were performed before the string was cut and placed through the grommet (thus capable of the full 30" length).
Also, note that the points can form a straight line (if drawn on the graph) which shows optimal linearity (thus a change in resistance is directly proportional to a change in the length of string).
In order to get this information into a useable format for a home automation system an equation of the line must be determined using the Y = m X + b slope/intercept formula.
A How-To on Analog to Digital Converters Explained was created that shows a step by step process for determining this. An easier method exists for those that have Microsoft's Excel though. After entering the values on two columns plot them using a scatter plot graph (DO NOT use a line graph). You will have to select the appropriate columns for the X and Y axis, but should wind up with a graph similar to the one above).
Now, right click on any data point on that graph and then click on "Format Trendline..." as shown below:
Now a dialog box will be shown for various data trend options. Make sure the "Linear Trend/Regression" type is selected and that the last two box entries are checked as shown below.
Now the equation will be shown on the graph as well as a linear trend line. Also, the closer the R-squared value is to a value of one the more linear the data is.
For this graph "Y" will of course represent resistance and "X" will represent inches. Note that we will wind up taking data again once the unit is installed in the water softener (preferably near empty) and will plot voltage or bits measured by the analog to digital converter vs. percent of salt left (more on this later).
The potentiometer's wiring was then connected. Since my A-D board has a maximum voltage measurement capability of five volts, I selected a five volt wall wart that I had on hand. The schematic is shown below. Note that I elected NOT to install a fuse (as the wall wart's current was very low) but this could be an option one may want to deploy.
Now that the unit is assembled and tested, it was installed in the water softener as shown below.
A weight was placed that would ensure the string retracted when the salt's level decreased.
One thing that I did note from earlier testing was the pulley did not return to the exact same spot once retracted. This is not a problem as the pulley can easily be turned to a marked location each time salt is refilled (i.e. only needs to be accurate when 'pulling' down). The unit is repeatable when taking multiple readings in the same 'down' location though. I believe this is a result of the weight being lifted when retracting the string and not enough tension exists between the pulley and string (if this were a 'grooved' pulley, this would probably not happen). In any case, I wasn't worried about it in my application as I only need to readjust the pulley about an eighth of a turn when refilling.
Now that the unit is installed, it needs to be calibrated in situ with the water softener and analog to digital measurement system. There are many ways to do this, but the method I choose is to divy up the maximum (100% full) and the minimum (0% full) readings. I have a graduated label 1 through 8 on the side of my softener. Since I wound up a few inches short of the full height of salt level capable, I decided on the '7' of the label to be the 100% full height and the '1' of the label to be the 0% full height. This would give me a bit of a buffer (between 0 and 1 of the label) before I totally ran out of salt (like the reserve gas switch on a motorcycle!).
Now that the analog to digital converter is in place, it is possible to retake calibration data and incorporate this 0% and 100% height and see what corresponding bit value is achieved with the analog to digital converter. One could also establish another value (say mark the 50% height or even more points) and take those corresponding data points as well.
A new plot will need to be established and with it determine the new equation as described above which will now incorporate percent filled with bit value measured from the analog to digital converter!
Since I have this value as a HomeSeer device, I can send emails to remind me to get salt at a predetermined level! I also have an event that records the date/time with the current level once a day so I can graph salt usage (why, because I can!).
Many other options exist now that you can incorporate current salt level with your home automation system system.
Note that this method is not perfect and has its flaws. Most notable, having to slightly turn the pulley to its original position when refilling with salt (as you have to retract the weight and move it out of the way). But, if marked carefully and prominently, this really isn't much of a problem (takes under five extra seconds to do).
Also, though this is a heavy duty retractable holder, I'm wondering how it will wear over the course of time (though if you think about it it only really fully retracts less than once each month with my current salt usage).
Plus, this method beats monitoring the 'idiot light' that blinks when the salt is at a low level (I really don't like the threshold on mine as it starts to blink with many, many days of salt left).
Another important note is I have NO long term experience with this methodology, but of course will update this How-To over the course of time with any successes or failures (this is an alpha version!!).
As any project, it can be improved, especially with the suggestions of our membership, so feel free to comment (go to the forum post to submit any questions or comments).