Sunday, January 12, 2014

Major burst of progress

I've been slacking on documenting my pool automation project, but I'm about half way done now. This post will highlight the hardware aspect.

Features:
  • control Pentair Intelliflow VS pool pump and set run speeds as well as query status
  • monitor pH and chlorine (with ORP) levels in pool
  • control Pentair Intellibright LED pool light 
  • be able to turn waterfall on and off
  • be able to switch between pool cleaner and skimmer/pool drain 
  • capability to upgrade in the future to a solar pool heater. 
Here are the components used to get the features above:

RF board:
8 channel Relay board (GPIO interface)
ORP sensor kit (TTL serial interface)
pH sensor kit (TTL serial interface)

Around October I whipped up a PCB and sent it off to OSH park to fab in parallel with ordering all the parts from Digikey. The PCB design took longer than I wanted as my interest on the project waned somewhat because my final plan wasn't too solid (specifically the software part). Before submitting the design, I double and triple checked the footprints and connections in the schematic.

After getting everything in I dove into making a board. Despite the PCB being somewhat simple, I still made several mistakes. The first was with the RS485 package. I thought there was only 1 8-SOIC footprint (I took one from the Sparkfun Eagle library to make the part). Turns out there are many "widths" and I had ordered the 5.3mm part, not the 3.9mm. Oops. I some how managed to squeeze it onto the PCB with a lot of careful pin bending. IC parts are not meant for their pins to bend. I ruined a part when one of the pins broke off.

Everything else on the PCB assembly went pretty much ok. The next issue popped up when I could not communicate with the pool pump. I was fairly confident I had the right protocol information from the Internet.  After struggling all weekend I finally realized the part needed 5V, not 3.3V. Double Oops. I was able to sever the 3.3V trance on the PCB and send a floating wire from the 5V pin of the regulator over to the part. Success! I could communicate with the pump and tell it to turn on and off.

The next fun came when I tried to read a thermistor via the DAC chip. It just would not read, so I broke out the DSO Nano oscilloscope and saw signals toggling wrong. Despite I2C SPI specifying signals like "master in, slave out (MISO)", I still wired the chip up backwards to the Synapse module. Again, more PCB surgery with cut traces and floating wires and I got it to work.

This was a lot of mistakes with a single PCB. I've made several in the past that were a lot less error free. I think what got me in trouble was the PCB design being drawn out over several months. Lingering that long didn't allow me to focus on the details like I should have.

I decided to edit my PCB and make a new spin of the board with all the fixes. While I waited on the new PCB, I ran across some Maxxim RS485 parts I had sampled way back and forgot about. Great!, I said. No need to order 3 tiny parts from Digikey. I can just use the Maxim part. Well I got the new PCB rev in and went to town soldering all the parts on. However, the pump communication was dead again. After spending way too much time debugging the issue I re-read the Maxim datasheet and realized the part has a "low power mode" when the TXEN pin was off. There is a required wake time before the part can take data in, and I think the Synapse module is violating the timing. I don't have a logic analyzer to show it for sure, but I'm pretty sure that is the problem.  Going back to Digikey to see what I could find, I tripped across the original TI part, but in a 3.9mm width package. Woot! Since the old rev PCB was more functional at this point, I swapped it back into the system for more testing.

So with the Christmas break fast approaching and no project plans yet, I decided to order the ORP and PH kits to work on that over the break.  I was able to plug them up and get them working without a fuss. This was a nice change after all the painful milestones before. I even found all the plumbing parts to create a "sensor manifold" with out going to a commercial plumbing supply store. Just some 1/4" plastic tubing, a few adapters for icemakers/water purifiers, some 1/2" threaded PCV tubing and some probe adapters. Right after I bought the kits from Atlas Scientific, they started carrying the adapters themselves. I always hate paying for multiple shipping charges. Oh well.

At this stage I placed everything in the box outside and left it for several days. All of a sudden, the pump communication started to fail. Great. What's wrong now?  Turns out now my hacked wire supplying 5V to the RS485 chip had a cold solder. As I attempted to fix it, the 5V pin broke off the RS485 chip. Awesome. No more pump communication for me. Time to finally order the right TI part. Luckily I found the 24VAC transformer I need to power the valve acutators, so the shipping charges are less annoying now.

That's pretty much where the project stands today. I'm waiting for the Digikey order so I can restore communication to the pump again. I really, really hope getting that right part in will solve the intermittent communication issues with the pump I had.

My next post, which should be soon, will dive into how I solved the software side of things. Sometimes starting and failing to solve a problem just opens the door for new solutions later.

Saturday, August 24, 2013

Bootstrapping

My last posts on my old dead blog were documenting an atmega128rfa1 based wireless network I was building. The plan was to use Contiki OS. After I got the PCBs made and assembled (44pin QFNs with toaster oven reflow), I realized the software part was going to take a lot of work. Also the amount of effort it took to make such small, complicated PCBs was not worth it either. My interest in the plan decreased and my workplace got sold to another company. I decided it was time for a change of plans, and change in location.  Now fast-foward 2 years to today.

So now I'm in Phoenix, AZ, but my needs have changed. I still wanted to open my garage doors from my phone, but I also need to automate my pool. First step was to make a solar powered temperature monitor using an RF200 Synapse module, coupled with an Solar powered Wireless, Sensor Node kit and xbee2synapse adapter board. You can follow the temps on my Xively feed.  The pool_air_temp channel isn't really accurate as it is directly in the sun. It's hot here in Phoenix, but not that hot. I need to make a better case for it so the guts are shaded, but the solar panel is outside the shade. 

After learning all about pool maintenance at the awesome troublefreepool.com site, I decided to go with liquid chlorine system. Chlorine generators (salt systems) are expensive and with the hardness of our water (high calcium), I just didn't think that was a good way to go. People say they like the feel of a salt pool, but you can always add salt in a liquid chlorine system.  Chlorine tablet systems were highly discouraged in the TFP site as it will overload your pool with chlorine stabilizer (CYA). If you ever get into trouble with algae, I'm told it's nearly impossible to fix it when your CYA levels are off the chart.

During these summer months, I have to pour about 1 quart of 15% in every other day with 1 quart of acid once a week. I'm sure come fall the when the temps lower and amount of sunlight the pool gets lowers, those amounts will have to change. Thus my desire to digitally monitor these 2 chemical levels of my pool and automate injection of them to keep things in balance. 

I would also like to swap out the single speed pump with a variable speed (VS) pump to save on energy costs. On top of that, one day I would like a solar pool heater so I can get 3 more months of pool usage out here. I was kinda surprised when I learned that pool season is not 12 months here in Phoenix. The pool temps are really only enjoyable May-September. Evaporation and reduced sun in the fall/winter really causes it to cool down fast. 

I'm definitely learning pool equipment has crazy markups. Worst of them is digital automation controllers. Even a basic one that does just time of day pump on/off costs >$200. A "decent" one will set you back $1k. The guts of those things are relatively simple......

Since my post is going long, I'll stop here. Next episode I'll post some details about the automation system I'm about to build. Synapse wireless modules to the rescue!