Heating Oil Tank Monitor

In this subforum you can show projects you have made, or you are busy with. Please create your own topic.

Moderator: leecollings

Post Reply
User avatar
kivster
Posts: 6
Joined: Thursday 08 January 2015 21:59
Target OS: Linux
Domoticz version: beta
Location: United Kingdom
Contact:

Heating Oil Tank Monitor

Post by kivster »

Background
I've been looking for a monitor for my oil tank for a while now. I currently have an old Watchman device that reports how much oil remains in 10% increments. Over the past two years it has proven to be very unreliable and has stopped working completely now.

I have Domoticz running on a Raspberry Pi and I wanted something that would integrate with this. I searched for Z-Wave, ZigBee, RFX etc. compatible devices, but couldn't find anything. I then looked for Internet enabled devices and all I found was one product by Watchman. It still only measures in 10% increments but for a (quite expensive) monthly subscription you can have the device send the data back to the companies servers and notify you via a smartphone app if your oil is low. Needless to say I was disappointed, so I decided to make my own.

Hardware
I grabbed a spare Raspberry Pi, ordered a breadboard (£3), a HC-SR04 sensor (£3), some wires and got to work. The result so far is a prototype that looks like this:

Image
Programming
After getting that working I wrote a Python script to use the ultra-sonic sensor/Raspberry Pi to measure the volume of heating oil remaining in an oil tank and send the value to a Domoticz virtual device.

The script can be found here - https://github.com/kivster/oil-tank-monitor

The script sends N number of pings from the HC-SR04 ultrasonic sensor connected to the GPIO pins on a Raspberry Pi. It measures the time between sending and receiving the ping. If it don't get a successful ping, it takes the measurement again.

It then takes each ping time and calculates the distance to the top of the oil. I found that measurements would fluctuate based on how hot the room was (I'm testing this in my house). I remembered from GCSE physics that the speed of sound changes when air temperature changes. To address this I factored in the current air temperature for speed of sound calculations.

Each calculated distance to the top of the oil is added to an array of distances. The array is sorted in ascending order and outliers eliminated by keeping only the "middle" third of distances in the array. An average is taken of the middle third of distances. The averaged oil tank space is subtracted from the height of the tank in order to calculate the height of the oil. With the height of the oil the litres of oil and percentage of oil remaining can be calculated.

Right now the oil tank capacity is hard-coded and I fudge the percentage of oil remaining from that, without considering the tank shape. The next thing to do is to add accurate calculations of oil volume remaining in my tank based on the shape of the tank. I have a very odd shaped tank, so this is going to be tricky! Calculating this for cuboid tanks would be easy so I'm going to start by adding the calculations for those, followed by cylindrical and oval tanks.

Image

Finally the script sends the value by json to a virtual device on a Domoticz home automation server, where it is plotted on a graph and can be alerted on.

Image

Image

I'm currently working on a case for this device and a way of attaching it to a threaded hole on the tank. I'm thinking of using UPVC plumbing supplies to come up with something. Also, depending on how successful I am at powering this, I may consider an Arduino version in the future.

I'll be posting progress here and on my GitHub repo. If anyone has questions about the hardware or software I'd be happy to answer them. Once I have a final design, I may even consider making these for people.
Last edited by kivster on Monday 13 July 2015 22:53, edited 2 times in total.
Raspberry Pi + Domoticz + Aeon Labs Z-Wave USB
1x Aeon multi-sensor, 1x Popp dimmer, 1x Fibaro dimmer, HRT4-ZW thermostat/ASR-ZW receiver, home-made oil tank monitor - http://www.domoticz.com/forum/viewtopic.php?f=38&t=7275
User avatar
blackdog65
Posts: 311
Joined: Tuesday 17 June 2014 18:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Norfolk, UK
Contact:

Re: Heating Oil Tank Monitor

Post by blackdog65 »

Damn! :shock: Same tank, same sensor, same problem! :lol:

I've got one of these en route from China as I thought it'd be a bit more robust for in the oil tank.
http://www.ebay.co.uk/itm/231541072898? ... EBIDX%3AIT

My plan was to rig up a simple MySensors/arduino mini pro rig and just get a oil height reading. Hopefully using something like this http://bl.ocks.org/brattonc/5e5ce9beee483220e2f6 as dennisdiving is doing here viewtopic.php?f=8&t=7122&p=47582&hilit= ... vel#p47582 but all the eye-candy in the world means nothing compared to the accuracy you are aiming for!
Well played sir! I shall be watching with interest while waiting for my Chinese package to arrive :D
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
User avatar
blackdog65
Posts: 311
Joined: Tuesday 17 June 2014 18:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Norfolk, UK
Contact:

Re: Heating Oil Tank Monitor

Post by blackdog65 »

Oops.... :oops:
Could have gone here http://www.amazon.co.uk/Generic-DYP-ME0 ... B00CXKKO6U
saved time on delivery and saved 3p per unit DOH! :roll: :lol:

Never mind, my delivery from China arrived today... time to start experimenting :geek:
kivster wrote: I'm currently working on a case for this device and a way of attaching it to a threaded hole on the tank. I'm thinking of using UPVC plumbing supplies to come up with something. Also, depending on how successful I am at powering this, I may consider an Arduino version in the future.
1) The DYP-ME007Y transducer looks to be a nice push fit into a 22mm hole. My internal tank has a removable screw-in blanking plug and the hole that the watchman transducer sits in. Both would be a suitable mounting point.
2) An arduino ( or better still MySensors ) version would be really cool as a Pro Mini is just a little cheaper than a RasPi ;)
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
Kouseri
Posts: 57
Joined: Sunday 04 January 2015 21:24
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Finland
Contact:

Re: Heating Oil Tank Monitor

Post by Kouseri »

I've been planning to do similar kind of oil measurement device for my brother. Intention is to build an Arduino based device which uses ultrasonic sensor and the most probably DS18B20 temperature sensor.
Data will be sent to Domoticz via MQTT protocol or JSON commands.

Because my brother lives in Finland, temperature differences can be pretty significant between winter and summer times. Because of that I've been calculating how much temperature affects
to the results. As you wrote temperature will affect to speed of sound but it also affects to thermal expansion of oil. I've done an excel based "calculator" which can be used to estimate an affect of temperature
to amount of oil. "Calculator" can be found via following link: http://1drv.ms/1K7JR20

As one can see from the excel (please let me know if you find bugs from the excel) temperature has significant impact if and when exact amount of oil needs to be measured and calculated.
Next thing is to understand and define should the amount of oil to be normalized to some default temperature or how to calculate end result.
Last edited by Kouseri on Wednesday 15 July 2015 21:43, edited 1 time in total.
arnaudth
Posts: 10
Joined: Wednesday 15 April 2015 18:53
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: France
Contact:

Re: Heating Oil Tank Monitor

Post by arnaudth »

hi everybody,
I'm really interested in your projects. I already looked something similar that can be used with domoticz.
I've found wireless(or wired) gauges (but not made to work with domoticz) and some of them were specially made to work in potentially explosive atmospheres.
Are you planing to have such protection with your project ? Even if oil is not so explosive .

Thank you for sharing your projects !
Arnaudth
User avatar
kivster
Posts: 6
Joined: Thursday 08 January 2015 21:59
Target OS: Linux
Domoticz version: beta
Location: United Kingdom
Contact:

Re: Heating Oil Tank Monitor

Post by kivster »

blackdog65 wrote:Damn! :shock: Same tank, same sensor, same problem! :lol:

I've got one of these en route from China as I thought it'd be a bit more robust for in the oil tank.
http://www.ebay.co.uk/itm/231541072898? ... EBIDX%3AIT

My plan was to rig up a simple MySensors/arduino mini pro rig and just get a oil height reading. Hopefully using something like this http://bl.ocks.org/brattonc/5e5ce9beee483220e2f6 as dennisdiving is doing here viewtopic.php?f=8&t=7122&p=47582&hilit= ... vel#p47582 but all the eye-candy in the world means nothing compared to the accuracy you are aiming for!
Well played sir! I shall be watching with interest while waiting for my Chinese package to arrive :D

Haha. I knew I couldn't be the only one!

I've just checked out MySensors and it looks really promising! I'm ordering a Arduino Nano and bits now. This will solve my power issue as I should be able to run the Arduino from a battery and solar panel. I just have to remember my C programming module from years ago at uni!

I like the look of that sensor too, looks a bit more robust. Let me know how it goes!
Raspberry Pi + Domoticz + Aeon Labs Z-Wave USB
1x Aeon multi-sensor, 1x Popp dimmer, 1x Fibaro dimmer, HRT4-ZW thermostat/ASR-ZW receiver, home-made oil tank monitor - http://www.domoticz.com/forum/viewtopic.php?f=38&t=7275
User avatar
kivster
Posts: 6
Joined: Thursday 08 January 2015 21:59
Target OS: Linux
Domoticz version: beta
Location: United Kingdom
Contact:

Re: Heating Oil Tank Monitor

Post by kivster »

Kouseri wrote:I've been planning to do similar kind of oil measurement device for my brother. Intention is to build an Arduino based device which uses ultrasonic sensor and the most probably DS18B20 temperature sensor.
Data will be sent to Domoticz via MQTT protocol or JSON commands.

Because my brother lives in Finland, temperature differences can be pretty significant between winter and summer times. Because of that I've been calculating how much temperature affects
to the results. As you wrote temperature will affect to speed of sound but it also affects to thermal expansion of oil. I've done an excel based "calculator" which can be used to estimate an affect of temperature
to amount of oil. "Calculator" can be found via following link: http://1drv.ms/1K7JR20

As one can see from the excel (please let me know if you find bugs from the excel) temperature has significant impact if and when exact amount of oil needs to be measured and calculated.
Next thing is to understand and define should the amount of oil to be normalized to some default temperature or how to calculate end result.
Your temperature calculations take mine to the next level! That's a very impressive spreadsheet :)

I just considered temperature affecting the speed of sound, I didn't consider thermal expansion of the oil! What I've done is probably good enough for the UK, but in the interest of accuracy I'll have a think about how to incorporate your calculations in my script. Thanks!
Raspberry Pi + Domoticz + Aeon Labs Z-Wave USB
1x Aeon multi-sensor, 1x Popp dimmer, 1x Fibaro dimmer, HRT4-ZW thermostat/ASR-ZW receiver, home-made oil tank monitor - http://www.domoticz.com/forum/viewtopic.php?f=38&t=7275
Kouseri
Posts: 57
Joined: Sunday 04 January 2015 21:24
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Finland
Contact:

Re: Heating Oil Tank Monitor

Post by Kouseri »

Great that you find my calculations useful! ;-)

About the sensors, has anyone use MabBotix's sensors? More information about the Maxbotic's sensors can be found via following links:

http://www.maxbotix.com/
https://www.sparkfun.com/search/products?term=maxbotix

MaxBotic seems to have a lot of support material and tutorials available which will definately help makers to integrate their product into different kind of applications.

http://www.maxbotix.com/tutorials.htm

It looks like only downside is cost... ;-(
Kouseri
Posts: 57
Joined: Sunday 04 January 2015 21:24
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Finland
Contact:

Re: Heating Oil Tank Monitor

Post by Kouseri »

It took some time but now my version of oil tank monitoring system is up and running. I just put code to the GitHub.
I'll add description about the system to the Domoticz forum once I've some spare time. I'll let you know when that has been done.
D'rMorris
Posts: 138
Joined: Thursday 01 May 2014 9:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands - Sittard
Contact:

Re: Heating Oil Tank Monitor

Post by D'rMorris »

Great solution ! I'm also going to experiment with this ultra sonic sensor. Can you please also let me know which lux sensor (saw it in your screenshot) you use? I also want to buy one. Thanks!


Sent from my iPhone using Tapatalk
Kouseri
Posts: 57
Joined: Sunday 04 January 2015 21:24
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Finland
Contact:

Re: Heating Oil Tank Monitor

Post by Kouseri »

Kouseri wrote:It took some time but now my version of oil tank monitoring system is up and running. I just put code to the GitHub.
I'll add description about the system to the Domoticz forum once I've some spare time. I'll let you know when that has been done.
A brief story about the Arduino based oil tank monitoring system added to the forum
dwmw2
Posts: 52
Joined: Thursday 03 December 2015 12:42
Target OS: Linux
Domoticz version:
Contact:

Re: Heating Oil Tank Monitor

Post by dwmw2 »

FWIW I've got the Watchman working now too; we can decode its 433MHz transmissions using a cheap DVB-T receiver and rtl_433 software. It reports the temperature and the depth of air above the oil in centimetres. The latter is already corrected according to the speed of sound. Full details at https://hackaday.io/project/1548-rocket ... r-teardown

Not sure if the Raspberry Pi has enough CPU power to do the full software-defined radio thing, but there are plenty of examples of hooking up an RFM01 receiver, and that could work fairly easily now that the protocol is understood.

It looks like a lot of different units are actually identical internally; the design is just rebranded and shipped in different packages. It's been seen as the Beckett Rocket, Watchman Sonic, and Apollo Ultrasonic monitors; probably more.

I'm now starting to look at how to hook these up to Domoticz. Rather than a percentage (for which we have to enter a height anyway), I'd quite like to be able to enter the full dimensions of the tank and have a volume of oil logged in litres. Do you have existing data structures in Domoticz for that, or are you just using user variables?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest