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


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:


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 (D0 on Photon)

4.) Grey - ECHO (D1 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:

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.