DIY Standalone Nixie Pool Controller - tagyoureit/nodejs-poolController GitHub Wiki

Disclaimer

Working with high voltage electricity is dangerous and can cause personal injury or DEATH as well as other property loss or damage if not used or handled properly. This guide assumes you have some level of confidence performing do-it-yourself electrical work. If you have any doubts whatsoever, PLEASE do the smart thing and hire a qualified electrician to perform the work for you.

ALWAYS disconnect power at the source and verify no power is present when connecting or coming into contact with wires. VERIFY your wiring before re-applying power.

You should ALWAYS consult your local electrical code for the connections. The wiring diagrams supplied here may or may not be up to code within your jurisdiction. The information provided here is not intended to be instructional or "certified" electrical information for installation purposes. It is provided for informational purposes only and should not be construed otherwise. Please ensure you follow your local electrical codes.

Getting Started

So you want to assemble a pool controller from scratch parts. While this may seem daunting, it really isn't that hard provided you have some level of confidence connecting and assembling equipment that is readily available. This guide is broken into a few parts. The first part is here to help you plan your work so you can work your plan. The second part is describing the equipment and some suggestions on what, where, how and to obtain it. The final part will focus on how to wire it all up.

I will refer to the controller as Nixie. This is the component in njsPC that operates as the brains of your pool controller. After you have installed all the hardware and software there will be 3 main components associated with it. First, nodejs-PoolController is the main controller. Next, RelayEquipmentManager works hand in glove with njsPC to control relays, sensors, and hardware devices. Finally, dashPanel provides a human interface web environment that allows you to be in control.

Capabilities

The pool controller described here is incredibly capable. It is capable of controlling up 64 valves, circuits, and lights. It can control two heaters per pool body, multiple temperature sensors, and RS485 pumps, chlorinators, heaters, and chemistry controllers. It is also expandable with off-the-shelf parts. The number of schedules are unlimited, complete with sunrise and sunset start and end times, heat settings, and days of the week.

From a user interface perspective, it provides a rich user interface that operates on touch screens, mobile devices, and can be accessed via virtual private networks. Equipment management is provided via easy to use configuration options to simplify setup and change settings on the pool.

IntelliBrite lighting themes and color control is also provided from the interface. You will be able simply select the lighting palette that suits your mood. If you are currently flicking a switch on and off or using an external light controller, you won't have to do that anymore. Simply select the theme you want and the lights will respond.

This software will also control your variable speed pumps. You can set up speeds and flows that are triggered via schedules or circuits that set the pump flow and/or speed based upon your settings. No more going to the pad to change the schedules or turning on the equipment. You will also get an unlimited number of circuit and feature groups to combine equipment settings into themes.

Planning

Some planning is required before you start. You should take a moment and verify the equipment you currently have and plan on the location where you will mount your new pool controller enclosure. Like that big red dude from the north always says make a list and check it twice.

Survey your equipment pad so that you know where things will be located

  • Find the location where your equipment breakers are located Is there space for 1 more single pole GFCI breaker in that panel? Is there sufficient capacity to support another 15amp single pole breaker?
  • Determine the mounting location and some method of securing it. Your enclosure can be wall mounted or pole mounted as long as it is properly secured. Mount your enclosure at least 12 inches off the ground. However, 12 inches is pretty low to the ground and unless your first name is Ben and your last name is Dover, I would suggest you mount it high enough off the ground so it isn't uncomfortable to work in the box.
  • Never mount your enclosure to a wooden fence. If you have ever had a fence blow down you will know why. It's a lot like tying your dogs leash to the ball hitch on your truck. While its effective at keeping the dog from running off, there are too many potential hazards related to it.

Identify the equipment you need to control. Items include

  • Pumps: These days many pool pumps are variable speed. If you have Pentair RS485 controlled variable speed or flow pumps, Nixie can control these for you and allow you to manage the speed and/or flow. It will also report the energy use. Record the model and make of your pool pumps as well as what they are used for. For instance, you may have a filter pump, feature pump, and/or jet pump. There will be at least one pump on your pool.
  • Chlorinators: Determine whether your have a chlorinator that can be automated by njsPC. If it can this can also be controlled by your new pool controller. Currently, the qualifying models are Pentair IntelliChlor and Aquarite models.
  • Chemistry Controllers: I won't get too deeply into these but if you have an IntelliChem or simply use a peristaltic pump to dose chlorine or acid, your new pool controller will handle these devices nicely.
  • Valves: At a minimum in a shared body system (pool + spa) you will need two valves. One for the intake and one for the return. These valves will be automated as you switch between pool and spa modes. If you need valve control for water features, Nixie will accommodate these as well.
  • Heaters: Nixie is capable of controlling your heater so that it will call for heat when it needs it, and turn off when the setpoint is met. It works with most relay controlled heaters as well as heat pumps. If you have a model that includes cooling it will also control that. Solar heaters are also setpoint controllable.
  • Lights: When completed you can to control IntelliBrite lighting including scenes and colors as well as standard lighting features. If you have landscape lighting Nixie can control turning those on and off through her schedules as well.
  • Sensors: A wide variety of sensors are supported for your pool controller. At a minimum you should have at least two temperature sensors, one for the water temperature as well as one for the air temperature. If you have a solar heater you should also install a temperature sensor near the solar panels.

Acquiring the Hardware

A huge variety of hardware can be used for your pool controller. If you find hardware that performs the same functions then use that in lieu of the suggested hardware. However, I will give you a list in this guide such that you can draw parallels to substitutions should you desire.

I will make every effort to describe each hardware item, its purpose, and any precautions related to its use. Since things like wire and wiring are dependent on your planning efforts these will be assumed but you will need enough of this to get the job done.

Here is an abbreviated bill of materials for all the items we are discussing:

  1. Controller Enclosure
  2. Raspberry Pi4
  3. 24vdc Power Supply
  4. 24vac Power Supply
  5. Sequent Microsystems MEGA-BAS Building Automation Card
  6. Sequent Microsystems relay hat
  7. DIN Rail terminals
  8. Temperature Sensors (at least 2)
  9. Valve Actuators (1 for each valve)
  10. Miscellaneous wiring and connectors

Additional Items for the Neat and Tidy

  1. Raspberry Pi DIN Rail Mount
  2. Ferrule Crimper Kit

Budget

The costs for putting this controller together vary depending on the equipment you need to control. Below is a budget for a top of the line pool controller. You can do this for a lot cheaper if you do some research. If you work at it you can get this down to less than $200 for a single body system. That is a far cry from the $1,500 minimum for a commercially available system that has less capability that what we are talking about here.

The bottom line here is that the components for your controller can vary depending on your needs and budget. Spend a bit of time and do a little research. If you have any questions submit them on the discussions page and somebody will give you some help.

Single Body Dream System (Pool or Spa)

Item Purpose Cost Notes
Enclosure Houses everything at the pad $140 This is for a top of the line 14x12x8 Altelix Enclosure
Raspberry Pi4 Microcontroller brains of the system $190 This is for a fully outfitted kit with 128Gb SD Card
24vdc Power Supply Powers the Microcontroller and peripherals $90 Model SDR-240-24
Building Automation Hat Powers the Pi and provides sensor inputs $80 There are cheaper alternatives listed in the section below
8-Relay Hat Relays for controlling equipment and valves $35 Stack as many as you need to control all your equipment
Temperature Sensors Provides temperature values for both air and water $17 You can find these in packs of 2
Base Costs $422

Shared Body Dream System (Pool/Spa)

Item Purpose Cost Notes
Base System See the table above $422 The additional equipment used for body control is listed below
24vac Power Supply Power for valves $38 Model with 100VA and circuit breaker protection
Valve Actuators Bolted to the valve body, these actuators rotate the valve position $100x2 You need at least two of these for one for intake and one for return
Total Costs $660

Budget Single Body System

Item Purpose Cost Notes
Enclosure Houses everything at the pad $60 Polycarbonate with door
Raspberry Pi4 Microcontroller brains of the system $75 Pi4 4Gb 64Gb SD Card
5vdc Power Supply Powers the Pi and peripherals $18 Meanwell MDR-40-5
ADS111x5 Analog to digital converter for sensors $7 16-Bit ADC
Relay Board Relays for controlling equipment and valves $10 GPIO controlled 5v relay board
Total Costs $170

Controller Enclosures

First you should get an enclosure. I like the Altelix FRP (Fiberglass Reinforced Polyethylene) boxes with DIN rails. There are several advantages to these. First, they are pretty UV resistant and will last years sitting on your equipment pad. Second, you can get them in a variety of sizes but you should consider an enclosure that is large enough. I would suggest the 14x12x8. Finally, they are very sturdy and since they are not metal they will not significantly degrade wifi signals. If you decide you want a wifi access point in the box or are using wifi to connect to the enclosed Raspberry pi you should shy away from metal enclosures.

You can also get vented or polycarbonate models but you do not need those that have supplied power in them.

During the planning phase you determined where the enclosure was going to be mounted. Now you need to make sure there is enough space for all the equipment you want to manage. If you want a well organized panel that you can have people oogle (this is now a word if it wasn't before) over, then lay it out on a piece of paper that matches the size of your selected controller. Then draw out where the equipment will mount within that space.

If you live in a hot climate I would suggest some active cooling in the enclosure although there have been reports of folks operating this equipment in hot climates without it. Most of this equipment is capable of operating up to 70C and is industrial in nature.

Here are a couple of enclosure options to get you started

Altelix 14x12x6

Altelix 14x12x8 Vented

Altelix 17x14x6 Vented

Raspberry Pi 4

The processor requirements for your pool controller require Linux, Windows, or MacOS to operate njsPC or dashPanel. However, unless you want to re-write the RelayEquipmentManager to operate on an Arduino, just get a Raspberry Pi and be done with it. RelayEquipmentManager does however, support BeagleBone Black and OrangePi as options for its use. For the description of this installation we will focus on running all three parts of the system on a single Raspberry Pi 4.

If you are new to Raspberry Pi I would suggest just getting a starter kit that includes the noobs distro on the card. Raspberry Pi comes in 4 or 8gb versions but I always seem to buy the 8gb version. It isn't required but Raspberry Pi always seems to end up getting more use so the extra ram is always a plus. For the SD card get at least 34gb since as I mentioned earlier you may want to start playing with Grafana and other options that are available once you get your butt out of the dark ages.

For mounting the Pi in the enclosure you should also consider a DIN rail mounting kit. I like the ones that mount the Pi perpendicular to the DIN rail. This makes for a neat installation where connectors are readily accessible. Here is an example from Adafruit but there are a ton of them out there. Raspi DIN Mount. As an aside I have only used the metal ones so I don't know how well the polycarbonate ones perform.

24vdc Power Supply

You will need a power supply for the microcontroller. I am recommending a 24vdc power supply because it provides the greatest flexibility for your installation. This power supply will be used to power the Raspberry Pi, peristaltic pumps, and potentially any network routers or switches should you decide to pop them into your enclosure.

I prefer the Meanwell DIN Rail power supplies. Specifically I used the SDR-240-24 in my enclosure. This power supply is more than enough power for all that I wanted. However, the SDR-120-24 is also a good choice if you plan on keeping it simple. I chose the SDR series for my application because it provides the most protections but the EDR and NDR series are also good choices.

A 5vdc power supply can be substituted in lieu of a 24vdc. Essentially, this power supply without any extras is being used to power the Raspberry Pi through the building automation card described below. The reason for the 24vdc power supply recommendation is that it provides power in the box for other things. For instance, my pool controller has a 10 inch touch screen mounted inside the box from which I can control everything. As well I use it to operate a 24vdc peristaltic pump to dose acid.

Another alternative is to use the 24vac power supply since the Building Automation card can power your Pi with 24vac or 24vdc. However, if you do this make sure you get one large enough to handle all the loads including the number of valves.

24vac Power Supply

The primary purpose of the 24vac power supply is for providing power to the automated valve actuators. If you find one that is DIN rail mounted it will either be too small for the load or outrageously expensive and bulky. Stick to the foot mounted ones and put a DIN rail adapter on it if you insist on putting it in your enclosure. A great alternative mounting point for this is where the old dial time clock used to sit if you have one of those. Yank that stupid thing out of there and screw a 24vac power supply in its place. If you do not have any automated valves then you don't need this power supply.

The specs for this power supply are based upon the number of valves you want to control. For pool + spa combinations there must be enough power supplied by the transformer to move two valves at once. When switching between pool and spa, both valves rotate in unison to divert the intake and return and each of these valves use .75 amps of power.

You will find the ratings for power supplies of this type in VA (volt-amps) so a 40VA rated unit will supply ~1.67 amps of power and will be capable of moving two valves at the same time with a little bit of headroom. I would suggest something like this though as it will supply 3.125 amps of power for all your needs and includes circuit breaker protection. Functional Devices 75VA 24vac

Sequent Microsystems Building Automation Card

I recommend this card because it provides all the sensor needs, power supply, and RS485 connectivity all in one neat package. You will find with RelayEquipmentManager it is very easy to configure and offers support for up to 8 temperature sensors, dry contact switches, or 0-10v sensor inputs. The best part is that there is no other circuitry required to measure temperature from this board using standard 10k pool temperature probes.

You will be wiring the 24vdc power supply to this board so no other power is required to power the Raspberry Pi or the relays. Sequent Microsystems Building Automation Hat

As an alternative to this hat you can use any of the ADS11x5 cards out there for temperature sensors, a 5vdc power supply for the Pi, and a couple of resistors. To see how to wire a up a 10k temperature sensor using a voltage divider here is a tutorial. Temperature Sensors

Sequent Microsystems 8 Relay Hat

You have quite a bit of leeway here regarding relays for your Raspberry Pi. While you can use GPIO pins attached to a relay, this hat provides 8 high power relays on a compact single board without extra external power. You will require one relay for every circuit, valve, and heater in your pool controller but you can add as many of these hats as you need to get up to 64 relays. Sequent Microsystems 8 Relay Hat

If you choose to go another route there are several options from Docker Pi as well as MCP230xx based boards that are supported for relays. I would not suggest the cheap low level trigger relays since these will cycle as the Raspberry Pi boots up. Sure they can be wired with a pull up but it just complicates things.

IMPORTANT: Never wire a pool pump directly to one of these relays. While the suggested relay board supports up to 8 amps of power, the initial power draw will from a pump motor will cook the relay. If you need to turn on and off a booster pump or single speed pump (RS485 controlled variable speed/flow pumps do not have this requirement), use a 3hp relay connected to the relay on the hat using the 24vdc power supply. You are looking for a 3HP 24v Pool Pump Relay. You should be able to find these for anywhere between $25 to $100.

DIN Rail Terminals

DIN rail terminals will assist you in organizing the wiring in your enclosure. There are a lot of options here and I would suggest you do a search on DIN Rail Terminal Blocks to see your options. They come in a variety of colors and number of terminals and you can buy them in kits from a variety of manufacturers.

As an aside there is another tool that will help keep things tidy when setting up your enclosure. Get a Ferrule Crimping Took Kit for your wire ends to keep it all neat. NOTE: Do not put ferrules on any high voltage wiring the ferrules are aluminum and not code for wiring into a circuit breaker.

Wiring it all up

At this point you should be sitting in a pile of cardboard boxes and anti-static plastic bags. You've made all your equipment decisions and have a plan of attack to get it up and running so lets get going.

Stacking up the Pi

So you took my advice and bought the hats I suggested and got a Raspberry Pi kit. This means that from here on out we are on easy street. First assemble your Raspberry Pi with the heatsinks that came with your Raspberry Pi kit. It is easiest to configure the Raspberry Pi on the bench, if you have a spare monitor laying around with an HDMI connection then that will ease this process as well.

I won't write instructions on how to set up a new Raspberry Pi because there are 100,000,000,000+ tutorials out there. Get your Raspberry Pi set up with the operating system and we will take it from there. One thing that you may want to do is install a remote desktop application on the Raspberry Pi such as Xrdp or RealVNC. There are a couple of other options but take a moment to do this so you can access the Raspberry Pi from its native interface using a PC, Mac or tablet. It's just easier to access without having to use the command line through ssh all the time.

Once you have the initial setup done for your Raspberry Pi, shut it down using the command sudo shutdown now then disconnect the power.

Stack the Sequent Microsystems Building Automation HAT

Stack the Sequent Building Automation hat on the Raspberry Pi using the supplied standoffs while ensuring all pins on the 40 pin male connector for the Pi are inserted into the 40 pin connector on the Building Automation hat. Then from the left top of the hat, set the jumpers for each 10k temperature sensor you will be using. The 10k temp sensor setting for the jumper is the first set of pins.

image

If you have any flow sensors or push buttons you will be installing move the jumper to the middle set of pins for those inputs. Take note of which inputs are used for each function.

Next we want to set the jumpers for the RS485 pass through on the board. Install two jumpers on the J3 header vertically so that two jumpers are installed side-by-side on the J3 connector. This will enable the RS485 communication chips on the board.

image

Stack the Relay HAT(s)

Stack the first relay hat on the 40 pin connector for the Building Automat HAT using the standoffs provided with the relay. If you have more than one relay hat, be sure to set the address (stack level) for each of the subsequent hats. This must be unique for each relay board you install.

Install Software Prerequisites

There are some prerequisite software items needed by the relayEquipmentManager, nodejs-PoolController, and dashPanel. These include git, nodejs, and node version manager. We will install these first.

Install Node Version Manager and nodejs

(See NVM for the most recent installation instructions.)

  1. Open a command prompt on the Raspberry Pi

  2. Issue the following command

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash

  3. Close the command prompt and open a new one.

  4. Issue the following command

    nvm install 16.16.0

Install git (github)

  1. Open a command prompt on the Raspberry Pi
  2. If you do not have git installed on the pi you can do this by issuing the following two commands

sudo apt update

sudo apt install git

Install RelayEquipmentManager

Turn on your Raspberry Pi and allow it to boot up. In order to access the hardware in your Raspberry Pi stack, you must first enable the I2c bus. To do this, from the Raspberry Pi menu choose Preferences > Raspberry Pi Configuration. A Raspberry Pi configuration dialog will open. Select the Interfaces tab and enable the I2C interface. Then press OK.

image

Once the I2c interface is enabled then we can install RelayEquipmentManager.

  1. Once you have successfully installed the prerequisites, you can clone git repositories. If you haven't installed the prerequisites stop jumping ahead and install these. To clone the REM repository issue the following command.

git clone https://github.com/rstrouse/relayEquipmentManager.git

  1. Once the installation completes run the following commands.

cd ~/relayEquipmentManager

npm i

npm start

  1. The REM server should start from that command. Leave this command prompt open for now. Later we will install PM2 to automatically run REM, njsPC, and dashPanel when the Raspberry Pi starts up.

Install nodejs-poolController

Now you need to install nodejs-PoolController. This software is the command center for the pool and will talk to REM and dashPanel to operate the pool.

  1. Open a command prompt and issue the following command

    git clone https://github.com/tagyoureit/nodejs-poolController.git

  2. Once the command completes and the repository has been successfully cloned, issue the following commands.

    cd ~/nodejs-poolController

    npm i

    npm start

Install dashPanel

dashPanel is the user interface for nodejs-PoolController. It provides an easy to use touch enabled website that allows you to configure and operate your pool.

  1. Open a command prompt and issue the following command

    git clone https://github.com/rstrouse/nodejs-poolController-dashPanel.git

  2. Once the command completes and the repository has been successfully cloned, issue the following commands.

    cd ~/nodejs-poolController-dashPanel

    npm i

    npm start

Install PM2

PM2 is a piece of software that automatically loads programs when the Raspberry Pi is booted up. This way if power is interrupted on your pool controller or you reboot the Pi it will load up all the software we just installed as part of the bootup process.

Since there is already a tutorial on how to set up PM2 in the wiki I am going to point you there for this. Please review the up to date documentation for PM2 for options beyond what is described here and don't forget to install log rotate. Wiki for PM2

After you have installed PM2 shut the Raspberry Pi down so we can make sure you have everything installed correctly and the Pi boots up with njsPC, REM, and dashPanel.

Assemble the Pool Controller Enclosure

If you are using DIN rail mounting in your enclosure install 2 or 3 DIN rails horizontally in the enclosure. Be sure to install the top rail so that there is at least one inch of clearance from top of your 24vdc or 5vdc power supply. We install the power supplies at the top of the enclosure so that heat generated from these can be vented from the top and not heat up the Raspberry Pi. If you install the Pi above the power supply then the heat from it will heat up the Pi.

Next install the 24vdc power supply on the top rail. If you also have a 24vac power supply consider stuffing this thing in your old timer box. If you aren't an old timer then find a good spot for it. I mounted one of these for a fire control system in my enclosure to a plate on the left of the box. The key is to allow the heat to rise from it so it doesn't rise through the Pi.

After you have the power supplies mounted, find a good spot for the Pi stack. A good location for this is on the bottom rail since mounting the Pi lower in the enclosure will be a cooler spot for it than higher in the enclosure. Furthermore, you don't want the convection heat from the power supplies rising up through your Pi stack.

image

Recently, I created a pool controller for a friend. This involved the components listed above stuffed inside an Altelix 14x12 box. In his case, the breakers for the pool were installed inside an Intermatic dual timer box. We removed the timers and installed 3hp relays where one of the timers were located and a 24vac transformer on the other side. The pool controller enclosure is mounted on extended poles above the old timer box which was installed very low. Below is the wiring diagram for that controller.

image

Equipment Wiring

At this point you should mount your enclosure at the pad. Installing the software and hardware items into the box without the connected equipment will ease the installation so if you haven't done this, do it now. Having a remote desktop connection to the pi over your local area network will also facilitate any troubleshooting and testing of the equipment you install.

Before you begin I have a couple of tips for you. Always use conductors designed to carry the load for the equipment you are connecting. In most instances you will be using 18awg, 14awg, or 12awg stranded copper wire within the enclosure. If you have a 15amp breaker going to your new controller enclosure use 14awg THHN stranded copper wire. If you plan on more load and are using a 20amp breaker use 12awg THHN stranded copper wire.

Always make sure your connections are tight. A loose wire, especially on a high load connection, can melt down and destroy your work. Take a moment and make sure everything is tight.

Ethernet/Wifi

The Raspberry Pi4 can be connected to ethernet using a wifi or hardwire connection. It is my preference to always connect networked devices in my home with a wire but the wifi connection on the Raspberry Pi will suffice if that is your only option. Remember your pool equipment is likely at the farthest reaches of your wifi network. If your coverage wifi connection is weak on the equipment pad, there are a number of wifi extenders for the Raspberry Pi that can expand your range to the equipment.

High Current Circuits

There are two types of circuit relays that you should be concerned with. Basically, there are those that require less than 8A of power to operate such as lighting circuits and transformers and those that require more than 8A of power such as pumps, chlorinators, and other high power devices. If you are in doubt as to what kind of power draw you have for the equipment or the equipment used 220v then please connect the equipment using a 3hp contactor relay driven by one of the relay circuits on the relay card described above.

NOTE: The 8A power limit is based upon an 8A relay board. Never exceed the power rating for the relay.

Recently, I did some testing on the contactor coils. To my surprise there is quite a bit of flyback using DC coil contactors. Flyback is a sudden voltage spike that occurs when a relay contact is opened. This voltage spike puts an undue load on the relay contacts and feeds voltage back into your power supply that you do not want.

The fix for this is very easy and you should do it. Install a 1n4007 diode between the coil contacts on the 3hp contactor biased so that the silver band on the diode is connected to the positive terminal and the other leg of the diode is connected to the negative terminal. In my installation I created JST-XH pigtails that the 3hp contactors plug into. I simply installed this diode between the + and - on the plug.

Another way to do this is to install the diode between the contactor coil connection. Be sure you have the diode with the silver band toward the positive terminal of the coil. If you do not you are creating a short circuit and not the cute robot kind like Johnny Five. Check it at least twice.

image

If you have a variable speed or flow pump that has an RS485 communication port, it should never be connected to a relay and be powered at all times. No relay is required or desired for this scenario. In fact, you will be defeating the circuit protection on the pump that energizes the pump circuitry to ensure cold weather does not harm the pump drive.

Pumps that require a relay typically come in one of three categories. These are Filter Pumps, Feature Pumps, and Booster Pumps. Each pump type has a special purpose within your pool controller.

If you are connecting a filter pump this is the main pump for the pool and its primary purpose is to circulate the water for the pool or pool/spa combo. I would recommend that you label this your filter circuit. The software will energize this relay whenever circulation is required. If you have a salt chlorinator its power supply should be wired into the load side of the 3hp relay to ensure chlorinator can only operate when the filter pump relay is energized. This is added protection to ensure the buildup of gasses within the pool plumbing does not occur. If you aren't convinced that you should do this have a look at some of the risks Salt Chlorinator Explosion.

In the diagram below the chlorinator controller is presumed to be 110v. If it is a 220v controller then the rightmost terminal of the 3hp Relay will be wired in lieu of the neutral wire.

image

This pool controller also supports dual speed pumps. If you have one of these I would suggest that you get one of the 2-speed pump relays from Pentair or Hayward. The instructions for installation are pretty straight forward but essentially you will use another relay from the Relay Hat for high speed. Bear in mind wiring in a VST model pump with 4 relays is different and a 2-speed relay is not required. You simply wire each of the speeds to one of the relays on the Relay Hat. IMPORTANT: Please review the documentation for the two-speed relay that you purchase. The wiring diagram below is provided primarily to show the low voltage wiring for the Relay Hat.

image

For a feature pump the wiring is the same. However, this pump will only be energized when the circuit is turned on. Again, if this is a VS, VF, VSF, or VST pump then you do not need a 3hp relay for it and the pump should be powered at all times directly from its own circuit breaker. Some examples of a feature pump include pumps for spa jets, waterfalls, bubblers, and even spa blowers. If it has a motor then you should hook it up to a high power contactor such as the suggested 3hp relay.

Lighting Circuits

Lighting circuits such as underwater lighting, feature lights, and landscape lights that draw less than 8 amps of current do not need a 3hp relay. The line (HOT) 120vac can be wired directly to the relay hat. Inventory the lights that you are connecting to the relay if there are more than 500 watts of lights or transformers, consider splitting these between relays or hooking them to a 3hp relay as described above.

For underwater lighting circuits always install a junction box that sits above the level of the pool water. This will ensure water does not flow out of the pool and into the electronics. You must also ensure these circuits and any components associated with them are properly bonded to the pool equipment. The diagram below represents the typical 120v pool light setup.

image

For 12v lighting circuits like the 12v versions of IntelliBrite, GloBrite, or Magicstream, the preferred method is to connect the relay to a 120v GFCI protected circuit. This cuts the power to the transformer whenever the relay is off. The diagram below represents the typical 12v pool lighting setup.

image

Automated Valves

To wire in your automated valves use the 24vac transformer as the power supply and wire one leg through one of the relays. njsPC will set the relay to the proper position based upon the configured valve assignment. You may connect as many valve actuators as you have available relays. The diagram below outlines a setup for a shared pool/spa system that also has a solar heater. Once njsPC is configured these valves will rotate to the proper positions for pool mode and spa mode. It will rotate the solar valve whenever the body setpoint for the selected body is greater than the water temperature and the solar sensor reads within the set offset temperature on the panels.

image

Optional Side Project: Connector Board for Valves Since you don't have enough projects to do and might be looking for a clean way to connect the 3-pin JST-XH connectors that are affixed to most of the valve actuators out there, I have decided to share a recent board that I made from a simple prototype board. This is assembled with some board mount screw connectors, JST-XH connectors, and a bit of 20awg hookup wire. This can be mounted on a couple of DIN rail mounts and it arranges the valve plugs neatly in the enclosure. So if you are friends with a soldering iron here is a cute little board for 4 valves.

image

Here is a diagram for the back of the board.

image

Temperature Sensors

The temperature of the water and the surrounding air are key factors in determining the comfort of your pool. Adding temperature sensors, while optional, are inexpensive and ridiculously easy to do. So if you are on the fence climb on down and get to it. If you plan on controlling a heater of any type temperature sensors are required. Simply get some 10k temperature sensors that are made for swimming pools. These can be obtained for less that $10 a piece and you can install up to 8 of them with the suggested equipment.

For most pools you only need one temperature sensor for air and one for water temperature. If you have solar then another sensor is required near the panel installation. You will be surprised at the difference in temperature on a roof vs that on the ground. Finally, if you have a dual body system that has more than one filter/pump combo then you will need one water sensor for pump and filter combination. Most pool/spa systems are shared where either you are in pool mode or spa mode and these share a water temperature sensor.

The described temperature sensors are easy to install in that you only need to drill a single hole in the pipe between your pump and filter just large enough to fit the rounded probe end into the pipe. Then simply use a stainless steel band clamp to hold it in place and seal the sensor into the hole.

image

For air temperature simply suspend a temperature sensor out of direct sunlight under the pool controller enclosure. For the solar sensor you will need to splice a wire long enough to place the sensor next to the solar panels on the roof. When you have installed the sensors simply wire them to one of the INx ports on the Building Automation Hat.

image

Gas Heaters

Gas heaters are controlled via a 2-wire fireman's switch on the heater control board. If your heater supports a 3-wire setup do not use it. The 3-wire connection is only for two fixed temperature setpoints. You will severely hobble your functionality because the heater controls within the heater are very very basic.

Connect the fireman's switch to one of your available relays and set the thermostat for the heater to the highest temperature. njsPC will call for heat through the fireman's switch whenever there is a call for heat. Also, only connect the heater to the NO and COM terminals. When power is cut to your pool controller you want the heater to cycle off.

I have yet to find a gas pool heater that does not have a fireman's switch connection for automation. It is a simple 2-wire connection that is located on the control board for the heater. Review the manual for the heater and do not apply power to this connection. Simply remove the existing jumper from the connection and wire them to the COM and NO terminals on one of your relays.

image

RS-485 Control

A number of your equipment items may communicate using the RS-485 protocol. These include variable speed/flow pumps, heatpumps (UltraTemp), Chlorinators (IntelliClor, AquaRite), and IntelliChem. This pool controller can control them all. An RS-485 comm port was connected in the main controller box. Simply connect the data A and data B lines for to the connector in your pool controller enclosure. You may connect as many RS-485 controlled devices as you like to the RS-485 communication bus in the controller enclosure.

Most often the control cables for these devices will be yellow and green. Connect the yellow wire to the RS485 (A+) and the green wire to the RS485 (B-) terminals on the Building Automation card. It is important that these wires make good connection, if you have multiple RS485 devices make sure they have positive connection by adding terminal blocks. If you put multiple wires into a single terminal ensure they have good connections. It can be maddening trying to figure out why one device or another is not communicating properly.

There have been a number of adapters that are improperly marked. For instance, I have an adapter that has markings for A- and B+ sitting on my desk. Confusing, sure but if you are having RS485 comms problems this is one of the first things to check.

Keep Cool and be a Fan

So pools tend to exist in warmer climates. For that reason I would suggest that you vent your enclosure. If you didn't get an enclosure with vents already installed, you should probably add one. The idea is that the equipment in the enclosure will generate heat. If you don't vent it out it will build up and create an issue with the electronics inside.

Most of this equipment is rated to 70C or 158F. However, the pi is a bit more sensitive in that it will start throttling the processor at around 50C or 120F. To keep this from happening install a vent shroud on the upper right side of your enclosure. Altelix will sell you these or you can buy them from a number of vendors out there. If you want active cooling place a fan on the exhaust connected to either 24v or the 5v USB from the pi. Heck you can even get fancy and let the Building Automation Card trip when the temp reaches a certain point. Depending on your climate you could put a rotisserie in there and make some delicious chicken without proper cooling.

After you install the out vent you will need an air inlet to get air into the enclosure. You can either put another vent on the lower left side of the enclosure or the bottom with a screen. I chose to put the vent on the bottom of my enclosure. This is my enclosure with a crazy amount of equipment installed in it. I installed a PWM fan that runs at different speeds depending on the cooling needs (yeah I am a geek). The inlet is on the bottom of the enclosure with a screen and filter to keep out the dust. I also installed a 5v fan to pull air out of the Raspberry Pi stack. Overkill for sure but when it was 114F outside the processor temp for the Pi just reached 40C or 104F.

image

Configuring the Software

By this point you should be ready to configure REM to control the hardware and njsPC to operate it. This is a tight connection between njsPC and REM to simplify the setup. The extent of programming required here involves a mouse to get it done. I'll walk you through setting up the relays and temp sensors and from there you should be able to figure out the rest.

By this point your pi should have all the cards stacked and the requisite software installed and running when the Raspberry Pi starts up.

Enable REM in njsPC (through dashPanel)

Step 1 Open dashPanel and click the gears (configuration) in the upper right.

Step 2 Navigate to Controller->Interfaces and expand the Relay Equipment Manager section

2023-06-01_10-49-28

Step 3 Click Find REM Controllers and through SSDP njsPC should find the REM installation.

2023-06-01_10-50-27

Step 4 Select your controller, enable the interface, and save it. The interface name will turn from gray to black.

2023-06-01_10-54-00

Enable REM in njsPC (manual method)

Step 1 installed PM2 open a command prompt on the pi and issue the following command. ~$ pm2 stop njsPC This will stop njsPC so that we can enable the interface with REM.

Step 2 Enable the REM interface by editing the nodejs-poolController/config.json file. Scroll down in the file until you find a section that looks like the section below. It is under the web.interfaces section of the file and if you search for the text "rem" it should get you to the start of the section.

If you renamed your pi then use the name or the ip address in the host field if you did not then leave it as raspberrypi. Next set the enabled field to true. Make sure the commas and quotes are preserved. When you are done save the file.

      "rem": {
        "name": "Relay Equipment Manager",
        "type": "rem",
        "enabled": false,
        "options": {
          "protocol": "http://",
          "host": "raspberrypi",
          "port": 8080,
          "headers": {
            "content-type": "application/json"
          }
        },
        "socket": {
          "transports": [
            "websocket"
          ],
          "upgrade": false,
          "reconnectionDelay": 2000,
          "reconnection": true,
          "reconnectionDelayMax": 20000,
          "allowEIO3": true
        },
        "uuid": "321c5a05-d6f2-48e7-80cf-b1018714ae36"
      }

Step 3 Restart njsPC by issuing the command ~$ pm2 start njsPC

Configure the Building Automation Card

To configure hardware for your pool controller we will be configuring Relay Equipment Manager (REM). REM is the hardware controller for your pool controller. So from a browser window type http://<ip address of the pi>:8080. A webpage will appear to allow configuration of the devices on the Pi.

Follow the instructions here to set up inputs for the temperature sensors on your controller. If you are using RS-485 devices such as pumps, chlorinators, or RS-485 heaters be sure to the set up the RS-485 pass through on the MEGA-BAS.

Configure your Relays

To configure your relays you need to first set them up in REM. So from a browser window type http://<ip address of the pi>:8080. Follow the instructions for setting up your relays. I2c Relay Setup

Configure all the relays for your valves, circuits, heaters, and lights in REM. We will be assigning these to options using dashPanel configuration screens. There are some special notes for the configuration related to relays configuration. Be sure to provide meaningful names for each relay you configure in REM.

Circuits For all pool types, the pool and/or spa should not be set up as a specific relay. While you can do this the better implementation is to think in terms of filters and the number of relays you will be using are related to the number of filters installed on your pool. So if you have a shared system with a pool and a spa you still only have one filter circuit. This filter circuit relay will be used to engage items that should be on only when the filter pump is engaged. REMEMBER: If the draw from the equipment is greater than 8 amps or the circuit is 220v, you must use a 3hp relay attached to the pi relay hat.

Valves In shared body systems (pool/spa combo) plan on using two relays for the intake and return valves. Set these up in REM to accommodate the mode in which the filter will operate. All of the logic required to manage the equipment assigned to each body will be controlled by the Nixie controller.

Heaters Heaters equipped with a fireman's switch must have a dedicated relay.

Lights Many of the pool and landscape lights draw less than the 8amp maximum rating for the relay. You can often switch the hot leg of these using one of the relays on your relay hat.