Files
hpr_website/www/eps/hpr1971/hpr1971_full_shownotes.html

165 lines
12 KiB
HTML
Executable File

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="generator" content="pandoc">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<meta name="author" content="Dave Morriss">
<title>BlinkStick (HPR Show 1971)</title>
<style type="text/css">code{white-space: pre;}</style>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link rel="stylesheet" href="http://hackerpublicradio.org/css/hpr.css">
</head>
<body id="home">
<div id="container" class="shadow">
<header>
<h1 class="title">BlinkStick (HPR Show 1971)</h1>
<h2 class="author">Dave Morriss</h2>
<hr/>
</header>
<main id="maincontent">
<article>
<header>
<h1>Table of Contents</h1>
<nav id="TOC">
<ul>
<li><a href="#introduction">Introduction</a></li>
<li><a href="#building-the-kit">Building the kit</a></li>
<li><a href="#the-software">The software</a></li>
<li><a href="#my-use-of-the-blinkstick">My use of the BlinkStick</a></li>
<li><a href="#blinkstick-pro">BlinkStick Pro</a></li>
<li><a href="#links">Links</a></li>
</ul>
</nav>
</header>
<h2 id="introduction">Introduction</h2>
<p>In late 2013 I noticed the local <a href="http://edinburghhacklab.com/" title="Edinburgh Hacklab">Edinburgh Hacklab</a> were offering soldering courses building a <a href="https://www.blinkstick.com/" title="BlinkStick"><em>BlinkStick</em></a>. I offered to sign my son Tim up to the next course since he wanted to learn to solder. He couldn't afford the time at that point, but we agreed to buy some <em>BlinkStick</em>s to build at home.</p>
<p>This episode describes some of our experiences with building and using the device.</p>
<p>The version we bought and built was the v1.0 release, since that and the <a href="https://www.blinkstick.com/products/blinkstick-pro" title="BlinkStick Pro"><em>BlinkStick Pro</em></a> were all that was available. The base version now available is v1.1, and there are several other products available from the manufacturer in addition to these. The company is called Agile Innovative Ltd, based in the UK.</p>
<h2 id="building-the-kit">Building the kit</h2>
<p>The v1.0 BlinkStick kit came with a nice quality PCB, a male USB type A connector, resistors, diodes and capacitors, an RGB LED and a socketed ATtiny85 micro-controller.</p>
<p><img src="hpr1971_img_001.png" alt="Components of the BlinkStick" /><br />
<em>Components of the BlinkStick</em></p>
<p>The <a href="https://www.blinkstick.com/help/build-1-0" title="Blinkstick v1.0 build instructions">build instructions</a> were great and very easy to follow. We had the suggested helping hands as you can see in the picture, as well as side and end cutters. The side cutters were better in general.</p>
<p>We added the six resistors first as recommended. For a first-timer this allows some chances to learn about bending the wires, properly and soldering neatly.</p>
<p><strong>Note:</strong> I don't know which picture belongs to which BlinkStick in this group. Some are mine, and some are Tim's. He's now an excellent solderer and has recently taught himself how to do Surface Mount soldering, which is more than I can do!</p>
<p><img src="hpr1971_img_002.png" alt="Adding the resistors 1" /><br />
<em>Adding resistor number 1, before cutting the wires</em></p>
<p><img src="hpr1971_img_003.png" alt="Adding the resistors 2" /><br />
<em>Now resistor 2 has been added, as seen from the top of the board</em></p>
<p><img src="hpr1971_img_004.png" alt="Adding the resistors 3" /><br />
<em>Now resistors 3, 4 and 5 have been added</em></p>
<p>The polarity of the Zener diodes is important as was made clear from the instructions.</p>
<p><img src="hpr1971_img_005.png" alt="Adding the diodes" /><br />
<em>Now we have resistor 6 and have added the two diodes</em></p>
<p>Next the capacitors were added, again being careful about polarity. This was not difficult given the excellent instructions. We didn't take any pictures of this stage.</p>
<p>This was followed by fitting the USB plug which needs to be anchored to the board and soldered to the circuit, making sure it is straight.</p>
<p><img src="hpr1971_img_006.png" alt="Adding the USB plug" /><br />
<em>The underside of the board while the USB plug is being fitted</em></p>
<p>Next the IC (integrated circuit) socket needed to be soldered on ready for the ATtiny85 chip. Then the RGB could be added. It was a little difficult to get this level and close to the board as you can see from the next picture.</p>
<p><img src="hpr1971_img_007.png" alt="The RGB LED close up" /><br />
<em>The RGB LED close up</em></p>
<p>Finally, the ATtiny85 chip was inserted into the socket, making sure to get the orientation right. This completed the board as can be seen in the final image.</p>
<p><img src="hpr1971_img_008.png" alt="The finished board 1" /><br />
<em>The finished board side view</em></p>
<p><img src="hpr1971_img_009.png" alt="The finished board 2" /><br />
<em>The finished board from above</em></p>
<h2 id="the-software">The software</h2>
<p>There are Python, Ruby and Node.js versions of the software available on <a href="https://github.com/arvydas" title="Blinkstick software on GitHub">GitHub</a>.</p>
<p>I installed the Python version thus:</p>
<pre><code>$ sudo apt-get install python-pip
$ sudo pip install blinkstick</code></pre>
<p>Just before preparing these notes I updated the software since it had been a while since I originally installed it:</p>
<pre><code>$ sudo pip install --update blinkstick</code></pre>
<p>Version 1.1.8 is the latest release at the time of writing.</p>
<p>This provides a command-line interface through the <code>blinkstick</code> command.</p>
<p>There is no manual page, but details of how to run the command can be obtained with the command:</p>
<pre><code>$ blinkstick --help</code></pre>
<p>Access to the BlinkStick device normally requires <code>root</code> access but the <code>blinkstick</code> command has the capability of creating a <code>udev</code> rule thus:</p>
<pre><code>$ sudo blinkstick --add-udev-rule</code></pre>
<p>Thereafter root permissions are not required. The rule is placed in the file:</p>
<pre><code>/etc/udev/rules.d/85-blinkstick.rules</code></pre>
<p><strong>Note:</strong> In the audio I said that the BlinkStick device is visible as a <code>/dev/*</code> device. This is not strictly true and probably misleading. It can be seen when using the <code>lsusb</code> command, but is not a mounted device that can be seen with <code>df</code>, which is what I implied.</p>
<p>Some of the features of the <code>blinkstick</code> command are:</p>
<pre><code>--brightness=LIMIT Limit the brightness of the color 0..100
--limit=LIMIT Alias to --brightness option
--set-color=COLOR Set the color for the device. This can also be the
last argument for the script. The value can either be
a named color, hex value, &#39;random&#39; or &#39;off&#39;. CSS color
names are defined http://www.w3.org/TR/css3-color/
e.g. red, green, blue. Specify color using hexadecimal
color value e.g. &#39;FF3366&#39;
--inverse Control BlinkSticks in inverse mode
--blink Blink LED (requires --set-color or color set as last
argument, and optionally --delay)
--pulse Pulse LED (requires --set-color or color set as last
argument, and optionally --duration).
--morph Morph to specified color (requires --set-color or
color set as last argument, and optionally --duration).
--duration=DURATION Set duration of transition in milliseconds (use with
--morph and --pulse).
--delay=DELAY Set time in milliseconds to light LED for (use with
--blink).
--repeats=REPEATS Number of repetitions (use with --blink and --pulse).</code></pre>
<p>Details of the command line interface are available in the <a href="https://github.com/arvydas/blinkstick-python/wiki" title="Python Wiki">Python Wiki</a>.</p>
<p>Simple use might be the following which sets the BlinkStick colour to blue:</p>
<pre><code>$ blinkstick blue</code></pre>
<p>By default the brightness is at the maximum, 100, but it can be turned down like this:</p>
<pre><code>$ blinkstick --brightness=30 green</code></pre>
<p>So, for example, in a script it is possible to make it pulse alternately red and green for 20 iterations like this:</p>
<pre><code>for i in {1..20}
do
blinkstick --pulse red
sleep 0.5
blinkstick --pulse green
sleep 0.5
done</code></pre>
<p>You can have more than one BlinkStick plugged in at any time. To address them you need to find their serial numbers:</p>
<pre><code>$ blinkstick --info
Found device:
Manufacturer: Agile Innovative Ltd
Description: BlinkStick
Serial: BS000473-1.0
Current Color: #002600
Mode: -1
LEDs: unsupported
Info Block 1:
Info Block 2:</code></pre>
<p>Then to refer to a specific BlinkStick use the <code>--serial=SERIAL</code> option:</p>
<pre><code>$ blinkstick --serial=BS000473-1.0 white</code></pre>
<p>There is also a Python programming interface, as mentioned, and more information about this (with example code) can be found on the <a href="https://github.com/arvydas/blinkstick-python/wiki" title="Python Wiki">Python Wiki</a> referred to earlier.</p>
<h2 id="my-use-of-the-blinkstick">My use of the BlinkStick</h2>
<p>My current project using the BlinkStick is quite simple. As an HPR volunteer I wrote a web scraper script to spot when a new show gets submitted and appears on the calendar page. I want to know this so I can run the show notes through the various scripts I am developing.</p>
<p>I run the scraper out of <code>cron</code> where it performs a check every 30 minutes. If there is something for me to check out I make the script generate a sound, write a pop-up message on screen and turn on the BlinkStick choosing the red colour.</p>
<p>I have a 7-port powered hub on my desk, and I leave the BlinkStick connected to this so that if the light comes on it's very obvious.</p>
<p>The script, called <a href="https://gitlab.com/davmo/hprmisc/blob/master/cronjob_scrape" title="cronjob_scrape"><code>cronjob_scrape</code></a>, is available on <em>GitLab</em>.</p>
<h2 id="blinkstick-pro">BlinkStick Pro</h2>
<p>In 2014 I also bought a <a href="https://www.blinkstick.com/products/blinkstick-pro" title="BlinkStick Pro">BlinkStick Pro</a> from Agile Innovative. This device does not have any LEDs itself but can control a wide variety of other LED systems. I have not yet built this device and I don't have any specific projects for it.</p>
<p>I do have an <a href="https://www.adafruit.com/products/1586" title="Adafruit NeoPixel ring">Adafruit Neopixel 24-LED ring</a> which I may use with this, but I would quite like to buy one of these reels of RGB LEDs on a self-adhesive strip and control it with the Pro.</p>
<p>I plan to do another HPR episode on the Pro when I have built it and set it up.</p>
<h2 id="links">Links</h2>
<ul>
<li>Edinburgh Hacklab: <a href="http://edinburghhacklab.com/" class="uri">http://edinburghhacklab.com/</a></li>
<li>BlinkStick website: <a href="https://www.blinkstick.com/" class="uri">https://www.blinkstick.com/</a></li>
<li>BlinkStick Pro: <a href="https://www.blinkstick.com/products/blinkstick-pro" class="uri">https://www.blinkstick.com/products/blinkstick-pro</a></li>
<li>Build instructions for BlinkStick v1.0: <a href="https://www.blinkstick.com/help/build-1-0" class="uri">https://www.blinkstick.com/help/build-1-0</a></li>
<li>BlinkStick Software: <a href="https://github.com/arvydas" class="uri">https://github.com/arvydas</a></li>
<li>BlinkStick Tutorials: <a href="https://www.blinkstick.com/help/tutorials" class="uri">https://www.blinkstick.com/help/tutorials</a></li>
<li>BlinkStick Python Wiki: <a href="https://github.com/arvydas/blinkstick-python/wiki" class="uri">https://github.com/arvydas/blinkstick-python/wiki</a></li>
<li>My <code>cronjob_scrape</code> script: <a href="https://gitlab.com/davmo/hprmisc/blob/master/cronjob_scrape" class="uri">https://gitlab.com/davmo/hprmisc/blob/master/cronjob_scrape</a></li>
<li>Adafruit NeoPixel ring: <a href="https://www.adafruit.com/products/1586" class="uri">https://www.adafruit.com/products/1586</a></li>
</ul>
<!--
vim: syntax=markdown:ts=8:sw=4:ai:et:tw=78:fo=tcqn:fdm=marker
-->
</article>
</main>
</div>
</body>
</html>