Devices and settings don’t stick when running Brewpi rev C with bluetooth but ok with USB

Continuing the discussion from Issue with device configuration:
Devices and settings don’t stick when running bluetooth but ok with USB.
Version number not reported on reboot- any ideas?

I am running BrewPi on Wheezy PC with Multiple instances.
I have had these converted to bluetooth so I don’t have to have the USB cables hanging around.
I change the config.cfg file port for the instance eg Brewpi1 to the USB port (in this case ttyACM0) if I have to reprogram the arduino as i cant load it over bluetooth. I then change the port back to a rfcomm* port. Reboot everything and it ticks away nicely but devices can’t be changed properly and version is reported as 0.0.0 when on Bluetooth.

I was running version 0.2.4 and though it was time to upgrade to 0.2.10 so I changed to ttyACM0 and uploaded 0.2.10.
All works fine when connected to the USB but when I go back to the rfcomm I seem to lose some functionality and ability for devices to be changed.

This is part of the log file when I change back to rfcomm:

Sep 02 2015 09:14:04 Notification: Script started for beer 'coopers50gCascadeUS05’
Sep 02 2015 09:14:14 Checking software version on controller…
Sep 02 2015 09:14:16 Found BrewPi v0.0.0 on port /dev/rfcomm0

NOTE version isnt listed in log file

Sep 02 2015 09:14:16 Warning: minimum BrewPi version compatible with this script is 0.2.4 but version number received is 0.0.0
Sep 02 2015 09:14:16 Warning: version number of local copy of logMessages.h does not match log version number received from controller.controller version = 0, local copy version = 1

NOTE LogMessages doesn’t match
Went to play around with devices
In Device log screen when I refresh device list with read values I get

Parsing installed devices
Parsing availble devices
Device listupdated for null with a null shield

Sep 02 2015 09:14:59 Installed devices received: [{“a”: “282203D305000034”, “c”: 1, “b”: 0, “d”: 0, “f”: 5, “i”: 0, “h”: 2, “j”: 0.0, “p”: 18, “t”: 1, “v”: 16.688}, {“a”: “28ADE1D3050000A3”, “c”: 1, “b”: 0, “d”: 0, “f”: 6, “i”: 1, “h”: 2, “j”: 0.0, “p”: 18, “t”: 1, “v”: 15.688}, {“a”: “280764D305000029”, “c”: 1, “b”: 1, “d”: 0, “f”: 9, “i”: 2, “h”: 2, “j”: 0.0, “p”: 18, “t”: 1, “v”: 17.313}, {“c”: 1, “b”: 0, “d”: 0, “f”: 2, “i”: 3, “h”: 1, “p”: 6, “t”: 3, “v”: 0, “x”: 1}, {“c”: 1, “b”: 0, “d”: 0, “f”: 3, “i”: 4, “h”: 1, “p”: 5, “t”: 3, “v”: 0, “x”: 1}]
Sep 02 2015 09:15:00 Available devices received: [{“c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 1, “p”: 2, “t”: 0, “x”: 1}, {“c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 1, “p”: 19, “t”: 0, “x”: 1}, {“c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 1, “p”: 4, “t”: 0, “x”: 1}]

Went back to USB cable
Traceback (most recent call last):
File “/home/brewpi/brewpi1/brewpi.py”, line 728, in
ser.write(‘l’)
File “/usr/local/lib/python2.7/dist-packages/serial/serialposix.py”, line 518, in write
raise SerialException(‘write failed: %s’ % (v,))
serial.serialutil.SerialException: write failed: [Errno 5] Input/output error
Sep 02 2015 09:24:11 Error opening serial port /dev/ttyACM0.
([Errno 2] No such file or directory: ‘/dev/ttyACM0’):
Sep 02 2015 09:24:11 Error opening alternative serial port /dev/ttyACM1.
([Errno 2] No such file or directory: ‘/dev/ttyACM1’):
Sep 02 2015 09:25:01 Notification: Script started for beer 'coopers50gCascadeUS05’
Sep 02 2015 09:25:11 Checking software version on controller…
Sep 02 2015 09:25:11 Found BrewPi v0.2.10 build unknown, running on an Arduino Uno with a revC shield on port /dev/ttyACM0

NOTE found version OK

Sep 02 2015 09:30:01 Notification: Script started for beer 'coopers50gCascadeUS05’
Sep 02 2015 09:30:11 Checking software version on controller…
Sep 02 2015 09:30:11 Found BrewPi v0.2.10 build unknown, running on an Arduino Uno with a revC shield on port /dev/ttyACM0

NOTE Build “Unkown” Went to play around with devices a bit more and no issues with assigning slot or function

Sep 02 2015 09:31:08 Installed devices received: [{“a”: “282203D305000034”, “c”: 1, “b”: 0, “d”: 0, “f”: 5, “i”: 0, “h”: 2, “j”: 0.0, “p”: 18, “t”: 1, “v”: 16.875}, {“a”: “28ADE1D3050000A3”, “c”: 1, “b”: 0, “d”: 0, “f”: 6, “i”: 1, “h”: 2, “j”: 0.0, “p”: 18, “t”: 1, “v”: 17.0}, {“a”: “280764D305000029”, “c”: 1, “b”: 1, “d”: 0, “f”: 9, “i”: 2, “h”: 2, “j”: 0.0, “p”: 18, “t”: 1, “v”: 17.313}, {“c”: 1, “b”: 0, “d”: 0, “f”: 2, “i”: 3, “h”: 1, “p”: 6, “t”: 3, “v”: 0, “x”: 1}, {“c”: 1, “b”: 0, “d”: 0, “f”: 3, “i”: 4, “h”: 1, “p”: 5, “t”: 3, “v”: 0, “x”: 1}]
Sep 02 2015 09:31:08 Available devices received: [{“c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 1, “p”: 2, “t”: 0, “x”: 1}, {“c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 1, “p”: 19, “t”: 0, “x”: 1}, {“c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 1, “p”: 4, “t”: 0, “x”: 1}]
Sep 02 2015 09:36:38 Installed devices received: [{“a”: “282203D305000034”, “c”: 1, “b”: 0, “d”: 0, “f”: 5, “i”: 0, “h”: 2, “j”: 0.0, “p”: 18, “t”: 1, “v”: 16.938}, {“a”: “28ADE1D3050000A3”, “c”: 1, “b”: 0, “d”: 0, “f”: 6, “i”: 1, “h”: 2, “j”: 0.0, “p”: 18, “t”: 1, “v”: 17.438}, {“a”: “280764D305000029”, “c”: 1, “b”: 1, “d”: 0, “f”: 9, “i”: 2, “h”: 2, “j”: 0.0, “p”: 18, “t”: 1, “v”: 17.313}, {“c”: 1, “b”: 0, “d”: 0, “f”: 2, “i”: 3, “h”: 1, “p”: 6, “t”: 3, “v”: 0, “x”: 1}, {“c”: 1, “b”: 0, “d”: 0, “f”: 3, “i”: 4, “h”: 1, “p”: 5, “t”: 3, “v”: 0, “x”: 1}]
Sep 02 2015 09:36:38 Available devices received: [{“c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 1, “p”: 2, “t”: 0, “x”: 1}, {“c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 1, “p”: 19, “t”: 0, “x”: 1}, {“c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 1, “p”: 4, “t”: 0, “x”: 1}]

Reprogram to 0.2.4 over USB to see if was the version

**** Arduino Program script started ****
Settings will not be restored
Devices will not be restored
Checking old version before programming.
Checking current version: Found BrewPi v0.2.10 build unknown, running on an Arduino Uno with a revC shield on port /dev/ttyACM0

Requesting old settings from Arduino…
Saved old settings to file settings-Sep-02-2015-09-43-34.json
Loading programming settings from board.txt
Checking hex file size with avr-size…
Program size: 25766 bytes out of max 32256
Programming Arduino with avrdude: /usr/share/arduino/hardware/tools/avrdude -F -e -p atmega328p -c arduino -b 115200 -P /dev/ttyACM0 -U flash:w:“brewpi-uno-revC.hex” -C /usr/share/arduino/hardware/tools/avrdude.conf
Result of invoking avrdude:

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f
avrdude: erasing chip
avrdude: reading input file "brewpi-uno-revC.hex"
avrdude: input file brewpi-uno-revC.hex auto detected as Intel Hex
avrdude: writing flash (25766 bytes):

Writing | ################################################## | 100% 4.13s

avrdude: 25766 bytes of flash written
avrdude: verifying flash memory against brewpi-uno-revC.hex:
avrdude: load data flash data from input file brewpi-uno-revC.hex:
avrdude: input file brewpi-uno-revC.hex auto detected as Intel Hex
avrdude: input file brewpi-uno-revC.hex contains 25766 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 3.31s

avrdude: verifying …
avrdude: 25766 bytes of flash verified

avrdude done. Thank you.

Avrdude done, programming succesful!
Giving the Arduino a few seconds to power up…
Back up in 5…
Back up in 4…
Back up in 3…
Back up in 2…
Back up in 1…
Back up in 0…
Waiting for device to reset.
Checking new version: Found BrewPi v0.2.4, running commit 2a6f7f05 build 40, running on an Arduino Uno with a revC shield on port /dev/ttyACM0

Resetting EEPROM to default settings
INFO MESSAGE 15: EEPROM initialized
**** Program script done! ****
Sep 02 2015 09:44:04 New program uploaded to controller, script will restart
Sep 02 2015 09:44:09 Notification: Script started for beer 'coopers50gCascadeUS05’
Sep 02 2015 09:44:19 Checking software version on controller…
Sep 02 2015 09:44:19 Found BrewPi v0.2.4, running commit 2a6f7f05 build 40, running on an Arduino Uno with a revC shield on port /dev/ttyACM0

NOTE Build reported Went to play around with devices a bit more and no issues with assigning slot or function

Sep 02 2015 09:44:31 Installed devices received: []
Sep 02 2015 09:44:34 Available devices received: [{“a”: “282203D305000034”, “c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 2, “j”: 0.0, “p”: 18, “t”: 0, “v”: 17.313}, {“a”: “28ADE1D3050000A3”, “c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 2, “j”: 0.0, “p”: 18, “t”: 0, “v”: 18.125}, {“a”: “280764D305000029”, “c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 2, “j”: 0.0, “p”: 18, “t”: 0, “v”: 17.188}, {“c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 1, “p”: 2, “t”: 0, “x”: 1}, {“c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 1, “p”: 5, “t”: 0, “x”: 1}, {“c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 1, “p”: 6, “t”: 0, “x”: 1}, {“c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 1, “p”: 19, “t”: 0, “x”: 1}, {“c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 1, “p”: 4, “t”: 0, “x”: 1}]
Sep 02 2015 09:46:30 Device updated to: {“i”:0,“t”:1,“c”:1,“b”:0,“f”:5,“h”:2,“d”:0,“p”:18,“a”:“282203D305000034”,“j”: 0.000}
Sep 02 2015 09:46:54 Device updated to: {“i”:1,“t”:1,“c”:1,“b”:0,“f”:6,“h”:2,“d”:0,“p”:18,“a”:“28ADE1D3050000A3”,“j”: 0.000}
Sep 02 2015 09:47:12 Device updated to: {“i”:2,“t”:1,“c”:1,“b”:1,“f”:9,“h”:2,“d”:0,“p”:18,“a”:“280764D305000029”,“j”: 0.000}
Sep 02 2015 09:47:53 Device updated to: {“i”:3,“t”:3,“c”:1,“b”:0,“f”:2,“h”:1,“d”:0,“p”:6,“x”:1}
Sep 02 2015 09:48:17 Device updated to: {“i”:4,“t”:3,“c”:1,“b”:0,“f”:3,“h”:1,“d”:0,“p”:5,“x”:1}
Sep 02 2015 09:48:17 Device updated to: {“i”:4,“t”:3,“c”:1,“b”:0,“f”:3,“h”:1,“d”:0,“p”:5,“x”:1}

Changed recording to 2 min

Sep 02 2015 09:48:40 Notification: Interval changed to 120 seconds
Sep 02 2015 09:49:01 controller debug message: INFO MESSAGE 12: Received new setting: pidMax = 5
Sep 02 2015 09:49:05 controller debug message: INFO MESSAGE 12: Received new setting: iMaxErr = 0.1
Sep 02 2015 09:49:47 Setting profile ‘DrSmurtoUS05’ as active profile
Sep 02 2015 09:49:47 Notification: Profile mode enabled
Sep 02 2015 09:49:48 controller debug message: INFO MESSAGE 12: Received new setting: mode = p
Sep 02 2015 09:49:48 controller debug message: INFO MESSAGE 12: Received new setting: beerSet = 20.0

Changed Ki to 0.1 (works better for me and reduces heating cooling cyles)

Sep 02 2015 09:50:36 controller debug message: INFO MESSAGE 12: Received new setting: Ki = 0.1

Changed back to rfcomm

Sep 02 2015 09:53:52 Serial Error: [Errno 5] Input/output error)
Traceback (most recent call last):
File “/home/brewpi/brewpi1/brewpi.py”, line 734, in
ser.write(‘s’)
File “/usr/local/lib/python2.7/dist-packages/serial/serialposix.py”, line 518, in write
raise SerialException(‘write failed: %s’ % (v,))
serial.serialutil.SerialException: write failed: [Errno 5] Input/output error
Sep 02 2015 09:54:11 Error opening serial port /dev/ttyACM0.
([Errno 2] No such file or directory: ‘/dev/ttyACM0’):
Sep 02 2015 09:54:11 Error opening alternative serial port /dev/ttyACM1.
([Errno 2] No such file or directory: ‘/dev/ttyACM1’):
Sep 02 2015 09:56:02 Error opening serial port /dev/rfcomm0.
([Errno 112] Host is down: ‘/dev/rfcomm0’):
Sep 02 2015 09:56:02 Error opening alternative serial port /dev/null.
(Could not configure port: (25, ‘Inappropriate ioctl for device’)):
Sep 02 2015 09:57:08 Notification: Script started for beer 'coopers50gCascadeUS05’
Sep 02 2015 09:57:19 Checking software version on controller…
Sep 02 2015 09:57:20 Found BrewPi v0.0.0 on port /dev/rfcomm0

NOTE version isnt listed in log file

Sep 02 2015 09:57:20 Warning: minimum BrewPi version compatible with this script is 0.2.4 but version number received is 0.0.0
Sep 02 2015 09:57:20 Warning: version number of local copy of logMessages.h does not match log version number received from controller.controller version = 0, local copy version = 1

Played with settings and assigning devices etc but they don’t stick

Sep 02 2015 09:59:49 Installed devices received: [{“a”: “282203D305000034”, “c”: 1, “b”: 0, “d”: 0, “f”: 5, “i”: 0, “h”: 2, “j”: 0.0, “p”: 18, “t”: 1, “v”: 17.438}, {“a”: “28ADE1D3050000A3”, “c”: 1, “b”: 0, “d”: 0, “f”: 6, “i”: 1, “h”: 2, “j”: 0.0, “p”: 18, “t”: 1, “v”: 18.875}, {“a”: “280764D305000029”, “c”: 1, “b”: 1, “d”: 0, “f”: 9, “i”: 2, “h”: 2, “j”: 0.0, “p”: 18, “t”: 1, “v”: 17.25}, {“c”: 1, “b”: 0, “d”: 0, “f”: 2, “i”: 3, “h”: 1, “p”: 6, “t”: 3, “v”: 0, “x”: 1}, {“c”: 1, “b”: 0, “d”: 0, “f”: 3, “i”: 4, “h”: 1, “p”: 5, “t”: 3, “v”: 0, “x”: 1}]
Sep 02 2015 09:59:50 Available devices received: [{“c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 1, “p”: 2, “t”: 0, “x”: 1}, {“c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 1, “p”: 19, “t”: 0, “x”: 1}, {“c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 1, “p”: 4, “t”: 0, “x”: 1}]

Sep 02 2015 10:12:01 Notification: Interval changed to 120 seconds
Sep 02 2015 10:12:59 controller debug message: INFO MESSAGE 12: Received new setting: Ki = 0.1

I havent done a new git pull to get the latest script etc. maybe I should. But if I revert to an older version (0.2.4) I would have thought it would be ok?

Please try with the latest version of the script. After flashing new firmware, you need to do an EEPROM reset for devices to stick, by sending E to the serial port.

sudo echo 'E\n' > /dev/ttyACM0

I doubt this is the problem though, it sounds like your serial communication is not working well, given all the serial errors in your log. I don’t think this is a problem with BrewPi, but with your bluetooth hack.

Thanks for the quick reply. I will try the eeprom reset after I flash 0.2.10 with the usb while the usb is still active and then change back to Bluetooth to see how it goes and report back.

I tried to extend the USB serial link with a pair of Digi Znet zigbee modules. It never worked good enough to be reliable. I tried different bit rates but was always losing characters.

My conclusion was that I was going to need to write a reliable protocol wrapper in the Arduino and the Python script to deal with lost characters. I went back to the wired configuration.

Jimmy

I reset all arduinos to 0.2.10. All working ok. The issue is that if i reboot the pc and dont reboot /turnoff the arduinos i get a null device and null shield response in the device setup screen and the devices cant effectively be setup.
If i reboot the pc and then after the script starts i reboot the arduinos the device screen recognises the shield and the device settings are able to be setup. So in my setup i have to reboot arduinos after resetting the pc and all is fine… :slight_smile:

PS i did need to use the eeprom reset when initially programming a chinese knockoff arduino over usb