Starting to think about the code

A project log for Propane and IoT Propane Accessories

I want to keep track of how much propane I use to heat my shack. So I'm building an IoT scale to keep track of the weight of my tanks.

Dan MaloneyDan Maloney 11/07/2017 at 01:360 Comments

I've close to done with prototyping the electronics. I've got the Wemos connected to the pair of HX711 amps, and each amp has a load cell connected. Built a simple demo app to start up a simple web server to display pull requests for weights. Works a treat, although I didn't bother optimizing the code or even calibrating the load cells. That can wait.

Now I'm thinking about what the UI will look like. At first I thought I might do this as a Blynk app, but they want money to do anything interesting, and do I really want to pull my phone out every time I want to know how much fuel I have left? Practically speaking, the best UI would be a local display to quickly see how much fuel is left, plus a simple web interface to display the same info and perhaps allow access to logging data. I'd also build in some kind of alerting - email or text. That can be configured in the web interface. 

So what does the display in the shack look like? Well, I have a little 64x48 OLED screen, and that seems like enough space to show what I need. I decided to mock up the graphics using Google Sheets, making each cell 8x8. Here's my first attempt:

I was going for a gas gauge paradigm, which I liked, and a display for the indoor temperature. The lower line would tell me which tank's level is displayed, main or reserve. I figure I'm going to need a button to indicate when a tank is refilled anyway, so it could do double duty to toggle displays.

But I wasn't 100% in love with it, so I retooled it:

I really like the tank icons, and having both on the screen at once is nice. There's room for outdoor temperature as well, if I want to implement that. Much slicker, IMHO, although I have to tune up centering and spacing. OCD much? And sorry metric fanboiz - we loves us some Fahrenheit around here. Not going to program this to switch to Celsius - just no need.

Since the display is monochrome, I might want to have a way to call attention to a low tank. I might start blinking the bar when it gets below 20%, and maybe sound a buzzer when it gets to 5%. I'll still need a button to mark a tank as refilled so I can use that to silence the alarm. The refill menu can be accessed through a long press of the button, then it'll just toggle through simple text options, like "Refill 1?" and "Refill 2?" Pressing the button again resets the bar to 100%. 

Taring the scales really should be necessary. The empty tanks are a known weight (about 40 pounds), so that value can be hard-coded into the program as zero. If the load cells drift a bit, or if I get 16 pounds of propane in the tank rather than the 17 it's supposed to hold, big whoop. It shouldn't matter that much. 

I'm going to start mocking the indoor display up in code soon, so I can get used to the using the SparkFun OLED library. They have primitives like lines, rectangles, circles, and filled shapes, plus three or four different fonts. Some of this will have to be setting individual pixels, though. Oughta be fun.

Time to start a Github page on this I think.