I have a small in-ground swimming pool, with a sand filter. The filter occasionally needs to be backwashed, when the sand has filtered a lot of dirt from the water. The filter has a pressure gauge on the top, providing a PSI reading. The pressure reading is used to determine when it is time to backwash. For my setup, the filter starts clean at around 10 PSI, and needs to be backwashed at around 20 PSI.
OK, I'm lazy. I can see the pool from my window, giving me a overall visual of how the pool is doing. But if I want to know how the filter pressure is doing, I have to walk, ALL THE WAY OUTSIDE.
So, I thought I would see if I could develop a wireless pressure sensor to send the pressure reading to me.
Step 1: Arduino and XBee to the Rescue
These are the main parts I used for my wireless pressure sensor system. I chose the Arduino Nano because I already had a shield that fit nicely in an otterbox that I had on hand. You could use any arduino and shiield combination that works for you. You will need a shield for an XBee radio.
- Arduino Nano V3 (5V)
- Nano IO shield from iteadstudio
- XBee 2mW Wire Antenna - Series 2 (ZigBee Mesh) (qty 2, 1 for inside, 1 for outside)
- Otterbox for weatherproofing
- Generic Carbon Steel Alloy Variable Pump Water / Air Pressure Sensor(DC 5V)
- Anderson Metals Brass Pipe Fitting, Barstock Street Tee, 1/4" Female Pipe x 1/4" Male Pipe x 1/4" Female Pipe
- A generic 9V wall wart (DC convert for power)
- XBee Explorer USB
For inside the house, I have the 2nd XBee radio with the SparkFun XBee Explorer USB, attached to my computer.
Step 2: The Pressure Sensor
I searched for a long time trying to figure a way to get a pressure sensor into the system.
I knew that the top of the filter where the existing pressure gauge was attached, was the best place. And then I noticed a lot of nice brass fittings on Amazon. So it dawned on me that I could install a Tee fitting where the existing gauge is connected, and install my electronic sensor there. The sensor that I found is also on Amazon. The threads on the sensor are not exactly correct for the fitting, but it works. The brass fitting is "NPT", which is tapered, but with some teflon tape and a little thread sealant, it works fine.
The sensor takes a 5V supply, and gives an analog reading between 0.5V to 4.5V. I found this in the "product details" section on Amazon (the sensor came with no documentation). This is perfect for an arduino analog input pin. This is another reason why the Nano IO shield works well, the pins are broken out with 5V and GND conveniently next to each I/O pin. I'll talk more about reading the analog pressure later when we get to the code.
Step 3: Weatherproofing and Wiring
The arduino and shield obviously need to be protected from the elements. The sensor itself is very rugged and has a waterproof connector. I drilled 2 holes on opposite sides of the otterbox, 1 for the sensor connection, and 1 for the power supply. I sealed the holes with a little silicone sealant. This should keep everything dry. At this point, the weak link is probably the AC adapter. I have a protected outlet for the AC adapter, but the wire is not ideal for an outdoor application. I plan on replacing the wire with something better for outdoor use.
Step 4: Attaching to the Filter
Velcro is your friend. I used some velcro inside the otterbox to hold everything in place, and I used some rugged outdoor velcro to hold the otterbox to the side of the filter.
Step 5: The Code
I made the code a little more complicated than most people might want. You can use my code as an example, especially reading and translating the analog value into PSI.
But, I use the XBees in API mode. This is mostly because I am used to doing it that way. You can simplify your setup by simply programming 2 radios to automatically connect to each other in AT mode like a "wireless serial cable", if you desire. There should be many examples on the Internet for that.
Additionally, I encode the pressure reading into a little bit of XML. I might have gotten a little carried away, but it could be useful later.
The XML is sent once every second.
I also increment a counter that is sent with each reading, and a UUID, because again, I got carried away. The UUID is created with a library called TrueRandom. The sketch file is called, PoolPressure.ino.
Inside the house, I use Linux with the XBee Explorer USB. For this, I use Attie's awesome library, libxbee. The code simply connects to the remote radio, and logs whatever comes from the radio. For now, I simply look at the end of the file to see the latest pressure reading. The code for Linux is in the file, pool.cpp.
Step 6: Finished
I hope this project gives you ideas for your pool.
The code may be a little advanced for some, but can be simplified if you look at common examples of using XBee radios with arduino.
Please leave feedback. This is my first Instructable, I hope you enjoyed it. I will update to make things more clear if there are questions.