Tag Archives: RaspberryPi

Raspberry Pi Project 1: Bitcoin value ticker

With the recent explosion of the Bitcoin value, I decided to do to build a display with the current value shown in Dollar and Euros.

The Bitcoin Exchange MtGox offers an API to get the current value (And much more). One line of python is sufficient to get the last value in Dollar or Euros (borrowed from here):

 euro = float(json.loads(urllib2.urlopen('https://mtgox.com/api/1/BTCEUR/ticker').read())['return']['last']['value'])

Now we need to get it on the screen. I noticed a directory “python_games” on the Raspberry: a collection of simple games that appeared to use  pygame, a really easy to use SDL based module mainly intended to write games. This makes it possible to create a full screen application without the need of an X Server and more complicated graphical toolkits.

So, all I need to do is create a scheduler which triggers the retrieval of the BTC value, format string and blit them on the screen.

Finally, I added a line to /etc/rc.local, so the application starts automatically after booting:

python /home/pi/btctracker/btc.py &> /dev/null &

The Result



The decision to use python and pygames was definitely right for this application. Any other tool I could think of would have taken me much more time and lines of code.

Is it useful? It definitely triggered some interesting discussions on Bitcoins and it current valuation. Shops accepting Bitcoins could use the ticker to display the current exchange rate, but in for that use case I would add the possibility to pay (camera to scan the wallet QR, numeric keypad to enter the amount).

Small Raspberry Pi projects

Another batch of raspberies arrived yesterday. Why have one RPi when you can have two? The new one has a transparant housing this time. Nice and nerdy.

I have many ideas already, but an idea is nothing without execution. So I have decided to do couple of small Raspberry Pi projects in the coming weeks.

The idea is really to get something up an running as soon as possible (MVP in hipster speak) which means:

  • Quick and Dirty (TM) coding
  • Copy/borrow as much code from my or other’s project (and Stackoverflow.com)
  • Only the main functionality, no nice to have features

Stay tuned for the first project!