poss. OT, make lever work a switch multiple times

i guess this is more of an electro mechanical thing than electronics, but i thought i'd try here first.....

i want to make a controller for my computer to play a couple of underground train simulators, they are played using the keyboard, pressing one key advances the power/brake lever one notch, press it again it goes up another notch, press another button and it decreases it a notch and so on,

i want a way to do that button press from the movement of a lever, i will make it with the mechanical notches to hold it in the right places, and need some way to have the lever activate multiple switches as the lever passes them and give out a single key press (they can't be held down or the lever on screen advances repeatedly till the end stop)

simple enough, switches that are bumped by the lever as it passes between notches, but the problem is how to get it to press a different set of switches on the way back down to give the reduce notch key presses?

obviousely if the lever hits the advance switches going down, it will signal an up press,

at the moment i'm using the scroll wheel of a gamers keypad, roll it forwards one notch and it gives out one keypress, which is mapped to increase one notch of the power lever, roll it backwards, gives out the pull back keypress, so i guess something like that with a lever mounted to the scroll wheel.....

not sure how the notched scroll wheels in mice work, are they optical encoders, i'm sure i was inside a wheel mouse and it wasnt, it was some arangement of 2 switches on a cam system.

Reply to
Gazz
Loading thread data ...

One way might be to hack into a surplus keyboard and substitute transistor switches for the appropriate key contacts and then drive the transistors from a microcontroller that "listens" to the movement of the lever. You may be able to do it using a series of one-shots instead, where the one-shot fires when the lever reaches a position but won't continue to fire if it stays in that position. You'll need to handle contact bounce, of course.

There's probably a clever way to do this using discrete logic but a state machine in a microcontroller would seem to be the simplest.

Alternately, dispense with the keyboard and build it all around a micro that has a USB peripheral and have it emulate a USB keyboard. That gives you the option of using any inputs, within reason, and then generating an arbitrary sequence of virtual keypresses.

Possibly the very (very!) early mice worked with mechanical switches but, up until the advent of the current generation of optical mice, the x-y motion was pretty much universally done using optical sensors in quadrature, via the slotted wheels.

--
Rich Webb     Norfolk, VA
Reply to
Rich Webb

I have used an old keyboard, to solder the contacts of a reed-relay across the print traces for a number of keys. Then you only have to supply 5volt to the reed coils, to remotely press a key.

Reply to
Sjouke Burry

You need some slop in the mechanical system - two small buttons as close as posible to each other (say less than 1/2"). The button actuator has to slide (easily) within guides - to position on top of one or the other push buttons. The triangular (sawtooth) shape attached to the lever first slides the actuator over to one end stop then pushes it down on the switch.

\/\/\/\/\/\/\/\/\/\/\/\/\ Lever bottom I ||- I-------------|| Actuator in guides I |---| |---| | | | | PB1 PB2

--
Geo
Reply to
Geo

USB HID device:

formatting link

You will need to modify the code to handle the one key press issue.

Let us know how you get on.

hamilton

Reply to
hamilton

nd

ss

Most (for instance PC classic game controls) levers are connected to potentiometers, i.e. variable resistors. Your problem is that the intended action depends not only on the lever position, but on the history of that position.

Conceptually, you need an accumulator (like, an up/down counter) and to update that count when any power/brake adjustment is made. Whenever the lever position is significantly above the accumulator reading, send a 'power' signal and increment the accumulator, and when it's significantly below, send a 'brake' signal and decrement the accumulator.

If 'twere a PC doing the control, this would be a simple matter of software, with the lever connected to one of the game port analog control pins.

Reply to
whit3rd

i

nd

ss

eed

r

nal

ull

Not sure I follow - but use a 2nd switch (that is otherwise unused, but is still in the direction of travel). By comparing the activation sequence, you can tell which way the lever is traveling.

Reply to
mpm

You're on the right track. You need a beam-break optical system (LED paired with a phototransister), and an encoder wheel. You'll need a pair of the optical circuits and a pair of D flip-flops. You can make the encoder from whatever is easiest to use, but you need to construct something like this

formatting link
If you look at the bottom under "Incrimental Decoder", it explains how a quadrature signal can be decoded to yield both a step signal and a direction signal. Do a google search for "optical encoder direction".

On Jan 11, 6:55=A0am, "Gazz" wrote: ...

nd

ss

...

ull

Reply to
lektric.dan

That's brilliant!, here's a variatiom (not to scale)

\ /\ /\ /\ /\ / \ / \ /__\ / \ / \ / \/ \// \\/ \/ \/ o \__/ o \\ // up down

use a ball (or roller) instead of the slider and angle the awitches. o is a stop bar so the ball doesn't escape.

--
?? 100% natural
Reply to
Jasen Betts

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.