Monthly Archives: January 2014

Dual Speed Swimming Pool Pump Controller

A couple of years ago, I installed a dual speed motor for the swimming pool pump. It works great and rather than burning 9 amps @ 220V to circulate the pool water, it can run half speed at 2 amps @ 220v. As you can imagine, this saves quite a bit of money and is also much quieter.

Unfortunately, there is a downside. If the pool heater starts heating the water when the pump is running at low speed, the water begins to boil in the heater – not good. The boiling sounds are quite loud, and when I hear them, I can run outside and flip the switch to run the pump at high speed. This is not ideal. I am not always at home or awake… sadly.

To solve the problem, I have been working on a motor control circuit, to measure the water temperature as it enters the pool heater, and as it leaves the pool heater. If the output temperature is 1C higher than the input temperature, the controller activates the high speed winding on the pump motor. When the temperature differential has dropped below 1c, the controller waits about 15 more minutes and then returns the pump speed to low speed (eco).

PoolControllerPrototypeThe controller has two switches, one to force the motor to run at high speed (when you need to clean the pool), and the other to put the system in maintenance mode (stop motor to clean filter, etc.), and a 2×20 LCD display to show the current status. The pic below is an early prototype without the display header.

The brains of the controller is an ATmega328 microcontroller with and Arduino bootloader. This monitors the waterproof temperature probes and switch settings. An MC14555 1of4 switch is used to activate the relays. 2013-05-11_22-51-15_464Theoretically this part is redundant, but since I trust programmers about as far as I can throw them, (I can’t throw myself very far either…) I added this switch to make sure that it is never possible to have both motor windings activated at the same time. The chip will only activate one output pin at a time.

Picture 11I had initially planned for the switching to be done by a pair of Solid State Relays. Benchtop testing successfully powered an incandescent bulb and aff. The testing was done using 110V (!). The controller was mounted in a spare outdoor electrical box left over from the hot tub I used to have. For power I dug out an old Nokia power supply and connected it to one side of the 220V motor circuit and ground(!).

Picture 10 I wired up the controller and the motor, installed the temperature probes for the heater, double checked all my wiring and when satisfied, flipped the master switch. A short blink on the LCD display and then it went dark. After considerable effort rechecking the connections, I went to the basement to check the circuit breaker for the pool. The breaker is a Ground Fault Interrupt (GFI) breaker. If it senses power leaking into ground, it trips. Oops. The power supply is connected to ground, not neutral.

Having resolved the GFI issue, I powered up the system once again. LCD lights up, displays the startup diagnostics, seems happy and reports the motor is now running in eco mode. Exactly as planned… except the motor is quiet! Flip the switch to go to high speed, the display updates correctly, but the motor is quiet. WTF?

I think I spent over a week researching this one online and even resorting to discussing the issue with the guys in a local electrical supply. By all indications everything should work. I ended up bringing a 220V circuit into my lab and started testing. It took a few days of testing and a few blown light bulbs before I found the answer. Unlike European 220V, which is on a single wire, North American 220V requires two live 110V wires and the load is connected between them. Nearly all Solid State Relays (SSR) use a zero crossing circuit to detect when the phase crosses zero and initiates the open or close action when the phase crosses zero and transfer voltages are at their minimum. On a North American 220V circuit, this does not work. The zero crossing detector cannot find the crossing point and never activates the relay. Back to the drawing board.

If SSR is out of the question, then relays are the way to go. I have a 1 horsepower electrical motor, so went online and found a good deal on a bunch of 2HP 250V relays. Perfect.Photo on 1-22-14 at 10.47 PM

Once the relays arrived, I installed everything on a piece of stripboard. Since the outputs from the mc14555 are not powerful enough to drive the relays, I populated the board with two basic 2n2222 based relay drivers and a header for power and inputs for the low and high relays. I replaced the SSR relays with this board and amazingly, everything worked as planned. YAY!

After a few weeks of operation, I started to notice the pump motor making odd sounds. Switching from low speed to high was not smooth, the motor would stutter and sometimes not engage. Other times the motor would start to stutter when it has been running at high speed for a while. More research. Seems these relays are technically rated for 2hp motors, but are not intended for extended duration workload. Photo on 1-23-14 at 10.37 AMA bit of searching in eBay got me a few of the monstrous relays to the right. Two inches per side, but this one will probably keep running long after the pool has been filled in!

For the high speed windings, the I installed the new relay, and kept the smaller relay for the low speed winding. The new relay needed a new relay control circuit. During testing, I noticed an odd side effect. When applying power to the control board, it would momentarily trigger the relays, activating both and sending a momentary surge to both the low speed and high speed windings. Not good. I am using 2n2222 NPN transistors to switch the relays, with the relays being between VCC and the transistor. relaydriverIf I placed the relay between the transistor and ground, it would avoid the surge, but the relay coils would not always trigger, or trigger slowly, causing extended arcing (sparks). Picture 34Eventually, I found the simplest solution is to make a resistor/capacitor based delay circuit. When power is applied, a resistor slowly charges a capacitor and when the voltage exceeds the base threshold, the transistor opens the flow of electrons to the rest of the circuit. Simple, cheap and it gives me a nice 10s delay on power-on. The end result can be seen on the right, built on a small Radio Shack prototyping board.

With the relays now working properly, I ran into another problem. When the high speed winding is activated, the board would occasionally reset. Initially I thought this might be related to the small 500mA power supply I was using, as the current draw when activating the new relay is quite significant. I replaced it with a larger 1A power supply and the reset problems went away – sort of. The LCD display controller still tends to lose its mind when the high speed winding is started. After a few months of pondering, I have come to the conclusion that the problem may be a drop in source voltage on the 220V side when the motor starts. Adding a large 2000 mfd capacitor to the DC power bus will probably solve the problem.

It is winter and -10C (14F) outside today. Still a few months to go until the weather is warm enough to re-open the pool. There are still quite a few things to do with the controller. Aside from the power issue which still needs to be resolved, there are quite a few bugs in the code. In the latest iteration of the code, for some reason it is forgetting to read the thermometers… I would also like to upgrade the board from its protoboard build to a custom designed board. All of the relay changes have also made a mess of the power cable routings in the box. The ribbon cable to the display has failed a couple of times, so that needs to be improved. There is also a problem with the serial interface. I have about a 30% success rate when attempting to reprogram the board with my FTDI adapter.

Advertisements

ATtiny Programming Jig – Part 1

Lately I have been making a few projects with the ATtiny84/85 micro controllers. The pumpkin light controller I presented a few months ago, as well as a brushless motor controller I have been playing with (amongst others) have been built with these controllers. I use the Arduino IDE to write and compile the code and an Arduino programmed with the ArduinoISP sketch to write the code into the chips.

At first, I wired up a small breadboard, which worked fine until I needed the breadboard to test something else. Arrrgh. Need to make it more permanent. Rather than make one board for each of the controller types I have, I built it for all three – ATtiny84/85/861. So far, I have tested it with the 84 and 85 with perfect results.Photo on 1-15-14 at 10.15 PM

I always like to put a cheat sheet on the underside of my boards. Not only does that help in remembering which pin connects where, but it also serves as an insulator. I cover both sides of the paper in clear packing tape (poor man’s lamination), punch a few screw holes and attach it with some risers and screws. Keeps the solder side out of the inevitable clipped wire strands and soda-pop condensate puddles.

Photo on 1-15-14 at 10.16 PM #2

The jig includes the Arduino reset override capacitor and LED indicators referenced in the ArduinoISP code. The lights sure look nice when blinking, but about the only thing they really show is whether code is being written to the ATtiny or not.

This jig has worked well over the past few months, but is also wearing out its welcome. I am currently working on an Arduino shield version, which will make it much easier to disconnect and reconnect the jig, without taking my glasses off to see if I connected the jumper to the right hole or not. More info to follow.

Meanwhile, here is a draft schematic of the board, for those who are interested: attiny programmer.sch