Tank Level Alert for Pellet Stove

7.5K8931

Intro: Tank Level Alert for Pellet Stove

If, like me, you have a pellet stove which does not indicate the low level of the tank, I suggest this little module which will beep when the reserve is almost empty.

This gap is problematic because when there are no more pellets, the stove switches off and the ventilation still blows for 40 minutes. Only after that it is possible to restart it.

This module consists of 2 boxes, the first is the sensor which will "read" the level of the tank and the second contains the buzzer to warn, a test button, and an LED to indicate a reading in progress. Everything is powered by a battery (a power bank to use to recharge phones for example).

STEP 1: Study

I did some tests with a test board and an Arduino Uno to know how to use the ultrasonic sensor.

The HC-SR04 detector uses ultrasound to determine the distance an object is located. Regardless of the light intensity, temperature or type of material, the sensor can easily detect how far it is from the obstacle.

The stove tank heats up to around 46 degrees Celsius but that shouldn't be a problem as the sensor has a Working Temperature: -15°C to 70°C

On such a project I don't need a lot of I/O so I chose a Digispark.

To facilitate programming I used the NewPing.h library. The problem is, I couldn't get this library to work with a Digispark. So I used the basic functions to read the sensor but the values seemed less precise.

So I created 2 version of the code depending on whether you choose a Nano or a Digispark :

  • NiveauPellet.ino for Arduino Uno or Nano (Use NewPing.h library)
  • NiveauPellet_v2.ino for Digispark

The rest is pretty basic, a buzzer to alert, an LED to indicate that a reading is in progress, and a button for do a reading test.

STEP 2: 3D Print

I designed the boxes with the Fusion 360 software, I planned a housing inside the boxes to be able to install a small magnet.

For printing I used carbon black PLA with my FlashForge Finder printer

STEP 3: Welding of Components

For the control part, the components are soldered onto a small piece of pre-drilled printed circuit board.

For the ultrasonic sensor, I unsoldered the pins and soldered the wires directly.

And for the cable, I recovered an old computer Y cable (it was used once for a wireless keyboard and mouse receiver).

STEP 4: Assembly

The circuits are installed in the cases, the covers are glued, and the cable is connected to the Arduino.

The Digispark having a standard USB port, I can plug it into a power bank.

STEP 5: Bip Bip!

The sensor is installed under the tank cover thanks to its magnet, and the control part is placed on the edge of the stove and remains in place thanks to its magnet too.

This is how it works: when the pellet level is low (I left about 10 cms), the buzzer sounds every 2 minutes and I know I need to refuel.

If you liked it, please consider your vote for the automation contest ;)

20 Comments

Beau petit projet, merci pour l'idée.
J'ai un peu adapté le code car il y a des erreurs de mesures avec ce capteur:
Une mesure toutes les 20'
Après 3 mesures consécutives positives: bipbip et intervalle de mesure diminue.
Après 5 alertes bipbip (fond de réservoir atteint) fin d'alerte (pour me laisser dormir)
Mais les mesures continuent et après 2 mesures consécutives négatives (=remplissage), le cycle recommence.
Fonctionne très bien chez moi depuis quelques jours.

Je pense aussi à une autre approche:
Faire une moyenne (en excluant les valeurs extrèmes) de 3 mesures et utiliser cette moyenne pour faire varier le nombre et/ou le volume et/ou l'intervalle des bipbip. Ainsi, à l'oreille, on pourrait estimer la quantité de pellets restante dans le réservoir...
Merci pour ton retour.
ça m'intéresserai de voir ton code source !
/***************************************************
Pellet stove tank level alert
www.magicmanu.com
Modifié janvier 2023 Patrick JOACHIM
Carte: Digistump Digispark (Default - 16,5MHz)
Tester le positionnement du capteur dans le réservoir (grille de protection)
***************************************************
Attention: couper alim externe pour update software
***************************************************/

long intervalle = 20; // intervalle de mesure initial (en minutes). Idéalement: 20' (cycle de 1h)
int niveau = 35; // niveau d'alerte (en cm)

#define echoPin 2 // Echo Pin P2
#define trigPin 3 // Trigger Pin P3
#define buzzer 4 // the pin of the active buzzer P4
#define led 1 // led intégrée
long duration, distance; // Duration used to calculate distance
long TimeRef = 0;
long Cycle; // cycle de mesure
int CountPos = 0; // compte les mesures positives
int CountNeg = 0; // compte les mesures négatives
int cms = 0; // distance mesurée
int coefficient = 1; // divise l'intervalle de mesure si positif (valeur: 1, 2, 4, 6)
int bip = 1; //nbre de Bipbip

void setup() {
intervalle = intervalle * 60000; //conversion min en ms (x60000)
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(buzzer, OUTPUT); // initialize the buzzer pin as an output
pinMode(led, OUTPUT); // led
BipBip(bip); // Mise sous tension: 1 bip
}

void loop() {
Cycle = millis() - TimeRef;

if (Cycle > intervalle / coefficient) { // mesure toutes les x mS, diminue l'intervalle au fil des alertes

digitalWrite(led, HIGH); // indication de mesure sur la led intégrée (flash 2S)
delay(2000); // 2s pour indiquer mesure en cours
digitalWrite(led, LOW);

// Read the distance
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);

//Calculate the distance (in cm) based on the speed of sound.
cms = duration / 58.2;

if (cms > niveau and cms < 48 and bip <= 5) { // 50cm = fond du réservoir. Plus d'alerte si fond atteint ou après 5 alertes
digitalWrite(led, HIGH); // si positif, Led allumée jusqu'à la prochaine mesure
CountPos = CountPos + 1;
if (CountPos > 2) { // si positif 3x de suite: bip (évite les fausses mesures)
BipBip(bip); // nbre de bip bip augmente au fil des alertes
CountPos = 0;
coefficient = coefficient * 2; //diviseur intervalle de mesure au fil des positifs pour une alerte de plus en plus fréquente
bip++;
}
} else CountPos = 0; // si négatif, compteur à zéro

if (cms < niveau) { // si remplissage
CountNeg = CountNeg + 1; // si négatif 2x de suite (éviter les fausses mesures)
digitalWrite(led, LOW);
if (CountNeg > 1) {
coefficient = 1; // si remplissage pellets, intervalle de mesure initial
bip = 1;
}
} else CountNeg = 0;
if (coefficient > 4) {
coefficient = 6; // limite l'accélération des alertes
}
TimeRef = millis();
}
}

void BipBip(int bip) {

for (int i = 1; i <= bip; i++) {
analogWrite(buzzer, 50);
delay(100); //wait
analogWrite(buzzer, 0);
delay(100); //wait
analogWrite(buzzer, 50);
delay(200); //wait
analogWrite(buzzer, 0);
delay(200); //wait
}
}
Very elegant and well thought solution! Congratulations.
How long does the power bank last ? for what capacity?
As said by @Jakwiebus, the use of an ESP8266 could add some nice features such mail notifications and deep sleep for longer battery life.
Anyway, toutes mes félicitations!
Thank you so much!
The battery failed me so in the meantime I'm using a phone charger connected to the mains so I'm not sure.
Yes it is true that there is a way to add interesting functions with an ESP8266!
do you think this whod work for a pelit grill
I don't know what that looks like, sorry.
what if it starts beeping in the middle of the night and wakes you up?
It is not turned on at night, I program it to turn on 1 hour before I wake up.
Very cool. Simple, effective, and built for purpose :)
I've made something fairly similar to this, though I use a small OLED screen to display distance readings and tank level. However, I'm really having trouble getting accurate and consistent readings from the ultrasonic sensor in this environment. Especially when the stove is running and the pellets are shifting around in the hopper, I will sometimes not even receive a return signal from the sensor. My best guess is that the transmitter is lining up with a gap between the pellets and not being correctly reflected back to the receiver, though I don't know enough about ultrasonic sensors to be sure. Has anyone else encountered this issue and figured out a way to get more consistent and error-free readings?
how about leaving a flat piece of expanded polysterene on top of the pellets? It will drop with the pellets and should give a consistent surface.
Yes it is true that the readings are sometimes random, I think you have to take an average: for example take 5 readings in 5 minutes, and take the average distance.
bien pensé, simple , pratique ........ que dire de plus ? la finition est nickel .... je dis bravo . cdlt . de lionel de Belgique
I like this very much! It's simple, cheap and very very effective.
Good job!

If you change the arduino for an ES8266 you can even have a phone notification reminder to fill the reservoir.
Thank you ! Not bad the idea, I have never used an ES8266 but it is an idea that I keep ;)
This is such a simple but awesome automation project :)