ArduinOil update…

Posted on

It has been a few months, and I’ve had a few other projects come and go in the meantime. However, I’ve always had this project in the back of my mind. Not too long ago, I had a much better design idea for detecting the amount of oil in the tank. At first, I was trying to read the meter that is already on the tank, but the results were less than perfect and the hardware was going to be a major PIA to mount and maintain. One day I caught a video of a guy that made an automatic water dispenser for his cat or something crazy like that. But the thing I noticed was he was using a Parallax PING sensor to detect the amount of water in the bowl…enter proverbial light bulb. So I ordered one (a PING sensor) and started playing around with it. The results were amazing…not only is it amazingly simple on the hardware end, but the responses were more accurate and the code implementation was simple too.

Now that we have the data, we have to find some place to store it. I signed up for a BETA account at and had a lot of fun programming the Arduino to speak pachube. I even got fancy with some Asterisk code to report pachube information via the telephone. But at the end of the day, there was still something missing…history. I really wanted to be able to look back on my fuel usage and get some trending information for curiosity’s sake…and I could not get such functionality from Pachube. So I did what any self-respecting nerd would do…I wrote my own. Here is the way it works:

The Arduino is listening on port 23 (telnet) for traffic. A cron job runs a script on the hour from a server that connects to the Arduino and sends a “p” (for percentage…”i” would return inches), which prompts the Arduino to pulse the PING sensor 5 times, average and convert the value to a percent based on the total tank size. The Arduino returns this information to the script which records the value and a time/date stamp to a database. From here I have a script that checks the database once a day and alerts via email if the level gets too low…however, I can do any number of things with that information. I have yet to write a “front end” to the database to make the information viewable over HTTP, but that is definitely in the works as well.

My next order of business will be mounting the ArduinOil components in the tank / furnace room, and doing the final hardware prep. I’d post some pictures, but honestly, at this point it’s just a bunch of code and tanggled wires. Hang in there…more to come!

Comments ( 3 )

  1. ReplyJosiah Ritchie
    If you simply made this a plugin to Cacti or Nagios, you'd have access to the power of RRD-tool and the resulting beautiful graphs and other fun things as well. Then you could easily track almost anything in the house right along side it and have multiple ways to be alerted to change.
  2. ReplyDan
    Thanks for the suggestion. I'm a network admin and use Zenoss / RRD for SNMP monitoring all the time. This was one of the options I took into consideration, but with the level of logging and customization that I wanted, I decided to write my own back/frontend from scratch. This way I'm able to access the data from my Asterisk PBX, etc. I also tried up Pachube, but again, I like control :)
  3. ReplyJohn Kelley
    I came across this while looking for a way to measure the remaining diesel fuel in the tank attached to our office building's emergency generator. Out of curiosity are you simply reading the remaining oil and reporting a % remaining or are you converting the reading into an estimate of the gallons remaining?