Friday, October 12, 2007

I type a LOT...


...and I type fast. That's why you can't see most of the alphabets on my keyboard. Like most of you reading this, I can touch type. People who believe in two-finger-poke typing, always complain how difficult it is to use my computer.

You can learn a lot about letter frequencies by studying my keyboard. If you look closely, you'll notice that "P", "V", "G", "Z", "X", "V", "W", "Q" and "B" are the least commonly used letters. I compared my observations against the letter frequency chart on Wikipedia to check if my observations were correct..but I realized that "J" and "K" were also very rarely used. However, on my keyboard, these two letters have been wiped off completely! Why?? Well, the answer is simple..my index finger and middle finger rest on those keys when I'm not typing.

If you click on the picture below, you'll notice some more startling facts:


I guess I use the Enter, Backspace and Delete keys a lot too. It also seems that I use the right Shift key more than the left one. Humm..I wonder if everyone does that.

Well, it all comes down to this...I should buy a new keyboard.

UPDATE: I did some experiments today to check which Shift key I use more often. Here are the results:

ActivityLeft Shift Key
Right Shift Key
Writing E-mails
54.3%
45.6%
Programming (C#)
66.6%
33.3%

When I'm writing e-mails, I use both of the Shift keys. However, I use the left one more while writing code. The right shift key on my keyboard is slightly smaller than the left one..and I'm pretty sure this is the reason why its entire surface has been wiped clean by my pinky.

Thursday, September 13, 2007

Computer Controlled Stepper Motor



A few months ago, I bought a stepper motor for only Rs.75 (about USD $1.50). I had almost forgotten about that motor until I found it lying in a secluded corner of my bedroom, collecting dust the other day. I searched the internet for information on controlling stepper motors with a computer and I was surprised at how easy it was! My stepper motor has five wires, and it is a unipolar stepper motor with a step angle of 7.5 degrees.


Here's the simple circuit I had used for controlling it:

(Note: If you can't find ULN2003, you can simply use use a single transistor for each winding as shown here.)

As you can see in the diagram, each successive coil in the motor is connected to successive data pins on the parallel port. If the coils are not connected in the correct sequence, the motor will not rotate, but will only wiggle from side to side. Identifying the wires on the stepper motor was probably the only time consuming step. Click here for information on how to do this.

Now, since each coil can be programatically controlled, you can experiment with different types of stepping modes. The simplest stepping mode is called Single-Stepping. In this mode, each successive coil is energized and the motor moves one full step at a time. For example, my motor will make a full step of 7.5 degrees whenever the coils are energized in the following sequence (D0 - D3 represent parallel port data pins):

Step No.D0D1D2D3
11000
20100
30010
40001

Another interesting stepping mode is Half-Stepping. The difference between single-stepping and half-stepping is that for the same step rate, half-stepping gives you half the speed but twice the resolution of a single step. Since my motor has a step angle of 7.5 degrees, half-stepping it would result in approximately 3.75 degrees of rotation. Here's the sequence in which coils are energized for half-stepping:

Step No.D0D1D2D3
11000
21100
30100
40110
50010
60011
70001
81001

You can achieve other types of steps by energizing the coils in different ways. For example, here's how high torque stepping works:

Step No.D0D1D2D3
11100
20110
30011
41001

For more information on these stepping modes, read this article.

My program allows me to control the motor with the scroll wheel on my mouse and I can press the right mouse button to switch between different stepping modes. Watch the video above to see it working. I'm still thinking of ways to use this stepper motor with my projects. I guess I could use it as a camera panner. It would be better, efficient and more compact than my floppy drive camera panner. My floppy drive camera panner could only rotate through an angle of 45 degrees because of mechanical limitations. This stepper motor can rotate a camera through 360+ degrees!

Here's something interesting I found while googling - Neil Fraser's "Computerized Etch A Sketch". Neil has used two computer controlled stepper motors for turning the horizontal and vertical knobs on an Etch A Sketch. His work is just amazing! I just wish he posted some videos of the device in action.

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. :)