Monday, July 27, 2009

Reed Switch Motor and Parallel Port Tachometer



Hello readers! I'm posting a project here after quite some time. After moving to Bangalore, I had slowed down. Well, now I am building stuff again so I'll be posting much more often!

A few days ago, my brother Amrit Derhgawen, cousin Anand Karpatne, and I decided to make a simple reed switch motor. My brother is a character animator at DreamWorks, but he also happens to be good with electronic things. So, after a few hours of construction and troubleshooting, he finally got the motor working. JOY!

A reed switch motor consists of a rotor made up of 2 (or 4) permanent magnets. An electromagnet and reed switch are placed close to the rotor on opposite sides. I got my electromagnet by stripping a relay. When a magnet on the rotor gets close to the reed switch, the reed switch gets magnetized and allows current to pass through and turn on the electromagnet. The electromagnet pushes the magnet closest to it, and makes the rotor turn. The electromagnet is switched off when there is no magnet close to the reed switch, and this allows the rotor to spin freely from inertia. When the other magnet gets in working range of the reed switch, the electromagnet pushes again.



After making the motor, I decided to measure it's RPM (Revolutions Per Minute) using my computer for the fun of it. So, I connected another reed switch to my computer's parallel port as shown here:



By default, status port 7 (S7) is high on my computer. When a magnet comes close to the reed switch, S7 becomes low. I placed this reed switch very close to the motor's rotor. The software is a C# Console Application which uses Inpout32.dll to read the parallel port. For about every 60 revolutions of the motor, it estimates its RPM.

The motor usually spins at around 3000 to 4000 RPM depending on voltage. Here is a graph I generated using values from the program:



I turned the motor off and on 3 times quickly, and also played with the voltage. You can see all this in the graph!

Do watch the video to see it in action!

For more information on how to make reed switch motors, check out this wonderful tutorial - http://www.simplemotor.com/rsmotor.htm.

Cheers,
Ashish :)

Saturday, July 12, 2008

A new place, a new beginning...

My family has just moved from Delhi to Bangalore after a tiring 36 hour train journey. Wow..can you even believe that? That's the longest I've ever been on a train! Our movers haven't arrived yet, and our apartment is pretty much empty. There's no refrigerator, no TV, and no bed to sleep on! Well, hopefully everything should arrive within a day or two. The weather here is so much better compared to Delhi (which was very hot and humid when we left).

Moving can be stressful, especially since you have to part with lots of people and friends. Thankfully, this isn't anything new to me as I've always been wandering and on the move. If I remember correctly, I've moved a total of 10 times across 2 countries (U.S. and India), and 6 cities in the 20 years of my existence in this life. I wonder what's after Bangalore! :)

Friday, April 11, 2008

Coding4Fun: Webcam Based Laser Tracking for Human-Computer Interaction


Here's a new Coding4Fun article I did - Webcam Based Laser Tracking for Human-Computer Interaction.

In this article, we will put together a program which will allow us to move the mouse cursor on our computers with a laser pointer, and even generate mouse clicks using only a webcam for computer vision.

You can also use it for impressing your friends by drawing things on your computer with a laser.

Enjoy! :)

Sunday, March 16, 2008

Laser Tracking with webcam for Human-Computer Interaction



This post should have been written two months ago, in January, but with all sorts of things keeping me busy, I just couldn't get enough time to shoot videos and write about the project. Anyway, now that I do have time (and a video), here's what the whole thing's about: While writing an email to Scott Hanselman on January 29th, 2007, I thought - Wouldn't it be cool if I could control my mouse cursor with a laser pointer, and even draw things with it. I had tried doing something similar in 2006, but it had some serious speed issues. This time, after rewriting the code and introducing some neat image processing techniques, the code is much faster than before. I was surprised that I had a working prototype within 3-4 days of coding.

The idea is pretty much similar to Johnny Lee's Wii Whiteboard project, except that I'm using a webcam instead of a Nintendo Wii remote. The program uses the webcam to track a laser dot in its FOV. With a projector, you can select its projected area, and the program would map its coordinates to your screen. Then, for opening a file, you'd just have to point on the file with a laser pointer and your computer would open it for you!

Oh, and by the way, while sending my next email to Scott, I didn't use a mouse for clicking the "Send" button. :)

Source code and details coming soon!

Cheers,
Ashish