Using Ultrasonic Sensors To Measure And Log Oil Tank Levels

[Mike] lives in a temperate rainforest in Alaska (we figured from his website’s name) and uses a 570 gallon oil tank to supply his furnace. Until now, he had no way of knowing how much oil was left in the tank and what his daily usage was. As he didn’t find any commercial product that could do what he wanted, he designed his own solution. In his write-up, [Mike] started by listing all the different sensors he had considered to measure the oil level and finally opted for an ultrasonic sensor. In his opinion, this kind of sensor is the best compromise between cost, ease of use, range and precision for his application. The precise chosen model was the ping))) bought from our favorite auction website for around $2.5.

[Mike] built the custom enclosure that you can see in the picture above using PVC parts. Enclosed are the ultrasonic sensor, a temperature sensor and an LED indicating the power status. On the other side of the CAT5 cable can be found an Arduino compatible board with an XBee shield and a 9V battery. Using another XBee shield and its USB adapter board, [Mike] can now wirelessly access the tank oil level log from his computer.

52 thoughts on “Using Ultrasonic Sensors To Measure And Log Oil Tank Levels

      1. I’ve been working on this type of project on and off for some time now.
        If I understood the construction correctly you used a #7 plastic with holes in it so you can place the transducers through.
        The fuel tank is a Hazardous location and classified as a Class II/ Division 2 / Group D, by the NFPA which is the governing body of the NEC (national electric code) and any electronics, unless they are “intrinsically safe” or in an “explosion proof enclosure” you are in violation of national and local codes. One of two things could happen. The tank could catch fire or if the local fire Marshall hears about he could find you. I am sorry for the bad news and thought you should know.

  1. Another major advantage of ultrasonic: it’s non-contact measurement. You don’t have to worry about the sensor actually being in contact with the stuff you’re measuring (as compared to a float sensor).

    1. But you have to be careful. I use a Schneider ultrasonic sensor to monitor oil. Some have a rubber sensing end which absorbs the vapour over time like a sponge, and expands. There are stainless cased and hard plastic ended ones that are better. I use a 0-10v sensor connected via z wave module. Works brilliantly and very accurate

  2. Nice idea. My motorcycle aprilia don’t have gas measuring gauge and it have very curvy tank with two chambers . I think that this will be a great solution for it and for other motorcycles

    1. It will probably not work. If your tank is anything like the tank on my BMW you dont have line of sight from anywhere useful. Ultrasonic needs that. And that’s why we have a trip meter. In city driving I know I need to fill at around 240 miles.

      1. its aprilia pegaso 650 and its like bmw pretty much .i have experience with sound equipment and acoustic instruments,simple tap on some chamber can tell you is it fool or not and how much , it can be done with in range of normal sound frequency but it will require some clever coding.

        1. Oooh! We could make it really complicated! First, apply a 0hg vacuum to the tank. Then measure the amount of air it takes to fill the tank back to atmospheric pressure. You could measure the air volume with either a device that measure air volume, or through an orifice of known diameter, and the amount of time it takes. Don’t forget to account for altitude, temperature and humidity.

          :)

          1. There are sensors that use the principle but instead of the sound in the air they use soundwave waves travelling through a [partially submurged] metal rod. You can either measure the acoustic resonance of the rod, or listen for echoes as the ultrasonic sensors do.

    1. Automation Direct is awesome. Their prices are excellent, and since they’re about 11 miles from me, I can pick up locally, or have things overnight.

      I’ve been playing with PLC controllers the last several months as a result of a different project that indirectly involves them. I used one on a personal project, a pneumatically controlled can crusher. At work, I recently used one for automating a door cycling tester (presents a credential using a server, actuates the handle with a linear actuator, then another LA opens the door, the handle is released, and the door is closed. ADC channels are used to measure the position of the LAs).

      Sure, I *could* have used an Arduino or Beagle Bone or Raspberry Pi, but a bottom of the line CLICK PLC is $69, comes with conditioned I/O, and was a great excuse to play with PLCs.

  3. Oil delivery companies have been tracking the fuel use of their customers for decades. They model your furnace and your tank in their computer. They know the weather and they can calculate how much oil you are going to burn today. They can tell you within a gallon or so, how much oil you have in your tank. They will show up to refill your tank when it runs low. When they fill your tank they determine how much was left in your tank and they use this data to refine their model of your furnace. They negotiate a fixed per gallon price for the fuel, so it is in their best interest to deliver it efficiently. This has been common practice in New England since the ’70’s. You don’t need an oil level sensor, you need a weather station unit that can calculate and tabulate degree-days.

    1. They probably do something like that here for those that choose automatic fillups. I like to choose when the credit card takes the hit. I do plan to add weather sensors as I can, but this allows me to compare running a space heater vs. no space heater or keeping the temp lower vs. higher. Ultimately, I would make it part of an alarm system as oil tanks get targeted by thieves.

    2. While perhaps some of the oil delivery companies do this, it seems that others do not. I’m in New England, and the reason I came to this site is because this is the 2nd time that our oil company let our tank run dry. We’re on automatic fill and have been for years. It’s currently freezing; we have no heat tonight and can’t take a hot shower. Perhaps you are correct that they are trying to get the best prices for oil which may mean “running a bit low” sometimes. Obviously, they let us run a bit too low since we’re currently out of oil. So I am looking at buying or building my own measuring system, and I think they should probably get cracking on remote monitoring as well since obviously at least one New England company doesn’t do it right. (And yes, perhaps we could change oil delivery companies, but they also fix our boiler on a yearly service plan which is included and that has paid for itself in spades).

  4. We’ve got a large water tank behind our house to collect rainwater. This summer I made sensor out of a hollow float (soft drink bottle with hot glue) on long rod, then at the other mounted on a long shaft potentiometer as a pivot. So less than $2 in parts for the sensor itself :D. Though this only works if your tank is more wide than it is tall and never fills up to the very top, at least not without some sort of fancy watertight potentiometer. The range from empty to full covers about a quarter of the available rotation of the potentiometer. I am gradually taking measurements by hand to properly calibrate the sensor. The goal is to know next summer how quickly we’re running through the water so we can adjust our garden’s watering regime accordingly.

  5. This looks like something I could use at work. We have a 20ft (approx) tall diesel tank for our equipment, and once a month someone has to take a ladder and a folding ruler out there, climb to the top, and measure the depth manually. Looking at the specs for this sensor, it looks like it may work for our tank as well.

      1. A handheld version would be handy to test it to see if it would work. Part of the appeal of this project is the promise of not having to climb up on top of that tank anymore though. :)

      2. Mike,
        Excellent project. Thanks for documenting it so well.
        One thing that might help (from the photos) is a drip loop on your cat-5 cable. Just
        pull through about 40cm of slack and put a 20cm downward loop right where the
        cable enters the PVC housing (and another 20cm loop at the house end, too). The
        rainwater and condensation on the cable will drip off before it has a chance to ingress
        through your joint.
        Looking forward to part-2. :-)

        1. I did put silicone around the cable and the LED. I think the only chance of moisture seeping in is where the piece of PVC enters the threaded adapter since I have not yet sealed that off. It seems pretty tight though and I haven’t noticed any moisture when I have checked it. For now it is too cold (low teens fahrenheit) to check for problems like that.

          I have started writing up part 2. I was initially waiting on some data to get a better feel for the metrics I want to collect, but then I realized that I had some underpowered resistors and I am waiting on replacements. I did manage to collect some data and test out the system, but I have a few resistors that have darkened in color.

          1. Use a large PVC end-cap with hole in end to OD of existing PVC. This will form a “hat-brim like porch roof” to direct moisture to drip outside the tank openings threads.

  6. Ultrasonic fuel level sensors have been around for sometime now. I always through that they are good for level sensing but not good for “emergency” situations like alarm states and emergency shut offs. I know they they have a tendency to fail when the fuel is splashed onto the them therefore you’ll still need a reed style float to trigger when there is too much fuel.

    Anyone wish to comment on that?

    1. They are among several kinds that have been around forever. The best is often the capacitive type that has capacitance sensing all along its length at short intervals, but that is also fairly expensive. Ultrasound is common, although in fuel applications they are typically a bit more…involved than what was done here. Float switches are a must for safety, although they can be supplanted by other technologies of adequate rating (although never ultrasonic, as far as I know). There are a lot of ways to measure level.

    2. I think it depends on the design. A lot of backup sensors on cars use ultrasonic which should handle liquid. I did have problems for several days with some liquid getting on the screen on the front of the sensor, but it hasn’t been an issue for a while. I am fairly sure it is splash back from the return line and now the level has gotten low enough (around 500 gallons) to not be a problem any more. As far as I can tell, it was also not a problem until the level got down to 510 gallons, but that is only a 1 inch range that had problems. It is also possible that it was condensation or moisture somehow got into the PVC.

    1. I am surprised I don’t see any of those types of gauges in town. I can’t imagine that there aren’t others around that want to keep an eye on general usage. I know some use auto-fill, but I would still want to see how fast it is going without having to go out and dip the tank all the time.

  7. Lots of companies provide these types of sensors for fuel tanks levelcon and smartank are two out here on the west coast. Power consumption is really important in this setup as the fuel tanks we are talking about are often on farms in remote locations and need to run on batteries. I think this is the reason these companies use float or pressure sensors rather than ultrasonic.

  8. Let’s all remember that Fuel “Oil” isn’t Oil – it’s Diesel. #2 Fuel oil is basically the same #2 Farm Diesel. We’re not talking like the difference between 10w-30 and gasoline. The viscosity of fuel oil is the same as that of diesel from the gas pump… and it also produces fumes in just the same way. Fumes that could ignite if given the chance to be sparked by electronics…

Leave a Reply to ThopterCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.