The controller had these requirements:

  • 24V to 5V and 3.3V regulator
  • Interface for the original Balboa display
  • 8 relay outputs
    • Main (power to the other relays, should one stick then this relay can turn everything off)
    • Heater
    • Circulation Pump
    • Jet Pump 1 - Low
    • Jet Pump 1 - High
    • Jet Pump 2
    • Blower
    • Ozone generator
  • I2C output
  • 1-Wire output
  • NTC interface for the original water temperature sensor
  • NTC interface for the original heater temperature sensor with a hardware fail-safe
  • 6 inputs for use with regular (waterproof) pushbuttons to control the hot tub settings
    • Temperature Up
    • Temperature Down
    • Jet Pump 1
    • Jet Pump 2
    • Blower
    • Lighting

After some design iterations, the board containts these elements:

  • WeMos compatible pin sockets (I used the WeMos D1 Mini Pro for having an external antenna connector)
  • TPS54308 regulator for converting the 24V to 5V
    • MCP1700 for converting 5V to 3.3V so I didn't have to use the WeMos 3.3V regulator
  • Balboa display interface for talking to the original display (mileage may vary on newer models)
    • Connected to the WeMos I/O for minimal overhead when polling the display
    • RJ-45 connector so the original cable can be used to plug in the display
    • More information on the display protocol can be found in the documents folder of the github repo.
  • Onboard 1-Wire DS18B20 temperature sensor
  • TXS0101 as a 1-Wire buffer for connecting external 1-Wire sensors
  • I2C buffer for maybe one day connecting a homebrew display if the current one quits.
    • Could also be used to interface with external addons like a pH sensor.
  • NTC thermistor interface (simple series resistor with opamp buffer) 
    • For use of the original Balboa NTC water temperature sensor
    • Connected to the WeMos ADC
  • Another NTC thermistor interface with latching comparator as a hardware fail-safe
    • For use of the original Balboa NTC heater temperature sensor
    • The trigger threshold can be controlled with a potmeter
    • It will reset the I/O expander causing all relays to be de-energized
  • MCP23017 I2C I/O expander.
    • Driving relays through a ULN2803A darlington transistor array
    • Driving a high current Mosfet for controlling the lighting
    • Sampling button inputs for controlling the hot tub settings with simple buttons
    • Sampling the filter loop pressure sensor
  • Everything is routed to terminal blocks to be housed in a din rail enclosure.

The firmware is my first try in using C++ in embedded code, so you might see some weird approaches.
Feel free to give suggestions. Some features:

  • Software only Balboa display controller class
  • Hot tub class controlling all the hot tub elements
    • Heating (simple on-off control for now, no pid, but working very well)
    • Filter cycles (pre-programmed by specifying time window, frequency and length)
    • Flush cycles (also pre-programmed)
    • Auto-off of blower and jet pumps after a pre-programmed time
    • Continuous error checking using the water temperature sensor and pressure sensor
  • Time synchronization using NTP.
  • Commands and status using MQTT.
  • Serial console for debug.