|
|
how to measure the level of a fluid Saturday, February 26 2011
Excited by my progress with fleshing-out a complex Arduino-based physical computational framework, I farted around today on Sparkfun.com looking for new things I might be able to interface to Solar Controller III (this was in keeping with a familiar feature-creep pattern I've followed over the years: a Vic-20 in 1985, a Commodore 128 in the early 1990s, and an XT-style PC in 1994). When I ran across a cheap range-finder, it seemed like the perfect solution to an interfacing problem I'd been thinking about: how to measure fuel level in the oil tank. You see, Solar Controller III is more than just a solar controller; it's also a boiler system logger (and potentially intelligent instigator). Already it is aware of when the boiler is or is not firing. I want it to also know what the fuel level is so I can easily graph its consumption and compare rates over the course of future winters. Earlier I'd thought about perhaps encoding fuel depth by using a floater somehow attached to a spring-loaded potentiometer. But an ultrasonic rangefinder seemed much better. It could be completely sealed within the tank and wouldn't be subject to mechanical drift or any kind of wear. As I researched this particular range finder, though, it proved less than perfect in a number of ways. Its granularity is no smaller than an inch, which, in a 250 gallon tank, is a lot of fuel. Also, there is the political standpoint of whoever makes it, which is the sort that results in a PC board with "[picture of a cross] [picture of a Jesus fish] 1st" etched into its surface. I know this doesn't have any bearing on its functionality, but if I'm free to choose, I'll work just a little harder not to have such things incorporated into my DIY projects.
So then I started wondering how hard it would be to make my own rangefinder using a piezo speaker and an Atmega microcontroller. I'm now adept enough with the Arduino environment that I feel like I could write the code to send a pulse of sound and then count the microseconds until that pulse's echo is returned. So I set to work.
It wasn't long before I found myself hopelessly bogged down in the world of analog electronics. I love digital electronics, a world where things either work or do not work. In analog electronics, though, things can sort of half-work or stubbornly produce maddeningly useless results through all sorts of tweaks. I've had good luck in the past with comparators, but today's experience with operational amplifiers (used to amplify a weak sound picked up by a microphone) drove me nearly to tears. It wasn't helped by the crappy quality of my solderless breadboards, which refused to convincingly hold onto anything plugged into them. Eventually I was back to investigating my multi-turn potentiometers to see if there was some way to translate the height of a floating bob into a resistance. It was possible, but it was going to be a mechanical mess.
So then I thought: what if I measure the pressure exerted by a a floating shaft having low specific gravity? Such a shaft will press upward in proportion to how deeply it is immersed in a fluid. I could measure this pressure with a simple strain gauge; I have two scrap ones that used to serve as Gretchen's kitchen scales.
So there I was, determining what if any sort of information I could get out of a strain gauge. It turns out that they produce electrical resistance in proportion to how much pressure they experience, and this was a start. But the change in resistance was too small to be useful. I would have to use an operational amplifier! So there I was, back in the world of analog electronics, suffering for hours with nothing to show for it.
For linking purposes this article's URL is: http://asecular.com/blog.php?110226 feedback previous | next |