Game Port Photogate

photogate

Hack-A-Day regular [Andrew] has posted an incredibly simple game port based photogate. He uses a pair of light dependent resistors. Each one is placed inside of a ballpoint pen tube to limit ambient light on the sensor. He’s got a simple QBasic program to calculate the velocity of an object passing the sensors. You’ll have to run it inside a DOS emulator to get access to the game port under XP.

25 thoughts on “Game Port Photogate

  1. this is sweet. i’d like to work it into something for the desktop. like a background of the world that adjusts it’s light levels based on that of the room. Or a city-scape that does the same.
    very cool

  2. That really is pretty neat… a few months back I was messing around for ages with a HC908 microcontroller and USB port to try and get an ambient light detector working. My laptop doesn’t have a joystick port but I probably wouldn’t have thought to use it anyway. The only thing about this project is that anybody somebody uses BASIC, a jesus kills a kitten ^_^…

  3. IIRC Game a couple of pins on the game port are intended to be hooked up to a variable resistor / potentiometer – what senses position on a single axis of a joystick – and without any extra hardware can read off the value of said resistor, which makes building a joystick REALLY simple.

    Likewise – hooking up a different type of variable resistor, in this case one which varies it’s value based on the amount of light hitting it, would work in place of the joystick.

    SO now, in Basic one can read off the “joystick’s” “position” in one axis and really be getting a value corresponding to the amount of ambient light.

    To do the same thing with a serial port one would need to first use an Analog to Digital convertor of some sort to turn the value of the ambient light sensor into a digital value, and then put together a serial protocol to transmit that value over the serial bus. On the other end one would have to read out the data from the serial bus and convert it into a usable value.

    Seriously – game ports and parallel ports are very nifty interfaces for homebrew equipment.

  4. WOW! The winner of the most stupid project ever! Speed claculation with LDRs. Does this guy know how “fast” LDRs are? And how reliable theyr time constant is? The speed of what does he want to detect? A worm crouching on his desktop? Why not use a circuit with Photodiodes or Photoresistors? Photodiodes would be very precise in addition. How often good work was destroyed by avoidig a bit more work (or thought)…

  5. Chill out michael, even if it isn’t the best technique in the world, it seems to serve his purpose just fine.

    That’s pretty dang clever (not stupid at all). Honestly I hadn’t thought about using a gameport that way… but it greatly simplifies creating a simple and dirty ADC.

  6. it’s probably fairly taboo to comment on one’s own post, but here i go. delay of an average photoresistor is around 30-40ms, that’s 0.03s to 0.04s. it’s not really about precision, it’s about what you can get for a few cents’ worth of parts. and the joystick port probably isn’t responsitive enough for anything more precise. if you’re going for something particularly accurate, then by all means build a 48 bit pci adc with a sample rate of 48000mbps and an accuracy of .0000000001v with a laser/photodiode combination on a dual cpu athlon 64 3.2ghz machine with 10gb ddr2 ram and a 20,000rpm sata hard drive and… you get my point. it just isn’t meant to be that precise. and hey, if you want to build something like this then by all means build it however you like, the parts i used were what i had on hand ;)

  7. kickass, after going through your article i did some research into parallel ports and the joystick port, i’m starting with a simple program to be able to turn on and off my air conditioner from my computer (buggers on the other side of the room), hopefully, if all works out, i can automate my room off a the parallel port.

    thanks for the inspiration and again, kick-ass project.

  8. Antiwhack,

    Sounds pretty awesome. Be sure to take into account the fairly prodigious current that an AC unit draws. You’ll need moderately heavy duty relays etc.

    Anyway, good luck and look forward to seeing you’re write up!

  9. My first reaction to this hack was ‘SWEEEET’ just because of how unique it is. Using the game port is a great idea and I didn’t know it was practical to do so because I’ve just never seen it done. Using microphones like a previous hack to measure velocity might be a bit simpler but sound can’t always be used. This fits the bill of a great hack, fairly simple, purposeful, and just plain clever. Commenting on your own hack is great; it gives insight into why a certain method was used and informs more than a how to could alone. I’m curious to see how antiwhack’s automation goes because I’ve been meaning to do something like it.

  10. I like seeing posts from the project creators on here.

    And about the harsh crit:

    This is hack a day, not “precision-made aerospace development-esque project a day”

    We’ll leave those glittering gems for folks like michael to post.

    -any day now.

  11. Though I have said this to Andrew IRL, I want to add here that I find his synthesis of ingenuity, programming, and physics to be a refreshingly creative solution to this problem. Out-of-the-box solutions with comparable precision (e.g. Vernier probes), cost much more and require much less thought. Way to go!

  12. #22: as there aren’t any built-in game port functions in vb (that i know of) i think it would be rather difficult, though certainly not impossible, to interface this project to a vb app. at the moment i don’t have any answers for that one.

Leave a Reply to smilrCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.