Kinect + Arduino

With an Arduino Ethernet, Processing, and a Kinect, I was able to easily create this little demo where hand movement can control a servo. This is just a tiny step in my master plan to create a robot clone so that I don’t have to leave my chair.

The following libraries and drivers made this work and also made it super easy for me to create it:

OpenKinect
Daniel Shiffman’s Processing Kinect Library (he knows his stuff and has great examples on his site)
Arduino Ethernet UDP send / receive string

Servo:
EMAX ES08A Servo

How it works:

  1. The Arduino Ethernet acquires an IP address and waits for UDP packets on a certain port.
  2. The machine with the Kinect sends packets to the Arduino that contain hand coordinate data.
  3. The Arduino then takes this data (an integer) and maps the range from 0 to 180 degrees.
  4. The mapped value is sent to the servo.

Arduino’d Gingerbread House

It’s not a serious competition until you’ve put a microcontroller inside your gingerbread house. Since we were going for the Charlie Brown theme, I ripped apart and adapted a musical card that played ‘Linus and Lucy’. I also rigged up some LEDs to blink with the music. Video below the pictures.

Ubuntu and PCMCIA card

After installing Ubuntu Server 10.04 LTS on an old laptop (don’t ask why) I found that it wouldn’t detect its PCMCIA wired Ethernet card (PCM100).

Solution:

  1. Copy over the packages pcmciautils and libsysfs2 (I had to download them and transfer via USB flash drive: pcmciautils, libsysfs2)
  2. Install the packages: sudo dpkg -i [name].deb
  3. Reboot

VoilĂ !

Cloning a drive the ‘dd’ way

Here’s how I cloned a drive with bad sectors using ‘dd‘.

Since I did this on a Mac, I saved the output image file as a ‘.img’ file. This would give me the ability to mount the image after I created it if I needed to get individual files.

Clone the failing drive to an image file, skip bad sector errors with ‘noerror’:

  1. Connect the drive to a Unix / Linux machine – do not mount the disk
  2. Find the drive name in /dev (for me it was /dev/disk1)
  3. Verify the host system has enough local storage to create the image, and in a terminal type:
    sudo dd conv=noerror,sync if=/dev/disk1 of=disk.img
  4. Give it time to create the image. You may see errors when it hits bad sectors, but it’ll keep running thanks to ‘noerror’.

Copying from the image file to the new drive:

  1. Connect the new drive and make sure it isn’t mounted (if it’s really new it shouldn’t have any file system or partitions at all)
  2. Find the drive name in /dev (for me it was /dev/disk1)
  3. Type in a terminal:
    sudo dd conv=noerror,sync if=disk.img of=/dev/disk1
  4. Give it time to copy from the image to the new disk.

The nice thing is that it copies everything. For me, the MBR was still there along with all partitions. If you wanted to just copy a single partition you could just be more specific (/dev/disk1s1 or however your system represents them). If the new drive was larger than the original drive, you’ll notice that there will be unallocated space. You can either create a separate partition, or use a utility to grow an existing one. Recent versions of Windows and OS X have this capability built in.

On boot, the machine I was repairing recognized the filesystem was dirty (it was a Windows XP machine / NTFS), and immediately ran a SCANDISK. I also manually ran it again once I booted into the system, and also ran ‘sfc /scannow’ to verify the system files were intact.

That’s all you have to do. No expensive cloning software needed, just the power of Unix / Linux.