Sunday, August 26, 2007

Whistle (or scream) to control your computer!

Hello Readers!

It has been a long time since I wrote my last blog post. Well, I had been busy with a lot of things – like college, harmonica playing, meeting people, (and not to mention a whole host of fun, yet unproductive things I had been doing). Oh, and I was also busy reading, discussing and thinking over the last Harry Potter book by J.K. Rowling. Harry Potter and the Deathly Hallows is stunningly beautiful. I loved it. :)

Well, anyway … I’m always in search for alternate ways to communicate with computers, and ever since I built a sound sensor for my Viper robot, I was thinking of ways to communicate with my computers using sound as a medium. I figured out how to use DirectSound to read the levels of my computer’s available sound capture devices thanks to a wonderful example by Jacob Klint over at CodeProject. I’ve written code to count the number of times the sound level of my microphone exceeds a certain threshold for controlling a few things on my computer. Say, for example, if I whistle two times (loudly), the software would check my email. If I whistle three times, it would turn off my computer, and so on.


The drawback is that it won’t be long before everyone in your house will be irritated by your whistling! That’s why I still prefer laser gesture recognition for controlling things. :) However, if you’re interested in seeing the code, just let me know.

Now, I’m thinking about capturing sound from two sources and perhaps even perform sound localization! That would be very cool. :) Keep visiting...

Tuesday, July 17, 2007

Cell Phone Controlled Door Latch


Download Video (1.78 MB)

I’ve been reading a lot on how DTMF (Dual Tone Multi Frequency) tones work over the last couple of weeks. I’m sure you’ve noticed that when you press the keys on a standard telephone keypad, an audible ‘beep’ is generated. These beeps are actually the combination of two distinct frequencies. For example, the tone you hear when you press the number ‘9’ on a telephone, is actually a combination of a 1447 Hz and 852 Hz signal. In a telephone exchange, these signals are decoded by a computer which finally connects the dialer to the designated phone line. For example, the tone of 1447 Hz and 852 Hz will be decoded as binary ‘1001’. In this project, I have designed a simple DTMF decoder circuit which allows me to control appliances in my house from any place on Earth using a telephone.

I always wanted to be able to control things such as air-conditioners, lights, etc, remotely…but I never thought about putting the front door of my house under remote control until I saw this “knock to open” door hack on Hackaday. It’s a door that will unlock when the correct knock pattern is performed. After being inspired by the mechanical door opening system in that hack, I decided to do something similar to allow me to open my door with a cell phone! I mean c’mon, door locks with keys are obsolete..everyone uses them..they’re so old fashioned! They’ve been around for over 4,000 years. Yikes! It’s time for a little change.

This project would have been much simpler if I had an electronic door lock…but I didn’t! They’re expensive, so I didn’t want to buy a new electronic door lock. I wanted to open the front door of my house without “seriously” modifying/replacing any door components. I thought about using a servo/stepper motor to twist the door knob on the door, but their control circuitry is slightly complicated if you’re not using a microcontroller. So, I decided to use a simple, 24VDC, “pull solenoid”. They don’t have any complicated control circuitry and you just have to supply the required voltage to make them work. I simply fastened the solenoid to the door knob with a metal wire. When the solenoid is switched on, its linear motion twists the door knob and opens the door. Positioning the solenoid properly was probably the only mechanical challenge in building this door opener because the force applied by a solenoid, is theoretically inversely proportional the square of the length of the air gap. Thus, strongest force is generated when the air gap is smallest.



The second part of this project was to build a DTMF decoder circuit. I used a CM8870PI tone decoder IC for doing this. The circuit I have built is fairly simple, and can be used for controlling up to four devices. If you want to control more than four devices, check out this circuit. I had a Nokia 1100 cell phone lying around with a hands-free accessory which was rarely used. So, I hacked its hands-free accessory and connected it to the circuit (I just cut the wires which went into the earpiece). That’s about it! To control things in the house, you just dial into the base station and the Nokia 1100 auto-answers the phone call. Each function is just a matter of pressing the appropriate number on the phone and the DTMF chip decodes it and sends output to a transistor which controls a relay. To open my door, I just dial the phone, enter the magic code and voila - Alohomora! Watch the video above. :)





Now I’m thinking about building a password protected door by placing a keypad outside my house which will generate DTMF tones. A circuit on the other side of the door will check the numbers entered, and if the password is correct, it will open the door. However, there’s one little snag. Any nasty programmer would just love to use a computer to generate DTMF tones and crack the password using brute force…I would. :)

Monday, June 11, 2007

Pong Playing Computer playing against another computer using a webcam as an eye!


Download video (5.54 MB)

Several years ago, when I was a stupid little schoolboy, I created a really fun and addictive game called Ping Pong. It was based on the classic arcade game, PONG, and had some cool features like gradual speed increase, two game modes, and some neat sound effects.

I had almost forgotten about that game until I saw this auto wood-chopper project in which a computer plays a simple game on a PSP using only a webcam to view its screen. I thought the idea was pretty good. So, I decided to make my own computer play that old pong game of mine on another computer using a webcam for vision! I fired up my code editor, and after several hours of coding and experimentation, my image recognition code started looking good. It uses edge detection to determine the boundaries of the ball and the bat in the webcam’s field of view. The area of the ball is more than the bat, so that’s how it differentiates between the two. The other steps are more or less similar to the things I did for my object tracking app. Like the auto wood-chopper dude, I thought about using motors to press the keyboard keys on my laptop. However, I thought it would be overkill when I could write a simple TCP client/server program to establish communication between the two computers.

Be sure to watch the video above! I’d love to hear what you think. Oh and here’s a similar project in which a computer plays Minesweeper on another computer using a webcam – wow!

You can download my fun Pong game from here. (1.20 MB)

This was a very exciting project. In my opinion, one of the coolest webcam based projects I’ve done so far. I entered the world of webcams after working on CamCapture – a project based on a Coding4Fun article by Scott Hanselman. :) Webcams are fun but I sometimes wonder why they’re called Webcams. I never use them for online video conversations! In my opinion, they should be simply called USB cameras. :)

Opto-isolated Parallel Port Driven Relays

A few months back, I made a parallel port driven relay box for Engineer 2007 with four outputs which were opto-isolated from my PC. Since I didn't have opto-isolators, I built my own by taping LED/photoresistor pairs together. It worked perfectly.


I also combined it with laser gesture recognition to turn four appliances on or off using a laser pointer for Engineer 2007. I guess everyone loved it. :)

If you can make pcbs, and are interested in a simple little circuit
to provide opto-isolator protection to 4 parallel port inputs, and relays on the other 4 bits, as outputs, then check the offer on....

http://www.arunet.co.uk/tkboyd/ele1pp.htm


... which is a little way down the page, next to the Google panel, in
the paragraph starting "I have a third generatino, inexpensive...".