2014-05-31

DIY presentation clicker

I think it is very cool that with a board like the Arduino it is easy to make your own USB input devices that speak the regular HID protocol and therefore work with any modern computer (and even some phones and tablets) without any additional software or drivers. For example I made this emergency mute button that I still think is a very practical device. But making Bluetooth input devices used to be somewhat harder, until Adafruit released their Bluefruit EZ-Key. Its purpose is making it easy to create devices that work as Bluetooth keyboards and mice. And in the simplest cases, it doesn't even require a separate microcontroller. I got one and to test it I made this presentation clicker:



It has two buttons that are connected directly to Bluefruit's pins 2 and 3 that correspond to left/right arrow keys by default:



And then it's enough to provide power (I used a coin cell battery) and pair it with your computer. The form factor is reasonable so I could even imagine using it in real life:

Bluetooth thermometer

Some time ago I measured the temperature inside my fridge with a Raspberry Pi and a TMP36 sensor. That was cool, but obviously you don't need an entire computer running Linux just to report temperature. So I made a wireless thermometer using Adafruit's Trinket, a DHT22 temperature/humidity sensor and a cheap Bluetooth serial module from dx.com. Here's what it looks like:



And here's a diagram:



The connections are pretty straightforward, I used three AA batteries for power, which was fine for the 3.3V Trinket and the Bluetooth module. I connected the DHT22 sensor to the regulated 3.3V output on the Trinket. I only connected the RX pin on the Bluetooth module, because I was only going to be sending data. The DHT22 sensor also has one data pin and there's a 10K pull up resistor between the data pin and VCC.

As far as software goes, I used this library to talk to the DHT22 sensor, because the one from Adafruit that I used previously with a real Arduino didn't want to work on a Trinket for some reason. I also used this SendOnlySoftwareSerial library because I was only sending data and with the regular SoftwareSerial library the sketch wouldn't fit in Trinket's limited memory. You can the sketch I used here, it's a simple modification of the example sketch that comes with the DHT22 library.

To read the temperature from this thermometer, you need a device (phone, tablet, computer) with Bluetooth and a terminal application. It prints the temperature and humidity every two seconds:

2014-05-30

Bitcoin price ticker

You can get some cool stuff for cheap on dx.com. For example this TM1638 display board costs around $8 and has eight 7-segment digits, eight two-color LEDs and eight buttons. I connected it to a Raspberry Pi and made a Bitcoin price ticker:



Even though I didn't get any documentation with the board, the protocol it uses is well known on the Internet, I found this Arduino library and ported the parts I needed to Python to run on the Pi. You need three GPIO pins on the Pi to connect to DIO, CLK and STB0 pins on the board. You also need to connect the VCC pin on the board to the 5V pin on the Pi and GND to any of the grounds.

Getting a price to display is easy, Bitcoin exchanges usually provide this data via a JSON service. You can see my code here.

Like I mentioned before, the display board also has buttons, so it would be nice to extend this to display prices from multiple exchanges, using the buttons to select which price you want to see.