Bitcoin Price as an OS X Widget

There are many solutions for OS X Yosemite (open source, free or paid apps) to stay up to date with the latest BTC/USD exchange rate (the list to the Github repos can be found below). I wanted a simple solution that I can hack in a few minutes on a lazy Sunday night. The solution is a simple Today widget. To get the result in the shot below, continue reading.

today-widget-bitcoin-price

Setup

All you need is Today-Scripts (a simple OS X app that allows you to run shell scripts in your Today bar) and a small Python script and you’re set. Follow these instructions get the desired result:

  1. Download the latest build of Today-Scripts (latest build) or if you prefer, compile your own version from source code (Github Repo)
  2. Create a new python script (anywhere) from the following gist (get_data.py). The scripts calls the Coinbase REST api to get the latest price.
  3. Using Today-Scripts select the ksh shell and specify the python interpreter to use followed by the script’s absolute path (if you find a more elegant solution for this, drop a line in the comments section below)

btc-widget

 

 The Setup as a GIF

widget setup gif

Oh, and btw, the gif above was created by adopting this method: https://gist.github.com/dergachev/4627207

Alternatives

I don’t vouch for any of these options as I haven’t personally tested them

Menubar options:

Sparkfun: Color LCD Shield back-light problem patch

Problem

As I was working on a project that makes use of the Sparkfun color LCD shield I noticed after running sample code that the back-light is not working properly. Adding to that, it was a bit challenging to find Arduino (v1.0) compatible libraries to make this shield work as it was intended. The solutions for these 2 problems are summarized below.

Back-light fix

Credit is due where credit is due. The original hacker who, with a bit of research and reading a few comments on the product’s page, found the solution can be reached through this link. Although the description of the fix is quite straight forward, I though it could be simplified more.

The problem relies in a resistor on the board (R1) that was supposed to have the value of 15KOhm but was (for some reason) replaced with a 3.3KOhm resistor (as shown in the picture below).

Original Color LCD Shield - sku: LCD-09363
Original Color LCD Shield
sku: LCD-09363
images are CC BY-NC-SA 3.0

 

 

 

 

 

 

 

 

 

 

 

In order to resolve this issue and provide enough voltage to activate the back-light, this resistor needs to be short-circuited by soldering the edges of 2 components as shown in the picture below. A small solder drop is enough to provide you with an elegant fix.

 

 

Soldering fix
Solder the 2 edges and you’ll be good to go.
Close up for the fix
Close up for the fix

That should do it.

Libraries compatibility problems

I naively assumed that upgrading my Arduino IDE to version 1.0 would not break any existing library, however as it turns out it does. The libraries that enable the color LCD shield do not work with v1.0. The libraries that are available either use “WProgram.h” or “wiring.h” header files which have been merged in the new version of the Arduino IDE with the “Arduino.h” header file. In addition, replacing these header files with “Arduino.h” does not seem to fix the compilation error.

So in order to avoid hours of pain, Arduio IDE v0023 runs the LCD shield libraries perfectly well.