Monitor Heating Oil Tank Gallons With Email, SMS, and Pushbullet Alerting

1,193

24

24

Published

Introduction: Monitor Heating Oil Tank Gallons With Email, SMS, and Pushbullet Alerting

About: http://blog.vpetkov.net

SAFETY INFORMATION: In case anyone wants to know if "this is safe to build/install" -- I have taken this to 2 different Oil companies for feedback/safety considerations, and I have run this by the fire department's Fire Prevention Deputy Chief. Per all 3 - the device is considered completely safe with norisk of fire or explosion. That said, I cannot control your individual environment/what you do with it, so please assume your own risk when installing it. Per the oil companies - electric sparks/open flames will not ignite the oil, so there is no possibility of catching fire/explosion/etc. Nothing compresses/creates a vacuum/creates air pressure to cause an explosion. My favorite quote was "even if you flick lit matches in your oil tank, it will not catch on fire."


This is a very quick and easy DIY build for a system that lets you monitor your home oil tank level (in *exact* gallons - down to the 10th of a gallon) remotely, and alert on different levels via Email/SMS/Pushbullet, etc.

The entire build is meant to be quick, clean, and less than $40!

The key parts are a Particle Photon for the "intelligence", a HC-SR04 for the "sound pulse" which will be used to measure the distance to the oil and using some data charts calculate the exact number of gallons avaiable, and a nice PVC shell for an easy build which can be directly screwed in into the tank.

I've made sure to provide a lot of images (especially of a few gotcha's) in order to make this as easy as possible.

For more information, background, and code (and feedback/comments), please go to my blog:

http://blog.vpetkov.net/2017/11/12/diy-monitor-heating-oil-tank-gallons-with-pushbullet-sms-and-email-alerting

Step 1: PARTS NEEDED

1.) You need about $4-5 worth of 2" PVC:

a.) 2" Male Adapter (left side)
b.) 2" Female Adapter (right side)
c.) 2" Cleanout Plug (bottom/middle)

2.) You need a rubber gasket "sheet" that's ~3x3 or bigger. This is ~$1.25-1.50

3.) You need a HC-SR04 sensor. You can get 5-6 of them for $8-10 (don't pay more than $2/each).
This is essentially a "trigger"/"echo" supersonic module..

4.) You need a Particle Photon (wifi) - $20
(alternatively, if you don't have WIFI access, you can get the Particle Electron - more expensive, and uses SIM card that's $3/month)

5.) Cables -- Jumper cables (female-to-female), and MicroUSB cable+usbpower (not pictured - could be replaced w/ battery)

Step 2: Mark the Circle and Cut It Out

Mark the circle size and cut it out. This will be used as a seal/barrier between the chambers. It will also protect your electronic components, prevent oil fumes, and add other safety solutions.

Don't worry about exact size for now. Make sure it's bigger rather than smaller -- you will trim it down eventually to fit perfectly.

Step 3: Rubber Cement Male and Female PVC Together

Rubber Cement Male and Female PVC together as pictured.

The idea is two fold - create a secure PVC structure that has enough space to keep all of the components + keep any potential oil fumes out.

Step 4: Mark HC-SR04 Sensor, Cut It Out, Fit It In

1.) You want to mark the sensor in the center of your disk.

2.) Cut +'s (PLUS/Xs), but do NOT cut out the holes yet. (it helps with the bending/accuracy to wait for this until the disk is the right size).

I've broken this into many images to show the problems you might run into:

a.) The FIRST problem you will probably run into is the folds (see image tags for examples). You don't want this. If you run into this, take it out, size the rubber disk down a little, and try again. Once it fits, take it out and then cut out the circles.

b.) The SECOND problem you might run into is the rubber gasket not being pushed all the way. You really want it to fit into the "lip" that's left between the male and female adapters. This is the PERFECT place to "tuck in" the rubber gasket. You can see it in one of the images.

c.) After you get a good fit (see images), take it out, and THEN cut it -- but make sure the circles are slightly smaller than the markings. You want a tighter fit.

d.) At last, rubber cement the edges.

Step 5: Insert the HC-SR04 and Rubber Cement It From the Outside

The next step is to carefully bend the pins on the sensor so that they stick up. This will make it easier to connect to it when you have it inserted.

Insert the HC-SR04 sensor, and then push it all the way through.

Once that's done, use the rubber cement to "glue" the surrounding edges around the holes.

Step 6: Connect Header Cables, and Add the Photon

Connect the female-to-female header cables to the HC-SR04. You need 4 of them.

1.) WHITE - to the VCC (5v)

2.) BLACK - to the GND (Ground)

3.) Purple - TRIGGER (D01 on Photon)

4.) Grey - ECHO (D02 on Photon)

You will want to connect a microUSB cable to power the photon. Ideally, you can route it through the square cap (the Cleanout Plug).

Step 7: You Are DONE - Here's the Code

Final Product - you now just need to find one of the 2" `bungholes` on your tank, and unscrew the metal cap and screw in this.

The code for the Particle Photon, and some background can be found here:

https://blog.vpetkov.net/2017/11/12/diy-monitor-heating-oil-tank-gallons-with-pushbullet-sms-and-email-alerting/

If you have any comments/questions/feedback, please post a comment on my blog. I'll try to answer/help with anything that I can.

Step 8: Particle Photon - Screenshots of Code/Firmware + Library

Hopefully this should clarify the:

What if you have never used a Particle Photon? Detailed Help on setup/code/flashing!

section from the blog.

It walks you through creating the "app", pasting the code, attaching the library, and then saving/compiling/and flashing.

Step 9: Particle Photon - Web Hooks - Notifications (Pushbullet, SMS, Email)

Hopefully this should clarify the:

What are these Web Hooks/Notifications – step by step instructions

section from the blog.

It walks you through creating the "webhook" - and some information about it.

Share

Recommendations

  • Clocks Contest

    Clocks Contest
  • Oil Contest

    Oil Contest
  • Water Contest

    Water Contest

24 Discussions

POWER QUESTIONS: Have you tried to use the HC-SR04 and Photon with a battery? My tank is outside, so no power nearby to plug in to. I will probably use a solar cell to recharge it. I think the HC-SR04 needs 5V, so a boost converter or two LiPo or Li-ion cells in series and a voltage regulator would be needed, right? If yours is always plugged in, you probably did not bother with sleep mode and interrupts to wake. But if you know how to implement sleeping to save power, please add that to this instructable. Thanks!

6 replies

Steve - pinging you directly because I have made a significant change to the code which I think you will need. Please take a look at the new one. This is the correct code for vertical oil tanks -- which appear to be the standard. The previous is for the horizontal tanks. Also, I have changed the alerts/levels so that they are much more practical.

Thanks for keeping me updated, Ventz! Actually, there is very little of your original code left in my version, as I have been busy with my own mods. Gallons are not used here (Ireland) so I was not using the table anyway. My tank is 1000L horizontal with some internal structure that was causing sound reflections. I think I have solved that problem. But the internal structure (which displaces a significant volume of oil) will require a difficult calibration process for each such tank to get true litres.

But I had lots of other problems related to solar and batteries that I am still working on. I will post the results when it is all working reliably. I am just waiting for some sun now, to see if solar charging is working.... ;)

Take a look at this:

http://resources.heatingoilexpress.com/fuel-oil/ho...

It might be helpful in calculating the exact measurements with a direct formula.

By the way, thanks to the extreme weather we have had recently, I've had the pleasure of testing the sensor down to some very low temperatures (~ -17-18C), and so far it seems to be accurate.

Steve - yea I have. Actually the first time I started using the HC-SR04, after getting it to work quickly, the first real project was with a lipo battery.


The HC-SR04 does need a 5V. I've tried with 3V and while it "sometimes works", it's not reliable.

Take a look at the Particle Power shield -- this is by far the easiest and "everything you need" included one:

https://www.amazon.com/Particle-PWRSHLD-Contains-C...

(NOTE: it comes with a large lipo included which is nice, and it has some other nice benefits like multiple charge options, over charge, current protection, volt/amp meters, etc. There is one down side around disconnecting the battery physically for a while and trigger powering it back on when it's later connected after 2 hours -- but you won't run into that with this project since you don't need to constantly disconnect/re-connect the battery...in fact, it will probably just stay connected)

All you would do is attach the the external powered solar panels.

I would recommend the Particle powershield because then you don't need a boost converter, you don't need any regulators, and you pretty much don't need anything else. "It just works". You need to be careful about which pins you use on the photon (I think the first couple end up being reserved for the power measure functionality), but past that, it's basically "plug and use".

Alternatively, you can take a look at the sparkfun battery shield: https://www.sparkfun.com/products/13626
(NOTE: it does not come with a lipo, thus half the price, and it's much simpler, but roughly the same. It has a few less features, but it's smaller. Sparkfun also makes one for charging from solar panels, but that requires more parts and I don't recommend it for this)

I have not played with the Sparkfun one but a lot of friends have said good things about it.

For the solar panels, I did a lot of research, and at the end realized that I could spend ~$65-80/panel for "nicer brandname" ones, or I could get these (https://www.cafago.com/en/p-l1613.html- actually on sale for $14 right now) super thin "generic/no-brand name" which are IP65 rated water proof and paper thin. You can even easily chain two of them. Because they are so light, you can mount them with zip ties which is fantastic! I have 2 of these panels, and I am very happy with them.


Because of the functionality of the oil tank, and because you don't actually need to monitor it often/in real time, you can put the photon and especially the wifi chip to sleep, and then you can get away with VERY little battery. If you wake it up 1-2 times a day, measure, connect online, send results (or just connect when bellow a threshold), you can go for 60-80 days easily on the lipo charge that comes with the photon powershield. Thus the solar panel will be more than enough. Take a look at this for more information: https://community.particle.io/t/sleep-mode-explai...

Also, take a look at the official documentation for the sleep function:
https://docs.particle.io/reference/firmware/photon... (search for "Backup RAM (SRAM)", and look at the chart right under that for the options/what they do)

Something you will have to deal with is water sealing the components - but that's easy. You can sealant spray the whole thing or use rubber cement on the outside. I would use teflon tape ("plumber's tape") for all of the threaded/screw in components to create better seals and keep the rain/moisture out.

At last - about the temperatures, you are more than ok. The particle photon is rated for: -40 C to +85 C, and the HC-SR04 is rated for: -15°C to 70°C

You can easily add a tiny temperature sensor. I would recommend this one: https://www.sparkfun.com/products/13314 -- it's all self contained, and you don't have to add anything other than the headers you need. Alternatively, if you want something smaller/cheaper, you can get this: https://www.sparkfun.com/products/13314 (but you need a resistor, and it needs to be soldered to the legs + it's harder to attach the photon in a removable fashion). I would stick with the #13314 personally.

Good luck!

Thanks, Ventz, for the helpful advice and links. I had already gotten for this project the SparkFun Photon Battery Shield, and already had a Li-ion cell to use with it. Those notebook solar cells look great. Are they really 10W?!? I had already gotten a smaller one, at 2 for £12 http://amzn.eu/13x7bN7 with 2.5W 5V rating.

And a cheap boost converter is on the way to power the ultrasonic sensor: http://amzn.eu/40OQINc at £9 for 5. I did not find anything in the Particle power shield documents about it having a regulated 5V output.

Regarding temperature, I was not worried about the electronics not working, but just needing recalibration as the temperature changes, since the speed of sound changes with air temperature, and so do crystals' frequency. I have a bunch of DS18B20 digital temp sensors that are very similar to the Max31820 you suggested. If any of you have already implemented a temp calibration curve for HC-SR04, let us know.

To be honest - I have not had to deal with crazy cold temperatures yet when using the sensor. I would assume there is some standard of calibration based on degrees above/bellow a certain point. I did find this which seems to talk about exactly that: https://www.instructables.com/id/Temperature-Compe... and also this: http://la3za.blogspot.com/2014/05/temperature-comp...

Per the 2nd link, it seems like the base library (formula) is good for +/-30 C. I would assume that should be good enough for cold...it's probably heat that's the problem. The 2nd link also has the author's code on the bottom that deals with the temperature.

Funny - the panels you chose is what I had decided on from amazon before I found the no-name ones I ended up with (and yes - they really are 10W...it's crazy for that price point). This is what happens when you don't get the middle man markup. The down side is that you don't get fancy charging ports, but it does have a micro USB attached and sealed, although you will probably have to re-seal whatever you connect into that port. Given the low power requirements behind this project, I think almost any panel will be fine. The bigger concern is lithium ion in low temperatures.

I like the DS18B20s too - especially the nicely sealed ones, which seem ideal for water/snow/non-ideal conditions.

0
user
ventz

6 months ago

If anyone here needs to do this outside in *extreme* temperatures, it seems like the "US-100" sensor is a better choice (~$4). It has a built-in temperature sensor, and it auto-corrects for extreme temperatures.

2 replies

Hi Ventz, On your suggestion, I switched my HC-SR04 with a US-100 sensor, and am using it in digital (serial) mode. This simplifies the Photon code (by putting the distance calculating into the sensor) and seems to correct for temperature. But it is a bit flakier, and sends junk and needs to be reset once in a while. I appreciate getting mm precision where the HC-SR04 had only cm precision. I think the US-100 is accurate to about 3mm. I had to install a PVC pipe in my tank, which the sensor pings down to sense the oil level, because I was getting hell from various sound reflections off the internal structure off the tank. The pipe is open at the bottom with a notch so that oil will be at the same level inside it as out. Solar charging was also a lot of learning and mods I had to do. It is now working great, with 60-second sleeps between measurements using a 6Ah lead acid gel cell battery, which can easily stand the Irish cold, unlike a LiPo battery. I am also using ThingSpeak.com to track oil usage, temperature, and solar charging. Fun!

Steve - good to know. I got the same feeling (about the stability) from reading some of the reviews on this sensor. It seems to be "better", but a bit more flaky. Depending on your usage, I am assuming you can sleep for longer periods of time, and then poll a few times over a minute to "stabilize" the results. I am still using the HC-SRC04 here since the temperature is not a problem. It sounds like you might be better off with the MaxBotix sensors which seem to be incredibly accurate/resistant to weather. They seem to be rated for -40°C to +65°C (although recommended low is 0°C). The down side - they are a lot more expensive. By the way, that's a hardcore battery :) -- but to your point, needed for the colder temps. I keep seeing people building weather stations with LiPo batteries, and I am amazed that they make it through, but somehow they do. By the way, do you need to poll the sensor that often (every 60 seconds)? I would assume the oil should not change that much no? Thanks for the feedback on the sensor by the way!

0
user
ventz

6 months ago

UPDATE: 12/26/2017 (Dec. 26th 2017) - I have made significant changes and updates to the photon code and "table" implementation to work with the 275 gallon VERTICAL tanks (which are "normal/standard" oil tanks used in the United States). I have also changed the interval and "zones" for the alerts so that they are more practical. If you have created this project, please just pull the new code and re-flash your photon. You will notice very granule gallon detection/ranges along with some other improvements.

OUTDOOR QUESTIONS: How temperature-sensitive is the reading? I assume the crystal of the HC-SR04 is uncompensated, true? Here (Ireland) the outdoor temp where the tank is will vary between about -5 and +30°C. Should we implement some sort of temperature compensation? Does the Photon have a temperature sensor in it?

And what would be the best for waterproofing the electronics? Using a female PVC cap, rather than a male cleanout plug might help prevent rain and dew leaking into the threads.

1 reply

Added the temp bit in the long response about using the battery/outdoors, but posting here for anyone else searching:

You are more than ok. The particle photon is rated for: -40 C to +85 C, and the HC-SR04 is rated for: -15°C to 70°C

The photon does not have a temperature sensor that you can access, however you can easily add a tiny temperature sensor. I would recommend this one: https://www.sparkfun.com/products/13314 -- it's all self contained, and you don't have to add anything other than the headers you need. Alternatively, if you want something smaller/cheaper, you can get this: https://www.sparkfun.com/products/13314 (but you need a resistor, and it needs to be soldered to the legs + it's harder to attach the photon in a removable fashion). I would stick with the #13314 personally.

For the water, pasting that bit :)

Something you will have to deal with is water sealing the components - but that's easy. You can sealant spray the whole thing or use rubber cement on the outside. I would use teflon tape ("plumber's tape") for all of the threaded/screw in components to create better seals and keep the rain/moisture out.

Thank you Ventz! Very useful device I am now replicating. For those of us who are new to JavaScript, Photon and Pushbullet, can you post here (or on your blog) some more detailed guidance on how to implement the SMS alert? You had a code snippet but I don't know where to put it. In the Photon's program? Somewhere on Pushbullet? Both the Pushbullet API documentation and the Particle documentation are huge and geared to experienced IoT folks.

3 replies

Steve - replied on the blog post, but just adding the information here in case it's useful to others:

Added two new sections:

* What if you have never used a Particle Photon? Detailed Help on setup/code/flashing!

and

* What are these Web Hooks/Notifications – step by step instructions

These should provide the much needed clarifications.

At last – I have uploaded a bunch of new screenshots to go with with both sections (on the Instructables post) for the software side of the Photon and the Webhooks.

Let me know if these help and especially if something could use some more clarifications.

Thanks for the extra screenshots and their labels, Ventz. That really helps a lot!

Steve - glad you found it useful.

No problem - and you actually brought up a great point - I ended up rushing trying to get everything posted, and I did not do a good job providing details around the code/web hook/etc.

I am going to add to the post step by step instructions on what to do with the photon in terms of pasting the code/building it/flashing it, and then how to add the webhooks/some more information around that.

Give me a bit, i'll post the pictures here and some more information on my blog.

0
user
ventz

7 months ago

SAFETY INFORMATION: In case anyone wants to know if "this is safe to build/install" -- I have taken this to 2 different Oil companies for feedback/safety considerations, and I have run this by the fire department's Fire Prevention Deputy Chief. Per all 3 - the device is considered completely safewith norisk of fire or explosion. That said, I cannot control your individual environment/what you do with it, so please assume your own risk when installing it. Per the oil companies - electric sparks/open flames will not ignite the oil, so there is no possibility of catching fire/explosion/etc. Nothing compresses/creates a vacuum/creates air pressure to cause an explosion. My favorite quote was "even if you flick lit matches in your oil tank, it will not catch on fire."

0
user
Railes

8 months ago

Great Project, would recommend a few changes.

1. your gasket materials are all viton, which is just a normal rubber, Recommend updating to a Buna style rubber to prevent longterm exposure of the fuel from degrading the gasket.

2, your sensor isnt enviromentally sealed and may cause your fuel to explode if you have enough Oxygen inside your cap. Would suggest updating and using a MAXbotics enviromentally sealed unit.

1 reply

Railes,

Thanks.

#1 - I was wondering about the same thing (even though the fuel is not touching the gasket), what years and years of "oil fumes" would do to the rubber gasket. Thanks for the recommendation. It seems the Buna style rubber is pretty expensive, but if 1/16th of an inch is thick enough, this might do well: https://www.amazon.com/dp/B0075DYR8Q/ref=biss_dp_t...

#2 - I might be missing something, but there's no oxygen pressure build up anywhere. That is, the bottom "chamber" really just isolates the "fuel fumes" from entering to the top (and protect the electronics from the oil), but the top "chamber" (where the electronics are) is no way air tight. Also, there's no air pressure buildup in a home heating tank. I would never use this sensor for anything commercial/large industrial (I have seen those sensors at $200+ just for the sensor, and they are usually steel made). Am I missing something here/can you provide me some more info. If there are any concerns, I would love to fix them. (I actually checked with our Oil company before putting this on here just to make sure it was "safe" :))