
Every winter I’m nervous leaving my house, because I never know when my pellet furnace will run out of pellets, letting my house to cool down. My heating runs on pellets and while the system runs pretty much on its own, it has one major flaw..
It needs to be refilled.
Pellets come in bags and I have a baby blue bin where I pour in pellets. Every time the bin runs out, I need to go downstairs, fill in 15 bags and clean up the ash from the oven. It takes about 15 – 20 minutes.

(scared when you look at that photo? me too!)
Over the years I developed a hunch for when I need to feed the beast, but when the winter breeze hits hard, my intuition gets less reliable. “We’re out of pellets already?! But you filled them in last week..” I keep hearing from my wife, so she’s of no help either..
I had this issue for years.. since I moved in to be exact.. If I think about it, all it would take is one short peek into the bin every time before I leave the house – it’s just about building the habit.
Well.. We’re still cold from time to time.
As you’d expect, I’ve been thinking about a technical solution for my inability, but have always postponed realising it because it seemed like a rabbit hole.. lots of work for a stupid laziness cure..
Then last month, I decided to give it a go anyway.
Thinking about it, it was not that big of a deal.. what would really help me is a notification.. 2 days before the bin runs out, so that I know the inevitable’s going to happen and I can plan around it.
If only there was a way to measure how many pellets I have left..
Thought process
One day, I put it all down into a diagram – I love these, don’t ask why.. I figured the best way to track how many days left is by getting the bin’s weight.. Surely there must be some sort of a small kitchen-scale like things that I could just put below the bin’s feet..
But if there were 4 scales, that would give me 4 numbers to deal with and then I’d need to do MUCH PHYSICS™ and I’m not that good at that.. damn..
Is there a way to simplify this to only get one number?
Turns out there is – I can hang the whole bin in the air with a hook 🪝 and use a single scale (similar to what they use to measure pigs 🐖)

Ingenius, I know, but hanging a giant steel box to the ceiling is not something I saw myself being capable of, so..
Let’s ditch the weight
Instead of weight, I could drill two holes on each side of the bin- one for an IR LED or Laser, the other one for the receiver – when the pellet level drops low enough, the diodes will see each other again and send me a signal. That’s even easier to process – that’s just an On/off signal..
Or maybe even less drilling— I could hang a little rock on a string and tie it to a switch

then when the pellet level falls low enough, the weight would press down on the switch and that would send the signal too..
But that was not enough information for me (and that weight idea seems like it could backfire if the rock on a string slipped through the pellets somehow..) so I decided to go another way.
Introducing ULTRA-SONIC SENSOR
I mean.. that sounded really cool.. 🙂
What if I place a sonar on top of my pellet bin somehow and measure the distance from the top? There are all sorts of advantages with this approach – I’d only get one number to process, there’s only one sensor, no drilling, no hanging a huge box on my ceiling… This sounded really doable 👍
So I went sensor-hunting on Amazon. Everyone’s offering this thing that I’ve seen on all homemade quadcopters and robots,

but I found one that looked even cooler (and PRO)

I felt YOLO that day so I bought it. It looked expensive enough to be accurate.
Then it arrived
So I have the sensor.. what now.. I knew I had to finish this project in one night, otherwise I’d never finish it and it would just land on my sad pile of crap..
So after a week of staring at the sensor, I grabbed it, put it into my pocket so it bugged me all day when walking around, then when kids fell asleep, the clock started ticking.
I had an ESP8622 board lying around, so I used that. Arduino IDE is for noobs so I downloaded PlatformIO. It took a while to get the first light flashing (trying all sorts of board configs), but from there on, it was a breeze..
I love Codex ❤️
If you’ve been living under a rock – Codex is a piece of software that runs ChatGPT and allows it to run commands on your machine and then it also feeds it outputs from the commands – so if your build fails, ChatGPT can automatically fix it for you.
And fix it it can… I don’t remember touching the C++ code at all.. Codex, can you please:
- Add software serial to port 5
- I have this sensor (here are the docs: https://wiki.dfrobot.com/sen0311) – here’s the formula to get millimeters from the UART values) – please send millimeters to the other serial port
- Make the LED brighter when the distance gets lower
- Add OTA updates
- Add a HTTP server and implement a basic website showing the measurements from the sensor.
- Send the measurements to this and that API with HTTPS..
After an hour of back and forth, I got it working.. I mean.. I still needed to know what I wanted to do – haven’t spent countless hours banging my head over Arduinos, I wouldn’t be able to do that.. but still.. it was pretty impressive.
The coolest thing at this point was the LED that got brighter when Sonar was close to something – I remember I was walking around my room like an idiot pointing Sonar in various directions and staring at the LED going brighter and dimmer – it was very Endorphine-inducing – highly recommended 🙂 (yes my wife told me numerous times to get checked for ADHD).
Meeting some old friends
Then I needed to do a little API that would save my measurements and send notifications.. oh no.. here we go.. I hate my home projects for this exact thing – making a simple API is soooooo complicated – what do I pick.. do I take C# that I know well but it’s not that cool on the internet or do I go with Node that I haven’t used for some time.. or maybe I should try Go.. noo noo, let’s do Rust – yes Rust is cool..
Screw that – I used… – brace for impact – …. – PHP.
PHP is cool
Hate me all you want, but..
- PHP is old – there are more docs about it than for anything else (maybe that’s a stretch but still..)
- hooking up PHP with MySQL database is literally one line
- I already have a web hosting that I can repurpose and it runs PHP beautifully
- All the dependencies are already installed on the hosting
- I don’t actually need to install anything on my machine
- No building or transpiling or whatever..
- The word PHP literally means “Personal home page” 👌
So.. PHP it was. I mean.. Codex did everything again.. I created a folder on my machine, opened up WinSCP and enabled Sync – whenever there was a file change, it got sent to the server directly – that allowed for a very fast workflow.. Whatever I built, I could test it imediately (not a Hot reload but close enough 🙂
Codex built the API and a funky little dashboard and ChatGPT made the logo – “PelletYell” fits nicely 👍. Setting this all up and getting the sensor to send the measurements correctly took me 2 hours altogether.
Time to deploy to production
So I got the sensor, I got the API, I got the dashboard – great – then I figured I forgot a tiny little detail – how to mount this thing to my bin 🙂
I’m a software guy so this was a big deal for me.. do I really need to drill? Where do I put the chip and where should I mount the sensor.. Will the WiFi even work if I put both things into the bin?
No, turns out WiFi doesn’t work from the inside of the bin – I plugged the chip to a power bank and threw everything inside – blackout. That meant, I needed to mount the chip outside the bin. It was already very late when I was doing that, so I took the easiest approach possible –
I had a piece of a plastic rail lying around – I cut it to the right length and carved out the corners – it fit very nicely on top of the bin, so half of the problem was solved. Then all it took was some double sided tape and the sensor was mounted 👍

Then I used some long wires to connect the sensor to the chip and that was it.

It sure looked like a bomb and I hope it won’t scare the chimney sweeps when they visit.


Calibration
With the sensor mounted, I could finally get some real-world numbers to send the notifications. Full bin, immediately after refilling it with 15 bags was 135mm, so I pinned that as 100% and an almost empty bin that would probably empty after 2 days was 670mm and that was my 10% – and that’s basically all I needed.

Time to setup notifications. Again – the hosting I used (domenca.com) had everything I needed. PHP Mailer and my hosting’s SMTP server were a perfect combo.
And surely after a few days, I got my email:

Job done 👍
Final thoughts
This was hands down the smoothest project I ever did – not throwing away stuff finally paid off (that plastic rail was a god-sent-gift haha), nothing broke down during mounting or otherwise.. it was almost too easy 🙂 I had to do close to 0 coding and that was a massive boost. Especially because I didn’t get a chance to overcomplicate it. Almost everything I did was essential, no additional unnecessary features I might need in the future but then I never do..
This thing is now running for the second month and it’s still as good as it was at the start.
There are many things I could do with the data and I had some wild ideas for the frontend, but I think I’ll leave that for now as it is.
