Cannot load hex file to Arduino, 'Script not running'

Hi all,

For the last couple of days me and a friend have been struggling with the setup of the brewpi controller. Long story short, we cannot seem to download the specified .hex-file to our Arduino board.
For reference, this is what we have done so far:

We set up our Raspberry Pi v2 to run as a headless computer with a running VNC server to display the RPi display over a WiFi connection. Furthermore, we ran all the update commands on the RPi command line (sudo apt-get update, sudo apt-get upgrade and so on).

Hooked up the RPi with an Arduino Micro board (which should be equal to Leonardo?). This is a working Arduino which currently runs the ‘blink’ program without any problems.

Then we ran the automatic installation script to install brewpi, which seemed to install smoothly without any fuzz. We got the web interface up and running and… then we got stuck.

As we get to understand from the http://docs.brewpi.com/after-install/program-arduino.html, the next step is to download a .hex configuration file to the Arduino board. Now, the docs says that the brewpi.py script should be up and running before this is done. Problem is, we can’t get it to run. The web interface says ‘script not running’, and nothing happens when we click the Start Script-button. Trying to run the script manually from the command line yields the following output before it just hangs

Oct 06 2015 20:39:14 Opening serial port
Oct 06 2015 20:39:14 Notification: Script started for beer 'My First BrewPi Run’
Oct 06 2015 20:39:24 Checking software version on controller…

It never snaps out of this state. Exactly the same output is shown in the web terminal thingy when we try to download the .hex file without running the script.

Browsing around on this forum told us to run the programArduinoFirstTime.py. That yields the following

**** Arduino Program script started ****
Settings will not be restored
Devices will not be restored
Oct 06 2015 20:48:26 Opening serial port
Checking old version before programming.

before it hangs. Seems like it gets stuck in a loop somewhere while checking the SW version. Perhaps it can’t read from the serial port? BTW the serial ports should also be good as our USB port uses the default ttyACM0.
Finally, we tried running the ~/brewpi-tools/updater.py which yielded the following

######################################################

Welcome to the BrewPi Updater!

######################################################
Checking whether the update script is up to date
/home/pi/brewpi-tools is up-to-date.
*** Updating BrewPi script repository ***
Stopping running instances of BrewPi
[Errno 2] No such file or directory
Could not connect to socket of BrewPi process, maybe it just started and is not listening yet.
Could not send quit message to BrewPi instance with pid 6294!
Killing it instead!
SIGKILL sent to BrewPi instance with pid 6294!
You are on branch master
The latest commit in /home/brewpi is 4c7dfa342d8403eb2b485e9970e2cdec9e53c9e4 on Wed, 05 Aug 2015 23:15:44
The latest commit on origin/master is 4c7dfa342d8403eb2b485e9970e2cdec9e53c9e4 on Wed, 05 Aug 2015 23:15:44
Your local version of /home/brewpi is up to date!
*** Updating BrewPi web interface repository ***
You are on branch master
The latest commit in /var/www is d44c03e786d0bde0dc43f86a8bd655659f3f3d2b on Wed, 11 Mar 2015 22:59:39
The latest commit on origin/master is d44c03e786d0bde0dc43f86a8bd655659f3f3d2b on Wed, 11 Mar 2015 22:59:39
Your local version of /var/www is up to date!
No changes were made, skipping runAfterUpdate.sh.
If you encounter problems, you can start it manually with:
sudo /home/brewpi/utils/runAfterUpdate.sh
The update script can automatically check your controller firmware version and program it with the latest release on GitHub, would you like to do this now? [Y/n]:y
Stopping any running instances of BrewPi to check/update controller…
[Errno 2] No such file or directory
Could not connect to socket of BrewPi process, maybe it just started and is not listening yet.
Could not send quit message to BrewPi instance with pid 6295!
Killing it instead!
SIGKILL sent to BrewPi instance with pid 6295!

Checking current firmware version…
Oct 06 2015 20:45:07 Opening serial port

The weird thing is that no other forum posts we’ve seen shows a problem where the scripts hangs at that particular place. They all seem to get further and at least show a leading error message.

Best guess from our side is that there are issues with the serial port readings, but we have no clue as to how to go about and fix it. It would be much appreciated if some of you guys could lead us to the problem. I’m sure we’ve missed something somewhere.

Thanks in advance

Edit: one last thing: The wifichecker thing of the cron job keeps spamming us with the following error message in the web terminal window

/home/brewpi/utils/wifiChecker.sh: line 32: [: 192.168.10.1: binary operator expected
BrewPi: wifiChecker: Attempt 1 to reach 192.168.10.1
192.168.10.1 failed (Sun Oct 4 19:50:11 CEST 2015)
BrewPi: wifiChecker: Attempt 2 to reach 192.168.10.1
192.168.10.1 failed (Sun Oct 4 19:50:36 CEST 2015)
BrewPi: wifiChecker: Unable to reach router. Restarting wlan0 interface… (Sun Oct 4 19:51:01 CEST 2015)

Don’t now why this is complaining, as the WiFi seems to be up and running. Anyway, this turned out to be a long post, hope you guys take your time to read :smile:

Does anyone have any clue on what might be causing this? I’m sure someone here has encountered a similar problem. Any help will be much appreciated.

I’m having this same issue and have not found a way to get it to work

I receive this error when I try and run the automated update script on my raspberry/uno setup. The script also resets my config.cfg file found in /home/brewpi/settings . Since the config.cfg file gets cleared the the brew pi script can not find the the uno to read the sensors. Once I replace my config.cfg file with the settings in defaults.cfg I was able to get the web frontend and the script to talk to the uno. At which time I was able to use the Reprogram Arduino tab of the Maintenance Panel to push the 0.2.10 hex file to my uno. Hex can be found here https://github.com/BrewPi/firmware/releases . The automated update script still resets my config.cfg file so I recommend making a backup of the file that you can copy over when needed.

Example of my config.cfg file if needed for reference.

scriptPath = /home/brewpi/
wwwPath = /var/www/
port = /dev/ttyAMA0
altport = /dev/ttyACM0
boardType = uno
profileName =
beerName =
dataLogging = active

Are you talking about updater.py? That should not affect config.cfg.
If you are running the installer again, that’s a different story.

It happens when I follow the steps found on this page

cd ~/brewpi-tools
sudo python updater.py --ask

The script fails to update the arduino and also seems to clear my config file.

I think the automatic update script is indeed not working on the Arduino currently. I am working to fix this, but you should be able to upload via the web interface.

port = /dev/ttyAMA0, is wrong. This is the internal serial port on the Pi, not your Arduino.
I recommend leaving the setting on auto, unless you are using more than 1 Arduino.