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); 
?>

Mining

Literally no idea what I’m doing here. Cryptocurrency mining. Time to learn more.

Switch Tags

Sam and I wanted to get all of the benefit of the Nintendo Switch Amiibo system without (very much of) the associated cost. So instead of investing our money into the plastic figurines we purchased:

  • an Adruino board (~£20)
  • a RFID board (~£15)
  • Some blank RFID programmable cards (~£7) but be sure to buy the correct ones. Earlier standards don’t work, as we discovered.

And then we did a bit of online research.

The first thing is how to wire the whole lot up. This is how we did it:

Wiring up the hardware

The next task is to program the Arduino. We used libraries that are linked to from

Worth a read

You need the latest RFID cards:

RFID

These are one-time-only writeable so it’s good that they are relatively cheap. Bottom line is – it all works and we were able to download the codes for the Amiibos, create our own cards with the relevant information, and use fruitfully. What a great system.

Algorithms

Possibly one of the coolest and simplest algorithms of all time. An easy way to find the greatest common divisor (GCD) of two numbers. This algorithm was discovered/created by Euclid and presented as a proposition in his Elements book.

5 REM Euclid's algorithm for greatest common divisor
  6 PRINT "Type two integers greater than 0"
  10 INPUT A,B
  20 IF B=0 THEN GOTO 80
  30 IF A > B THEN GOTO 60
  40 LET B=B-A
  50 GOTO 20
  60 LET A=A-B
  70 GOTO 20
  80 PRINT A
  90 END
Published
Categorized as Coding

Photon drives ePaper

One thing I’ve wanted to do for ages now is to use a Particle Photon board to place information onto an ePaper electronic ink display.

The problem has been that it is impossible to find code libraries for any specific ePaper device you might own. I bought the one below at reasonable cost and thus far have only managed to drive one third of the display. I’ll keep at it.