close-circle
Close

Using analog.io to more efficiently order Fuel Inventory

A project log for analog.io - A full stack IoT platform

A full stack project dedicated to easily collecting, analyzing and sharing IoT sensor data.

Luke Beno 09/15/2015 at 05:040 Comments

This example is a little off of the typical IoT sensor path but it has been a fun project to work on. The story goes a little like this. My in laws operate 4 gas stations in the local area. It's been their business for over 10 years now. My father in law prides himself on his ability to optimize his fuel orders in order to improve margin between what the price on the Street is vs his costs.

Part of his workflow is to have his employees send him a text message every morning with the current fuel inventory. He then has a very elaborate system of mental math that frankly I'll never understand, that is his black art.

One problem with the current system is that it relies on the employees to send a text message. This isn't the most reliable. For this reason, I thought that I would make an attempt for a better system.

Maybe some of you have noticed one of these when passing through your local convenience store:

I don't have any evidence to back this up but at least in my observations, Veeder-Root has approximately 100% market share with these Tank Level Sensors. They are pretty old school systems, but then again the market isn't really demanding new features and I could only imagine that there are regulatory hoops to jump through. I'm getting beside myself...

So the goal really is to create a hack for this device such that I could extract fuel inventory and zoom it off to the internet. Luckily most of these devices have a very convenient serial port that was used back in the day to connect a printer or modem. The port is the 25 pin D-Sub variant topping out at 9600 baud.

Much to my surprise, Veeder-Root is also very open when it comes to openly publishing their operators manuals, service manuals and Serial Interface manuals. You can find it all on their online documentation server.

So I pulled the appropriate service manuals and learned about the serial protocol. One thing led to another and I ended up designing the following accessory:

It is a pretty simple circuit, just a 5V to 3.3V LDO, a MAX232, the Electric Imp, ATSHA EEPORM and a logic gate for level shifting the UART. Here is the back side:

The unit is designed to fit into this Case:

As you can see, this project is based on Electric Imp. This has been very useful because I could install the device at the gas station, get it connected to WiFi and then program from my house which is about 4 miles away. This is great because no one likes to sit and debug code on sitting on the floor of a cramped gas station supply room!

So here is the plot. Because this is some sensitive business data, I redacted the actual values. I am willing to share the Electric Imp code on a case by case basis so please contact me if interested. I don't think that it is appropriate to make it public to everyone.

One interesting thing about fuel is that it actually changes it's volume based on temperature. It is neat to look at the temperature of the Fuel in the underground tank over the course of summer. Overall the underground temp is about 10-15 degrees cooler than the air temp.

In addition to the analog.io analytics, I also wrote some Electric Imp agent code that leverages the Twilio API in order to send the daily text messages. Lastly the code detects when he is getting a delivery, sends a notification text, and also when the delivery is complete it sends a delivery summary text. This has been convenient because he can know right away if the fuel company misses a delivery that he ordered or if they accidentally delivered the incorrect amount.

This is an example of the real applications for IoT, you can't really hype something like this but for gas station operators across the world, tools like this will become increasingly important. I can't take all of the credit, other solutions exist too. I imagine this one is just more cost effective.

Discussions