HELP Double Click Circuit

Thread Starter

gregmora

Joined Jul 7, 2017
1
Hi everyone!

I'm have a very basic knowledge of electronics.

I need a circuit that recreates a double mouse click, inside of a mouse.
Meaning, when you press the left button the circuit must sent two left click press:

Event you press a button once and: left mouse click down - left mouse click up - delay of 30 ms - left mouse click down - left mouse click up.

I have a circuit with a 555 but is for successive pulses while the button is hold down.

Thanks in advance!
 

crutschow

Joined Mar 14, 2008
34,280
Can the mouse button contacts be connected either to ground or to the plus voltage, as required?
 
Last edited:

WBahn

Joined Mar 31, 2012
29,976
Something like an 8-pin microcontroller might be the best solution, but there is an upfront cost and learning curve.

An alternative is to use 555 timer as an astable and use a counter or shift register to produce the two pulses in response to a trigger.
 

AnalogKid

Joined Aug 1, 2013
10,986
It would be easier if the first outgoing pulse comes from the mouse button down-press, and the second outgoing pulse comes from the mouse button release.

ak
 

Alec_t

Joined Sep 17, 2013
14,280
You could base a circuit on this, though fitting it in the mouse might be a problem. Doubling the values of R2 and R3 and halving the values of C1 and C2 would save some space.
DoubleClick.PNG
The inputs of the three unused gates in the IC should be grounded.
D1 prevents any existing pull-up resistance in the mouse from affecting the pulse timing. R1 limits current through the switch.
 

EM Fields

Joined Jun 8, 2016
583
Hi everyone!

I'm have a very basic knowledge of electronics.

I need a circuit that recreates a double mouse click, inside of a mouse.
Meaning, when you press the left button the circuit must sent two left click press:

Event you press a button once and: left mouse click down - left mouse click up - delay of 30 ms - left mouse click down - left mouse click up.

I have a circuit with a 555 but is for successive pulses while the button is hold down.

Thanks in advance!
From your query, it appears you want to generate two left-click pulses every time the left-click button on the mouse is pressed, and you want the separation between the trailing edge of the first pulse and the leading edge of the second pulse to be 30 milliseconds. If so, then:

1. How long do you want the synthesized left-click pulses to be?
2. What is the minimum time allowed between successive actuations of the mouse's left-click switch ?
3. Is the output of the mouse's left-click switch low true or high true?
 

JohnInTX

Joined Jun 26, 2012
4,787
Something like an 8-pin microcontroller might be the best solution, but there is an upfront cost and learning curve.
+1 A PIC10F200 in the SOT-23 package would be a natural. I crashed some code together as a test and it compiles to 50 words in XC8 1.42 free mode - about 20mins including setting up the project. Not a particularly robust effort but a good start.


C:
/*
* File:  DCmouse.c
* Author: John
*
* Created on July 9, 2017, 9:49 AM
*/

// CONFIG
#pragma config WDTE = OFF  // Watchdog Timer (WDT disabled)
#pragma config CP = OFF  // Code Protect (Code protection off)
#pragma config MCLRE = OFF  // Master Clear Enable (GP3/MCLR pin fuction is digital I/O, MCLR internally tied to VDD)

#include <xc.h>

#define BUTTON_IN GP3
#define BUTTON_IN_PRESSED 0  // what it reads when button is pressed

#define LEFT_CLICK_OUT GP2
#define CLICK_OUT_PRESSED 0  // what it should output for clicks
#define CLICK_OUT_RELEASED 1  // and releases

#define GPIOinit 0b00001100  // Button input, Click out==1, ICSP strapped
#define TRISinit 0b00001000

#define CLICK_MSEC 25  // 25msec down time
#define INTER_CLICK_MSEC 30 // 30msec between clicks
#define DEBOUNCE_RELEASE_MSEC 5 // blind time after button released
#define _XTAL_FREQ 4000000  // 4mhz internal osc

void main(void) {

  GPIO = GPIOinit;  // init IO
  TRIS = TRISinit;

  while(1){  // wait for button
   if (BUTTON_IN == BUTTON_IN_PRESSED){

    LEFT_CLICK_OUT = CLICK_OUT_PRESSED; // output first click
    __delay_ms(CLICK_MSEC);
    LEFT_CLICK_OUT = CLICK_OUT_RELEASED; // release

    __delay_ms(INTER_CLICK_MSEC); // wait awhile

    LEFT_CLICK_OUT = CLICK_OUT_PRESSED; // then output second click
    __delay_ms(CLICK_MSEC);
    LEFT_CLICK_OUT = CLICK_OUT_RELEASED;

    while(BUTTON_IN == BUTTON_IN_PRESSED);  // wait for mouse button release

     __delay_ms(DEBOUNCE_RELEASE_MSEC);  // debounce a bit when released
   }//if button detected

}// main while loop
}
 
Last edited:

WBahn

Joined Mar 31, 2012
29,976
+1 A PIC10F200 in the SOT-23 package would be a natural. I crashed some code together as a test and it compiles to 50 words in XC8 1.42 free mode - about 20mins including setting up the project. Not a particularly robust effort but a good start.
@gregmora: Clearly if you have never worked with a microcontroller or done much programming, there is a lot more than 20 minutes involved as well as some cost. You'll have to buy a programmer (which isn't too outrageous if you get a real basic one) and you have to learn the fundamentals of using a microcontroller, writing programs for it, compiling them, and programming the part. But this is a nice, simple, real project to use as a starting point and JohnInTx has given you a good start, if nothing else, at the code. If you have any interest (or if you see yourself working on other problems that will lend themselves to microcontroller solutions), then now might be a really good time to jump in.
 
Top