How To Check Salt Level In Water Softener
Methodology
This method uses an "ultrasonic" sensor so nothing touches the table salt. Likewise, with the mounting method used, the sensor tin be pivoted out of the way for easy refilling of common salt in the water softener.
First, I would similar to thank young man Cocooner roussell for posting about the Maxbotix Ultrasonic Sensor in THIS thread. This sparked an interest for a lot of applications, thus THIS dedicated thread was created.
As well, this How-To was featured as a Abode Toys article for their August 2006 issue.
Ultrasonic Sensor Details
Hither is the link for the Maxbotix Ultrasonic Sensor used.
These MaxSonar-EZ1 offers very short to long-range detection and ranging, in an incredibly pocket-sized package with ultra low power consumption.� The MaxSonar-EZ1 detects objects from 0-inches to 254-inches (half-dozen.45-meters) and provides sonar range information from 6-inches out to 254-inches with ane-inch resolution.� Objects between 0-inches and half dozen-inches range every bit half-dozen-inches.� The interface output formats included are pulse width output, analog voltage output, and asynchronous serial digital output.
�HERE is a detailed information sheet for this sensor.
Preliminary Testing
Bench testing was commencement performed to determine what code/methodology was needed for a series interface too every bit power and overall system accuracy. I had a leftover 5 volt wall wart and since the unit required iv.v to 5.5 volts DC for power I thought it would make for a proficient power source.
Afterwards plugging in the wall-wart (to check the voltage output level earlier connecting it to the sensor), I noticed that the voltage was slightly above five.5 volts DC (a mutual trouble with most wall warts that I utilize in my abode). I therefore placed a diode in-line with the positive lead in guild to get the voltage down to a level within specs.
All the unit needs for an RS-232 interface is for pivot 2 of the serial port to be connected to the "TX" solder ring and pin five to the "GND" solder ring. The wall wart would of course exist connected to "+5v" and "GND".
HyperTerminal was used to check for communication. As soon as the unit was powered up and HyperTerminal set for 9600, Due north, viii, 1 serial port settings (no hardware control) the unit sent an "R" followed by a iii digit ASCII number which represented inches. The update was very fast and information technology was accurate to within one inch.
I found that as long as the "RX" line was loftier (or disconnected in this instance), the unit would merely "free run" (i.e. continue transmitting the information). I too noticed that CPU level was significantly increased when the unit of measurement was continued and free-running.
Since I wanted to place this unit in a very warm garage environs and since I didn't want to take it gratis run I decided the easiest way to have the unit interfaced with my automation reckoner was to plow power to the unit on via an appliance module for merely a second whenever data was needed (only once a solar day in this case).
I would simply plough the apparatus module on, wait a 2nd, get the distance data to a HomeSeer device, then turn the unit off.
I would like to thank Michael (the Great) McSharry for helping me out with the serial code (in THIS HomeSeer thread) to interface this device via HomeSeer. Though this code is HomeSeer specific it should be easily modified for other HA systems.
Mounting the Sensor
The Water Softener
The sensor is very small and is very piece of cake to mountain. Intendance must be taken equally to not short out any circuitry on the PC board.
I mounted the unit of measurement on a leftover "hinge mountain" from an Ten-10 security motion sensor (I dropped the motility sensor... long story). I used a safety washer between the mount and the sensor's PC board. I drilled a small hole through the arm of the mount and fastened the sensor equally shown.
Ultrasonic Sensor Mounting
I then attached the mount to the water softener. Brand sure yous know exactly what you are drilling/screwing into equally non to damage the h2o softener itself!
Ultrasonic Sensor Mounting
Ultrasonic Sensor Mounting (Overhead View)
I had the luxury of Air-conditioning Ability and Cat5e cable available near the water softener (prior planning before the house was built). I simply used a pair of Cat5e wires from that cable (for the RS-232 bespeak and gnd) and plugged an apparatus module and the wall wart in the nearby outlet via a dwelling house made short Ac extension cord (for the unit's power). This homemade extension string has a congenital in small amperage fuse, therefore I didn't place any additional inline fuses in the system.
I then routed the five volt power leads and the Cat5e pair through the water softener's "overfill drain" outlet and soldered the diode and leads to the sonic sensor's PC board.
Making the Connections to the HA Computer
I and then wired the HA calculator's Com7 port to the advisable patch socket in my wiring closet via a custom DB-ix to True cat-5e interface cable. Every bit long as yous continue track of the colour pair (brown/brown-white in my case) that you lot wired the sensor'due south TX and GND lines to, this cablevision will work through multiple patches.
I merely wired the brownish wire (connected to the TX) to pin #2 of a 9-Pin D Female connector and the brown-white wire (connected to GND) to pin #five of the D Female person connector to one cease of a (cut) Cat-5e cable and plugged the other end into the nearby RJ-45 socket. Afterward going through multiple patches I so used a cut piece of a Cat5e jumper and placed the RJ-45 connector end into the outlet near my computer and soldered the brown wire to pin #2 of a ix-Pivot D connector, and the dark-brown/white wire to pin #v. I and then connected the ix-Pin D connector to Com7 of my Edgeport USB to eight port serial expander which is on my HomeSeer PC.
Yous can besides apply a RJ-45 to 9-Pin "D" connector (such as THIS one) for this final connectedness instead.
Final Wiring & Mounting
Testing the System
I again opened HyperTerminal upward and looked at Com 7 with the appropriate serial parameters listed above.
I then turned the appliance module on and noticed a reading of R018 on HyperTerminal which of course meant the unit was reading 18 inches.
I took a record measure and measured from the "tip" of the sensor to the salt level and that reading was over 17 inches. Therefore the unit looked like information technology was working properly. I took a slice of cardboard and tested other "simulated" table salt levels. The unit'southward readings were e'er within an inch of the real measurements.
Developing the Code
As mentioned earlier Micheal McSharry helped with the bulk of the serial interface code. Basically when HomeSeer starts, I want to open up Com 7 (in my example as I'm using an Edgeport 8 serial to USB interface) in the "StartUp.txt" file and close the Com Port when HomeSeer exits.
And so, whenever a reading is needed, a HomeSeer consequence will exist created and the unit will ability on for a second and so power off. During that time a sensor reading volition be "blimp" in a HomeSeer device and a "converted percentage" reading stuffed into another HomeSeer device. This second per centum reading will correspond the salt level in "%" (i.due east. between 0-100 percent filled).
Code Listing
Here is the HomeSeer (ver 1.7x) code I used to open serial port 7 and is placed in the "startup.txt" entry:
Note that I'm using HomeSeer virtual device "R10" to store the inches data from the sonic sensor and "D12" for the appliance module for controlling power via the wall wart.
'Open Com 7 and have Sonic Sensor "Push" Readings To Device "R10"
e=hs.OpenComPortex(7,"9600,n,viii,1",1,"sonic2.txt","sonic", chr(xiii), i)
if due east "" so msgbox "Mistake opening COM7 (Sonic Sensor): " & eastward
And here is the lawmaking for the "sonic2.txt" file that is referenced past the hs.OpenComPortex control:
sub sonic(data)
� �if left(data,1) = "R" and len(data) = iv then
� � � �sDigits = mid(data,2)
� � � �if isNumeric(sDigits) then
� � � � � �hs.setdevicestring "r10", cstr(cint(sDigits))
� � � � � �hs.setdevicevalue "r10", clng(sDigits)
� � � �end if
� �finish if
end sub
Of grade when HomeSeer shuts down the Com7 serial port must be airtight. Place this lawmaking in your "Shutdown.txt" script:
hs.CloseComPort(7)
Doing the Math
Well, I really don't like "inches" and would rather have "percent filled" displayed in another HomeSeer device. In order to do this, some math relationships need to be established.
Observe in the within water softener picture there is a graduated pipage with measurements starting with "8". I only fill up the softener upwards the the acme of the "7" marker, therefore I'm calling this 100% filled. This comes in handy since the way I mounted the sensor that the commencement reading by six inches was the top of that "7". (Remember this sensor does non start reading at zero, rather it starts at vi inches).
I never desire my common salt level to get below the "top" of the "1" in the graduated pipe and so I will call that "zero" percent filled. Now an equation needs to be established with the ultrasonic inches readings and these percent human relationship boundaries.
Taking the Data
I first took an ultrasonic reading for the top of the "seven" graduated piping mark by placing a large sheet of paper-thin at the top of the "7" marker and, keeping the cardboard level, took a reading with the sensor.
I then took readings at the "half-dozen", "5", and "iv" marks (since the electric current salt level was below the "4". At each reading I took the corresponding "inch" reading from the ultrasonic sensor. The results are shown below.
Inch Data Measurements at Graduated Pipe Markings
Equally y'all can run across the data is linear (three inches separates the readings on the graduated pipe's readings). Therefore (as we learned in THIS Guide) we tin develop an equation which represents a relationship between the ultrasonic sensor's "inch" reading and "percent" filled.
Since the data is showing a nice linear progression, I merely extrapolated the date to the "3", "2", and "i" marks (since the salt was higher up those numbers, thus prohibiting taking "real" measurements at those levels).
Offset let�s take a look at the two "extreme" information pairs (for zero and 100 percentage filled):
INCHES (X Value)_____PERCENT FILLED (Y Value)
7"__________________100%
24"_________________0%
Now we demand to calculate the slope intercept formula using those data sets to a higher place. For a very detailed explanation on how to practise this delight run across the Analog to Digital Converter Guide.
The equation Y = mX + b will exist used where k represents the "slope" and b represents the "Y-intercept".
Summate 'g':
k = (Y2 - Y1) / (X2 - X1)
m = (100 - 0) / (7 - 24) = -5.882
Calculate 'b':
Now solve for b using one of the data pairs above (24,0 in this example):
Y = mX + b
0 = -v.882X + b
b = 141
Determine the Equation:
Therefore we have an equation which tin convert "inches" from the ultrasonic sensor to "percentage filled":
%Filled = -5.882 (inches) + 141
You can exam this equation using whatever data pair listed above and encounter that information technology is correct. For additional details on how and why this method was used please refer to the Guide listed above.
Implementing the Final Code
Now we take to place all of the higher up pieces together with an event that will run a program to comprise all of the in a higher place features.
Using HomeSeer set an event to burn one time a day (probably in the evening for the voice announcement to be heard) to implement this code (recollect the Com port was already opened via the "startup.txt" script):
For my scenario D12 is the appliance module device, R10 is the ultrasonic "inches" data device, and R11 is the "percent filled" device.
sub chief()
Dim SaltLevel
hs.ExecX10 "D12", "on", 0, 0 �'Ability for Sonic Sensorhs.WaitSecs 1 �'Expect Ane Secondhs.ExecX10 "D12", "off", 0, 0 �'Power Off Sonic Sensor hs.setdevicestring "r11", (141 - (five.882 * (hs.DeviceString ("R10"))))hs.WaitSecs 10 �'Wait Ten Seconds
Dim SaltPercent
Dim i'Set virtual device r11 to percent from the inch reading of r10
hs.setdevicestring "r11", (141 - (5.882 * (hs.DeviceString ("R10"))))If
hs.DeviceString ("r11") > 22 so �'Send an Email if salt level (inches) to low
����
hs.sendemail"yourpop3.com","yoursmtp.com","Water Softner Table salt Level Low", "The Water Softener Needs to be Filled!"hs.speak "The H2o Softener Needs Filled"end if
terminate sub
�I was having a timing problem where the percent device would not go updated, only the inch device would. I solved this by the hacked fix above of just reading and computing the percent twice (I know, hack chore but I got a little lazy towards the end of this project). Perhaps one of you code gurus tin figure that problem out for me.
When the salt level gets to exist more than 22 inches from the sonic sensor (i.east. less filled) yous tin send an Email so you can remember to make full information technology.
Putting the Icing on the Block
I use MainLobby and asked Mario if he could create a flash icon which would visually represent the salt "per centum" filled for my h2o softener. He fabricated the icon below. Note that the slider uses a value from zero to 100 for it'due south min and max values. I can associate the "percent" HomeSeer device to this icon, thus having an authentic visualization of how total my water softener is!
***********MainLobby Flash Icon of H2o Softener***********
Decision
This represents one way to measure salt level for your water softener. I disadvantage is it needs a serial line to the water softener from your HA machine.
Ane of the many advantages is there is goose egg touching the table salt and no strings or devices that need to exist reset/recoiled when filling the softener. I would recomend covering the sensor with a small baggie though when filling the unit and so the salt's dust can non enter into the sensor.
Forum Thread
How To Check Salt Level In Water Softener,
Source: http://cocoontech.com/forums/page/articles/_/tutorials/home-automation-tutorials/how-to-measure-the-salt-level-in-your-water-softener-r49
Posted by: matterfinge1992.blogspot.com
0 Response to "How To Check Salt Level In Water Softener"
Post a Comment