Automatic Thermostat Control Based on Location and Weather

The Pittsburgh Perl Workshop will be held at the Carnegie Mellon University on October 9-10, 2010. The PPW is a gathering of Perl programmers from around the world (and near Pittsburgh) to learn more and discuss the future of Perl.

At this year’s PPW, I will be giving a talk called, “Connecting the Internet of Things with Perl“ (visit for schedule info). I will also explain how to create an Internet of Things application using off-the-shelf Perl modules and web control technology by ioBridge.

As you may or may not know, Perl is a really powerful programming language that enables everything from fast prototyping of web applications to large-scale software platforms. What makes the language unique is the library of modules available to you. If you get a great new idea for a web app, you can get started quickly and find modules that others have written. In some cases, it’s literally copy-and-paste.

A big movement for the past few years is this concept of The Internet of Things. More things will be on the Internet than people in the next few years, so my talk is to highlight why Perl is still relevant after 20 years and needs to be apart of this emerging technology. Internet of Things applications involve connecting sensors and controllers to the web. Perl is perfect for parsing lots of data, pushing data into databases, and connecting services together, known as “mashups”.

My Internet of Things project, written in Perl, allows your current location and home weather conditions to control your home heating and cooling system.

Location Aware Home Automation using Google Latitude API and ioBridge API

I call it,  ”Location Aware Home Automation”. You don’t have to do anything to control your HVAC/Thermostat, it all happens based on where you are. If you are home, the thermostat regulates the inside temperature as normal. When you leave, systems turn off or enter power saving modes. When you get near your home, the heating/cooling system kicks back on so you have a comfortable temperature by the time you get back home. In order to pull off all of this passive and automatic functionality, I have mashed up several APIs from Google Latitude, WeatherBug, and ioBridge.

Using the API for Google Latitude, I track the location of my Android mobile phone. When I get near my home, I check the weather using Google Weather API, WeatherBug API, and my home temperature (via ioBridge) to see if I need to to use the air conditioner, the heater, or neither. If I do need to control the HVAC, I send the control commands using the ioBridge API that routes the commands to the IO-204 controller that’s hooked up to my thermostat.

This application is really just a beginning. Right after I got everything working, I started having a flood of ideas. I can see some real power here.

The ‘How To’ Portion of the Show

Google Latitude

You have to enable Google Latitude on your mobile phone and get your Badge ID. This ID represents your position in the world, your latitude and longitude. Visit the Google Latitude API site for more information.

Install the latest Geo::Google::Latitude Perl module from – this module completely abstracts the access to the Google Latitude API for you. All you have to do us pass your ID and the module returns the date, time, last known latitude and longitude (the values are in decimal degrees).

use Geo::Google::Latitude;
my $gl=Geo::Google::Latitude->new;
my $id="7832225593622256926";
my $badge=$gl->get($id);
my ($lat2, $lon2) = $badge->point->latlon;

Calculating how far you are away  from home

You have to figure out how far you are from home, you do this by doing some math. Oh wait, there’s a Perl module for that. Install Geo::Distance and all you have to do is tell it what latitude and longitude to compare and it spits out the distance.

use Geo::Distance;
my $geo = new Geo::Distance;
### Home Location
my $lon1 = "-79.76408";
my $lat1 = "39.980342";
### Calculated Distance
my $distance = $geo->distance( 'mile', $lon1, $lat1 =>; $lon2, $lat2 ); # Use 'meter' to calculate distance in meters

Getting the Weather

You can use a number of weather APIs to get weather data for your home location. All you need to know is where you live. The easiest to implement is Google Weather (Weather::Google), but the WeatherBug API has a lot more information you can use for other Internet of Things things you may do.

 use Weather::Google;
my $gw = new Weather::Google(15401); # Zipcode
my $current_outside = $gw->current->{temp_f}; #Use temp_c for Celsius

Connect to ioBridge

All you have to do to connect with ioBridge is to send command via the ioBridge Widget API. First you create the control widgets for your heating and cooling system. For mine, I can use relays. Others may need serial strings, which you can send as well. Once you have the widgets created, locate there widget ID’s and send them to the API.

use LWP::Simple;
my $Air_Conditioner_widgetID = "Gb2Q1FUKPmzZ"; ### Replace with your widget ID's
my $Heater_widgetID = "9c3WEGHKemnzJ";
my $Inside_Temp_widgetID = "D32SDghy98iOu";
my $ioBridgeAPI = "";
$ioBridgeAPI = "" . $Inside_Temp_widgetID . "&value=1&format=text";
my $current_inside = get($ioBridgeAPI);
### Test if the heater or the air condition should be turned on
if ($current_outside >= 78 && $current_inside >= 72) {
$ioBridgeAPI = "" . $Air_Conditioner_widgetID . "&value=1&format=text";
elsif ($current_outside $ioBridgeAPI = "" . $Heater_widgetID . "&value=1&format=text";

Putting it all together

Once you have the entire built all you have to do is call the app periodically using CRON Linux or Task Scheduler on Windows. Here is a TXT file of the Perl application with all of the parts tied together, probably will be easier to read and understand.

The hardware side uses the ioBridge IO-204 connected to the control lines of a thermostat or an HVAC control box. The lines switch at 12 volts, so I use relays trigger them. Other thermostats that I researched use serial lines which the IO-204 can tap into using RS-232.

It may seem like a lot of work, but just think about what is happening. Feeds from Google Latitude and WeatherBug are being processed and passed to your home network via the Internet. All of this is happening without your direct interaction – your things are working for you. I hope that you can see that is a start of some pretty amazing applications of technologies that will advance over time. A lot has changed in the past year, I can’t image what comes next.

If you get around to building a project like this, please drop me a line. I love this stuff.

Dominion Card Game Review and Storage Project

Thanks to my friends in the StruebSquad, I have been playing a lot of board games as of late. They started me off with some pretty stock games and then slowly introduced me to deeper Euro Games, Cooperative Games, Abstract Strategy, and Miniatures Games. Now I know what Meeples are, I have said, “I have Wood for Sheep”, and I have even oar raked another ship recreating an ancient naval battle.

Dominion Card Game Storage

The latest game I have been playing is called, “Dominion” by Donald X. Vaccarino and published by Rio Grande Games in the United States. Dominion is a board game style card game. In the box you get a number of action cards, resource cards, and victory point cards. Each game you pick 10 of the action cards which will be common for all of the players. With resource cards like Copper, Gold, Silver, and Potions, you can buy action cards, resource cards, and victory point cards. At the end of the game you add up the victory point cards and the player with the most points wins the game. Each turn you can play an action card and/or buy cards if you have the right resources. Dominion starts with collecting actions and resources and finishes with a race to gain victory points. During the whole you are striking a balance with resources, actions, and victory points.

I really love this game and my appeal for Dominion is three fold:

    • It’s highly re-playable – with new expansion and card combinations, you can play a new game almost every time
    • It’s really balanced – everyone has the same chances to get the common action cards, unlike a lot of other card games
    • It has a lot of strategy – you have to adapt to how other people play, find good card combos, and know when to switch between gaining resources to gaining victory points


You might be thinking, “Hans, I have not heard of this game before, what gives?” My quick reply would be, “There are a lot of games out there,” Hans said gamely. If you have grown up in the United States, there are a few games that everyone has been introduced to – Monopoly, Sorry, The Game of Life, Candy Land – if you are “lucky” you might have played Risk, Scrabble, Stratego, and Trivial Pursuit. In general, you will notice that US favorite games are mostly luck based, meaning you use a randomizer (dice or a wheel) and then move a piece on the board. There is a big part of the game you can’t control, but in most cases these games are fun. Some of my best memories as a kid was playing games with the family and extended family. Now, in other parts of the world the games are less luck based and more choice based. Most European and Korean games are games played with a lot of choices. You have to choose what to do and each player has the same opportunity. As long as your playing board games, I am okay with either style of game or a game with a good combination of luck and choices. I recommend Lost Cities, Pandemic, Acquire, Settlers of Catan, Power Grid, and Divide and Conquer 😉 to name a few gateway games.


The designer and publishers of Dominion have released multiple expansions and promo cards that add more action cards and twist to the base game. An issue of storage and portability comes into play. You want to take Dominion over to a friend’s house or to a convention, you would have to carry 4 boxes. After some research online [Labels, Box], I created my own storage solution. I took one box and pasted in dividers. Using card stock and labels, I then added dividers for each set of cards. The result is that all of the cards are in one box in order like a file cabinet.

Dominion Card Game Storage

Looks like there will be a new expansion for Dominion called Prosperity that is scheduled for release Aug/Sep 2010. Just maybe it will be ready for Gen Con 2010 that starts in early August this year. The good news is that I think that expansion will fit in my uni-box as well. The box is getting heavy.

It’s time for you to Throne Room + Woodcutter and buy Dominion and the expansions.

Mini Vox Robot Hacking

Yes, I went to Radio Shack today. And, yes, I will still call it Radio Shack. And, yes, sometimes you need a quick electronics fix. I get most of my stuff online these days.

Radio Shack had the Erector Spykee Mini Vox robot on sale for $10. The Mini Vox takes voice commands and makes the robot move, talk, dance, and even fire a “laser.” The box says, “Ages 7+” – I fit that category. The box also says, “Some assembly required.” It should have said, “Some de-assembly required.”

Mini Vox Voice Controlled Robot

While playing with the demo model at the store, I realized that I could reuse the voice commands to set inputs on a microcontroller.

The voice commands go something like this:

“Mini Vox”

Robot beeps


Robot moves forward

Here are all of the commands and their response:

    1. “Forward”DC motors get positive voltage
    2. “Backup”DC motors get negative voltage
    3. “Turn Left”One DC motor gets positive voltage and the other negative
    4. “Turn Right”One DC motor gets positive voltage and the other negative
    5. “Laser War”LEDs flash and RGB LED flashes different colors
    6. “Yo Man”Says “Yo Man” back at you and RGB LED flashes different colors
    7. “Electro Dance” – Makes sounds, LEDs flash, RGB LED flashes different colors, and DC motors pulse on and off
    8. “Destroy Target”Says, “This is my favorite,” makes sounds, flashes LEDs, and RGB LED flashes colors

When I got Mini Vox home, I ripped it apart. I was quite surprised how responsive the voice commands are and how many parts are inside this little robot. Most of the parts are reusable.

Here’s what you get for your $10 investment:

    • Orange LED (x2)
    • RGB LED
    • DC Motor (x2)
    • Motor Driver Circuit Boards (x2)
    • 8 ohm Speaker
    • Microphone
    • Slider Switch
    • Momentary Push Button
    • Lots of screws

Mini Vox Guts

The forward and the back voice commands are the easiest to tap into. You can disconnect the DC motors and connect them to a digital input of a microcontroller and now you can use voice commands to set the state of 2 digital inputs and act on them.

If I come up with something clever, I will let you know. But, the first piece of my Iron Man suit has fallen into place.

$10 Mont Blanc Rollerball Hack

My dad gave me a Mont Blanc pen as a gift a while back. I love the pen – it writes amazingly smooth, it’s rather expensive, and I also don’t want to lose it.

On the site, I found a pen hack tutorial. Someone figured out that the refill for the Mont Blanc rollerball pen is the same as the refill for the Pilot G2 pen. The Mont Blanc is so nice because of the tip and the refill has the nib right on it. I picked up some office supplies and recreated the project. I bought a Pilot G2 for $3 and a Mont Blanc rollerball refill for $7 at Staples. My Pilot G2 / Mont Blanc rollerball pen turned out great. I feel much more comfortable carrying the hacked version around.

The Pilot G2 Mont Blanc

Here are some tips:

    • You can get blue or black Mont Blanc refills.
    • The Pilot G2 is the “0.7 Fine Point” version of the pen.
    • The Mont Blanc rollerball refill is slightly larger than the ink cartridge of the Pilot G2.

All you have to do is trim down the Mont Blanc refill and match the size. I took some sand paper and smoothed down the plastic endcap to match the size of the Pilot G2 rollerball cartridge.

Here is the tutorial that I found that inspired me to create my own $10 Mont Blanc Rollerball.

TouchShield Slide Two-way Communications

Over last summer, I got the GamePack from Liquidware which includes a touch screen display, joystick, microcontroller, and battery pack. With this kit you can make a GameBoy from scratch. With some blood, sweat, and tears, I was able to re-create some games like Asteroids and Tetris.

The touch screen is called the TouchShield Slide which is a 320×240 OLED and resistive touch screen. The screen also has a microcontroller that is Arduino compatible and expands your program space. Since the screen is really a microcontroller in disguise, it can be used for many types of projects. Overall I am very happy with the screen, but I realized I didn’t know how to use it very well. I set out to learn and develop a protocol / reusable library that allows the screen to talk to a microcontroller and vice-verse. So I wanted to take a moment and explain what I learned – maybe you can get going faster than I did.

The Goal

My goal is to be able to display data on the screen that has been received from another device. The data requested would be initiated by a touch on the screen. The protocol has to be consistent and reliable, while being flexible enough to be the basis for future projects.

Touch -> TouchShield Slide -> Arduino -> TouchShield Slide

Programming Tips and Tricks

I found quite a few libraries and resources on  I also discovered quite a few important things through my trial and error. My biggest frustration was with programming and figuring out the IDE. Here are some tips.

  • To program the screen use the Antipasto Arduino / Aardvark IDE
  • Program the screen and Arduino separately – make sure the IDE has the proper device selected
  • To put the screen in program mode, press the switch beside the power connector – it’s in program mode when the LED on the backside is red

TouchShield Slide Serial

Serial data sent and received by the TouchShield Slide uses the hardware serial lines.

To setup the serial connection, place this line in your setup code block:


Now you can read and write to and from the serial buffer. To read in a whole string, use a byte array to store bytes from the serial buffer when serial data is available. To write to the serial buffer, simply use serial print.

char charIn = 0;
byte i = 0;
char stringIn[32] = “”;

while(Serial.available()) {
charIn =;
stringIn[i] = charIn;
i += 1;


Arduino Serial

On the Arduino side, you have to use some form of Software Serial that sends and receives data on Pins 2/3. I have found that the Adafruit SoftSerial Library, “AFSoftSerial.h”, works the best. It seems to be reliable and produce consistent results when talking to the TouchShield Slide. Reading and writing from a software  serial buffer is about the same as a hardware one with this library.

To use software serial, follow these steps:

  • Include the “AFSoftSerial.h” library in your Arduino code header space
  • Define the RX and TX pins
  • Instantiate the software serial
  • Initiate the software serial line
#include AFSoftSerial.h

#define RX_PIN 3
#define TX_PIN 2

AFSoftSerial touchSerial = AFSoftSerial(RX_PIN, TX_PIN);

void setup() {

Demo Project

I took a moment to put together all of the things that I learned into a quick demo project. This project displays a random number on the screen. The random number is being generated by an Arduino, sent via serial, and requested by a touch of the TouchShield Slide.

Random Number from Arduino Displayed after Detecting a Touch…

Visit Liquidware’s App Store to download the source code and library for this demo project.

Steam Pumpkin – My Steampunk Pumpkin

Halloween is one of my favorite times a year being ShadowLord and all. I was Batman three times in my life and only once as a kid. Pumpkin carving is something I also get into. My first pumpkin at age 9 was an old farmer smoking a pipe. It even had a twinkling red LED in the corncob pipe. After burning up a handful of LEDs my dad taught me about current limiting resistors.

Fast forward 20 years and I am still shoving LEDs into pumpkins. This year my inspiration comes from steampunk, a growing subculture fascinated with steam-aged garb and future technology fusion. Steampunk was born of the H. G. Wells and Jules Verne visions of futuristic technology and style. Call it what you want, Steampunk is an inspiring movement of makers and re-users of technology and materials.

Here is my steampunk-inspired pumpkin.

Where do you start?
I cobbled together whatever I could find that resonated steampunk. I found my Mom’s old purse that had some faux leather, brass loops, and a gold chain. I also grabbed an old candle holder, a lampshade, a door hinge, a metal coffee filter, and some brass brads. My Dremel was used to drill, cut metal, and cause sparks (insert grunt).
Full of hot air
I knew that I was going to add some technology to the design and I settled on an automated fog machine that would blow smoke from the ears of the pumpkin. Okay, I know it’s a little literal, but it is a steam pumpkin.
How do you do that?
Using the ioBridge IO-204, I rigged up the fog machine to trigger when someone walked in front of the pumpkin. I used a passive infrared sensor from Adafruit to detect motion. The IO-204 has an upcoming feature that allows for onboard logic, meaning you can break off of the Internet and have local controls take over. To integrate it with the fog machine, I tapped into the wireless remote control that came with the fog machine. This made it easy to control using a single relay. To light the pumpkin, I bought a BlinkM RGB LED Blaster from Sparkfun. The LEDs are high-intensity lights that you can mix colors together. It turned out to be a neat touch. When someone gets close, I set the color with the IO-204 to an evil red to accompany the smoke.
For more information and more “How-to” detail, check out
Introducing The Steam Pumpkin
Here is a YouTube video of “Steamy Wonder” in action:

Internet-enabled Message Center

What are you up to now?

I took the leap and bought an Arduino from LiquidWare. Arduino is an open-source microcontroller that has a processor, some digital I/O pins, and analog inputs. You can create little standalone programs that monitor inputs, control LEDs, and pretty much anything that you dream up. My favorite projects are ones that involve the Internet. A microcontroller is rather simple by itself, but what if it could use the web to get answers, send an email, maybe update my Twitter status? That means there is an unlimited number of projects ahead – Microcontrollers collaborating in cyberspace. The missing link for the web part is the ioBridge IO-204. I know you are no stranger to the IO-204, but for those of you who have not heard. The IO-204 sits on my network and relays data from its channels to servers and back into my network. It allows for remote control and monitoring without network configuration and programming. One of the expansion boards is a two-way serial board that accepts serial strings and connects them to APIs of web services that ioBridge interfaces to and sends back responses. For instance, I can send the commands, “[[[calc|9*9]]]” and this returns 81. OK, maybe not impressive on the surface, but that result came from Google Calculator. Anything Google Calculator can solve, your microcontroller has access to those results. For more examples, visit the Serial Web Services API on the wiki.

Message Center Project
I wanted to combine these two worlds with a sample project – maybe it will inspire you to come up with something better, spark some ideas that you have. I have my Arduino measuring my outside temperature here in Pittsburgh, which is an analog input scaled to Fahrenheit. At any moment I can press a button and get the temperature on the LCD screen – no Internet required. Since I have been planning a work trip to Atlanta, I also wanted to compare my temperature with hot-lanta’s. So, my project solves that. Using the “weather command”, I am able to get the weather anywhere in the world by zip code or city name.
I added a few more things to the message center. With another button, I can get Google’s current stock price. My strike price was $405, so I have been watching it closely. If it gets below $405, I get an automatic email from my message center. The stock quote comes from the Yahoo Financials API.
I have one more button that emails me a secret message when it’s pressed. I put this in here for when my mom comes into my room from when I am on the road. It’s aptly labeled, do not press. Next time, I will hook it to a light sensor in the basement to catch her when she turns on my lights. I am sure you all have the same issues with your mom.

Source Code

The Arduino requires some c-like programming and I wanted to include the sketch for you to steal and use for your projects. You will see how I send the serial commands from the Arduino to the IO-204 using the UART serial connection (pins 0/1) and receive and parse the incoming results. I use a SoftwareSerial port for the LCD results. The pushbuttons are software debounced and use pull-up resistors for solid digital connections. The LED’s linked to each button use a 330-ohm resistor to protect them. I was aided by the Arduino Inputs tutorial on, Debounce Tutorial, and the ioBridge Wiki / Forum. Please let me know if you have any questions, maybe I can help. I have learned a lot about handling strings on the Arduino.

// Message Center using Arduino and the ioBridge IO-204
// An open-souce Shadowlord Project

#include SoftwareSerial.h>

// SoftwareSerial Pins
#define rxPin 2
#define txPin 3

// Setup Software Serial
SoftwareSerial softSerial = SoftwareSerial(rxPin, txPin);

// Global Setup
int middleLED = 11;
int rightLED = 10;
int leftLED = 12;

int leftButton = 5;
int leftButtonCurrent = LOW;
int leftButtonReading;
int leftButtonPrevious = HIGH;
long leftButtonTime = 0;
long leftButtonDebounce = 200;

int middleButton = 4;
int middleButtonCurrent = LOW;
int middleButtonReading;
int middleButtonPrevious = HIGH;
long middleButtonTime = 0;
long middleButtonDebounce = 200;

int rightButton = 6;
int rightButtonCurrent = LOW;
int rightButtonReading;
int rightButtonPrevious = HIGH;
long rightButtonTime = 0;
long rightButtonDebounce = 200;

int tempPin = 5;
int tempAnalog = 0;
int tempF = 0;

char* currentRequest = "";

// Start up program
void setup() {

pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);

pinMode(leftLED, OUTPUT);
pinMode(middleLED, OUTPUT);
pinMode(rightLED, OUTPUT);

pinMode(leftButton, INPUT);
pinMode(middleButton, INPUT);
pinMode(rightButton, INPUT);




// Setup LCD

// Test LEDs
digitalWrite(leftLED, HIGH);
digitalWrite(middleLED, HIGH);
digitalWrite(rightLED, HIGH);


digitalWrite(leftLED, LOW);
digitalWrite(middleLED, LOW);
digitalWrite(rightLED, LOW);


// Start main program loop
void loop(){

// Get Analog Input and scale as temperature for ioBridge temperature sensor on arduino
tempAnalog = analogRead(tempPin);
tempF = tempAnalog / 6.875;

// Monitor left button status and debounce
leftButtonReading = digitalRead(leftButton);

if (leftButtonReading == HIGH && leftButtonPrevious == LOW &&
millis() - leftButtonTime > leftButtonDebounce) {
if (leftButtonCurrent == HIGH) leftButtonCurrent = LOW;
else {digitalWrite(leftLED, HIGH);
softSerial.print("Outside: ");
moveCursor("02", "01");
softSerial.print("Atlanta: ");
leftButtonCurrent = LOW;
//Request temperature in Atlanta via ioBridge
digitalWrite(leftLED, LOW);
leftButtonTime = millis();

leftButtonPrevious = leftButtonReading;

// Monitor middle button status and debounce
middleButtonReading = digitalRead(middleButton);

if (middleButtonReading == HIGH && middleButtonPrevious == LOW &&
millis() - middleButtonTime > middleButtonDebounce) {
if (middleButtonCurrent == HIGH) middleButtonCurrent = LOW;
else {currentRequest = "Google";
digitalWrite(middleLED, HIGH);
softSerial.print("GOOG: $");
middleButtonCurrent = LOW;
//Request Google Stock Price via ioBridge
digitalWrite(middleLED, LOW);
middleButtonTime = millis();

middleButtonPrevious = middleButtonReading;

// Monitor right button status and debounce
rightButtonReading = digitalRead(rightButton);

if (rightButtonReading == HIGH && rightButtonPrevious == LOW &&
millis() - rightButtonTime > rightButtonDebounce) {
if (rightButtonCurrent == HIGH) rightButtonCurrent = LOW;
else {
digitalWrite(rightLED, HIGH);
softSerial.print("Alert: ");
rightButtonCurrent = LOW;
//Send email via ioBridge
Serial.print("[[[email||Alert|Mom, is pressing your buttons]]]");
digitalWrite(rightLED, LOW);
rightButtonTime = millis();

rightButtonPrevious = rightButtonReading;

// Display serial messages
if(Serial.available() > 0){


char charIn = 0;
byte i = 0;
char stringIn[32] = "";

while(Serial.available()) {
charIn =;
stringIn[i] = charIn;
i += 1;

if (currentRequest == "Google") {

int stockPrice = atoi(stringIn);
moveCursor("02", "01");
stockPrice = stockPrice - 405;
softSerial.print("Change: $");
currentRequest = "";


// End program loop

// ioBridge Serial LCD Functions and Parameters (for SoftwareSerial)

void displayMessage(char* message){

void clearLCD(){
softSerial.print(0xFE, BYTE);

void setBacklightBrightness(int level){
// level
// 0=Off -> 9=Brightest

softSerial.print(0xFE, BYTE);

void setBacklightTime(int level, byte seconds){
// level
// 0=Off -> 9=Brightest

// seconds
// 01 = 1 seconds => 06 = 60 seconds

softSerial.print(0xFE, BYTE);
softSerial.print(seconds, BYTE);

void moveCursorHome(){
softSerial.print(0xFE, BYTE);

void turnCursorOn(){
softSerial.print(0xFE, BYTE);

void turnCursorOff(){
softSerial.print(0xFE, BYTE);

void turnBlinkingCursorOn(){
softSerial.print(0xFE, BYTE);

void turnBlinkingCursorOff(){
softSerial.print(0xFE, BYTE);

void scrollMessage(int row, int speed, char* message){
// row
// 1=First Line -> 2=Second Line

// speed
// 0=Slowest -> 9=Fastest

softSerial.print(0xFE, BYTE);
softSerial.print(0xFE, BYTE);

void moveCursor(char* row, char* column){
// row
// 01=First Line -> 02=Second Line

// column
// 01=First Position -> 16=Last Position

softSerial.print(0xFE, BYTE);

void drawHorizontalGauge(int row, char* leftLabel, char* rightLabel, char* length){
// row
// 1=First Line -> 2=Second Line

// leftLabel and rightLabel
// 2 character labels

// length
// a=Empty -> k=Full (filled in from left to right)

softSerial.print(0xFE, BYTE);

void drawVerticalGauge(int height){
// height
// 0=Bottom -> 8=Top (filled in from bottom to top)

softSerial.print(0xFE, BYTE);


Bonus Project

It’s simple, but I hacked together a power supply for the Arduino, which gets power from USB or a coaxial input from a transformer. I wanted to only run one brick, wall wart, so I hacked a USB cable. There are 4 wires in the USB cable (from

2D-WhiteData –
3D+GreenData +

The IO-204 has a regulated 5VDC and ground (up to 1A – 4A total draw depending on supply) on each channel, so using a terminal strip, I connected the VCC and GND to a cut in half USB cable.

It’s magic – look ma, only one power source.

Death Tag – Spitball with Tic Tacs

You’re It!

Death Tag is a full contact game using a McDonald’s straw and various projectiles – the most lethal of which is the Tic Tac – 1.5 calories of pain. This is Death Tag’s story… Pass on the fun, er, the mayhem…You’re it!

I invented the game as a kid when I discovered that a Tic Tac and a McDonald’s straw had roughly the same diameter. A fresh Tic Tac fits almost perfectly into the straw. This principle makes the combination nearly lethal. Over the years, I have expanded on the design and have tested straws from every fast food chain in the United States and projectiles of all sorts.

The Straw

The McDonald’s straw has one of the largest diameters, with a straw from Starbucks a close second, and an In and Out Burger straw third (West coast glocking). Always have multiple straws on hand – you never know if you need back up muzzleloaders. Tic Tacs become sticky, so avoid copious spit.

The Projectile

The Tic Tac fits perfectly inside the McDonald’s straw. My independent testing proves that this combination is the most fierce with the highest muzzle velocity. The Tic Tac is the most accurate and longest shooting projectile I have used. It also leaves a white mark on your targets. There are two drawbacks though – stickiness and cost. Saliva + Tic Tac equals jammed barrel on occasion. I have recently switched to un-popped popcorn. This projectile is cheap and somewhat pointed to being your enemy to a swift submission. Popcorn also allows for some advanced techniques like “The Rain Maker”.


Load the projectile, use your tongue to stop up one end of the straw. Build up some pressure and move your tongue. You can gets some serious distance and accurate shots this way.
“The Machine Gun” or “The Rain Maker” technique requires a cheek full of popcorn. Load up some popcorn and shuffle the kernels into the barrel while blowing. Make it rain destruction on your opponent.

Origin of the Name

Death Tag started picking up steam in the early 2000’s. I was on the road a lot and drove solo across the country many times. On a drive from Columbia, SC to Melbourne, FL, my friend Dale and I stopped at a truck stop. The trucker’s paradise had everything, a Micky D’s and convenient snacks. I bought up a supply of Tic Tacs and grabbed a handful of straws. I explained the premise to Dale and it soon involved us shooting cars out of the window. We assigned point values to certain objects that you hit. For example, the side a truck was 1,000 points, but a minivan is 5,000 points. A car window had the point value of 10,000 points and a road sign was 15,000 (since you could shot out and arc it – we called it the golden arch). The ultimate thing we shot was a Target sign on the side of a tractor trailer – 50,000 points. The “freshmint” or white Tic Tacs also leaving a little white mark to be proof positive of a successful hit. We started calling it, “Death Tag” because we were paying more attention to hitting our targets than driving safely.

A Word of Caution

It’s called Death Tag for a reason. Be careful, you could die, lose an eye, or leave a welt. I know it sounds fun, but I am a trained professional. I recommend discussing the side effects with a doctor and always wear proper eye protection.

iTurn – iPhone and iPod Touch Hack

Since my toaster has been on the Internet Twittering my toasting habits, I have been flooded with email asking what I was going to do next. To be fair, most of the email suggested that I had too much time on my hands. My mom got me an iPod Touch for Christmas (she gave it to me a few days early). I have not had the thing out of my sight since she surprised me with a wonderful gift. She also gave me Batman which I transferred to the iPod. I turned the screen about 44 times a minute while watching The Joker and The Dark Knight try to out smart each other. This got me thinking, “Could I control a motor with the movement of the iPod?” I had my next hack.

The iPhone or iPod Touch has an accelerometer that detects how the device is oriented. As the devices moves off axis (from straight up and down) the screen rotates. I want to use that feedback to control the position of a motor or servo or cause specific events to happen depending on the device’s position.

Taking the ioBridge IO-204 module, I connected the servo controller and a servo to one of the channels. On the servo I taped a Best Western hotel pen to show the movement of the servo. I found from hours of testing that the Best Western worked the “Best” and Hampton Inn worked slightly worse.

iTurn Setup
On the ioBridge website, I created 3 widgets that corresponded with the orientation of the iPod. “Left” for when tilted towards the left, “Right” when I turned right, and “Forward” when I was holding the iPod normally (straight up and down).

Warning: The next part involves some light programming. I made a quick HTML file with some JavaScript that detected the orientation of the iPod and called the appropriate widget. The orientation code is below for those of you that are interested in trying this for yourself:

function updateOrientation() {
case 0: widgetExecute(“Upright Widget ID”);

case -90: widgetExecute(“Right Widget ID”);

case 90: widgetExecute(“Left Widget ID”);

Load up the completed HTML file on your iPhone or iPod Touch and now you can control a servo with the turning of your iPhone. I call it “iTurn” (didn’t see that one coming, did you?).

Here is a YouTube video of the iTurn project:

Social Networking for My Toaster

My Toaster Tweets

That statement sounds odd. Well, let me explain. My friends would describe me as the kind of person that has a lot of time on their hands. They would be right. That time is never put to productive use, but over Thanksgiving I got the gumption to start a new project. Sometimes, I start little servo, robotic, web-based projects for my own gratification, but I get fed up with all of the time I invest just so I can impress my 3 friends that also have nothing do to over the holidays.

My friend Jason Winters has been working on an module that simplifies the connecting of projects to the internet. He sent me one of his ioBridge modules to beta test and my mind started spinning. My goal this Thanksgiving was to think of a crazy project that would be the most senseless thing someone has ever heard of before.

Again, My Toaster Tweets…

Twitter is a social networking site that allows you to tell the world your current status – kind of like a microscopic blog that gets to the point. You can write, “Hans is going to lunch” or “Hans is tired”, etc. It’s fun to follow people and see what they can do creatively with just a few characters of updates.

I use my toaster when I am home and I thought that the world may want to know when I’m toasting.

Twitter Screen Shot

How do you make a toaster twitter?

I grabbed my old bagel / toast toaster and glued a switch to the outside, so when the slider gets pressed down it triggers the switch and when it pops up, the switch opens (couldn’t be any more binary than that).

Toasting Position

The ioBridge module has a digital input that I can hook the switch up to and monitor that state of toasting or not. Using a terminal board, a pull up resistor (1k), and some alligator clips, I hooked up the resistor from the digital input to the +5v source from the module, and clipped my clips on the resistor and the ground. A few pictures are worth more than my description.

Toaster Hookup Close Up

Module Hookup

Here is the whole system hooked together:

Twitter Toaster System

The Web Stuff

Using the ioBridge website, I created an event widget that monitors the input state of that particular digital input. And when the input is “high”, the site sends an HTTP POST to the ThingSpeak API to send a message to Twitter. ThingSpeak calls this “ThingTweet” and is one of many services that you can use to build Internet of Things projects.

MyToaster IoT Gadget

Follow My Toaster on Twitter at I think that I proved that I have too much time on my hands.