Particle Photon Pool Controller

I’ve been working on a clone of bscuderi13’s Pool Controller. I went somewhere different in controlling the pump. Instead of trying to figure out the code to make it talk RS-485 with their proprietary commands, I found a pump that would let me control it through PWM. I’m using a Particle Photon to drive an Adafruit DRV8871 motor controller to output PWM and piggybacking power 12VDC from the pump RS-485 connections. I’m also using a version of the Open Energy Monitor with the Buffered DC Bias Voltage setup running, using an LMV321 to give me live Watt measurements of the pump, and to give positive confirmation that the pump is indeed running, if I’m not available to just look out the window.

Ignore the watts value, it is correct, it’s just set up on my bench, but I can verify PWM output through an oscilloscope and the current transformer is disconnected.

I have the pool temperature coming in through a DS18B20 sensor and is reliably publishing its numbers through the Particle console every 10 minutes.

I’ve got the PWM, power monitoring, and temperature all sorted out on the particle side. I"m just having trouble bringing the temp to update correctly every 10 minutes in SmartThings on the main switch tile.

If someone wants to tell me where I went wrong, I’d appreciate it. Here is a link to the poolcontroller.ino file and the poolcontroller ST device handler

Photon variablepumpPWMv1.1.ino

Pump controller ST