If you have a fuel or water tank that is either metal or colored plastic, you may have run into the same problem I had: How do you know when it’s empty?

Mechanical level gauges are nice, but not always practical or even possible. So, I went on the hunt for an ultrasonic level sensor for my fuel tank.

Alas, what’s available on the market is too expensive, not very reliable, and often goofy in terms of features. So I decided to build my own!

This ultrasound fuel gauge can be built for around $33 using a breadboard, Arduino Uno, and one of 2 different ultrasonic transceiver modules designed for use with Arduino or Raspberry Pi boards.

For full plans, code, and other info, see:

DIY Ultrasonic Fuel Gauge / Level Sensor

Grab the parts needed now:

– Geekcreit UNO R3 Basic Starter Kit:

– JSN-SR04T Waterproof Ultrasonic Module:

– Or get the whole shebang more quickly on Amazon (with HC-SR04 transducer):

More techie tips: https://scottiestech.info

, https://i.ytimg.com/vi/8XcjyxUa3fc/hqdefault.jpg



  1. Could this be used on a school bus diesel fuel tank? My fuel gauge is kaput and looking for alternatives to check fuel level especially when low

  2. That was kind of goofy after 4min goof all
    Great vid all the same thumbs up ? Goofy ?

  3. might this work in a 16L plastic gas tank ? also can it read through the opaque white tank plastic or would i need to cut a hole?

  4. Is it work in two stairs water tank.Please tell me.If it work i will use in my home

  5. Hi,
    Can this be used to build a measure of butane tank level ? Thank you in advance for sharing idea.

  6. I see in your schematic you put a potentiometer 10kΩ?? For what reason?? And also where you put the JSN-SR04T sensor in the board?? Thanks

  7. awsome work ^_^ tnx really! i used it for detecting wather level in my tank so the pump stops pumping when it is empty! tnx!

  8. congrats about the project. I was wondering if you have something with Bluetooth conection because I am thinking to use for boat needs. Diesel gauge, water tanks etc.

  9. good video i am worried about the angle of the sensor i have a 3000 gallon water tank i want to use this on but at 9 foot i am worried the sensor will read the walls of the tank any thoughts? to they make a water prof sensor that is water proof?

  10. Hey Scottie, I'm learning more about Arduino's and coding and I'm having trouble wrapping my head around this specific part of your code:

    currentLevel = round(timeHigh / 58);
    if (currentLevel > tankEmptyDepth) {
    // If level is lower than empty, show 0%
    // This is useful if you want to have "empty" be "still 10cm of liquid left in tank"
    currentLevel = tankEmptyDepth;
    } else if (currentLevel < tankFullDepth) {
    // If level is higher than full, show 100%
    // This is useful since "full" level may vary when tank is refilled
    currentLevel = tankFullDepth;
    // Don't redraw screen if level is the same as last time
    if (currentLevel != lastLevel) {
    lastLevel = currentLevel;

    If the current level of the fuel is greater than 0%, why would you want to set it at 0%? Wouldn't that mean that at ANY point that its greater, it would be set to 0%? I've tested the code using your provided schematic and it works fine, but I want to learn about the code itself too.

  11. Hello

    Actually doing my dissertation on this but instead using a raspberry pi with python coding.

    I was just wondering if the code you wrote is compatible with python or not?

    Video was really helpful.


  12. hello, how did you work out with the blind distance? the jsn-sr04t has a blind distance of 20-22 cm, and im curious as how you;ve worked out with the blind

  13. So I bought one of these:


    LCD 1602 display with an I2C bus presoldered on to it.

    This allows this project to be completed with no breadboard or veroboard and gives it a smaller footprint with only four wires from the display instead of twelve.

    Yes the sketch needs to change to include a different LCD library but the good news is that this library is very polymorhpic with all the standard library commands supported so very few sketch changes are required. There is nothing to change in the setup or loop sections of the sketch.

    The following link is an excellent resource for the steps required – refer to chapter 5. This guy also provides a very good demo sketch that makes it very easy to copy and paste the new lines required.


    Using the I2C bus meant I was able to build very quickly and get everything to fit within a standard Uno enclosure. I'm pretty much sold on using this on all future LCD projects.

  14. Almost a year since this video, how about an update? Still working? Any issues?

  15. Hiya. I have already posted here saying I have had great success with this. But… exploring the Arduino a little more I came across the I2C Bus which can drive the LCD display with just four connections; much better than the 12 described here; it can even drive several displays if any more info required. I have ordered one to have a play. The sketch will need to change. If I get working, more than happy to post here about how I did it?

  16. Lovely little project. I have built it (breadboard at the moment – will veroboard) and it works fine in the house on the bench. It will become a fuel gauge for the boat. Thanks Scott.

  17. Do you not have one of these for sale yet? I do not have the time to build one? Will this work on a car?

Leave a Reply

Your email address will not be published. Required fields are marked *

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