AI and the Photon2 - This is not a tutorial per se, but mainly ideas

I began using Blynk, which suits beginners,
though the interface is not ideal. I chose to combine AI with the Photon2.
I asked AI to write code for my thermostat using HTML, CSS, JavaScript, and C++. I specify my target device the Photon2, so it integrates Particle.h automatically, etc.

// Hardware pin assignments
const pint FAN = D2;
const pint COOLING_S1 = D3;
const pint COOLING_S2 = D4;
const pint HEATING_S1 = D5;
const pint HEATING_S2 = D6;

// Segmented Mode Settings (Default: OFF, restored from FRAM)
int SystemChoice = 3;
const int SYSTEMFAN = 0;
const int SYSTEMCOOLING = 1;
const int SYSTEMHEATING = 2;
const int SYSTEMOFF = 3;

The AI produced the code quickly. Adjustments may be needed, so I request specific tweaks.
I am not a programmer guy, but a hardware person, wiring things is easy for me, I "play" with electricity. Programming them is a different story, and AI excels there.

Here are a couple of images of my thermostat UI.

The SDP810 Interface

My thermostat includes a FRAM, a microSD card for reading and writing events, etc., the Sensirion SDP810-500pa, plus 2 Mamac Static Pressure Pick-UP A-520-1-A-1 1/4" Brass HS Barb for CFM monitoring, a BME680, and a TFT display.
The only public domain library I am using is the SdFat.h, the rest rely on native code.

I use ChatGPT, which is somewhat slow, so I mostly use Gemini, it's very fast. The Photon2 performs very well, plenty of RAM space for my code.

The split between hardware and software work here makes sense, especially since wiring and enclosure work is where your experience actually is. Two things stand out: using FRAM for the segmented mode default is a good call over EEPROM wear, and relying on native code instead of stacking libraries keeps flash usage predictable on the Photon2. The CFM monitoring via the SDP810 with those static pressure pickups is the part I'd be most curious about, since differential pressure readings tend to get noisy around fan cycling. How are you filtering that before it hits the display?

You picked the most interesting part of my HVAC system, Here it goes:

The SDP810-500Pa code uses two stages of pressure averaging to reduce fluctuations caused by airflow turbulence at the two static pressure pickups locations (supply and return ducts).

It also includes data-validation and settling mechanisms. Here's exactly how it works.

static const uint16_t SDP810_CMD_START_CONTINUOUS = 0x3615;

The command 0x3615 enables Sensirion's continuous differential-pressure measurement with averaging until read.

The SDP810 internally averages pressure measurements between successive reads, reducing rapid fluctuations before transmitting a value to the Photon 2.

This is my primary noise filter:
static const float SDP810_PRESSURE_ALPHA = 0.15f; // EMA filter

The actual filtering occurs here:
sdpFilteredPa += SDP810_PRESSURE_ALPHA * (sdpPressurePa - sdpFilteredPa);

The result combines:

  • 15% of the latest pressure measurement.
  • 85% of the previous filtered pressure.

Here are additional protection/details:

1- Internal sensor averaging 0x3615 Reduces rapid pressure fluctuations
2- EMA filter 0.15 Smooths differential-pressure readings
3- CRC-8 validation Enabled Rejects corrupted I²C measurements
4- Pressure range validation ±500 Pa Rejects values outside the configured range
5- Pressure freshness 3.5 seconds Prevents stale measurements from being used
6- CFM settling 30 seconds Delays airflow estimates after blower-mode changes

This prevents noisy transition artifacts from entering blower calculations:
static const uint32_t SDP810_CFM_SETTLE_MS = 30000UL;

When the HVAC starts either cooling or heating, the SDP810 waits 30 seconds to display.
the CFM, at that moment the reading is very stable, ± 5 CFM

if (sdpCfmSettling)
{
if (static_cast<uint32_t>(now - sdpCfmSettleStartMs) < SDP810_CFM_SETTLE_MS)
{
sdpCfmStatusText = "Settling Airflow Duct Pressure...";
return;
}
sdpCfmSettling = false;
}

The SDP810 has this command, but as you can see, it does something different:
0x3603 Mass-flow compensation Average until read.

The Sensirion SDP810-500Pa is a highly sophisticated, fully integrated, precision differential-pressure sensor with advanced digital signal processing, exceptional sensitivity, intelligent averaging, and excellent long-term stability.

The SDP810 is located up in the attic, 35 feet away from the thermostat, I use two SparkFun QwiicBus - EndPoint- Voltage Range 2.5-5.5V to extend the I2C signal over an RJ-45 cable.

My HVAC system has two return-air ducts that converge into a common box called: plenum. The first static-pressure pickup is installed at this location, where the return air is drawn into the furnace
(between plenum and furnace).

The second static-pressure pickup is installed on the supply side, immediately after the furnace, just before the evaporator coil (between the furnace and evaporator coil)

Together, these two measurement points allow the Sensirion SDP810 differential-pressure sensor to monitor the pressure difference across the furnace and blower assembly, providing valuable information about airflow characteristics and system performance.

What draws my attention to the SDP810 is its differential static-pressure readings (inWC) and the estimated airflow (CFM) calculated from them. The CFM figures will show whether the system is declining with age or whether filters need replacement, etc. This offers the most complete HVAC CFM monitoring option not yet available on the market.