Connect with us

invert signal from momentary switch

Discussion in 'Electronic Basics' started by Russ Caslis, Jul 10, 2004.

Scroll to continue with content
  1. Russ Caslis

    Russ Caslis Guest

    I was/am building myself a custom mouse for my computer. I took the
    guts from an existing mouse and moved it over to my custolm enclosure,
    and got a couple switches to mount on the outside that fit the theme
    well.

    Well, it turns out I didn't check first and the switches an normally
    closed instead of normally open. Building a new enclosure will take
    weeks, so I was hoping to use something like an inverter to change the
    signal for the left and right buttons.

    I've tried everything I can think of using a 4069 inverter, but no
    luck. I'm not too good with electronics, so could someone smart out
    there tell me what I need to do to get this to work?

    Thanks.
     
  2. John Fields

    John Fields Guest

    ---
    View with a fixed-pitch font:

    Vcc
    |
    [10k]
    | |\
    |<--+----O| >-->OUT
    | |/
    O
    |
    GND
     
  3. Russ Caslis

    Russ Caslis Guest

    Thanks so much for the response, but I'm not sure I understand.

    The switch goes to ground on one wire, and the output of the circuit
    on the other wire. What's happening with Vcc and the input/output of
    the 4069 isn't clear to me.

    Also, there are two connections for the switch on the circuit board.
    One seems to be ground, and the other seems to have 5v on it and
    registers a button press when it's tied to ground.

    Can you provide a little more info? Thanks again.
     
  4. The 4069 inverts - when its input is high, the output is low, and vice
    versa.

    CMOS logic parts like the 4069 have a very high input impedance - if
    they are not connected to anything (as when the switch is open, and a
    resistor is not used), the input will wander aimlessly between high
    and low - as a result, the output of the inverter is unpredictable.
    To ensure that the input of the inverter goes high when the switch is
    open, you need a "pull-up" resistor (the 10K resistor shown in the
    drawing) to hold the input high.


    --
    Peter Bennett, VE7CEI
    peterbb4 (at) interchange.ubc.ca
    new newsgroup users info : http://vancouver-webpages.com/nnq
    GPS and NMEA info: http://vancouver-webpages.com/peter
    Vancouver Power Squadron: http://vancouver.powersquadron.ca
     
  5. John Fields

    John Fields Guest

    ---
    Actually, the simplest thing to do would probably be to replace the
    switches you've got with normally-open switches, but...

    On your ciruit board, there are basically two ways it could be wired
    for the switch:


    +5V
    |
    [R]
    |
    | <--O--A1
    |
    O-------A2
    |
    GND



    +5V
    |
    |
    | <--O--B1
    |
    O-------B2
    |
    [R]
    |
    GND

    In either case, if you measure the voltages at the connections (pads)
    for the switch, you'll read 5V (Vcc) on one pad and 0V (ground) on the
    other, as you found. However, if you measure the voltage on either
    pad when they're tied together (as would be the case when a
    normally-open switch was made) they will read either +5V or 0V. If
    they read 0V, then the circuit will be wired as in A1A2, above. If
    they read +5V, then it'll be wired as in B1B2. The difference is that
    in A1A2 the pullup resistor is wired to +5V, and in B1B2 it's a
    pull-down resistor and it's wired to GND.

    What you'll need to do is to find out which pad the resistor is
    connected to, and to do that you'll either need to inspect the board
    visually and track down what the pads are connected to, or measure the
    resistance from the pads to ground and Vcc. You'll almost certainly
    find that one pad is wired directly to Vcc and the other pad is wired
    to ground through a resistor, or that one pad is wired directly to
    ground and the other pad is wired to Vcc through a resistor.

    You could also measure the voltage on one of the pads and then short
    the pads together. If the voltage changes, then the pad the voltmeter
    is connected to is the pad the resistor is connected to. If the
    voltage doesn't change, then the resistor is connected to the other
    pad.

    In any case, the pad connected to the resistor is the one you'll be
    interested in, and you'll need to connect one of the 4069's inverters
    to it like this:

    NEW SWITCH MODS | | EXISTING MOUSE CKTY
    | |
    +-----+---->| |>-----Vcc
    | | | |
    | | | | |
    [10k] | | | [R??]
    | | \ | | |
    |<--+---O| >-->| |>--+--
    | | / | |
    O | | |
    | | | |
    +---------+---->| |>-----GND
    | |

    The switch shown is your normally-closed switch, and it shorts the 10k
    pullup resistor to ground, forcing the input of the 4069 low, which
    causes its output to go high, fooling the mouse into thinking that the
    switch is [normally] open. When the switch is pressed, it opens,
    pulling the input of the 4069 high, forcing its output low, fooling
    the mouse into thinking that the switch is closed. You'll need to add
    the 10k resistor to the circuit as shown, and you may need to remove
    the resistor (R??) on the PCB if it loads down the output of the 4069.

    Try it; if the circuit doesn't work when it's connected to the mouse
    guts, measure the voltage on the output of the 4069 with the switch
    un-pressed and pressed. Un-pressed should read pretty close to +5V
    and pressed should read pretty close to 0V. If it doesn't, unsolder
    one end of R?? and try again. If it still doesn't, well... we'll
    cross that bridge when we get to it. :)

    Finally, you'll need to connect the unused inputs of the 4069 to
    ground or Vcc. It doesn't matter which, they just shouldn't be left
    floating.
     
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

-