Brewometer integration

So after reading the entire thread above, I tried to integrate my Tilt into my BrewPi. I’m running an RPi3 with the BrewPi legacy branch and an Arduino UNO-C (2.10) and ran the Brewpi updater before the integration. Everything was working fine. After I ran the install (best as I could tell from above and the read.me file), I went to the BrewPi web interface and I can’t get the script to run. When I go to the maintenance panel, the RPI cannot retrieve info from the Arduino (I get a JSON error). I tried restarting the Apache server - no luck.

I have a few questions before I go back to a clean Brewpi image and try again…
1.) With an RPI3, should the the brewpi-web files go into /var/www or should it be /var/www/html -?
2.) Can someone confirm that the brewpi-script files go into the /home/brewpi folder (again with an RPi3 vs RPi2)?
3.) For the TEMPERATURE.colour calibration file, do the entered numbers need to be in Celsius if the Tiltometer and the BrewPi are set for Farenheit?

Thanks for your help on this.

Had time to work on this again, today. Hoping I can get some help. I think I may be erring on the file copy instructions.
I cloned the supercow files as I now understand @supercow code supports the Arduino UNO that I am using.
After this,

  1. I copied the folder brewpi-web to /var/www — so now I have a folder:
    /var/www/brewpi-web with the files:
    beer-panel.php, indes.php, previous_beers.php, and to folders css & js

  2. I copied the folder brewpi-script to /home/brewpi — so now I have a folder:
    /home/brewpi/brewpi-script with the files:
    blescan.py, brewometer.py, brewpiJson.py and Brewpi.py;
    and a folder brewometer
    I think I did something wrong above - ???
    If not, I ran the following:

    sudo apt-get install bluez python-bluez python-scipy python-numpy libcap2-bin
    sudo setcap cap_net_raw+eip $(eval readlink -f which python)
    python BrewometerTest.py (which I ran from the BrewometerTest folder)

And I am receiving the data from by Brewometer!!!

I then continued to the next instructions to fix the ownership
sudo chown -R www-data:www-data /var/www
sudo chown -R brewpi:brewpi /home/brewpi

This is where I know something is wrong. I went to my brewpi via my web browser and the brewpi loads but I can’t start the script. And when I try to connect to the Arduino in the maintenance panel, I get the following error:

error while receiving device configuration: Syntax Error: JSON Parse error: Unexpected identifier “Couldn”

@sbowler, @andylytical, @nanotapp, @NottingHill - I see there is a lot of great info on this thread and the related, but I’m hoping you all can help.
I’ll keep trying, I’m not giving up and I’m encouraged that I did see my brewometer when I ran the test!

Thanks for any help.
Bob

Tried again but with the following using jlvncy:

cd /home/brewpi
sudo git clone https://github.com/jlvncy/brewpi-brewometer.git
sudo apt-get install bluetooth bluez python-bluez python-scipy python-numpy libcap2-bin
sudo setcap cap_net_raw+eip $(eval readlink -f which python)
python /home/brewpi/brewpi-brewometer/brewometer-test/BrewometerTest.py

cd /home/brewpi/brewpi-brewometer/brewpi-web/
sudo cp -r * /var/www/html/brewpi/
sudo chown -R www-data:www-data /var/www/html/brewpi/
cd /home/brewpi/brewpi-brewometer/brewpi-script/
sudo cp -r * /home/brewpi/
sudo chown -R brewpi:brewpi /home/brewpi

Somewhere along this path, the web interface stops running the script and wont talk to the Arduino. I get the same error noted above.
I’ve tried rebooting with no difference.

I’ve gone back and ensured I had the latest Raspberry Jessie, Brewpi, and Arduino (Legacy 2.10) builds. Prior to building the brewometer integration, the BrewPi appears to be working just fine.

Bob

Hi @rolomo,

I think there are a few things that aren’t working here, so we’ll do our best to get them working.

The brewpi-web files should overwrite the existing files in either /var/www/html or /var/www/. There should not be a sub-folder called brewpi-web under this path. I believe the RPI3 puts the files in /var/www/html by default, but check and see which of those paths has the most files.

It looks like you’ve installed the script files correctly. In the arduino version, is there a file in the /home/brewpi/utils directory called fixPermissions.sh? If so, to fix the permissions, run the command sudo /home/brewpi/utils/fixPermissions.sh.

Are there any other errors in the logs, apart from the json error posted above?

Just to confirm, when you run the BrewometerTest.py script, can you see your brewometer?

Thank you so much for helping!

Significant forward movement.

I see that I was supposed to copy “Just the Files” in the brewpi-web folder, not the folder itself - just as you indicated. So I started over with a fresh copy of brewpi and put just the brewpi-web files into /var/www/html (this is where all the other files are) and then copied just the brewpi-script files into /home/brewpi.

As you indicated, there is a file called fixPermissions.sh in the folder you noted above, so I ran that command and received these two responses:
***** Fixing file permissions for /var/www *****
***** Fixing file permissions for /home/brewpi *****

That was it. I can now access the Arduino, the LCD text display is operating and the script is running! I can see the tiltometer reporting my sg. (Wish I had picked a color other than yellow!).

You are a genius!

Next, I’ll work on my calibration files.
Thank you, Thank you, Thank you!

1 Like

So, I thought I would provide my steps in loading jlvnyc’s version of @sbowler code.
I noted a couple of differences and bad assumptions on my part (thanks to @sbowler) from jlvnyc read.me file.

For those that have a Pi 3 and an Arduino Uno -C, these steps worked for me:

cd /home/brewpi
sudo git clone https://github.com/jlvnyc/brewpi-brewometer.git
sudo apt-get install bluetooth bluez python-bluez python-scipy python-numpy libcap2-bin
sudo setcap cap_net_raw+eip $(eval readlink -f which python)
python /home/brewpi/brewpi-brewometer/brewometer-test/BrewometerTest.py
cd /home/brewpi/brewpi-brewometer/brewpi-web/
sudo cp -r * /var/www/html/
sudo chown -R www-data:www-data /var/www/html
cd /home/brewpi/brewpi-brewometer/brewpi-script/
sudo cp -r * /home/brewpi/
sudo chown -R brewpi:brewpi /home/brewpi
sudo shutdown –r

(after reboot…)

sudo /home/brewpi/utils/fixPermissions.sh

Still need to work on updating the calibration files, but I have to run to a gala opening of a new local, small brewery in my town - this will be my task for tomorrow.

-Bob

@sbowler, I worked on my calibration file and I believe I have set the gravity up correctly. No errors in any logs that I can see.

However, I just now started fermentation of a beer I created today. Below is a screenshot of the BrewPi web interface. What is interesting is the Brewometer SG says 1.045 (s.b. 1.049) but if you notice where it is plotted - the graph indicates 1.006. I’ve put red circles around these areas. Not sure why it says 1.045 on the right - should say 1.049 if I calibrated correctly. But I’m really puzzled by the graph indicating 1.006.

-Any ideas?

Bob

And here is my GRAVITY.colour file:

Is that line not the Temp? I know it says degF on the right and degC on the left but 18.89 lines up about right and makes sense if we assume both units are actually degC in this case. And is the SG not the EXTREMELY faint line just under the blue Fridge Temp line which does seem to be at ~1.045?

I think you need to rename this file to GRAVITY.yellow instead of leaving it as GRAVITY.colour. The idea is you can have one of these file for each different coloured tilt so you can have multiple working with one system.

Thanks. I think I should have bought a different colour. and yes, I needed to change it to GRAVITY.yellow and TEMPERATUR.yellow. Works fine. Thanks.

@Espen,

Did you tweak the codes to change the color/shade of yellow? I have the same problem and I’m looking at this right now. brewometer.css looks like it controls some of this. But, not completely.

Thanks,
Bob

That’s the file. Feel free to change.

In fact if any yellow owners have suggestions for a better, more visible colour, please feel free to suggest and I can update the source css file. I have to admit that I didn’t put a lot of effort into colour selection.

Yes, I tweaked the colors. I am on vacation right no, so no easy access to the pi at the moment. I seem to remember that in addition to the CSS file, I also had to change a file I believe was named graph.(php or something). In there the colors were spesified directly using RGB codes. Sbowler can probably correct me if I am wrong here.

@sbowler: Thanks a lot for all the great work put into this! I think the colors except the yellow is great:-) My stupidity buying the yellow one :smile:

It looks like brewometer.css only controls the color settings in the legend. I’ve adjusted the colors to a darker yellow (220, 220, 0) after which I see a change in the legend but not in the graphing. So, I’m guessing that the graphing function (dygraph??) is plotting the yellow solid and dashed lines using RGB settings from somewhere else or maybe default in the function call-out??

@Espen is right. I’d forgotten about the graph colours being defined separately in js\beer-chart.js the var chartColors on Line 301 contains the definitions for the chart colours. As it turned out I used the CSS definition of ‘yellow’ so it’s easy to see the entries you need to edit.

Thanks for the navigation help! Found the line just where you said. Change default yellow to ‘rgb(230,220,0)’ for both entries of yellow on that line. It’s an “ugly yellow” but more readable.

So I’ve been having a couple of issues intergrating my Tilt into my Legacy Brewpi (on Arduino). I’ve got it most of the way there, but there are a couple of things still not working right.

  1. Seems like Chrome can’t draw the graph data right, but Firefox can. Is this a universal problem? Mobile chrome seems ok though.
  2. When hovering over a particular point of data, the Tilt data will not display in the legend on the right.
  3. My Purple Tilt lines are neon green! I did remove some of the other color data from a few files since drawing time was ridiculously long as it was polling for all the color Tilts that I don’t have. Where is the code to change the RGB for the Tilt lines exactly?

I suspect that some of the modifications to remove the other colours may have impacted the overall graph functionality. Not sure why it would work differently on Firefox to Chrome, but the neon green line is almost certainly a symptom of this. I’d recommend doing a diff between the repository beer-chart.js and your modified version to understand the changes, and work out what further changes you’ll need to make to make it work with your modified logging structure.

Nice colour. I think we should write to the W3C to get it registered as a named colour… I think your ‘uglyyellow’ has a nice ring to it :wink: