January 5th, 2014
I have had a desire to be alerted when the salt level in my water softener gets low. I have put this off and put this off. My original plan was some convoluted mechanism of springs and weighing the barrel. The main reason for that was the concern that the salt would corrode any electronics that were inside the barrel. Later I thought of a sealed magnet with a reed switch or hall affect sensor on the outside. Then I read a post somewhere that basically said that the salt shouldn’t be an issue. I like that! I went with the Parallax Ping))) sensor since I had a couple around. Originally, I had planned for this to be an Arduino project. But I become very pro-Raspberry Pi since then. It has less I/O than an Arduino, but most (all) of my projects require very few I/O pins. The other day I decided that this needed to be completed. I found an article that very simply and easily got the distance value from the Parallax Ping))). That forum post is here. User feiry absolutely nailed it! As feiry did, I used pin 11 on the Pi for SIG, pin 2 on the Pi for 5v and pin 6 on the Pi for GND.
You will have to forgive that image. I’m new to Fritzing.
The next important bit is the code that will get the distance for you. As I said this is the code that was posted by feiry back in October.
import RPi.GPIO as GPIO
I wrote a shell script (I need to learn more python) that calls that python code, then takes the value distance, populates a variable with it and inserts it into a mysql database. Then I have a script on my database server that will check various values from the database and do things based on those values. Mostly it will email me when a value requires attention.
There you have it. A Raspberry Pi based water softener salt level notification tool.
Special thanks to feiry and richlish…@gmail.com
Forum thread: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=37&t=7688
Fritzing part for Parallax Ping)): http://code.google.com/p/fritzing/issues/detail?id=875#c508