This tutorial will show how to monitor pH, ORP, and temperature of a pool or spa and upload the data to ThingsBoard.io's visualization and storage service.
- Any ESP32 development board. This one seems reasonable, but any will work.
- An Isolated ISE Probe Interface board and a pH probe. You can get them both at ufire.co.
- An Isolated ISE Probe Interface board and a ORP probe also from ufire.co.
- Some odds and ends like wires and USB cables. You can also use Qwiic wires with all uFire boards for easier connections.
Now for the libraries: From in the Arduino IDE, goto Sketch / Include Library / Manage Libraries...
- Search for and install 'ArduinoJson' version 5.13.2.
- Search for and install 'PubSubClient'.
- Search for and install 'Isolated ISE Probe Interface'.
- I will assume you are familiar with Arduino, the Arduino IDE, and have it installed already. If not, follow the links.
- Make sure you have the ESP32 platform installed.
Because the uFire devices communicate through I2C, they need unique addresses. The ISE devices we are using to measure pH and ORP are the same, so by default they come with the same address. The address can be changed though, and that is what we will do now.
From the Arduino IDE, go to 'Files / Example / Isolated ISE Probe Interface' and select 'Shell'. This is a convenient to use shell-like interface for using and configuring uFire devices. Upload the sketch to your device, make sure one of the uFire devices is connected and run the following command.
That should have changed the I2C address of the device permanently to 0x3E. Now both devices will have a unique address, one will be the default 0x3F, and the other to 0x3E.
The ESP32 we are using has WiFi and BLE interfaces, so that just needs a power supply. You'll probably want a USB cable supplying power, but a battery is another option. Many ESP32s can be bought with battery charging circuitry already on the board.
The uFire devices that we will be measuring pH, ORP, and temperature connect to the ESP32 by the I2C bus. With the ESP32, you can choose any two pins for I2C. Both devices will be on the same bus, so the SCL and SDA pins will be the same. If you look at the code (next step), you will see these two lines.
ISE_pH pH(19, 23); ISE_ORP ORP(19, 23, 0x3E);
I decided to use pin 19 for SDA and pin 23 for SCL. So Connect the ESP32's 3.3v (or whatever the pin may be called on your particular board) to the first uFire device's 3.3/5v pin, GND to GND, 19 to SDA, and 23 to SCL.
The pinout on your ESP32 may be different from the picture.
ThingsBoard is an online service, that among other things, receives sensor input and visualizes them in the form of charts and graphs. There are several installation options. For this tutorial, it will be using a local installation running on a dedicated computer.
Visit ThingsBoard.io's installation instructions and choose the install the appropriate selection for you.
I installed the Docker image which allowed me to access the installation by going to http://localhost:8080/.
As described here, the default login username and password is firstname.lastname@example.org and tenant.
- Once you login to ThingsBoard, click 'Devices'.
- On the next page, you'll see an orange '+' on the bottom right, click it and the 'Add Device' dialog will appear. Fill in the 'Name' field with whatever you'd like to call our device. Then under 'Device Type', enter 'ESP32', although it could be anything. Click 'Add'.
- Click the newly created device's entry in the list and you'll see quite a bit of information about it. Leave this screen open and go to the next step.
You can take a look at the source here.
- Change ssid and password to your WiFi network information.
- From the previous step's open screen, click 'COPY DEVICE ID' and change the 'char device' variable to the copied values. Do the same for 'COPY ACCESS TOKEN' to the 'char token' variable.
- Finally, change the 'char server' variable to the IP address of the computer running ThingsBoard. Mine was '192.168.2.126'. No 'http', slashes, or anything else, just the IP address.
- Copy the files into an Arduino project.
From within the 'LATEST TELEMETRY' tab, you should see our three data points, C, mV, and pH. If you click the checkbox on the left of each item, you can then click 'SHOW ON WIDGET'. You'll be presented with a lot of charting options. Pick the one you like, then click 'ADD TO DASHBOARD'.
ThingsBoard provides lots of options from this point on so I'll leave that up to you to explore.