Help me decide: Arduino or Raspberry Pi for brewing and smoking applications

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

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

jfenton78

Well-Known Member
Joined
Aug 11, 2008
Messages
89
Reaction score
10
Greetings all,

I'm interested in building a "controller" for my brewing and fermentation, but would also like to use it for smoking. I don't need anything too fancy such as web monitoring or controlling 30 valves. I basically would use it to monitor 3-5 temps and control 3-5 relays/SSRs. What are you recommendations for the microcontroller? I'm currently looking at a Arduino or Raspberry Pi. Should I look at anything else?

I've already got a brewtroller that I'm using, but I'd like to have a second "more standard" system to play with and that I can code. I don't have a strong coding background, but I learn quickly.

Let me know your thoughts on Raspberry Pi or Arduino and why. THanks

Jeff
 
All depends on what type of coding you want to do and the user interface you want. I'm playing with a Pi right now and can see where I can come up with a sharp looking web based user interface that's not possible with the Arduino. But I can see where code written for the Arduino could run much faster than a Pi hosted web project.
 
Thanks for the feedback. I would like to keep the coding to a more minimal form if that makes sense. As for the interface I'm okay with just text. After more reading it seems like people are using the Pi for the UI or as a network interface, but still require the Arduino for the inputs and switching. To me it seems like the Arduino is what I need, but am I missing out on something with the Pi?
 
Thanks for the feedback. I would like to keep the coding to a more minimal form if that makes sense. As for the interface I'm okay with just text. After more reading it seems like people are using the Pi for the UI or as a network interface, but still require the Arduino for the inputs and switching. To me it seems like the Arduino is what I need, but am I missing out on something with the Pi?

No, I think that are just leveraging hardware they are familiar with and they are adding the Pi as a user interface driver. But I've look at enough of the mixed designs and researched enough hardware to convince myself that it can all be done in a Pi. I just wish I could find a USB controlled stir plate!
 
Does anyone feel constrained by the memory of the Arduino Uno? I would like to program it to measure temp, switch a couple of relays based on temp, and sound alarms. I'll likely use just on/off and PID based switching.

I'm not looking to recreate the brewtroller, but maybe just simplify it with the core functionality that I'd like to play with.
 
I built Arduino based controllers for my brew system (Uno for hlt, rims, and kettle pid control with data logging) and fermentation controller (old Mega simple on/off controller and data logging). I did not hit memory issues with either. Honestly, I might not be using but half the memory in either application.

One thing to consider, the Arduino is a micro controller and runs in real time. The timing in your code will be consistent. There are not operating system processes to delay the next command.

While the Raspberry Pi typically runs Linux based OS and sometimes the processor has to run operating system processes and delay processing the next command in your code. We are talking about a handful of clock cycles at 700MHz, but some people consider that an issue. I did just read that there are now real time operating system builds for the Pi, but I've never used one. I use my Pi to store and serve data like you mentioned in your post

Maybe a computer engineer or computer scientist will chime in. I don't want to regurgitate what I read incorrectly.
 
Maybe a computer engineer or computer scientist will chime in. I don't want to regurgitate what I read incorrectly.

Hi!

I highly doubt you'll run into programming memory space issues on the 'Duino with a project like this (unless you want ethernet)

Arduino:
Pro - Real-time operation, many analog-to-digital pins with reasonable accuracy (8-bit, I think?), extensive documentation (good for someone new to this area!)
Cons - Limited UI options (think push buttons/LEDs/small LCD/seven-segment displays), limited internet connectivity (RAM/PROG space limitations). Also the ethernet shield isn't cheap. Stuck with C/Wiring for language (might not be a con depending on your experience)

RPi:
Pro - Internet is easy (including WiFi!), full linux on the board means full TCPIP tools, GUI, video out, etc. Cheap (actually cheaper than Arduino + Ethernet shield!). Many choices of programming languages (yay, Python!)
Con - No Analog-to-Digital (but you can add cheaply with these http://www.digikey.com/product-detail/en/MCP3008-I/P/MCP3008-I/P-ND/319422, a breakout board like this http://www.adafruit.com/products/914 and some soldering), linux experience def needed to leverage full power. NOT guaranteed real-time execution (though it might not matter too much in this case).

I'd say weighing the above: Go arduino if you DON'T want internet connectivity and can live with the GUI limitations. If you want to control/administer/view the thing over the web, go RPi, just keep in mind you will need an external A2D converter circuit.

ETA:
To expand on the real-time issues: These really only come into play if you're looking to switch something off and on with millisecond accuracy (say to keep an LED at half-brightness, or other PWM tasks)- that would be difficult to do with the RPi out of the box. If on the other hand you only want to turn a fridge on/off every few minutes to keep a constant temperature (for exampe), you'll have no problems with the RPi. Feel free to PM me with any questions along the way, I've got a few years experience in this area.
 
I think that mhespenh summed it up very well. His point about the RPI for pulse width modulation to turn something on and off quickly, like pulsing a solid state relay for a hot water heating element, is very good. Without the real time operating system, the control loop might not be stable enough because the pulse width might vary. I'm sure if you dig around the forum you might find some RPI electric brew system that work directly from the GPIO. I'd think it is possible, I just don't know how stable the temps would be.
 
I think that mhespenh summed it up very well. His point about the RPI for pulse width modulation to turn something on and off quickly, like pulsing a solid state relay for a hot water heating element, is very good. Without the real time operating system, the control loop might not be stable enough because the pulse width might vary. I'm sure if you dig around the forum you might find some RPI electric brew system that work directly from the GPIO. I'd think it is possible, I just don't know how stable the temps would be.

The reality is your mash temperature is going to change slowly, giving the Pi plenty of time to react. The real challenge is programming a PID algorithm into either machine because without a PID algorithm you are far better off using one of the PID controllers from China to manage your mash temperature.
 
The reality is your mash temperature is going to change slowly, giving the Pi plenty of time to react. The real challenge is programming a PID algorithm into either machine because without a PID algorithm you are far better off using one of the PID controllers from China to manage your mash temperature.

Exactly right.

For something like that you don't need real-time accuracy (like PWM), just a good, solid PID algorithm, which the RPi would be more than capable of handling. The question then is your logic and programming skillz. Either way, RPi or Arduino, you still have to climb that mountain.

PID controller design is a fun/horrible project that every aspiring hardware/software co-designer should take on at least once. :fro:
 
There is an easy to use PID library for the Arduino. I use an older version that I modified to reduce the affects of integer wind up, but new versions have autotune algorithms.

A quick Google showed a several of RPI PID projects for brewing. I haven't b researched it much because I'm comfortable with my Arduino code and I've been using it for three years with out many issues.
 
There is an easy to use PID library for the Arduino. I use an older version that I modified to reduce the affects of integer wind up, but new versions have autotune algorithms.

A quick Google showed a several of RPI PID projects for brewing. I haven't b researched it much because I'm comfortable with my Arduino code and I've been using it for three years with out many issues.

Can you share the new version with the autotune algorithm?
 
I've been working on a project that has a web interface to a controller algorithm for the past 4 years now, starting with just Arduino w/ SPI wifi and a 2MB flash addition, then moving through various platforms as they became available.

ATmega (Arduino): Real time operation, ADCs, digital I/O and flexible PWM. Great for sensors and control, but the lack of RAM/storage really kills you when you want to make a web interface that is any more than just some basic text dump. I stored a web page in dataflash then had the page call back and request the actual data in JSON which was built in code. This worked ok but you've only got 1 simultaneous connection so it is pretty slow, and there's no history.

rPi - Freakin' awesome CPU power, RAM, storage. It isn't "real time" but it is close enough for most applications. If you don't need ADC or things like timer input capture or analog comparators, this is all you need.

I went with a hybrid approach, needing an ADC I figured the cost on an ATmega was comparable to a single ADC chip and I'd just let it do all the control and let the Pi do all the web serving and data storage. The microcontroller talks to the Pi via serial to a service, and the web service talks to that through a UNIX domain socket. The ATmega is also attached to the SPI bus so it can be flashed with new firmware via the web interface. It is like the best of both worlds, and gives you the safety of knowing that if the Pi crashes, the microcontroller still does its job.

The RaspberryPi with a wifi adapter is also fantastic because you don't have to run an ethernet cable to the controller. A lot of projects look like a giant CF of wires and crap so cutting at least this cord was a goal of my project.



HeaterMeter Project on GitHub
 
CapnBry, your sept up is similar to what I have for my Ferm Controller. I run the PID on the Arduino and dump the data to the serial buss as text. I use a Python script on the RPI to read the serial data and store it to a MySQL database. I run Apache with php on the RPI. Then I use php to query the MySQL and display data. I also use php to update the table for the fermentation chamber settings.

For brewing, I use the Arduino on the PID and dump data to the serial bus. I use a .Net program on my laptop to read the data and change the set points.
 
Here is a link to the PID library on the official library. The cod was developed by Brett Beaureguard and I believe he lurks around this forum... or at least used to.

The first link has some info about PID. The Wikipedia page was also helpful for me. I am an electrical engineer, but did no controls work in college.

http://playground.arduino.cc/Code/PIDLibrary

This is the autotune link:
http://playground.arduino.cc//Code/PIDAutotuneLibrary

Thanks, I took a look at the autotune link and it might work for me.
 
By the way, those Arduino libraries are what runs on osPID.

For experimental purposes I ported them to C, which might be useful if anyone is interested in getting away from the Arduino IDE.

The BrewTroller firmware, at least in its earlier versions, used an earlier version of the same Arduino PID library.

The author Brett occasionally pops up on this forum with useful info.
 
I am currently using a Raspberry Pi with an expansion board to wire up my DS18B20's for inputs and SSRs for outputs. The lack of realtime has not bothered me because I wrote my PID algorithm library to account for timeshifts. What I intend to experiment with more is using an Arduino (well, an Atmel microcontroller running on my own board) running mruby with a RasPi running mruby and interfacing via I2C. So far it's looking promising.
 
It would be good to retool the PID library using a real time OS.

For practical purposes you can usually forget about the D parameter anyway, so I'm not sure how much difference it would make.
 
It would be good to retool the PID library using a real time OS.

For practical purposes you can usually forget about the D parameter anyway, so I'm not sure how much difference it would make.
PIDLibrary is already written for a real-time OS. How much more real-time do you get than a microcontroller? And using them from user-space Linux is fine too. Why would you need less than 10 milliseconds of response time to react to something that changes so slowly, such as 15 gallons of water connected to a temperature sensor that takes 750ms to take a 12 bit reading?

For practical purposes in this application you most certainly can not forget about the D parameter. In systems where the "impulse time" is so large (the amount of time between you changing your output to the time where the input value actually changes), the D parameter is especially important to anticipate massive overshoots and oscillations.
 
Back
Top