Connect with us

Question: How to make a counter/timer using PC mouse input

Discussion in 'Electronic Basics' started by [email protected], Feb 27, 2005.

Scroll to continue with content
  1. Guest

    I would like to count the number of wheel revolutions of my indoor bike
    during training indoors, and don't know anything about electronics.
    I've taken apart an old, $2.99 mouse from an older PC and was able to
    "read" when the mouse buttons were clicked using javascript. I'd like
    to use that concept to make a bicycle wheel counter and write a
    javascript to keep track of speed. Any suggestions on how I'd do it?
     
  2. Randy Day

    Randy Day Guest

    If the bike wheel has spokes, mount a
    lever-action microswitch on the fork so
    that it depresses when a spoke goes
    by. Wire the switch in parallel with
    your mouse button.

    HTH
     
  3. paul

    paul Guest

    I was going to suggest the same but use a reed switch and magnet
     
  4. Chris W

    Chris W Guest

    Best of luck on what sounds like a fun project, but if all you want to
    do is know how fast the wheel is spinning, there are numerous bicycle
    speedometers that work by mounting a small magnet to the wheel and read
    the signal of the magnet going buy a sensor of some kind. You can enter
    the rolling circumference of your wheel into them and they will track
    speed, distance and a number of other things. They range in price form
    $20 to a few hundred. They call them Cyclocomputers. I'm sure your
    local bike shop will have them, or you can order them on line. My to
    favorite bicycle mail order companies are listed below

    http://www.performancebike.com
    http://www.nashbar.com

    --
    Chris W

    Gift Giving Made Easy
    Get the gifts you want &
    give the gifts they want
    http://thewishzone.com
     
  5. Kitchen Man

    Kitchen Man Guest

    That's going to be a tremendous amount of wear on the switch, there will
    be dozens of mechanical actions for each revolution. This type of
    operation would be implemented much more reliably with a magnet on the
    rim and a stationary hall-effect sensor. There are already many such
    devices available on the marketplace (bikenashbar.com for one), and the
    inputs from the device could be wired in parallel to the mouse input, as
    well as the original equipment. That would give a double-check that the
    numbers are accurate.
     
  6. John Fields

    John Fields Guest

    ---
    I'd paint a small section (maybe 1") of the rim flat black and then
    use a reflective opto like:

    http://www.fairchildsemi.com/ds/QR/QRB1133.pdf

    to sense when it went by.
     
  7. Rich Grise

    Rich Grise Guest

    So, there's no dirt where you ride? ;-)

    Rich
     
  8. Bob Masta

    Bob Masta Guest

    Hmmm, instead of clicks, how about the position info?
    The cheapie mouse probably uses an optical encoder
    that looks at a slotted or lined wheel via an LED and
    phototransistor. You'd need to count the pulses per
    second. I suspect you could rig the LED and phototransistor
    to look at your spokes. I have no experience with
    Javascript, so I don't know what access you have to the
    mouse position info. The routine you'd need might
    require reading the mouse position at a known rate,
    then repositioning to the center of the screen so the
    coordinates don't run off-scale. Getting a "known rate"
    from Windows may be a problem, depending on how
    accurate you want this, so you might want some external
    circuitry to help out here.

    Best regards,


    Bob Masta
    dqatechATdaqartaDOTcom

    D A Q A R T A
    Data AcQuisition And Real-Time Analysis
    www.daqarta.com
     
  9. John Fields

    John Fields Guest

     
  10. Rich Grise

    Rich Grise Guest

    Yeah, I missed the "indoor" part. 40 lashes with a wet noodle? ;-)

    Sorry.
    Rich
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-