• Please visit and share your knowledge at our sister communities:
  • If you have not, please join our official Homebrewing Facebook Group!

    Homebrewing Facebook Group

Can any Arduino programmers help?

Homebrew Talk

Help Support Homebrew Talk:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

JohnnyGunn

Well-Known Member
Joined
Oct 19, 2010
Messages
87
Reaction score
7
Location
Edmonton, Alberta
Hi guys,

I'm extremely new to Arduino, but I want to integrate a flow sensor/meter into my brewing system. It would also have an electric solenoid valve that would shut off the flow once a target volume is reached. I have the following components:

- Arduino Uno R3
- 16x2 Sainsmart LCD shield (however, I’d like to bypass the 6 on-board buttons altogether and simply add 2 momentary push buttons (SPST-NO) to act as a “menu” and “exit” buttons)
- KY-040 Rotary encoder module
- YF-S201 Hall Effect water flow counter
- 12V DC N/C 0-0.8MPa electric solenoid valve
- 5V 1 channel relay module board
- Piezo buzzer
- DS18B20 temperature probes

I want the main screen to display the following information: Target volume, Current volume, and % of target volume reached.

Besides the flow meter functionality and solenoid valve triggering once a target volume is reached, I’d like to use a rotary encoder to do things like:
- Toggle the units being displayed (chose between litres or gallons);
- Change the target volume;
- Display temperatures (toggle between F or C);
- Display flow rates (gallons/hour or litres/hour);
- Turn piezo buzzer function on/off with a visual display of that action (i.e. icon on main screen)

I would like the piezo buzzer to be triggered to sound once 90% of target volume is reached, increasing the frequency as the volume approaches 100% of target. Once target is reached, display a message (i.e. something like “VALVE CLOSED. TARGET REACHED”).

I realize that some of my components will need to be calibrated in order to be used properly and I can manage that calibration once the code is written.

Is there a good source for help on how to program this? I have no idea where to start!!

Thanks guys!
 
There are many code samples and lessons online. You will need to build your code in pieces to handle each bit of hardware rather than try to tackle the whole project at once. For example, work on getting the LCD working, then flowmeter, etc. then integrate the code into a finished product.
 
This is precisely what I would do too.

Get the LCD working and print "Hello, world!". It's a well-defined task that is documented in many blogs and how-tos. Once that's going you can display debugging information about other parts of your code as you add it.

The flowmeter should be next, as it is a core component. You can run fluid through it and display status information on the LCD. This will help you with calibration if necessary.

Everything else is just gravy.
 
Thanks guys! I posted the same question over at the Arduino forums and they had the same advice. I'll do exactly as suggested and program each step separately until it all comes together. I'll keep track of my progress here.

Thanks again. Cheers!
 
Some flow meters issues like low flow cut offs, accuracy, repeatability, that on a small home brewery could mean the difference between 5 or 6 or 7 gallons. Anything accurate enough is going to be super expensive and used on an industrial scale. As well easy to clog. The rotary unit you're using could be subject to this as well as moving parts that can break easily

I would suggest measuring the level of the vessel you're filling. Using anything laser,through air radar, Guided wave radar, or head pressure. Head pressure being the cheapest. Find a hydrostatic pressure transducer, that will put out a 4-20 mA reading.
 
Some flow meters issues like low flow cut offs, accuracy, repeatability, that on a small home brewery could mean the difference between 5 or 6 or 7 gallons. Anything accurate enough is going to be super expensive and used on an industrial scale. As well easy to clog. The rotary unit you're using could be subject to this as well as moving parts that can break easily

I would suggest measuring the level of the vessel you're filling. Using anything laser,through air radar, Guided wave radar, or head pressure. Head pressure being the cheapest. Find a hydrostatic pressure transducer, that will put out a 4-20 mA reading.


I have firsthand experience with this flowmeter and will tell you that your claims are not accurate in my experience. The unit, once calibrated, but is moderately accurate and has not clogged or failed despite aggressive use and in place cleaning.
 
I have firsthand experience with this flowmeter and will tell you that your claims are not accurate in my experience. The unit, once calibrated, but is moderately accurate and has not clogged or failed despite aggressive use and in place cleaning.

I was saying that some flowmeter could, and that a more fool proof / much more accurate method to measure level in a vessel with known dimensions

I wasn't picking apart the unit he was using.

in the food and bev industry, in batch processes, we'll use a level measurement instead of a flow for getting a volume. Its more accurate and repeatable.
 
Yes, direct measurement is much better, but also much more expensive unless you are using hydrostatic pressure measurement. However the accuracy would not be off by 5-7 gallons. As long as a consistent rate is used, the repeatability would be quite high. On the order of a pint or two.
 
Some advice from someone who recently went through this, go to adafruit website --> learning section --> Arduino. Do all lessons up through the second level of multitasking.

To build an LCD menu structure get familiar with:
- using millis () to limit refresh rate or UI will be sluggish at best
- switch-case to manage menu structure
- go ahead and update to a Mega. You will probably run out of space on the uno if your UI will be more than basic.

Using a rotary encoder: assuming you will use a cheap one, you'll want to learn about external interrupts. Some people will swear you need hardware denouncing (you will understand later) but I did in software with a couple lines of code and it works well.

In general, OOP will make your life easier and a multimeter capable of measuring microamps will take some guess work out of debugging your Wiring.



All of these are covered in the adafruit lessons. If you have the parts you can breeze through them in a couple weeks of evening play time.

I don't want to be your tutor but if tou get royally stuck after successfully completing the lessons, let me know and I can provide pieces of code to help ypu along. The whole program is around 3k lines so it would probably be overwhelming if you are just starting out but I don't mind sharing if anyone wants it.
 
Back
Top