Hack of the Whenever I Get Around to It

January 31, 2007

Offline Messaging Update

Filed under: Uncategorized — Chris Merck @ 2:23 pm

Breaking News: Gaim 2.0 beta 6 comes with a plugin that facilitates offline messaging by saving all messages typed to offline users as buddy pounces (see screenshot).

This feature is very cool, in that it allows me to send to people when they go offline, and have them still recieve the message, although at a later time (thank you Sadrul Chowdhury!) I am definitely going to make use of this plugin while im-ing over a shakey connection.

Unfortunately this has some disadvantages: I also randomly go offline, much to the annoyance of my friends, who use the proprietary AOL AIM software, so they won’t benefit from this feature unless they have gaim too (of course this isnt a bad thing since it perpetuates the free software). Furthermore, if I send to an offline user, then I go offline, then they go online while I am offline, it just complicates matters. Thus I believe the full solution is to support offline messaging at the server (or proxy) level.


January 23, 2007

Revamped Animatronic Hawk

Filed under: Uncategorized — Chris Merck @ 3:30 am

For the film Lady Hawk the special effects people built a very cool, radio controlled animatronic hawk. I had the good fortune of being asked to build a board to automate the old movie prop – to make it move as part of a display for a theater lobby.

Beneath the taxidermy the hawk contains a radio receiver and many servos which operate its 7 axises of motion: wings, tail, beak, body, and 3-axis head motion. My goal was to make the hawk put on little performances on a regular interval, such as taking off, begging for food, or talking. (Of course it doesn’t talk or take off, it just looks like it is trying to!) The easiest way to do this is with some kind of automatic electronic system…

I ultimately designed and built a microcontroller board to interface with the RC aircraft controllers it uses. Here is a video of the hawk functioning under automatic control (and a closeup of the head motion). Yes, its motions are rather mechanical looking, but that is mainly due to the difficulty of manipulating many axises of motion simultaneously.

Some photos of the Hawk

The controller board is based around a microcontroller (Microchip’s PIC16F627) which sends voltage signals to the radio controllers through resistor (summing) networks and op-amps. Here are some photos of that controller at various stages of development:

testing the op-amp circuit in a breadboard

PCB, fresh from the board house

board populated with components forming a
test rig using ZIF (zero insertion force) socket
to protect the PIC


the finished board

close-up of a resistor summing network

The most trying parts of this project were fiddling with the op-amps to enable control of each axis, and the Assembler programming for the PIC – it seems like each time I sit down to write some ASM, I have to think: “O.K., what the heck does btfss do again?”

Overall this project was one of the more enjoyable I have worked on, as non-technical people can also appreciate the result. I hope the hawk enjoys its new home!

January 22, 2007

Peep Hole Camera

Filed under: Uncategorized — Chris Merck @ 1:11 am

Peep-holes are wonderful things. When someone knocks on your door, it is the peep-hole that lets you decide whether you feel like answering. Unfortunately, having to get up and see who is there wastes valuable blogging time! The solution: get someone to watch the door for you! And who is better suited to that task than an old Logitech QuickCam.

How it went down:

1) Webcam placed up against peep hole. Problem! The image from outside is about 50 pixels big, and unrecognizable because the camera isn’t close enough to the peep-hole lens, the resolution is low, and the camera’s lens is rather wide-angle.

2) To get the camera closer to the peep-hole’s optics (in the hole), I removed the camera from its plastic casing (a white sphere, designed to look cool, but rather bulky) and investigated it. The lens screws into a dust-proof plastic cover over the CCD on the PCB (see image below) and is attached to a rather large lens flare / focus knob. To get it to fit I dremmeled the lens flare down to the width of the threads. The lens was still too big so I removed the room-side of the peep-hole assembly, set it aside, and now the lens fit! I used rubber splicing tape (which is second only to duct tape in my book) to hold the hall-side in-place.

(the 320×240 CCD chip inside it’s dust shield)

3) Now that peep-hole image takes up a respectable portion of the web-cams field of view, I duct taped the sucker into the peep-hole, and used a 10ft usb cable to reach my trusty Pentium III server.

4) To capture and record only the motion which occurs outside my door I use the linux command -line tool called ‘motion‘, which I learned about in Linux Desktop Hacks, a book I highly suggest to any Linux user. Motion has some realy smart default settings and all you have to do is go: motion and motion watches the first video device (/dev/video0) for motion and takes a jpeg snapshot (or mpeg videos!) of each frame that changes significantly. It even has a web interface for controlling it!

5) Unfortunatly, motion’s web interface doesn’t give you a live feed from the cam, or let you look at the logs. So I had it dump it’s jpegs into /var/www/motion/ on my server (by being in that directory when running motion) and used a simple php script to display all the images in a row. The coolest part of the page with all the photos is that if you scroll fast enough, it makes a video! Here is a taste of what the motion output looks like in firefox:

6) I decided to stop recording because I don’t want to invade people’s privacy, so I just display the live feed on a monitor above my desk. Of course, hallways are not for privacy, but it kind of freaked me out seeing the every motion of people on my floor… it’s so, clockwork. Anyway, with the monitor over my desk I don’t have to stop blogging to see who is at the door!

By the way, I could not find a real-time local webcam viewer for linux (or windows for that matter) that can do scaling. I need to scale the image 6X so I can see the image from across the dorm… so I modified Jaromil’s hasciicam, added SDL rendering and scaling to get what I wanted. The code is a real hack job, but it is good if you want to mess around with webcams in linux (using Video4Linux), which is hard to do if you are just staring at an API spec!

Create a free website or blog at WordPress.com.