Category Archives: Fun

Prototyping at Work

Prototyping at Work

I have a fun job. I’m a Software Engineer at Safari Books Online. I focus on automating our back-end infrastructure. I also experiment with prototyping hardware architectures. My boss, Clark Hartsock, loves low powered RISC boards for data crunching. We built a 12 Terabyte 10 nodes cluster to compete with our older Atom based stack.
Proto Type Side
Clark choose the hardware based on price, spending less than $2000 on this machine. The goal was to maximize Hadoop power for price. We created this prototype. Mounting everything to wood makes carrying around the cluster much easier.
Prototype Upright

Installing Rails 3 on a fresh Ubuntu 12.04

Installing Rails 3 on a fresh Ubuntu 12.04

How many times have you wanted to install rails 3 on a system and you ended up in dependency hell? I know I have. Life was simpler with Rails 1 and 2. You could use ruby 1.8.7 and all was good. Now you should use 1.9.3. On ubuntu systems it is confusing to install ruby 1.9.3 because the package is called ruby1.9.1. If you install the apt package rubygems, Ubuntu will install ruby 1.8.7, just the opposite of what you want to happen. I’ve run into this issue enough times to document a fool proof way to get rails 3 onto your Ubuntu system.

 

sudo apt-get update
sudo apt-get build-essential # this is needed for installing rubygems
sudo apt-get install ruby1.9.1 ruby1.9.1-dev 
sudo apt-get install libyaml-ruby 
sudo apt-get install libsqlite3-dev # needed for gem sqlite3
# download rubygems ( I used 1.8.25) 
tar xzvf rubygems-1.8.25.tgz
cd rubygems-1.8.25/
sudo ruby setup.rb
sudo gem install rails
sudo gem install sqlite3
sudo apt-get install nodejs # Or one of the other acceptable javascript runtimes from https://github.com/sstephenson/execjs
sudo apt-get install libmysqlclient-dev # if you want to use mysql, do these lines as well
sudo gem install mysql2
sudo gem install activerecord-mysql2-adapter

If you read the docs on installing RubyGems you’ll notice they recommend the apt-get packages libyaml-ruby and libzlib-ruby. I installed the first one but the second will already be installed with the above list. With this arrangement you will only have ruby 1.9.3p0 installed and your rails will be 3.2.13

 

spustay@roar:~$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
spustay@roar:~$ rails -v
Rails 3.2.13

I hope you can use this list, I reference it when I need to.

Tweet-A-Watt is working locally

Tweet-A-Watt is working locally

I made a Tweet-A-Watt last year which is a hacked Kill-A-Watt wall plug that sends data wireless to a computer. The twitter API has changed a lot since then, it now uses OAuth to authenticate tweets. I cloned ladyada’s Tweet-A-Watt github repo and started getting to work. My code isn’t ready to push up to the community yet but data is flowing.

 


 

Wood and PVC Camera Style Housing for Atari Punk Console

Wood and PVC Camera Style Housing for Atari Punk Console

This weekend I made an Atari Punk Console out of some wood and PVC scraps. I wanted to make a portable player that could feed into a larger amplifier. I added a line out to the system for this purpose. The wood and PVC are glued together but the PVC to PVC connection is free. This is how I open it up to replace the 9 Volt battery inside. I think the tube PVC helps make the speaker a little louder by providing a sound box for the APC.

Vegetable Barley Soup

Vegetable Barley Soup

We made a nice soup this week that we want to make again soon. It was really easy and healthy.

  • 2 quarts vegetable broth
  • 1 cup uncooked barley
  • 2 large carrots, chopped
  • medium celery, chopped
  • 1 (14.5 ounce) can diced tomatoes with juice
  • 1 (15 ounce) can garbanzo beans, drained
  • 1 onion, chopped
  • 3 bay leaves
  • 1 teaspoon garlic powder
  • 1 teaspoon white sugar
  • 1 teaspoon salt
  • 1/2 teaspoon ground black pepper
  • 1 teaspoon dried parsley
  • 1 teaspoon curry powder
  • 1 teaspoon paprika
  • 1 teaspoon Worcestershire sauce

Put everything in the pot and bring to a boil. After it’s boiling simmer for 90 minutes and enjoy. Remember to take out the three bay leaves.

Making LED blinking patterns with an Arduino

Making LED blinking patterns with an Arduino

I am a big fan of LED blinky lights. I’m an even bigger fan of full color LED blinky lights. I found some great color changing LEDs and wired them up to my Arduino Uno. The Arduino is a great platform for playing with electronics. It’s open source hardware and it has a great community behind it. Take a look at the blinking patterns I made with the Uno. Below I’ll show you how I did it.

RGB Blinking LEDs from scottz on Vimeo.

Wiring up the Arduino was pretty simple. I connected pin 1 through 13 on the Arduino’s digital outputs to my bread board. I found the LED calculator at led.Linear1.org to choose my resistor size. Lady Ada has a pretty good explanation of LEDs and voltage drops on her MiniPOV project.

So the Arduino digital out drove my little LED array .

The LEDs I used were slow changing RGB LEDs. This means they slowly cycle through all the colors of the rainbow. They start out red and move along the spectrum. This project would work with single color LEDs but the results looks so much better with colors that change. The code to make this work is available at github.

https://github.com/muskox/ArduinoLED/blob/master/Arduino_LED_patterns.pde

or you can look at it below:

// Blinking RGB LEDs
// Written by Scott Pustay
//
// This is a really simple example of how to make some fun LED patterns
// with your Arduino.
//
// I have LEDs being powered by output pins 1 through 13. This program
// cycles these LEDs on and off to make the pattern.
// Don't forget to add your resistors to the simple circuit. I'm calling
// LED13 the top and LED1 the bottom. This made sense for how I wired the
// LEDs to the breadboard.

#define LED13 13 // LED connected to digitial pin 13
#define LED12 12
#define LED11 11
#define LED10 10
#define LED9 9
#define LED8 8
#define LED7 7
#define LED6 6
#define LED5 5
#define LED4 4
#define LED3 3
#define LED2 2
#define LED1 1 

void setup()
{
 pinMode(LED13, OUTPUT); // sets the digital pin as output
 pinMode(LED12, OUTPUT);
 pinMode(LED11, OUTPUT);
 pinMode(LED10, OUTPUT);
 pinMode(LED9, OUTPUT);
 pinMode(LED8, OUTPUT);
 pinMode(LED7, OUTPUT);
 pinMode(LED6, OUTPUT);
 pinMode(LED5, OUTPUT);
 pinMode(LED4, OUTPUT);
 pinMode(LED3, OUTPUT);
 pinMode(LED2, OUTPUT);
 pinMode(LED1, OUTPUT);
}

void loop(){
 // all off
 digitalWrite(LED13, LOW);
 digitalWrite(LED12, LOW);
 digitalWrite(LED11, LOW);
 digitalWrite(LED10, LOW);
 digitalWrite(LED9, LOW);
 digitalWrite(LED8, LOW);
 digitalWrite(LED7, LOW);
 digitalWrite(LED6, LOW);
 digitalWrite(LED5, LOW);
 digitalWrite(LED4, LOW);
 digitalWrite(LED3, LOW);
 digitalWrite(LED2, LOW);
 digitalWrite(LED1, LOW); 

 // doubles skipping
 digitalWrite(LED1, HIGH);
 delay(500);
 digitalWrite(LED1, LOW);
 digitalWrite(LED2, HIGH);
 digitalWrite(LED3, HIGH);
 delay(500);
 digitalWrite(LED2, LOW);
 digitalWrite(LED3, LOW);
 digitalWrite(LED4, HIGH);
 digitalWrite(LED5, HIGH);
 delay(500);
 digitalWrite(LED4, LOW);
 digitalWrite(LED5, LOW);
 digitalWrite(LED6, HIGH);
 digitalWrite(LED7, HIGH);
 delay(500);
 digitalWrite(LED6, LOW);
 digitalWrite(LED7, LOW);
 digitalWrite(LED8, HIGH);
 digitalWrite(LED9, HIGH);
 delay(500);
 digitalWrite(LED8, LOW);
 digitalWrite(LED9, LOW);
 digitalWrite(LED10, HIGH);
 digitalWrite(LED11, HIGH);
 delay(500);
 digitalWrite(LED10, LOW);
 digitalWrite(LED11, LOW);
 digitalWrite(LED12, HIGH);
 digitalWrite(LED13, HIGH);
 delay(500);
 digitalWrite(LED12, LOW);
 digitalWrite(LED13, LOW);
 digitalWrite(LED10, HIGH);
 digitalWrite(LED11, HIGH);
 delay(500);
 digitalWrite(LED10, LOW);
 digitalWrite(LED11, LOW);
 digitalWrite(LED8, HIGH);
 digitalWrite(LED9, HIGH);
 delay(500);
 digitalWrite(LED8, LOW);
 digitalWrite(LED9, LOW);
 digitalWrite(LED6, HIGH);
 digitalWrite(LED7, HIGH);
 delay(500);
 digitalWrite(LED6, LOW);
 digitalWrite(LED7, LOW);
 digitalWrite(LED4, HIGH);
 digitalWrite(LED5, HIGH);
 delay(500);
 digitalWrite(LED4, LOW);
 digitalWrite(LED5, LOW);
 digitalWrite(LED2, HIGH);
 digitalWrite(LED3, HIGH);
 delay(500);
 digitalWrite(LED2, LOW);
 digitalWrite(LED3, LOW);
 digitalWrite(LED1, HIGH);
 delay(500);
 digitalWrite(LED1, LOW); 

 // in to out
 digitalWrite(LED7, HIGH);
 delay(500);
 digitalWrite(LED8, HIGH);
 digitalWrite(LED6, HIGH);
 delay(500);
 digitalWrite(LED9, HIGH);
 digitalWrite(LED5, HIGH);
 delay(500);
 digitalWrite(LED10, HIGH);
 digitalWrite(LED4, HIGH);
 delay(500);
 digitalWrite(LED11, HIGH);
 digitalWrite(LED3, HIGH);
 delay(500);
 digitalWrite(LED12, HIGH);
 digitalWrite(LED2, HIGH);
 delay(500);
 digitalWrite(LED13, HIGH);
 digitalWrite(LED1, HIGH);
 delay(500);

 // all off
 digitalWrite(LED13, LOW);
 digitalWrite(LED12, LOW);
 digitalWrite(LED11, LOW);
 digitalWrite(LED10, LOW);
 digitalWrite(LED9, LOW);
 digitalWrite(LED8, LOW);
 digitalWrite(LED7, LOW);
 digitalWrite(LED6, LOW);
 digitalWrite(LED5, LOW);
 digitalWrite(LED4, LOW);
 digitalWrite(LED3, LOW);
 digitalWrite(LED2, LOW);
 digitalWrite(LED1, LOW);  

 // out to in
 digitalWrite(LED13, HIGH);
 digitalWrite(LED1, HIGH);
 delay(500);
 digitalWrite(LED12, HIGH);
 digitalWrite(LED2, HIGH);
 delay(500);
 digitalWrite(LED11, HIGH);
 digitalWrite(LED3, HIGH);
 delay(500);
 digitalWrite(LED10, HIGH);
 digitalWrite(LED4, HIGH);
 delay(500);
 digitalWrite(LED9, HIGH);
 digitalWrite(LED5, HIGH);
 delay(500);
 digitalWrite(LED8, HIGH);
 digitalWrite(LED6, HIGH);
 delay(500);
 digitalWrite(LED7, HIGH);
 delay(500);

 // all off
 digitalWrite(LED13, LOW);
 digitalWrite(LED12, LOW);
 digitalWrite(LED11, LOW);
 digitalWrite(LED10, LOW);
 digitalWrite(LED9, LOW);
 digitalWrite(LED8, LOW);
 digitalWrite(LED7, LOW);
 digitalWrite(LED6, LOW);
 digitalWrite(LED5, LOW);
 digitalWrite(LED4, LOW);
 digitalWrite(LED3, LOW);
 digitalWrite(LED2, LOW);
 digitalWrite(LED1, LOW); 

 // fast line top to bottom
 digitalWrite(LED13, HIGH);
 delay(500);
 digitalWrite(LED12, HIGH);
 delay(500);
 digitalWrite(LED11, HIGH);
 delay(500);
 digitalWrite(LED10, HIGH);
 delay(500);
 digitalWrite(LED9, HIGH);
 delay(500);
 digitalWrite(LED8, HIGH);
 delay(500);
 digitalWrite(LED7, HIGH);
 delay(500);
 digitalWrite(LED6, HIGH);
 delay(500);
 digitalWrite(LED5, HIGH);
 delay(500);
 digitalWrite(LED4, HIGH);
 delay(500);
 digitalWrite(LED3, HIGH);
 delay(500);
 digitalWrite(LED2, HIGH);
 delay(500);
 digitalWrite(LED1, HIGH);
 digitalWrite(LED13, LOW);
 delay(500);
 digitalWrite(LED12, LOW);
 delay(500);
 digitalWrite(LED11, LOW);
 delay(500);
 digitalWrite(LED10, LOW);
 delay(500);
 digitalWrite(LED9, LOW);
 delay(500);
 digitalWrite(LED8, LOW);
 delay(500);
 digitalWrite(LED7, LOW);
 delay(500);
 digitalWrite(LED6, LOW);
 delay(500);
 digitalWrite(LED5, LOW);
 delay(500);
 digitalWrite(LED4, LOW);
 delay(500);
 digitalWrite(LED3, LOW);
 delay(500);
 digitalWrite(LED2, LOW);
 delay(500);
 digitalWrite(LED1, LOW);
 delay(500);

 // slow line top to bottom
 digitalWrite(LED13, HIGH);
 delay(1000);
 digitalWrite(LED12, HIGH);
 delay(1000);
 digitalWrite(LED11, HIGH);
 delay(1000);
 digitalWrite(LED10, HIGH);
 delay(1000);
 digitalWrite(LED9, HIGH);
 delay(1000);
 digitalWrite(LED8, HIGH);
 delay(1000);
 digitalWrite(LED7, HIGH);
 delay(1000);
 digitalWrite(LED6, HIGH);
 delay(1000);
 digitalWrite(LED5, HIGH);
 delay(1000);
 digitalWrite(LED4, HIGH);
 delay(1000);
 digitalWrite(LED3, HIGH);
 delay(1000);
 digitalWrite(LED2, HIGH);
 delay(1000);
 digitalWrite(LED1, HIGH);
 digitalWrite(LED13, LOW);
 delay(1000);
 digitalWrite(LED12, LOW);
 delay(1000);
 digitalWrite(LED11, LOW);
 delay(1000);
 digitalWrite(LED10, LOW);
 delay(1000);
 digitalWrite(LED9, LOW);
 delay(1000);
 digitalWrite(LED8, LOW);
 delay(1000);
 digitalWrite(LED7, LOW);
 delay(1000);
 digitalWrite(LED6, LOW);
 delay(1000);
 digitalWrite(LED5, LOW);
 delay(1000);
 digitalWrite(LED4, LOW);
 delay(1000);
 digitalWrite(LED3, LOW);
 delay(1000);
 digitalWrite(LED2, LOW);
 delay(1000);
 digitalWrite(LED1, LOW);
 delay(1000);

}