Building Arduino Firmware


First some background info

My old temperature controller was an old router that I hacked to expose a i2c bus that had some custom relay modules and temperature sensors daisy chained from it, it was running a very simple bash script - it’s finally died so I need a replacement and rather than re-invent the wheel I thought I would give this project a try.

First off, I acknowledge that the Arduino is a legacy platform but I need a cost effective way to control up to 6 fermenters on a glycol loop and at the moment that means the spark platform is out for me, I may reconsider when multi chamber is ready.

I’ve successfully got 4 Arduino uno’s running of one Raspberry pi and they work ok’ish in Fridge constant mode - I don’t think i’ve got the PID tuning quite right as i’m suffering from massive overshoot when the cooling kicks in, I also suspect that some of the solenoid valve aren’t sealing 100% of the time as some times the overshoot can be considerably target than other times.

I’m in the process of building some RC servo activated ball valves to replace the solenoids, ideally I would like to modify the Arduino firmware to drive them directly, I would also like to back port the changes in the spark firmware that allow beer profile mode to work with a single temperature sensor.

Now the problem,
I can’t get the Arduino firmware to compile, my preferred platform is my Mac, but I’ve also tried on a Debian VM and a Windows VM using Atmel Studio.

I’ve checked out the legacy branch of the firmware repository as this appears to be where the last Arduino release came from.
On both the Mac and the Debian VM the build fails with missing dependencies for Actuator.o, as there is no Actuator.c* files present in the legacy branch I’ve removed the Actuator.* rules from the make file, the build then fails with the following which is the same error I get in Atmel studio on the Windows VM.

In file included from …/DisplayLcdImpl.h:11:0,
from …/…/…/app/devices/DisplayLcd.h:25,
from …/…/…/app/devices/Display.h:29,
from …/./Brewpi.cpp:30:
…/OLEDFourBit.h: In member function ‘void OLEDFourBit::init()’:
…/OLEDFourBit.h:76:8: error: ‘DISP_RS’ was not declared in this scope
…/OLEDFourBit.h:76:17: error: ‘DISP_RW’ was not declared in this scope
…/OLEDFourBit.h:76:26: error: ‘DISP_EN’ was not declared in this scope
…/OLEDFourBit.h:76:35: error: ‘DISP_D4’ was not declared in this scope
…/OLEDFourBit.h:76:44: error: ‘DISP_D5’ was not declared in this scope
…/OLEDFourBit.h:76:53: error: ‘DISP_D6’ was not declared in this scope
…/OLEDFourBit.h:76:62: error: ‘DISP_D7’ was not declared in this scope

I don’t actually have any displays hooked up, but I can’t see how to disable the display code.

I’ve been looking at this on and off for the last week or so and could really do with pointer in the right direction.



Did you compile the legacy branch?
We used to compile this code both on a Linux server with avr-gcc and on Windows in Atmel studio.
You do have to use the makefile in


Yes i’m on the legacy branch, and that is indeed the make file I’m trying to use - if you look at line 120 there is no Actuator.cpp file anywhere in that branch.

So far i’ve tried removing all the reference to that file from the makefile and i’ve also had to add a whole load extra include directories to get it to start building, but it falls over on Brewpi.cpp with the the error I included in my first post.

it seems to me that the legacy branch as checked into GitHub isn’t what was used to build the last AVR firmware, but I can’t work out what was.



If your issue is getting the Arduino programmed, I had to use xLoader and manually download the hex file from here under the section titled 0.2.10. After getting programmed and setting the port to expect it on. I had to go into the BrewPi web interface and reset the config and it will start talking. NOTE: I’m trying to recall from over a year ago, what I clicked on in the interface and not looking at it while writing this.


You need to build 0.2.10 rather than the tip of the legacy branch.

The tip of the legacy branch of BrewPi/firmware does not build. But if you get version 0.2.10 it does (although I’ve not tried running it yet). There are a whole bunch of changes for the Spark that were merged in to 0.2.11. One of these is changing the #defines for the shield type into an enum (in BrewPi.h). But enums are not recognised by the preprocessor and so a number of #ifs fail to work as intended. These are only in the avr code and so this change doesn’t break the spark/photon build. Clearly 0.2.11 was never built for the Arduino.


Has anyone been successful at compiling the github legacy 0.2.10 branch? I’m trying to fix a bug that was corrected in 0.2.11 but since that version doesn’t support Arduino, I’m simply making the minor change in the 0.2.10 branch, but I can’t get the branch to compile even without my change… I get the same errors about the Actuator.c code that Russell mentioned.


It’s probably easier to just build 0.2.10 and cherry pick the bug fix.


That’s what I did, but the make file doesn’t work… I have the same issues that Russell did and he confirmed he was using the exact same makefile as you linked to.


It builds in Atmel Studio.


Hi @jmark71,
Here you are a patch file that fixes the build problem: (5.8 KB)

The build is working fine in my Linux environment. I had to make too some fixes: case problems (ie Brewpi / BrewPi), and a problem in the file PiLink.cpp, with the function “stringify”, that I think it is not necessary.

You can run:

$ make BUILD_NAME=dev BOARD=uno clean all

from $BREWPI_HOME/platform/avr/build

And you will get the .hex file in final/brewpi-avr.hex.

What are the issues fixed in 0.2.11 release that you say? I think we can generate a PR with both fixes.



Thanks… I’ll give this a shot sometime this week. The only issue I was trying to fix was the correction to the probe calibration logic that was fixed in 0.2.11 but not patched into the 0.2.10 branch. I’m not sure what else is in 0.2.11 but it doesn’t sound like that was ever built for the legacy platform.

EDIT… finally got this to work - THANK YOU!!! I did have to rename Brewpi.h to BrewPi.h, but other than that, the patch seemed to get everything sorted. I’ll see if I can’t upload the new Hex once my chambers are empty again!


Great news @jmark71!

Did you build the 0.2.10 with the 0.2.11 patch?


I only patched the one file with the 0.2.11 fix related to the calibration logic, so it’s basically a 0.2.10 hex with that one fix.


In order to work for me, I had to change the patch file by replacing BrewPi.cpp with Brewpi.cpp (this is within the first 5 lines of the patch). Then I applied the patch and in order to have a successful build, I had to change BrewPi.d occurrences inside the makefile.