First off, yes, I'm a "noob".
Second, yes, it's for a beer project.
So 95% of the people asking questions here? Make that 96% now!
For some reason I can't seem to find what I'm looking for...variations of such, but not the same.
Scope: Trying to measure the amount of beer (in Litres) left in my keg. Material: I'm using an in-line flow sensor, an Arduino Uno R3, and a 2x16 OLED display.
The Idea: I know a full keg is 19L, therefore as the pulses come from the sensor, it decrements from 20L until it reaches 0. The OLED display would show both a percentage remaining (%) and a "Fuel gauge" style bar reading, therefore visually showing the amount remaining. A reset button would reset the unit to 19L (so 100%) and the bar would return to full.
Extra: Thinking ahead, should the Arduino unplug/power go out, the unit would reset, therefore it would be nice to either have the information saved, or a dial to manually set the amount remaining.
Some people have weighed their keg etc...but I think the flow sensor provides a lot more potential.
I've tried a simple flow sensor code to familiarize myself, and I can also build the circuits, the more complex coding here is where I'm lost.
Any help would be greatly appreciated...maybe I can mail you some beer in return??
In other words, how can I make the code subtract from a given initial value (19L, 19,000ml etc...) in order to show the remaining amount in my keg, and display it as a bar gauge and percentage rather than in volume capacity.
I maybe didn't make it clear enough that being so new to Arduino (just a handful of days) I don't know the limitations of the coding language, or how to implement what I desire. If I were doing this logically, I would use the following:
X = 19-(Accumulated total in L)
Whereby accumulated total as per the code (I think) is;
// if a plastic sensor use the following calculation
// Sensor Frequency (Hz) = 7.5 * Q (Liters/min)
// Liters = Q * time elapsed (seconds) / 60 (seconds/minute)
// Liters = (Frequency (Pulses/second) / 7.5) * time elapsed (seconds) / 60
// Liters = Pulses / (7.5 * 60)
float liters = pulses;
liters /= 7.5;
liters /= 60.0;
The wiring sketch for this is simple:
As for the OLED (yes I know the're similar), I'm learning lots, but am again still trying to understand the language beyond simple text outputs, I understand it may be obvious arithmetic to many to get a percentage and a level bar to display (and logically it is), but it's the output to code that has me hung up. I can follow the code when its written, but beyond simple changes I'm a a bit lost
VFFGaston - Nice! Thanks
If you're an expert, this clearly might be too mundane for you, I get it. Just looking for beginner help over here...
Where's your code ? Have you got the OLED working ? Did you run the Flow sensor example ?
I get that you want us to write your program but we are here to provide help. You have to make an effort
to write the code. There's plenty of examples online . You already have example code for the sensor and
probably the OLED. So what's your first question ?
I can follow the code when its written, but beyond simple changes I'm a a bit lost
This is clearly not a request for help writing a program . This is obviously a request to have a program written. Start at the beginning and ask questions. All programs are written one line at a time. So what's your question/issue/problem ? We know the sensor and the OLED work and have examples, so where is YOUR code ? (where you try to integrate the two). I hope this isn't a homework assignment that you're trying to outsource
What exactly have you done toward writing the code?
The sensor is not food safe and will not work (well) with carbonated liquids.
That sensor can only be used under these two conditions:
You like your beer super-extra-ultra-foamy.
You want to invite montezuma and his revenge to your next keg party.
A scale under the keg would be a better use.
Put full keg on scale.
Push button -> copy start weight into eeprom.
Query scale for weight.
Calculate "19 - (start - current)" value to get the remainin beer in kg.
Resulting weight in kg is the same value as the remaining volume in liters for all practival purposes.
Output result on Display.
I thought the beer was carbonated after it left the keg.
Anyway, another approach would be something like a water-tank level sensor. One I read about a while ago used a pressure sensor at the top of a tube. The higher the water level the more it compressed the air in the tube.
First, no this isn't a homework assignment, but I guess I can understand the arrogance "raschemmel" if this is what kids these days are tricking you into...
The Adafruit Kegomatic is a great project, but made to run with the Raspberry Pi, not an Arduino. But, I do know the flow sensor will work, without foaming my beer or killing my friends. I appreciate the concern, and suggestions to use everything but what I'm actually using.
The flow sensor, Arduino and everything is already up and running, so yes, I have tested all items, modified the code to change the LCD description etc.....Everything has been working for over a week. Just fine
I'm not looking for any help other than for someone to guide me as to how I can take the accumulated total that is calculated in the flow sensor example code attached so that it deducts from a previously said total, instead of accumulating from "0". Not looking for someone to write my project.
The beer offer was a friendly (joking) offer, not payment for work. I'm just looking to tap into someone's knowledge...isn't this how we learn?
I'm not looking for any help other than for someone to guide me as to how I can take the accumulated total that is calculated in the flow sensor example code attached so that it deducts from a previously said total, instead of accumulating from "0".
Well that sounds simple enough. Where are you storing the previous total?
They're using the same flow meter as the OP. Doesn't that negate the comment that it's not food safe ?
I said that because it does not state what plastic is used, it apears it can not be opend to clean it and i have never seem a wheel type flowmeter in a bar installation.
They allways used meters with no moving parts, ultrasonic, very expensive.
But i have to admit, i gave it a look and found wheel type flowmeters that seem to be used and sold for beer/postmix lines.
But they have a service hatch to open and clean them.
You would not belive how filthy a beer line gets even after a short time. If you have seen the "snot" that comes out of a dirty line you do not want to think about the cultures growing on the wheel of this meter after a month.
So ok, wheel meters are used with cabonated beverages, i will take that back
@AHewat, I'm finding it hard to understand where, exactly, the problem is.
You have most of the conceptual thinking for the code figured out in Reply #8.
Just write a short Arduino program that does that and see what happens. If it does not compile or it does not do what you want post the code here and we will try to help.
DON'T expect to conceive of the code for the whole project all at once. Nobody writes code that way. Just do it in little pieces.
He said in his last post (Reply#14) that he already has a program that has been working fne for over a week now but he doesn't know how to calculate beer remaining.. I don't
think you learn by asking other's to do it. I think you learn by
trying to do it yourself. He won't post his entire code like I asked . He only posted a " snippet".from an example program. Don't know why he refuses to post his code.