I needed a ~$5 gift for family xmas this year, and was at a loss. Then I remembered the Useless Machine from Make, also known as a “Leave Me Alone Box.” I had a $5 box from the thrift store, a smaller version of the one I used for my iPad Charger. After a lot of planning in AutoCAD and even more trial and error I came up with this:

It took me a while to figure out how to put it together with the cam attached to the lid, and my daughter suggested a rod & tube setup:

The cam is connected to the lid through a bearing and a brass “bicycle fork”:

When the cam spins, it lifts the lid enough for the arm to come out and flip the switch.

One thing that I did slightly different was use a 5V DPDT relay to reverse the motor instead of a DPDT switch. This allowed me to use a SPDT switch with a lower actuation force.

I was working on creating a puzzle a couple of weeks ago and needed sets of a dozen 5-letter words that all “interacted” in a certain way (sorry, don’t want to give away too much). One of the software guys here at work suggested a Perl script to find sets words, specifically Strawberry Perl. I have been programming since I was a kid (basic on a VIC-20) but lately have been resistant to learning new languages because I can usually accomplish my goals with the languages I already know. This time I decided to take his advice and was pleasantly surprised with the simple learning curve and thought I’d pass on a bit of intro on how to set up and start using Perl to help create puzzles.

Disclaimer:

I am not a Computer Scientist, nor do I play one on TV. This is a description of how I went about solving a specific problem, not necessarily the best method. For informational purposes only. Use at your own risk.

Installation of Strawberry Perl was completely straightforward on my XP machine. I haven’t tried any Win7 installs, but the home page suggests it is just as simple. I just downloaded the Windows installer and let it run. This will install Perl on your machine let you run scripts from the command line.

1. Create a folder to place all of my code and research material.

2. Create a text file in the folder where I had all of my puzzle related info called “prompt.bat” (no quotes), and consisted of the single word “cmd” (again no quotes). Double-clicking this file will open a command prompt within the folder so you can launch the scripts easily.

4. Create a text file (I prefer Notepad++ for text editing. Be sure to set the Language to Perl to get the correct syntax hi lighting) with the name of the puzzle and a “.pl” suffix. This file will be your Perl Script.

5. Start the script with “#!/usr/bin/perl” This tells the computer that it is a Perl script.

6. Here’s a script I wrote to find all the rotations of a word (anyone who saw my sample puzzle on the forum may recognize this) listrotator.pl (Save target as… or you may get an error. No idea why). You can run this by typing “perl listrotator.pl words.txt” at the command prompt.

#!/usr/bin/perl

#use strict;

my %words;

my $i;

open(DATAIN,”<$ARGV[0]“) || die “cannot open \”$ARGV[0]\”: $!”;

while(my $line = <DATAIN>){

$line =~ s/\s+//;

$words{$line} = 1;

}

foreach my $word1 (sort keys %words){

my $num=0;

my $word=$word1;

print “-$word\n”;

for($i = 1; $i < length($word1); $i++){

$word= rotate($word);

print “$word\n”;

}

}

sub rotate{

my $foo=shift;

chomp($foo);

my $out=substr($foo,1,length($foo)-1).substr($foo,0,1);

return $out;

}

The beginning of the script reads in the command line argument (words.txt in the example above) then reads the word list into memory. Specifically into a hash structure named words hash, but I’ll discuss that later. While reading the file into memory, it also strips carriage returns and unprintable characters.

Next the script steps through each entry in the hash (%words). It takes this entry, and rotates it using the rotate function, once for each letter in the word. This way we end up with all possible rotations.

In a future post I’ll cover some of the neat things you can do once you have a word list in memory.

My daughter has swim meets every Saturday morning from 7am until around 1pm. During this time she is actually swimming a total of about 4 minutes, so the entire family tries to stay occupied the rest of the day. Almost every week someone complains “Oh, man! My iPod is dead!” Answering the tinkerer’s call to arms, I would like to present the Portable Electrick Storage Device Mark I:

Outside

Inside

USB Connectors

Charging my iPad

Specs:

Box – $6 brand new at the local thrift store, I only added electronics and handles. (I need to head back and get a couple more!)

I have been convinced to add the Steampunk PDA back to my list of projects I am allowing myself to work on, so the list currently stands as Deskpet, Mazetrix, PDA and notebooks. I ordered the accelerometers for the next 3 Mazetrix tiles (should be here Monday), and I should be building a couple of notebooks for some guys at work, but this sounded like more fun.

I have been thinking about the PDA for a week or two now, and decided to make a custom case rather than attempting to use a pocketwatch case. I picked up a 2″ brass pipe fitting from the hardware store and started shaping it on the lathe. It should be just about the right size…

I received the pcbs for Mazetrix and started the build. After 4 1/2 hours of troubleshooting I realized that I connected the SCK line to the wrong pin and finally managed to get AVR Studio to recognize the processor. Then I wrote enough code to verify the LEDs would all light up. However I then started having problems with the firmware. Finally, during my 15 minute lunch today, I found the problem was the fuse settings in the ATMEGA128 (either 103 comaptibility mode or JTAG enabled).

I just added the 3-axis accelerometer, but haven’t soldered on the supporting components. Also I still need to add the Li-Po charge IC. I am currently using the STK500 both to power and program the board.

Many moons ago I managed to score several 8×64 Red-Green matrix displays salvaged, evidently, from a casino display. Even though I had managed to reverse engineer them and figure out how to display nifty messages, they were just too large and too COTS for me. I removed the 8×8 LED matrices (matrixes?) and designed a small board to run them. The display is run directly from an ATMega128, using a half-H bridge on each column so I can use the entire matrix as a sensor. Additionally, I have added a MMA7260 triple axis accelerometer. Last but not least is an IR LED pointed in each of the cardinal directions, also connected to be used as an input and an output, for communicating to neighbor modules(PDF link).

The ultimate goal is to create tiles with a red maze and a green “ball” than you can manipulate by tilting, just like the good old labyrinth game. When you get to the edge of a tile, you can connect another, which will attach magnetically, and the maze will continue on the new tile.

I have decided to limit myself to 3 projects; Deskpet, Tiletoy and notebooks. I just built some notebooks, and my Tiletoy PCB is on the way (maybe more about that later), so I’d like to get back to Deskpet.

Deskpet is a project that I am working on to create a small robot to live on my desk as a pet. One of the things I have learned at work is that it is much harder to build something if you don’t know exactly what it is supposed to do. So here goes; high level design goals for Deskpet:

The major goal for the Deskpet is to construct a pet. It needs to live on my desk and generate an emotional attachment.

Sufficient output to be “interesting” – If all it has is a pair of motors, I can make it dance, but it would be much easier to generate an emotional attachment if it has other methods of expressing itself.

Sufficient input to be interactive – I want to be able to play with my pet, so it needs to be able to sense it’s surroundings, toys and possibly me.

Automatic recharge – If it is going to seem alive, I can’t keep having to put it on the charger.

Wireless communication and bootloading – This is going to require A LOT of firmware work on my part, so it ould be easiest if I could download new firmware without even toucing the ‘bot.

I will not be concerning myself with availablilty or cost of components with respect to eventually making kits available. This will be a project for me.