ESPHome PWM Output for Linear Analog Meter Display

Hi everyone! I’m working on a project to display the water tank level in my home using an analog meter. I’ve set up an ESP8266 to measure the water level and report it as a percentage through Home Assistant. My goal is to have this percentage displayed on an analog meter that I already have, which conveniently has a 0-100 scale marked in 100mV increments.

On an Arduino, I know I could output a PWM signal, smooth it with a low-pass filter, and use a voltage divider to get the right voltage range. But I’m trying to do this within ESPHome, and I’ve run into an issue. The PWM output from ESPHome seems to be logarithmic, which isn’t suitable for a linear analog meter. I’ve checked the documentation and forums, but I can’t find any examples or solutions for this specific problem.

Has anyone successfully used ESPHome to drive an analog meter with a linear PWM output? Any tips or workarounds would be greatly appreciated! I’d love to get this working so I can have a clear, analog display of my water tank level. Thanks in advance for your help! :blush: