circuit to emulate a double click

Discussion in 'The Projects Forum' started by Johnnz, Sep 28, 2009.

  1. Johnnz

    Thread Starter Active Member

    Dec 31, 2008
    55
    0
    Hi,
    just wondering if anyone has any ideas on how to design a circuit which will produce a double click from a single click (essentially). What I am trying to do is use an old mouse scroll wheel to be part of the front panel interface on a stereo rack MP3 player (which will be made from an old computer). I want to be able to use a single press on the scroll wheel that will play the song under the mouse pointer (that really requires a double click).

    THanks!
     
  2. KMoffett

    AAC Fanatic!

    Dec 19, 2007
    2,574
    230
    Perhaps an edge detector circuit. Press down generates the first pulse. Releasing generates the second one.

    Ken
     
  3. t_n_k

    AAC Fanatic!

    Mar 6, 2009
    5,448
    782
    Nice circuit Ken! Would it be necessary to add some sort of de-bounce?
     
  4. n9352527

    AAC Fanatic!

    Oct 14, 2005
    1,198
    4
    It might be simpler to do it in software. It is possible to capture the mouse input, process it accordingly and insert a double click.
     
  5. KMoffett

    AAC Fanatic!

    Dec 19, 2007
    2,574
    230
    Since they are there, I would probably use one of the spare gates to add debounce at the input.

    Kem
     
  6. Papabravo

    Expert

    Feb 24, 2006
    10,138
    1,789
    This is essentially the same idea as an iambic keyer. Holding down a switch produces a series of pulses at a predetermined rate. It is true that in a keyer there are two switches, one for short pulses (dit-dit-dit...), and one for long pulses (dah-dah-dah...) What is cool are the rules for what happens when both switches are depressed and one is released.
     
  7. Johnnz

    Thread Starter Active Member

    Dec 31, 2008
    55
    0
    Thanks for that. Would the output pulses have to be triggering a transistor to act as a switch in replacement of the double click microswitch, or could the output be connected directly up to the output side of the said switch? Also, how would I go about using the other gates to debounce the input switch?

    Thanks,
    -John.
     
  8. Johnnz

    Thread Starter Active Member

    Dec 31, 2008
    55
    0
    How would I start to find software that could do that? I've only ever dabbled around the edges of Autohotkey with scripts, and needed lots of help with that:)
     
  9. Johnnz

    Thread Starter Active Member

    Dec 31, 2008
    55
    0
    Turns out my local electronics shop doesn't have that particular chip. Is it possible to design a similar circuit with 4000 series using another variety of gate? Checking online they have available cd4001bc, cd4011bc, mc14081b, and 4002. Otherwise, I will have to order from out of town.
     
  10. KMoffett

    AAC Fanatic!

    Dec 19, 2007
    2,574
    230
    John,

    Since I don't know the circuit you are attaching the double-click circuit to, I can't really answer that. Do you have a schematic?

    You can make an one XOR gate with one CD4011 quad 2-input NAND .http://www.play-hookey.com/digital/xor_function.html

    I haven't tried this circuit, but I think it should work.

    Ken
     
  11. Johnnz

    Thread Starter Active Member

    Dec 31, 2008
    55
    0
    Thanks for that. All I know is that the mouse I am using is a Microsoft Wheel mouse 3.0. Will try to find schematics this evening.

    Thanks.
     
  12. Johnnz

    Thread Starter Active Member

    Dec 31, 2008
    55
    0
    Found this info on a later model SPCP Microcontroller (very hard to find any info at all about the old model I have which is spcp05a-04b). Hope this is enough info (presuming my ic behaves the same) to work out how your edge dectect circuit can be implemented?

    Mouse Buttons
    Mouse buttons are connected as standard switches. These switches are pulled up by the pull up resistors inside the microcontroller. When the user presses a button, the switch will be closed and the pin will be pulled LOW to GND. A LOW state at the pin is interpreted as the button being pressed. A HIGH state is interpreted as the button has been released or the button is not being pressed. Normally the switches are debounced in firmware for 15-20ms. In this reference
    design there are three switches: left, Z-wheel, and right.

    Edit: Can confirm that the buttons are pulling pins on IC low to ground. Can I just use a NPN transistor on the output of the logic circuit to act as a switch?
     
    Last edited: Sep 30, 2009
  13. KMoffett

    AAC Fanatic!

    Dec 19, 2007
    2,574
    230
    With my circuit, since the output is high going and a transistor will invert that, then I would say yes.

    Ken
     
  14. Johnnz

    Thread Starter Active Member

    Dec 31, 2008
    55
    0
    Does this look like it would work?
     
  15. jdub765

    Member

    Mar 5, 2009
    15
    0
    Doesn't the Microsoft IntelliMouse drivers allow you to remap the mouse wheel to a left click? It might even allow you to remap it to a double left click.

    You could also use a macro maker and record the action of a double click, and use the mouse wheel click as the hot key to trigger that macro.
     
  16. KMoffett

    AAC Fanatic!

    Dec 19, 2007
    2,574
    230
    Yes...but the roller switch is supposed to already have a pull-up, so you won't need the load resistor on your transistor.

    Ken
     
  17. Johnnz

    Thread Starter Active Member

    Dec 31, 2008
    55
    0
    So, I just connect the collector of the switching transistor directly to the roller switch, and leave out the connection to Vcc altogether? If I don't and dont use a load resistor it looks like the transistor will just be shorting Vcc to ground...?

    Thanks for all your help by the way :) I will get the bits I need to build this circuit tomorrow so will let you know how things go.
     
  18. KMoffett

    AAC Fanatic!

    Dec 19, 2007
    2,574
    230
    From your post #12:
    That pullup resistor will be the resistor you show as RL in your schematic in post #14. Collector to the high side of the switch (microcontroller's input), and emittee to common. Should work OK.

    Ken
     
  19. Johnnz

    Thread Starter Active Member

    Dec 31, 2008
    55
    0
    Woo Hoo!! Thanks for all your help Ken:cool:. I have just completed this little project and it worked perfectly first time (first time I ever that a circuit I have made worked first time - and I've made a few...:D). Thought I might've fried the transistor after I had to resolder around it when I noticed an incorrect lead during construction but all was well!

    Here's a picture for what it's worth:

    Cheers!

    Now that I have proven this to work, I can go ahead rehousing/refabricating this mouse's scroll wheel for my Mp3 player into a large "scroll" dial beside the 7" LCD screen on the front panel which will now be able to have single touch song selection/play control:D
     
  20. Johnnz

    Thread Starter Active Member

    Dec 31, 2008
    55
    0
    Hmm, unfortunately I have a small issue with this setup. The double click feature works everytime time, but on nearly every other click it will scroll up or down one line as I press the "double click" button. Perhaps I need a capacitor in there somewhere for filtering or something? I have confirmed that it is the addition of the new circuit that is causing this, because double clicking with the actual left mouse button does not cause this behaviour. Neither is it the scroll wheel slipping while I press it because I have taken the scroll wheel right out to test the button below by pressing it directly. (by the way the scroll wheel click button is completely isolated from the original mouse circuit (I removed portions of the PCB track leading to it both directions)).

    Any ideas what is causing this?

    Edit: Just an idea, but is it possible that the moment the switch is pushed in the new circuit the voltage drop in the mouse circuit is causing troubles? The funny thing is that it is only the scroll function that moves by one line (up or down). The mouse pointer position does not change (these three sensors are all the same type in the mouse - I guess they are IR LEDs with sensors detecting light and dark on either side (presumably to detect the direction of movement of the mouse ball rollers and scroll wheel)?)
     
    Last edited: Oct 3, 2009
Loading...