The concept solution explained
There’s an oil (kerosene) tank in the backyard of the house I’m renting. Oil or kerosene, is the 2nd most popular heating option in Ireland – 2nd to turf and wood. The tank (like most I’ve seen, if not all!?) has no indicator whatsoever, making it difficult and (extremely) annoying to keep an eye and deciding when’s the time to refill.
So… about a month ago, I started looking at different ways I could monitor the oil level. Then, while browsing, I came across this link. The project is based on an ultra sonic sensor (probably the most popular one used by the Arduino/Raspberry Pi maker community – the HC-SR04). I liked the project so much, I thought I’d give it a go and do it my way.
I have drafted few goal/features I would like to incorporate in my design:
- no wires coming out of the sensor mounted on the tank
- which meant it has to be battery powered
- energy saving mode
- which meant I will have to take measurements at regular intervals and put the entire device into sleep mode once I’m done taking them
- a way to visualize the tank level over time and
- store historic data (on a SD card?)
- ability to create alarms and generate SMS and/or e-mail orders
Everything except the last 2 items is basically a must. The last two requirements would be considered good to have, but definitely not a must.
So this is the block diagram I drafted to keep me reminded of what I would like to build:
The RTC (Real Time Clock) module is responsible for placing the MCU in sleep mode when not taking any measurements and waking it up otherwise. These modules come bundled with a 3V CR2032 battery and I would like to keep it that way – keep it separate from the battery powering everything else. But both batteries will be monitored so I know when I need to replace them. The battery “levels” will be sent along with the oil tank level measurement.
For the RTC module, I have chosen this one based on the DS1307.
For the battery monitor I am considering two options at the moment:
- discrete monitoring i.e. battery at critical level and needs replacement vs. all is good (basically a simple OP Amp based comparator circuit) or
- continually monitoring the voltage and “feeding it” to an analog input of the MCU.
The wireless module… hmm! I need something really simple and although I am still unsure of the choice, I think I will go with a board based on Nordic Semiconductor’s NRF24L01. It works in the GHz range and it should give enough distance coverage – even without an external but a PCB antenna! Then again, I don’t really need to cover a radius greater than 10m but on the other hand, I might need to consider the house walls. I guess in case I really need it, I will go for a board based on the same IC but with an external antenna feature.
I will use the same wireless module here as for the transmitter part of the project!
As for the MCU, I think of going with an ESP32 board with a built in OLED display. With this one I also cover the WiFi/Bluetooth feature requirement.
The working principle is a fairly easy one, in theory at least. Once I setup everything, I will slowly fill the tank up and take readings with the ultrasonic sensor, say every 20 or 50 liters. This way I could map the level inside the tank (in liters!) based on the distance from the sensor to the surface of the oil inside the tank.
Once I have that, I will put the MCU in sleep mode and wake it up every 30 minutes to take some readings e.g. take one reading each 100ms for 1sec. This will give me 10 readings with the ultrasonic sensor. I will have to develop an algorithm to “filter out” those samples that seem out of the ordinary or unexpected e.g. massive difference in value from the rest of the samples. I already have an idea on how to do that, but let’s see how it evolves.