Wednesday, November 29, 2006

Camera Panning Using Parallel Port Controlled Floppy Drive

The set-up:


Webcam view:





Howdy folks,

I’ve finally managed to control the stepper motor found in 3 ½ inch floppy drives! It took me almost 3-4 days to accomplish this. The first floppy drive I tried using had a broken stepper motor. So, I went to a computer service center and asked if they had any unused floppy drive they could give to me. They gave me three old floppy drives and didn’t charge anything! I connected these floppy drives to my computer’s motherboard to check if they actually worked. All of them worked perfectly. I opened their outer covering and for the first time had the opportunity to see how a floppy drive works under the hood.

Here are two articles which helped me in controlling the stepper:

According to the instructions on these articles, I tried connecting the floppy drive connector cable to my computer’s parallel port. I didn’t take out the stepper motor from the floppy drive because floppy drives have a built in controller which is capable of controlling the motor. Anyway, the connections I made were:

Floppy Drive--------------------------------Parallel Port
PIN # 18 (Direction)------------------------>PIN # 2 (D0)
PIN # 20 (Step)------------------------------>PIN # 5 (D3)
PIN # 14 -> Ground (Drive Select A)


All odd pins on the floppy drive connector are Ground pins. For example, pins 5, 7, 9 etc.

To make the stepper motor on the floppy drive move, first we have to ground pin 14 on the floppy drive connector. This is done to select the drive electronics. Grounding pin 14 selects Drive A (my floppy drive is jumpered as drive A). Then, we have to send a step pulse to pin 20 of the floppy drive connector to make the stepper move. The direction of movement is determined by the high/low state of pin 18 (the direction pin).

To control the stepper motor through my parallel port, I wrote a program which sent step pulse signal to D0, which is normally high. One low going pulse at step pulse line makes the stepper motor take one step.

All this sounds pretty straight forward, but trust me, I had all the difficulties in the world. The main problem was in my program. The values it sent to the parallel port were incorrect. So after a lot of testing with a multimeter and LED (used as a logic probe), I finally managed to fix it. Now, I am able to control the motor and move it in any direction.

After controlling the motor, I thought, what am I gonna do with this thing? I decided to somehow hook the motor to a camera and move it. With a little bit of construction, I attached the camera to a CD case cover. Then, I hooked the cover to the R/W head on the floppy drive. Whenever the stepper moves the head forward, it pushes the CD case cover open. When it moves backward, it pulls it. Pretty cool, eh? Check out the video and pictures above to get a better idea.

Well, I feel great right now! I can’t tell you how happy I feel. :) This project has taught me a lot about how floppy drives and stepper motors work. Now, my brain is full of all sorts of awesome ideas. I’m planning to write a program which will make the camera turn towards the brightest point in its field of view. In my case, this bright point will be a laser dot. So, if the laser dot is to the camera’s right, the stepper would turn the camera till that dot gets near the center of the camera’s view. Another wonderful implementation could be to make the camera follow a moving person! I already have some experience on motion detection, so this shouldn’t be very difficult.

If you found this post interesting (or even if you didn’t), do send me your comments. I’d love to hear from you. :)

See ya…Keep visiting!

Share/Bookmark

77 comments:

SourabhM said...

Just got to know about your project via Scott Hanselman's blog.

Awesome Ashish! Its amazing that you are experimenting successfully :-) with this stuff at this young age.

Keep up the good work.
-SourabhM

Anjan Bacchu said...

ashish, dude! you're cool!

Keep these posts coming regularly. I would love to know more about your programming exploits.

BR,
~A

Ashish Derhgawen said...

Thanks for the kind words guys..I really appreciate it. :)

I'm working on some more fun computer projects right now..Keep visiting!

Ashish :D

amir said...

Cool! I wish I had that much time to experiment. Keep up the good work!

Savu said...

nice

Anonymous said...

Very, very good! I would like to ask you is any chance to get source code of your program. I have problem with LPT signals. My e-mail is: damir.h@excite.com

Anonymous said...

great job. after thinking about it i was wondering if you could modify the light tracking program and combine this and the usb controled airsoft gun hack then you could paint a target with the laser and shoot the target. but i know verry little about programing so i dont know how hard that would be

Ashish Derhgawen said...

I'm planning to do this. Are USB nerf weapons available??

Anonymous said...

You are a genius!

This is very cool! An the use of a simple CD cover was clever.

Great job!

Anonymous said...

USB Nerf Weapons... Hmm, brings thoughts of using multiple USB interfaces and stepper motors. Robotic PaintBall! Now to learn about USB interfaces....

fever said...

well insted of using floppy stepper i prefer a small motor from printer.so that we can avoid all the mess from floppy drive and we can make a box with stepper connected to the bottom of the webcam.
so do u have any such design.ur current design is nice but iam thinking of compact version.

Ashish Derhgawen said...

Yes, it's possible to connect a stepper motor without all the floppy drive stuff. There are several articles on the net which have instructions on doing accomplishing this. Just do a google search. :)

Anonymous said...

Cool project and wery intresting :)

Qais said...

hello
your work is really nice and great
can u please send me a copy of your code program .. i would like to see it and see how do you control the stepper motor
send it to my e-mail please : taisso_k@hotmail.com

Anonymous said...

very great project ! i would like to get a copy of the source code please , send it to it please : qais_k2001@yahoo.com

Anonymous said...

in c#, how can i, send a bit of entrance, (photodiode bit) and then that response the pulse to the stepper motor (to what port, 10,11,12,13?) how the code goes?
:(

can u respond me to franck_85@yahoo.com

Anonymous said...

hi boss !! u r really great man...cool... how did u got d idea for all these...any way can u just send me the source code of it to my id...its shankar.np@gmail.com...

Anonymous said...

hey boss me too planning to do something exciting for my engg mini project...can u suggest me some thing like the one u did ...hw abt controlling a remort control toy car using ports...pls help me out? mail me at ...shankar.np@gmail.com..

anil said...

hi sir your work is great...

u done really a nice thing .

sir i have my final year project "PC BASED HEIGHT MEASUREMENT SYSTEM"

in which we r using using infrared Tx Rx for height sensing .

but for up n down we r using stepper motor .but we r facing problem in that part .

plz can u send me the program or ur project report to me .

i m very thankfull to u for ur kind act.

my email id is
yadav.kr.anil@gmail.com

Rosie said...

These comments have been invaluable to me as is this whole site. I thank you for your comment.

Anonymous said...

can help me o control a cd drive step motor

Anonymous said...

one hell of a programmer

Javier said...

Hi Man, i from Mexico, I read about your project, i think is amaizing. congratulations for you great idea!.. is to amaizing to the motion project idea..

I be so happy if you can add to you IM, i use the Live Messenger, my email is javyermtz@hotmail.com

I hope you can contact me.. i want to lear to do that.. hehe

Congratulation man again!!
Be happy!.

Javi Martinez.
Monterrey, Mexico.

Anonymous said...

Hi I'm Alain from Canada

Nice work, it will help a lot.
Is the code avelable.

Sorry for my english

Ciao

Ashish Derhgawen said...

Hello Alain,

The source code is available here - http://www.codeproject.com/cs/system/floppystepper.asp

ankur said...

Hello ashish,
I saw your project which is wonderful.I also inspire by that but i face one problem.In my project control stepper motor through PC.In whicch i programming in Turbo C.I control stepper motor which operating votlage is 12 volt through PC. Now i required small stepper motor for my application.so i used floppy drive stepper motor.I removed this stepper motor from floppy drive & applied same logic through parallel port.But this floppy drive stepper motor is not rotate.I considered this motor operating volt is 5.so plaese give idea about this things.

Thank you.
my mail id: diyora.ankur86@gmail.com

nyeh nyeh said...

hello ashish,
can u please send me a copy of your code program .. i would like to see it and see how do you control the stepper motor
send it to my e-mail please :

naim_snyper@hotmail.com

thanx..

Anonymous said...

Hi,
I have just been sent a link to your site. I have been trying to drive a FDD head-read motor for some time, but could find very little info. Then someone found Tomi Engdahl's web-site and, using this, I did what you have done here, i.e. I drove a motor ( except that I didn't use a computer. My set-up was very basic; the motor simply turned.
It was surprisingly easy. However, within a minute, the motor stopped and I cannot get it to turn any more. Both motor and its control chip were hot. I suspected that continuous rotation ( not how it normally works ) causes fatal overheating.
What is your experience?
Regards
Bruce (UK)

Ashish Derhgawen said...

Bruce: I have experienced that thing myself. This sometimes happens when the motor heats up. Don't rotate your stepper continuously for long periods of time..and release it (de-energize all its coils) whenever its not moving.

Joel M. Pinto said...

hey Ashish,
Good work, Keep It Up!

Open the floppy drive and theres a big broad & flat stepper motor.just lift the circular cover and you can see the whole of the inside! Its truly amazing.

Joel
joel_m_pinto@yahoo.co.in

Joel M. Pinto said...

Hi

I don't have a floppy drive cable so can we control the floppy drive without it?

Please tell me what connections i have to make in the absence of the cable.

Joel
joel_m_pinto@yahoo.co.in

Ashish Derhgawen said...

Hi Joel,

Yes you can do it without a floppy cable. You might have to solder some wires to your floppy drive though. Just make the connections described in this article -

http://www.codeproject.com/cs/system/floppystepper.asp

Cheers,
Ashish

Dr Matt said...

Good work, it sounds a bit brutal on the motor. I like the use of a CD case as a hinge. If you're still experimenting with this stuff you should look at servo motors. They aren't too expensive and are ideal for positioning tasks. They often use analogue inputs between a set voltage range then match the input with a output angle. Use two and you have horizontal and vertical. You could build two 4-bit ADCs (16 point resolution) using a handful of resistors and attach to the 8-bit output of the parallel port. This way you'd have a full pan and tilt camera.
All the Best
Dr Matt

ElCyph said...

Ashish,

You've come up with a lot of cool shit recently. This is the post which originally drew me to your site. You think u could control the stepper motors even if the drive wasnt connected through the parallel port? what would the code for that look like? Also how do you send a value to the parallel port? I've been trying to write my own code but I just learned C#.
thanks and again good shit...the CD cover thing was ghetto and brilliant.

Anonymous said...

great idea, you are very ingenius! this inspires me to use floppy to build a miniature cnc mill!

Ronak said...

hi,
nice job man but i want to know something about can it is possible to connect webcam with 8-bit parallel port.

Ronak said...

if u find something then please reply me on my e-mail add ronak.gcet@gmail.com i am waiting for ur reply please

GURUNATH SHINDE said...

Hello ashish ,
i have done project controlling motion of tool in cnc trainer lathe in which some operations like tapering,turning etc....have done using two diff stepper motors now my intension is to go towards making threading,knurling...can u have any idea to prepare g codes for the same?my ID:gurunath_1986@rediffmail.com

Anonymous said...

hii..
nice project..even i'm working on control of stepper motor..hey can u just mail the source code of stepper motor control to 1swaroopa5@gmail.com..
Thank you in advance..:-)
Swaroopa..

Anonymous said...

Sir your documents are not worked . when I click tha link the page cannot find error found . now tell me how would I access this articles

haniya said...

Hi
Can u send me ur program code my email id is sanayaseen1@hotmail.com

Valencia said...

I recently came accross your blog and have been reading along. I thought I would leave my first comment. I dont know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.


Joyce

http://www.shunmigraine.com

Anonymous said...

Hi Ashish, your projects are very good! I'm Edin from Bosnia. I want to control 3 floppy drives with one parallel port cable, is it possible? Thank you!

Ashish Derhgawen said...

@Edin: Hey Edin, since there are 8 data ports on an LPT port, you should easily be able to control three floppy drives with a parallel port.

Ali Haider said...

Good work dude! Reminds me of my final year project days. :)

web design company,web designer,web design India,website design,web design said...

nice videos

bollywood girls said...

i like your blog ....

Stefan said...

hello ashish,
can u please send me a copy of your code program .. i would like to see it and see how do you control the stepper motor
send it to my e-mail please :

James praker said...

Hi this is a nice post and nice overview about using the parallel port controlled floppy drive.
i am Web Designing
expert and i like your blog!

Free Web Directory said...

Great information, thank you for this nice post.

Software Application Development said...

Love to read some thing creative, thanks for sharing such a nice post keep writing.

Anonymous said...

Fantastic work!
I rigged up the circuit connections, and all seemed to be going well. However, the motor rotates only backwards. When 'forward' is selected, the shaft does not move, but a series of pulses seems to propagate along the shaft. This seems to be a faulty motor, are there any other possibilities where the fault could lie?
Also, wanted to ask if the secondary motor, the one with shaft axis perpendicular to the circuit board, can be controlled via the parallel port? Is there a procedure to obtain feedback between the two motors?
Thanks in advance.

Gadgets UK said...

I absolutely love your blog and find almost all of your post’s to be precisely what I’m looking for. Does one offer guest writers to write content in your case? I wouldn’t mind creating a post or elaborating on a lot of the subjects you write regarding here. Again, awesome site!

strumpfhosen said...

Thank you for another great post. Where else could anyone get that type of information in such an ideal way of writing? I’ve a presentation next week, and I am on the look for such info.

strumpfhosen said...

Thanks you. Very good post.Unless they can offer a really compelling reason for users to come back, it will be the next Bebo, MySpace

strumpfhosen said...

Thanks you. Very good post.Unless they can offer a really compelling reason for users to come back, it will be the next Bebo, MySpace

Kiosk Manufacturers said...

I just couldn’t leave your website before telling you that we really enjoyed the quality information you offer to your visitors… Will be back often to check up on new posts.

virtual assistant said...

Hello! I just would like to give a huge thumbs up for the great info you have here on this post. I will be coming back to your blog for more soon.

photographers brisbane said...

This is REALLY a very nice post.I’ve been reading your blog a few times and this is the first time I feel like I need to comment.Very nice

Buy herbal incense said...

Hi, interesting post. I have been wondering about this topic, so thanks for posting. I’ll definitely be subscribing to your site. Keep up the good posts

Costa rica dental said...

Hi, interesting post. I have been wondering about this topic, so thanks for posting. I’ll definitely be subscribing to your site. Keep up the good posts

Vasectomy said...

Thank you to tell us so much useful information. So nice sharing. I’m glad to read it.

Nautical Home Decor said...

This Blog is going places, the people, the layout, amazing to see such dedication and focus.

B2b marketing said...

Thank you, thats very interesting information. I need to share with my friends.

Nassau County business coach said...

I just wanted to add a comment here to mention thanks for you very nice ideas. Blogs are troublesome to run and time consuming thus I appreciate when I see well written material. Your time isn’t going to waste with your posts. Thanks so much and stick with it No doubt you will definitely reach your goals! have a great day!

Dropshipper said...

Hi, interesting post. I have been wondering about this topic, so thanks for posting. I’ll definitely be subscribing to your site. Keep up the good posts

Lingerie Pantyhose said...

I just wanted to add a comment here to mention thanks for you very nice ideas. Blogs are troublesome to run and time consuming thus I appreciate when I see well written material. Your time isn’t going to waste with your posts. Thanks so much and stick with it No doubt you will definitely reach your goals! have a great day!

Fulton Septic Cleaning said...

I found your website perfect for my needs. It contains wonderful and helpful posts. I have read most of them and learned a lot from them. You are doing some great work. Thank you for making such a nice website.

Electrician Galveston said...

Its highly informative. I would be visiting your blog hereafter regularly to gather valuable information.

RFA52S said...

This Blog is going places, the people, the layout, amazing to see such dedication and focus.

Training Tampa said...

Hello, I have browsed most of your posts. This post is probably where I got the most useful information for my research. Thanks for posting, maybe we can see more on this. Are you aware of any other websites on this subject... Regards..

Dishwashers Leicester said...

Wow, Fantastic Blog, it’s so helpful to me, and your blog is very good,
I’ve learned a lot from your blog here, Keep on going, my friend, I will keep an eye on it,

birthday online flowers delivery said...

That's a great attitude, I hope the incoming comments and suggestions are equally positive. I know I've said it in person, but for anyone reading the comments, its awesome!

rocky case said...

Really your blog is very interesting.... it contains great and unique information. I enjoyed to visiting your blog. It's just amazing.... Thanks very much for the share.

Rachman said...

i search how to freak out the Floppy disk drive then i arrived here.. :)

amelie adam said...

I thought, what am I gonna do with this thing? I decided to somehow hook the motor to a camera and move it. With a little bit of construction, I attached the camera to a CD case cover.
Computer Enclosures

aparna john said...

Hi,While search engine optimization (SEO) focuses on text quality and density,
Web Design Cochin focuses on appearance and aesthetics. Thanks........