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.

Comments

  1. jcwren says:

    I’m surprised he couldn’t find a COTS sensor. Centroid (http://www.centroidproducts.com) makes several styles. The fuel and water tank in my houseboat used these. They even have controllers that handle non-linear tanks.

    • I did some looking, but I didn’t come across that style. I will keep it in mind when I revisit this part.

      • Ken says:

        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.

  2. Mohonri says:

    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).

  3. t-bone says:

    what is ‘our favorite auction site’ and is ‘2.5$’ supposed to be $2.50?

  4. dejan petkovski says:

    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

    • Tyler says:

      Careful — motorcycles slosh. Also, it’s gasoline, which has issues with ignition (unlike fuel oil)

    • macona says:

      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.

      • dejan petkovski says:

        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.

        • jcwren says:

          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.

          :)

        • RP says:

          Actually, thinking of sound, how about simply determining the resonant frequency of the inside of the gas tank an using that to calculate the volume of air in the chamber?

          • Simon says:

            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.

  5. ichiban says:

    “The precise chosen model was the Maxbotix EZ0 bought from our favorite auction website for around 2.5$.” he used the hc-sr04, not the Maxbotix EZ0 that cost $25.

  6. Jimmy Bowler says:
  7. Cullen says:

    AutomationDirect.com also has a full line of sensors. They give free 2 day shipping on orders over $50.00

    • Jimmy Bowler says:

      U I use them at work on a do-more plc to web :)

    • jcwren says:

      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.

  8. F says:

    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.

    • 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.

  9. Simon says:

    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.

  10. Patrick - Bethesda, MD says:

    When my flashlight is not working I light a match over the hole which gives off enough light to look inside.

  11. Thopter says:

    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.

    • You could build a handheld version and try it out. The NewPing library makes it pretty simple to use this sensor. The Maxbotix models should just work as well with a 6 meter range.

      • Thopter says:

        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. :)

      • pucebaboon says:

        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. :-)

        • 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.

          • John Holton says:

            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.

  12. wetomelo says:

    There is some kind of intrinsecally safe circuit somewhere? rememebr your measuring FUEL,. isn’t as volatile or flamable like gasoline but stills fuel.

  13. Polaczek says:

    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?

    • Tyler says:

      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.

    • 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.

  14. Will Lyon says:

    Damn I’ve been toying with this SAME IDEA for months now for my oil tank. My tank has a manual gauge though like this (http://www.sybasystems.com/Images/Kreuger%20At%20A%20Glance%20Float/ata%20glance%20closeup.JPG). I was thinking of an ultrasonic sensor like he used or simply hooking an arm attached to a pot to the top of the gauge that’s already there and using it that way.

    • 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.

  15. Matt says:

    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.

  16. Tony says:

    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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 93,890 other followers