Thursday, October 6, 2011

The Bose QC15 headphones do an amazing job of cutting down airplane cabin noise. Everytime someone tried them on, their eyes went wide in amazement. They even did a better job of cutting down noise than plain old earplugs.

The best part about the QC15s is this:

The end with the switch plugs into the headphones. The "hi" setting is for your everyday MP3 player, cellphone, etc. The "lo" setting is for the airplane sound system. It keeps your ears from being blasted when the pilot or cabin crew make an announcement while you are watching a movie.

Wednesday, October 5, 2011

The Joy of Cup Noodles

Nissin Cup Noodles made an ordinary meal on a recent 15 hour flight into the best one ever. I eat a lot of instant noodles because it goes so well with all the vegetables we get in our CSA box, but I don't normally drink the "soup". Not during this flight though. With the sandwich that was served on the side, the Cup Noodles and its soup made for a nice hot lunch.

Friday, September 23, 2011

Bus Pirate DIY "case"

A little DIY case I threw together using a ruler, an Exacto knife, plastic from a blister pack, and some 4-40 hardware I had lying around:

It's not especially protective, but it will keep random stuff from falling on it and shorting something out.

The trick to making this is to start with the rectangular hole for the guarded probe connector because it's the hardest part to get right. Once you have cut a hole you like, use the edges of the Bus Pirate itself as a guide and lightly score the other edges one at a time to mark them. Use a straight edge to cut the marks deeper. It's faster to finish the cuts with scissors.

If you're not familiar with 4-40 hardware: 4-40 is a standard thread size. You can find 4-40 hardware in serial, parallel, and video D-sub connectors. They're often used in RC models too, judging from a quick ebay search. Sometimes the hardware store will carry 4-40 nuts and bolts.

Tuesday, September 13, 2011

NFS4 id fixes

I was having a problem with ids on an NFSv4 client:

$ ls -l /r1/bob/
drwxr-xr-x  2 4294967294 4294967294 4096 2011-05-14 19:29 junk
drwxr-xr-x  2 4294967294 4294967294 4096 2011-01-30 02:14 junk2
drwxr-xr-x 14 4294967294 4294967294 4096 2011-05-14 16:31 unsorted_junk

After fumbling around for a bit, here is the solution I'm running with now.

On both the server and the client, add this to /etc/idmapd.conf:

[Translation]
Method = nsswitch

On the client, add this /etc/rc.local:

service idmapd start
umount /r1
mount /r1

Now we're all good:

$ ls -l /r1/bob/
drwxr-xr-x  2 bob bob 4096 2011-05-14 19:29 junk
drwxr-xr-x  2 bob bob 4096 2011-01-30 02:14 junk2
drwxr-xr-x 14 bob bob 4096 2011-05-14 16:31 unsorted_junk

Monday, September 5, 2011

Boston Baked Beans

One of Mrs Squirrel's favourites, this is based on the recipe from the 1997 edition of The Joy of Cooking.

  • Total cooking time: 6-8 hours.
  • Ingredients:
    • 2 lbs white navy beans
    • 1 cup light or dark molasses
    • 8 oz salt port
    • 2 cups chopped onions
    • 2 tsp ground black pepper
    • 1/2 tsp ground cloves
    • water
  • Makes about 10 cups of baked beans, which will keep in the refrigerator up to 1 week, or frozen and enjoyed up to 6 months later.

Step 1: Cook the beans

The goal of this step is to get 2 lbs of white navy beans to the point where they are soft and creamy in the centre. Ideally, the skins should not not be frayed, nor should the beans be mushy and falling apart.

Pick over and wash 2 lbs white navy beans. Place in a pot and add 12 cups water. Boil for 2 minutes, then cover and let stand for 1 hour.

Bring the beans back to a boil and simmer for 45-60 minutes, until the beans are done, as described above.

If you're using a different species of bean, the required cooking times may differ from the above. For example, one species of small red beans required an additional 30-60 minutes simmering.

If you use red kidney beans, read the following, which I've copied from Wikipedia for convenience:

The toxic compound phytohaemagglutinin, a lectin, is present in many varieties of common bean but is especially concentrated in red kidney beans. Phytohaemagglutinin can be deactivated by cooking beans at 100 °C (212 °F) for ten minutes. However, for dry beans the U.S. Food and Drug Administration (FDA) also recommends an initial soak of at least 5 hours in water; the soaking water should be discarded.

Who said beans were boring?

While the beans are cooking, soak the salt pork to wash away some of its salt.

When the beans are done, gently strain them. Avoid shaking the colander, to prevent fraying or mushing the beans. Discard the cooking water.

Step 2: Bake the beans

In an oven proof pot, bring to a boil

  • 3 cups of water
  • 1 cup light or dark molasses
  • 2 tsp ground black pepper
  • 1/2 tsp ground cloves
  • optional: 1 tbsp salt

Gently stir in the beans along with

  • 8 oz salt port, cut into 1/2-inch cubes
  • 2 cups cupped onions

If necessary, stir in additional hot water to just cover the beans. Cover the pot and bake 4-5 hours until the liquid has thickened.

Saturday, September 3, 2011

16-segment LED from Active Surplus

Here's the pin-out of a mysterious 16-segment LED display we picked up last weekend from Active Surplus. Stamped on the top is "TR371 A 5G".

It has a common anode, at pin 18.

This is mostly for my own notes, in case I decide to do something with it later. Feel free to use at your own risk, not responsible for injuries sustained while ROFL, etc.

Wednesday, August 31, 2011

Using a 4511 to drive a 7-segment LED with an Arduino

An Arduino UNO can drive a 7 segment LED digit directly, but it takes seven output pins to do it. Additionally, your program is exposed to how the segments in the digit are wired to the Arduino.

A binary coded decimal (BCD) driver like the 4511 hides this level of detail for you. It takes 4 pins as input, another for latch, and drives the LED segments directly. You "tell" it what number to display, and it figures out which segments to light up.

The flipside to using the 4511 is you have to accept the way it draws digits like 6 and 9 without their tails. Also, it doesn't draw letters like A, b, C, d, etc. Well, using the 4511 is just an exercise, a stepping stone to a more sophisticated driver.

Anyhow, this is the code I whipped up in about an hour. I'm putting it in the public domain, so enjoy!

/*
 * Arduino UNO 4511 BCD to 7-digit LED driver
 *
 * 4511 pins 3 (lamp test), 4 (ripple blanking), and 16 (Vcc)
 * are connected to +5V on the Arduino UNO.
 *
 * 4511 pin 8 is connect to GND on the Arduino UNO.
 * The common cathode on the LED digit also connects to GND.
 * 
 * 4511 pins 9 through 15 connect to the LED digit as
 * appropriate.
 */
#define LATCH_ENABLE  13  // to pin 5 on the 4511
#define DATA1          1  // to pin 7 on the 4511
#define DATA2          2  // to pin 1 on the 4511
#define DATA3          3  // to pin 2 on the 4511
#define DATA4          4  // to pin 6 on the 4511

void setup()
{
  pinMode( LATCH_ENABLE, OUTPUT ) ;
  pinMode( DATA1, OUTPUT ) ;
  pinMode( DATA2, OUTPUT ) ;
  pinMode( DATA3, OUTPUT ) ;
  pinMode( DATA4, OUTPUT ) ;
}

// This macro tests bit 'b' in value 'v' and reports
// high or low as appropriate.
#define T(v,b)  (v & (1<<b) ? HIGH : LOW)

void show( unsigned int value )
{
  if ( value <= 9 )
  {
    // enable the latch so we can write
    digitalWrite( LATCH_ENABLE, LOW );
  
    digitalWrite( DATA1, T(value, 0) );
    digitalWrite( DATA2, T(value, 1) );
    digitalWrite( DATA3, T(value, 2) );
    digitalWrite( DATA4, T(value, 3) ); 
  
    // disable the latch now that we're done writing
    digitalWrite( LATCH_ENABLE, HIGH );
  }
}

void loop()
{
  for ( int i = 0; i <= 9; i++ )
  {
    show( i ) ;
    delay( 1000 ) ;  // msec
  }
}
The 4511 does a fine job driving a single 7-segment LED display, but it's old school compared to the MAX7219 which can drive up to eight of those displays. Here's a well written resource on the 7219. I'm going to try getting one soon.