The design of OPNpool hardware is based around a RS-485 Transceiver and an ESP32 System on a Chip (SoC). The transceiver converts between the RS-485 differential signals and the transmit/receive signals used by the UART in the SoC. The ESP32 is supported by the well documented Espressif IoT Development Framework (ESP-IDF).
We started by using a single threaded task on a Espressif ESP8266 SoC. This was cheap and offered built-in WiFi, but over time, we migrated to the newer ESP32. Though still very affordable, and it also offers Bluetooth LE and runs FreeRTOS which helps in separating the software components.
The official name of the ESP32 SoC is “ESP32-D0WDQ6”. It contains two CPUs and peripherals such as WiFi, Bluetooth and Bluetooth LE.
The ESP32-WROOM32 module combines this ESP32 with a clock circuit, 4 MByte flash memory and a trace antenna. This in turn is mounted on a Wemos LOLIN D32 daughterboard, that provides the reset logic, USB bridge and battery circuit. The main reason for using the LOLIN D32, is that we didn’t want to solder the micro-USB connector ourselves. Looking back, it seems more cost effective as well.
The schematic itself is pretty straightforward. We take the power from the pool controller and convert it to 3.3 V, and a buck converter provides 5 Volts to the battery connector on the ESP32 daughterboard. Using the battery input helps prevent problems when the circuit is also powered through the USB connector
The data path is between the RS-485 connector and the ESP32 on the LOLIN D32 daughterboard. There is an optional terminator resistor to prevent reflections on the bus. The JTAG header is for debugging as detailed in the Debugging chapter.
The second revision adds LEDs for RS-485
RX (green) and
TX (amber) to simplify setup. It also introduces a push button to preform a factory reset, and increases the bore hole size for the screws.
Bill of Materials
The price comes down to under $40 based on single quantity, excluding shipping and taxes. However, note that some items, such as the PCB, have minimum order quantities.
|Name||Description||Suggested mfr and part#||Paid|
|PBC r2||Printed circuit board||OSHPark nS1z3Duu||$9.43|
|ENCLOSURE||158x90x60mm clear plastic project enclosure, IP65||white label||$8.65|
|LOLIN D32||Wemos LOLIN D32, based on ESP-WROOM-32 4MB||Wemos LOLIN-D32||$6.50|
|RS485_CONN||Plug+socket, male+female, 5-pin, 16mm aviation, IP68||SD 16-5S||$3.50|
|MAX3485||Maxim MAX3485CSA, RS-485/UART interface IC 3.3V, 8-SO||Analog-Devices MAX3490ECSA||$5.01|
|DC1||DC/DC Converter R-78E5.0-0.5, 7-28V to 5V, 0.5A, 3-SIP||RECOM-Power R-78E5.0-0.5||$3.25|
|D1||Schottky Diode, 1N5818, DO-41||ON-Semiconductor 1N5818RLG||$0.38|
|LED1||LED, Green Clear 571nm, 1206||Lite-On LTST-C150KGKT||$0.34|
|LED2||LED, Amber Clear 602nm, 1206||Lite-On LTST-C150AKT||$0.34|
|C1, C2||Capacitor, 10 µF, 25 V, multi-layer ceramic, 0805||KEMET C0805C106K3PACTU||$0.54|
|C3||Capacitor, 0.1 µF, 6.3 V, multi-layer ceramic, 0805||KEMET C0805C104M3RACTU||$0.10|
|R1, R2||Resistor, 68 Ω, 1/8 W, 0805||YAGEO RC0805FR-0768RL||$0.20|
|R3||Not stuffed, resistor, 120 Ω, 1/4 W, 0805||KAO SG73S2ATTD121J||$0.13|
|RS485-TERM||Fixed terminal block, 4-pin, screwless, 5 mm pitch||Phoenix-Contact 1862291||$1.85|
|SW1||Tactile Switch, 6x6mm, through hole||TE-Connectivity 1825910-4||$0.15|
|HOOK-UP WIRE||22 AWG solid, 6 inch each, yellow+green+red+black||Adafruit 1311||$0.32|
|(2) PCB SCREWS||Machine screw, #6-32 x x 3/16″, panhead, Phillips drive, steel||Keystone-Electronics 9306||$0.10|
|(2) CONN SCREWS||Machine screw, M2-0.4 x 16 mm, cheese head, slotted drive, nylon||Essentra 50M020040D016||$0.26|
|(2) CONN NUTS||Hex nut, M2-0.4, nylon||Essentra 04M020040HN||$0.20|
|CABLE||Cat5e Ethernet Bulk Cable, 10 ft., blue||Monoprice 880||$1.00|
The schematic fits easily on a two layer PCB. Note the cut out for the RF antenna.
Behind the scenes
Just for fun, a little stop animation video of the PCB design and assembly