[SOLVED] Can't Seem to Program Arduino Uno

Hi Elco (or anyone else),

I am new to programming and this is my first BrewPi Community post. I have successfully installed the BrewPi web interface on my RPi. When I am trying to program the Arduino using the brewpi-arduino-uno-revC-0_2_10.hex firmware, I am getting the same error message as everyone else.

“Cannot receive version number from Arduino. Your Arduino is either not
programmed or running a very old version of BrewPi. Please upload a new
version of BrewPi to your Arduino”

I made sure I was using the legacy branch. I tried resetting the EEPROM using the code posted, as some have suggested. I tried different programming settings in the controller settings. I was going to try the Xloader option, but I am using a Mac. Nothing that I have read seems to work.

Any help would be appreciated!

Is your legacy branch up to date? Then the updater should be able to program your Arduino.

The reset EEPROM code does nothing if the Arduino is not programmed, it is a BrewPi specific command. In fact, it should not be used anymore, there is a button in the web interface to reset to factory defaults.

Ok. So I went back (again) and updated my legacy branch. I even tried the legacy_dev as you suggested to someone else. Currently back on legacy. This is what I get:

*** Updating BrewPi web interface repository ***
You are on branch legacy

Available branches on the remote ‘origin’ for /var/www:
[0] beta
[1] develop
[2] feature/chart-export
[3] feature/notifications
[4] legacy
[5] master
[6] Skip updating this repository
Enter the number of the branch you wish to update [legacy]:4
The latest commit in /var/www is 398f1b50c71904f69e836b26299dd178d9d4515a on Mon, 11 Jan 2016 05:16:11
The latest commit on origin/legacy is 398f1b50c71904f69e836b26299dd178d9d4515a on Mon, 11 Jan 2016 05:16:11
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…

Checking current firmware version…
Apr 20 2016 20:59:44 Opening serial port
Unable to receive version from controller.
Is your controller unresponsive and do you wish to try restoring your firmware? [y/N]:
y
Traceback (most recent call last):
File “/home/brewpi/utils/updateFirmware.py”, line 263, in
result = updateFromGitHub(userInput=userInput, beta=beta, useDfu=useDfu)
File “/home/brewpi/utils/updateFirmware.py”, line 76, in updateFromGitHub
if “Particle” in name:
TypeError: argument of type ‘NoneType’ is not iterable

*** Done updating BrewPi! ***

Then, went to BrewPi interface and reset controller to factory defaults under advanced settings. Finally, went to Reprogram Controller. Uploaded hex code as stated in earlier reply, chose Arduino Uno, and both settings were changed to NO. Went to Program the Arduino and this is what I get:

**** Arduino Program script started ****
Settings will not be restored
Devices will not be restored
Apr 20 2016 20:57:48 Opening serial port
Loading programming settings from board.txt
Checking hex file size with avr-size…
Program size: 26896 bytes out of max 32256
ERROR: could not find port in bootloader
Traceback (most recent call last):
File “/home/brewpi/brewpi.py”, line 649, in
{‘settings’: restoreSettings, ‘devices’: restoreDevices})
File “/home/brewpi/programController.py”, line 163, in programController
return programmer.program(hexFile, system1File, system2File, useDfu, restoreWhat)
File “/home/brewpi/programController.py”, line 274, in program
if not self.flash_file(hexFile):
File “/home/brewpi/programController.py”, line 650, in flash_file
’ -C ’ + avrconf)
TypeError: cannot concatenate ‘str’ and ‘NoneType’ objects
Apr 20 2016 20:58:03 Opening serial port
Apr 20 2016 20:58:03 Notification: Script started for beer 'Under Construction’
Apr 20 2016 20:58:04 Checking software version on controller…
Apr 20 2016 20:58:14 Warning: Cannot receive version number from controller. Your controller is either not programmed or running a very old version of BrewPi. Please upload a new version of BrewPi to your controller.
Apr 20 2016 20:58:44 quit message received on socket. Stopping script.
Apr 20 2016 21:00:03 Opening serial port
Apr 20 2016 21:00:03 Notification: Script started for beer 'Under Construction’
Apr 20 2016 21:00:04 Checking software version on controller…
Apr 20 2016 21:00:14 Warning: Cannot receive version number from controller. Your controller is either not programmed or running a very old version of BrewPi. Please upload a new version of BrewPi to your Arduino.

Thanks for your help!

The problem is that it cannot find a compatible serial device.

I have updated the code to print a better error message.

Please run: python autoSerial.py and check its output. It will list the available serial ports and show what it thinks is compatible.

Here is what I got after entering the code:

python: can’t open file ‘autoSerial.py’: [Errno 2] No such file or directory

I’m guessing based on your description that my Arduino is not recognizing any serial ports.

I can definitely confirm that I do not seem to have any compatible serial ports. Here is what I get when running:

sudo python /home/brewpi/autoSerial.py

All ports:
/dev/ttyACM0 - Arduino Uno, VID:2a03, PID:0043
/dev/ttyAMA0 - ttyAMA0, VID:None, PID:None
Compatible ports:
Selected port: (None, None)

Now I am just not sure where to go next. Searched boards for answers. No luck.

What kind of Arduino do you have?

The problem is that your PID/VID is not in the list of compatible devices.

It is an official Arduino Uno R3.

Ah, this is due to the ugly fight between Arduino/Genuino. The founders split the company.
Arduino.org uses the VID that you have. It is different from Arduino.cc

I have updated the script to recognize the Arduino.org VID too now.

I have the same issue, but de output from autoserial.py is quite different.

python autoSerial.py
All ports:
/dev/ttyUSB0 - USB2.0-Serial, VID:1a86, PID:7523
/dev/ttyAMA0 - ttyAMA0, VID:None, PID:None
Compatible ports:
Selected port: (None, None)

is it possible to change anything in config files by my self?

Thanks!

UPDATED: I put one more line in autoserial.py and now both PI and arduino can talk

{‘vid’: 0x1a86, ‘pid’: 0x7523, ‘name’: “uno”}

1 Like

Everything works!!! That seems to have done the trick. Can’t thank you enough. Time to begin the trial phase.

Were you able to get it up and running?

Almost…
Now rapspi recognize the arduino, and I can flash it. But… when I go to the ‘Device Configuration’ and press ‘Refresh Device List’ (with read values checked), the temp sensors doesnt appear. I check circuit (i ran a simple code to get the address and values, was ok), check the logs, many times and nothing.

  • Make sure the sensors are on pin A4
  • Make sure 5V is connected to the sensors, we ignore parasitically powered sensors, because they are not reliable.
  • Make sure you have a 4.7 kOhm pullup resistor. Not 1 per sensor, only one on pin A4.

Nothing… :-/
Changed the resistor, the wires, the power (and also reinstall the raspbian). Both relay (ports 5 and 6) was recognized (sounds “click” when I add).

But the temp sensors doesnt apear. I think the port A4 of arduino isnt OK…

I used the updater.py --ask like above and am on the legacy commit, but I am getting the following error when trying to program. This is a brand new clean install for 2 instances (clean linux install, and clean brewpi install). I have followed all the commands for running 2 arduinos. Any ideas?

Jun 20 2016 12:32:02 Opening serial port
Jun 20 2016 12:32:02 Notification: Script started for beer ‘My First BrewPi Run’
Jun 20 2016 12:32:12 Checking software version on controller…
Jun 20 2016 12:32:22 Warning: Cannot receive version number from controller. Your controller is either not programmed or running a very old version of BrewPi. Please upload a new version of BrewPi to your controller.
**** Arduino Program script started ****
Settings will not be restored
Devices will not be restored
Jun 20 2016 12:33:45 Opening serial port
Loading programming settings from board.txt
Checking hex file size with avr-size…
Program size: 26896 bytes out of max 32256
ERROR: could not find port in bootloader
Traceback (most recent call last):
File “/home/brewpi/chamber1/brewpi.py”, line 649, in
{‘settings’: restoreSettings, ‘devices’: restoreDevices})
File “/home/brewpi/chamber1/programController.py”, line 163, in programController
return programmer.program(hexFile, system1File, system2File, useDfu, restoreWhat)
File “/home/brewpi/chamber1/programController.py”, line 274, in program
if not self.flash_file(hexFile):
File “/home/brewpi/chamber1/programController.py”, line 650, in flash_file
’ -C ’ + avrconf)
TypeError: cannot concatenate ‘str’ and ‘NoneType’ objects
Jun 20 2016 12:34:01 Opening serial port
Jun 20 2016 12:34:01 Notification: Script started for beer 'My First BrewPi Run’
Jun 20 2016 12:34:11 Checking software version on controller…
Jun 20 2016 12:34:21 Warning: Cannot receive version number from controller. Your controller is either not programmed or running a very old version of BrewPi. Please upload a new version of BrewPi to your controller.

I found out I had to kill the brewpi.py processes before the autoSerial.py would take affect. Just in case someone else runs into this. sudo python /home/USER/brewpi.py --kill

Also make sure you only have one Arduino connected while updating.

How did you edit autoserial.py?

Open terminal
cd /home/brewpi/autoSerial.py
sudo nano autoserial.py

That will open a text editor in the terminal window for you to make the needed changes.

1 Like