Wood Pellett hopper sensor

For my home heating I use a wood pellett stove from MCZ. The variant I use is a few years old and there is no way to monitor the pellet level. This has caused me problems where you turn the heating on remotly and the level is too low, the stove will extinguish itself with no feedback unless I purchase the official add on hardware which I cannot find available locally.

My first soloution turned out to be the best for my use case and that was to use an ultrasonic sensor mounted inside the hopper.

I found a guide online from Andrea that got me 90% of the way there. Just a different hardware device to be monitored.

Components used:
ESP32
HC-SR04 Ultrasonic sensor

The software used will be ESPHome as this solution will be directly integrated with Home Assistant.

The SR04 sensor will be mounted inside the hopper at the top and point down into the hopper towards the bottom.

The first issue I faced was with mounting. The sensor needed a clear path to the bottom of the hopper but this was skewed by a protective grate halfway down that prevented items from dropping into the pellett feed auger. This was not something I wanted to remove.

The eventual compromise was to remove a small section of the grate in the corner to allow a clear view to near the bottom. The corner I removed can be seen below.

I attached the SR04 to a magnet using hot glue and in turn I could affix the sensor to the inside top of the hopper where is was isolated from any heat from the stove and ran the cables from it to the ESP32 which was mounted outside the stove at the rear. Again, this was to isolate the ESP32 from the heat but also the dust inside the hopper and to ensure stable wifi connectivity so when mounted intside the metal hopper, it was prone to loosing connection.

The setup was quite simple with the SR04 taking power from Vin and Gnd from the ESP32.
The SR04 needs two pins. One to send the pulse and the other for the echo back.
Trigger PIN was connected to GPIO13 and echo on GPIO12.

The initial code block used would return the measured level in cm but I wanted this as a percentage. Rather that convert this inside home assistant, I chose to do it inside ESPhome itself in a similar way to how Andrea did it.

filters:
    - lambda: return (0.49-x)*(100/0.49);

The 0.49 is the height so just set it to the height to measure. In my case the height of the hopper is 50cm before it tapers in, subtracting the 1cm of the sensor height. I wanted to treat 0% as the point at where the pellets are just covering the auger that feeds the stove.

Within home assistant I have an automation that will shut the stove down once it reaches 5% as to now allow the stove self extinguish.

As I said, the grate used to always cause the sensor reading to stall at 50% full, but once the piece was removed you can see in the image below readings become much more accurate. With some fine tuning and extending out the read time, it became a reliable measure of the hopper level.

The full ESPHome extract is show below.

esphome:
  name: hopper-level
  platform: ESP32
  board: esp32dev

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "**********************"

wifi:
  ssid: "*********"
  password: "**********"

captive_portal:

sensor:
  - platform: ultrasonic
    trigger_pin: GPIO13
    echo_pin: GPIO12
    name: "Pellet Level"
    update_interval: 300s
    filters:
    - lambda: return (0.49-x)*(100/0.49);
    unit_of_measurement: "%"
    
web_server:
  port: 80

Leave a Comment

Your email address will not be published. Required fields are marked *