How I re-installed BrewPi legacy software/firmware for Arduino (with serial errors)

Hello,
I built an Arduino BrewPi steup back in April '15 but I lost the RaspPi SD card after a power outage.
It took me a bit of trying to get it back running again so I thought I would document what I did here for anyone else who might find it useful.
This is not a how-to tutorial showing the best way, rather it is merely showing what I did to get it running (some of what may actually be redundant if I had done things in a different order, but I don’t know - now it is working I am reluctant to do it all again!)

FYI I followed the instructions here and here and here. I was/am using a (non-clone) Arduino Uno.

  1. With a newly formatted SD card, I downloaded and installed the 05-05-2015 image of Raspbian Wheezy (link).

  2. After installation, at the Raspi-Config panel, I enlarged the file system, ran apt-get update and apt-get upgrade. (I also changed the TZ and keyboard layout to suit, but left the locale as it was (GB) despite this not being my locale (actually NZ) - I got funny errors while changing locale on earlier attempts - weird).

  3. I installed the Arduino IDE (arduino & arduino-core).

  4. For me, the hardware was left exactly as from the previous build, so I plugged it into the RaspPi.

  5. I ran
    ls /dev/ttyACM
    which showed that the serial port name is /dev/ttyACM0.
    Note that this may actually be something like /dev/ttyUSB0 if you are using Uno clone; search elsewhere in this forum and in the official BrewPi docs for more on this if that is the case for you.

  6. I used the Arduino IDE to upload the Blink example - this proved the Arduino was connected correctly (it started to blink!) and the serial port was correct (mine was /dev/ttyACM0).

  7. I ran the command:
    git clone https://github.com/BrewPi/brewpi-tools.git ~/brewpi-tools
    and when prompted about the correct time I entered Y, entered the default about the directory, Y to confirm I still want to use it, Y to update the cron job, and N when asked if I wanted to restart wifi (as I am only using an ethernet connection).
    (from memory I had error(s) reported at this stage, as it could not find the arduino (could not find serial device, or similar).

  8. I then changed to the brewpi directory:
    cd ~/brewpi-tools
    and ran:
    sudo python updater.py --ask
    and selected the legacy option when prompted twice.
    I selected Y to updating the Arduino with the latest image, but this failed (from memory, the same errors as above in step 7 - or maybe this is the only place I got the error - my memory fails me sorry!)

  9. I downloaded the hex file (found here). I used the Uno RevC file.

At this stage I tried the BrewPi web interface but the script was not running and when I tried to upload the hex file it said:
Errors while opening serial port:
Could not find compatible serial devices

  1. To upload the hex file, I then went back to the Arduino IDE, went into preferences and ticked the Show verbose output during upload.

  2. I re-uploaded the Blink example (so that it was blinking which would give me an indication whether or not I could see if the hex file would upload - if it did it would stop blinking).

  3. I found the avrdude command in the arduino terminal window, which looks similar to this:
    C:\Arduino102\hardware/tools/avr/bin/avrdude -CC:\Arduino102\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -carduino -P\.\COM3 -b115200 -D -Uflash:w:C:\Users\Usr1\AppData\Local\Temp\build1538115773179135859.tmp\Blink.cpp.hex:i

I retyped the version from my arduino IDE into the terminal, but changed the location of the .hex file to point to the copy in my RaspPi’s Downloads folder (rather than the Blink file shown above), and this successfully uploaded the hex file to the arduino.

See here for a much better explanation of this part of the process.

After doing this, the same serial port error was showing on the BrewPi interface (grr!)

  1. I then noticed the /home/brewpi/settings/config.cfg file did not exist so I created/opened the file:
    sudo nano /home/brewpi/settings/config.cfg
    and added the line:
    port = /dev/ttyACM0
    just to be sure the serial port was found. **** THIS WAS CRITICAL - it would not find the Arduino without doing this, and it took me a while to find this ****

  2. I rebooted and found it the script running, and my Devices (OneWire temp sensors) could be read!

Edit: I should really point out the exercise uploading the hex file using avrdude may have been redundant if I had added the serial port location to /home/brewpi/settings/config.cfg earlier on, so I recommend trying this as soon as BrewPi is installed (but I don’t actually know, just worth a try).

Edit 2: Once all was up and running I found there was no graph (just a white space) once I started a new brew. I found elsewhere on this forum to solve it you must run:
sudo /home/brewpi/utils/fixPermissions.sh
and then start a new brew.

Thanks once again to Elco and co for creating such a great system!

1 Like

You probably have a non-official Arduino with a different USB PID/VID identifier.
You can check that by running ‘python autoSerial.py’ in the script dir.

The solution is to edit autoSerial.py and add your PID/VID to the recognized identifiers.

I have brewpi on a Raspberry Pi, but I have an Arduino so I was hoping to downgrade to legacy, but when I run the updater.py, there is no option to select legacy. Is the legacy branch of brewpi available somewhere? Ideally, a legacy version of the docker would be awesome.

I think i was able to hack the existing container successfully. See here: Automatic Installer Not working