iSpindel

As part of my venture into home brewing I need* to monitor progress of fermentation. Typically this is done using a hydrometer – a weighted glass bulb thing that floats in the brew to a certain depth. The idea is that the more sugar there is in the brew, the denser the liquid is, and the higher the hydrometer floats. As the sugar is converted to alcohol by the yeast, the liquid gradually becomes less dense and the specific gravity – alcohol strength – can be read off.

Two problems with this with the closed cask Pinter system I have on order:

  • The cask isn’t tall enough to accomodate a classic glass hydrometer
  • I couldn’t read it anyway as it is sealed in.

The solution is(n’t) simple! I bought an iSpindel. This is an electronic hydrometer comprised of a waterproof plastic cylinder containing a couple of circuit boards and a rechargeable battery. Basically it monitors temperature and tilt of the device. The more the device tilts in the liquid, the more dense the liquid is, and the more sugar there is and the less alcohol there is.

The third circuit connects to the wifi in the house and sends data.

To access the data you need to connect to a ubidots account which is a generic dashboard system designed for monitoring measures and triggering events based on values.

What I really wanted was to link this with IFTTT but there doesn;t appear to be an easy channel on either ubidots or IFTTT to enable that. The perfect scenario for me would be to collect the data over time and be able to plot specific gravity by temperature by time butthere is no way to readily access this data without paying a huge subscription fee.

So I’m building my own, using the cURL function in PHP to access the latest JSON data deom ubidots. It’s early days but I’m learning as I go.

<?php

$headers = array();
$headers[] = "x-auth-token: REMOVED";
$headers[] = 'Content-Type: application/json';
echo 'Headers set up in array...</p>';

$ch = curl_init();
echo 'CURL initiated empty...</p>';


curl_setopt($ch, CURLOPT_URL,"https://things.ubidots.com/api/v1.6/devices/ispindel000/temperature/values/?page_size=1");
echo 'URL set...</p>';

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo 'Returntransfer set...</p>';

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
echo 'Headers set...</p>';

$fp = fopen("brew.txt", "a");
echo 'File initiated for writing...</p>';

//fwrite($fp, "Go...");
//echo 'First line written...</p>';

curl_setopt($ch, CURLOPT_FILE, $fp);
echo 'File for CURL to write to set...</p>';

curl_exec($ch);
echo 'CURL executed...</p>';
if(curl_error($ch)) {
    fwrite($fp, curl_error($ch));
}
curl_close($ch);
fwrite($fp,"\r\n");
fclose($fp);
//    $state_result = json_decode($state_result); 
?>