Brewometer integration

I don’t know what all changed. @sbowler indicated that he has made a few changes. For example the settings.ini file and the beer-chart.js was changed. Is there a way to compare?

Working great! Thanks, I’m running an arduino and rsp 3. I am on the legacy branch https://github.com/jlvnyc/brewpi-brewometer2.

Encounter any issues from following the readme instructions? I started the process, but haven’t completed.

I had some issues with the https://github.com/sibowler/brewpi-brewometer.git. But the legacy branch https://github.com/jlvnyc/brewpi-brewometer2 worked for me. I just followed the readme…

Hi All,

I’ve just updated the modification to:

  • Update brewpi.py to be compatible with the 0.4.4 firmware.
  • Update references to Brewometer -> Tilt Hydrometer.

When upgrading the source, need to do the following steps:

  1. Rename /home/brewpi/brewometer directory to /home/brewpi/tiltHydrometer
  2. Ensure the existing Brewometer.py file has been deleted (note the code will still work if this file remains - this is just a cleanup step). The Brewometer.py library has essentially been renamed to TiltHydrometer.py.

Very good integration this. Thanks for Sbowler for his code and of course Elco for the excellent brewpi base.

This is my hacked attempt at doing some real time monitoring. This pic was taken exactly 48 hours after pitching. The Tilt is accurate to .1 points (I took a hydro sample and it was 1.018 compared to the Tilt’s 1.017). I can live with that accuracy! :slight_smile:

The battery level is taken every 12 hours via Gatttool and stored in my monitoring sqlite database along with the Tilt gravity samples.

4 Likes

I like the dials, or even just the extra information in the Brewpi header. Care to share with us how to arrange that, please?

Stefan

sure - I would post my code to github but it is part of a bigger process within my home virtual environment that includes custom monitoring etc based on a sqlite database. I need to spend some time in the new year seeing if I can refactor this into a standard facility as such. Need to think about this as the code base is changing soon via Elco and I am on Arduino.

But in outline:

  1. I created a sqlite database holding a brew/brewlog/brew_device table structure. The brew_device table contains the Tilt address and current battery level reading. This is used for other purposes too - hence the database approach.

  2. I added a new subroutine to the brewpi.py python script that inserts the current tilt SG and temp readings to the new brewlog table every x mins along with the standard brewpi logging data.

  3. I added a new python script that is run via cron twice a day and this runs gatttool to grab the battery status and updates the device table with this.

  4. I wrote a new php page called get_brew_status.php to just return a JSON array of the brew data from the sqlite database upon each call.

  5. I use canvas-gauges javascript library to display the brewtemp/sg/calculated ABV/battery level.

  6. each page or graph refresh updates the canvas gauges and the additional header values via a new javascript function which makes a ajax call to the new php - function getBeerStatus is at the bottom…

  7. Alterations to beer-panel.php for the new header fields as well as making the page public facing without exposing unauthorised admin functions.

function getBeerStatus(){

$.ajax({
    type: "POST",
    dataType:"json",
    cache: false,
    url: 'get_brew_status.php',
    success: function(brewStatusJson){
	
		var beerTemp=brewStatusJson[0].BeerTemp;
		
		var tiltSG=brewStatusJson[0].TiltSG;
		
		var startSG = brewStatusJson[0].StartSG;

		var currentAbv = brewStatusJson[0].CurrentAbv;
		
		var currentBattery = brewStatusJson[0].BatteryLevel;
		
		var tempGaugeElement = document.getElementById('beerTempGauge');
		
		tempGaugeElement.setAttribute('data-value', beerTemp);
		tempGaugeElement.setAttribute('data-animation', "true");
		
		var sgGaugeElement = document.getElementById('beerSgGauge');
		sgGaugeElement.setAttribute('data-value', tiltSG);
		
		var abvGaugeElement = document.getElementById('abvGauge');
		abvGaugeElement.setAttribute('data-value', currentAbv);

		var batteryGaugeElement = document.getElementById('batteryGauge');
		batteryGaugeElement.setAttribute('data-value', currentBattery);

					
		var startSgLineAttr = document.getElementById('abv-line-2');
		var currSgLineAttr = document.getElementById('abv-line-3');
		var currAbvLineAttr = document.getElementById('abv-line-4');
		
		//update the panel display:
		startSgLineAttr.innerHTML = "Starting Gravity: "+startSG;
		currSgLineAttr.innerHTML = "Current Gravity: "+tiltSG;
		currAbvLineAttr.innerHTML = "Current Alcohol % : "+currentAbv;
		
	}
 });  //end ajax post.

}

//json object returned by new php page looks like this:

[{“BrewID”:“2”,“BeerName”:“Meteor Dec2016”,“BeerTemp”:“17.94”,“BeerSet”:“18”,“FridgeTemp”:“18.32”,“FridgeSet”:“18.76”,“TiltSG”:“1.013”,“TiltTemp”:“18.33”,“StartSG”:“1.042”,“RoomTemp”:“3.19”,“CurrentAbv”:“3.81”,“StartDate”:“2016-12-17 13:23:29”,“EndDate”:null,“BatteryLevel”:“60”,“BatteryLastChecked”:“2016-12-20 12:00:03”}]

thanks for the comprehensive explanation, but to be honest, for my meager capabilities, TMI. I am nowhere near experienced enough to do 1/2 of what you suggested. I am just glad that can download from github and install the software or the updates. Maybe in the future, I can take some time to learn more or teach myself.

But thanks anyway for showing how, I am sure there are others who can use this immediately.

Stefan

I would also be interested in your process for the dial display and battery gauge. But wouldn’t have a clue how to do what you described.

Nappy New Year Mr. Bowler,
Apologize that I have to inconvenience you during the holidays but I was trying to install your Tilt integration, finally, after receiving my Tilt this Christmas. I am really looking forward to getting this working, your changes to the standard BrewPi look really good. However, I am getting an error in one of the early steps in the read.me file in Github.

Then you need to enable python to query bluetooth without being root.

sudo setcap cap_net_raw+eip $(eval readlink -f which python)

Failed to set capabilities on file ‘/home/pi/whic’ (Invalid argument)
The value of the capability argument is not permitted for a file. Or the file is not as regular (non-symlink) file

I am a total Linux noob, so have no idea where to start on correcting this. Any help that you (or any other forum members) can provide would be much appreciated.

Stefan

Stupid me, I am obviously a noob. I used ordinary ticks instead of back ticks. So now the setcap worked. But how and where do I load the files in @sbowler’s github? :confused:

apt-get install is not right, do I use git clone or another kind of git command?

@sbowler Maybe something to add to your read me?
:wink:

So I had my BrewPi all set up, added in the extra “security” features (to allow for Public/Private viewing) as well as hosting 2 web servers on my RaspPi. Below should be the steps to get you back up and brewing with the Tilt Hydrometer working.

  1. cd /home/brewpi

  2. sudo git clone https://github.com/sibowler/brewpi-brewometer.git

  3. sudo apt-get install bluez python-bluez python-scipy python-numpy libcap2-bin

  4. sudo setcap cap_net_raw+eip $(eval readlink -f ``which python)`

  5. python /brewpi-brewometer/tiltHydrometer-test/TiltHydrometerTest.py

  6. cd brewpi-brewometer/brewpi-web/

  7. cp index.php admin.php (this copy/pastes the index pages as the new admin page, due to Public/Admin setup; the goal is to replace the admin.php page [current] with this new page)

  8. rm -r index.php (this deletes the index.php page from the Tilt additional code, so it won’t overwrite the current index.php page)

  9. sudo cp -r * /var/www/html/BrewPi/ (This is because I am running 2 web servers and this is where BrewPi is at)

  10. sudo chown -R www-data:www-data /var/www/html/BrewPi/

  11. cd /home/brewpi/brewpi-brewometer/brewpi-script/

  12. sudo cp -r * /home/brewpi/

  13. sudo chown -R brewpi:brewpi /home/brewpi

  14. sudo shutdown -r

Thanks @lgbainbridge for your posting, it helped me get past my Linux noob block and get the files onto my PI (your line 2). I have also run lines 3,4 & 5. Unfortunately I do have a problem in 5, in that the test script does NOT see my Blue Tilt.

On the other hand, if I use hcitool lescan, the Tilt DOES show up. Anyone in the forum have any ideas on this issue, please (@sbowler?)

A very happy and brewy New year to all
Stefan

Glad it worked for you…If you have a Public/Admin setup I figured out how to update that as well (will be updated in the steps above)…it is VERY simple. I will also include it in my overall file on my blog but this may help you in the future… I will validate the setup when my tilt arrives in 3 weeks.

@beardy82 I posted at the bottom of this thread how to do it… (Jan 2017).

@Richard_Crump I noticed in the first pic all Tilt Hydrometers are listed and in the following post only the active one is listed? I currently am waiting on mine to arrive and I am hoping that the legend is displaying this way because there isn’t any data being collected and when one is hooked up it will only display that one…can you confirm this? If not any idea how to fix?

Once it’s all working ok and receiving the data. those extra ones disappear to leave only the active one(s) that are hooked up.

1 Like

Thanks for the reply, I am not using a Pub;ic/Admin setup (yet?); for the moment I use Chrome Remote Desktop to access the BrewPi from outside the home network.

Stefan