Dark activated Keypress with an LDR

I'm looking for the simplest possible circuit to trigger keyboard presses with an LDR.

I'm going to have to replicate this circuit quite a few times so I want to keep it as simple as possible.

The computer keyboard runs on 5V

The resistance of the LDR falls the more light shines on it.

I want the keyboard circuit closed when it is dark.

Can I achieve this with the LDR, a transistor and a resistor?

Or even just with the LDR and the transistor?

Or is it more complicated than that?

Thanks,

Gavin

Reply to
gavspav
Loading thread data ...

Which keyboard circuit do you want closed? The 5V supply? Simplest way is 555 configured as a Schmitt trigger: View in a fixed-width font such as Courier.

. . . . . . 2N2907 . 5V-------+---+--------+--+-------E C--->

. | | | | B . | | | | | . | | | +---[10K]-+ . | | | | | . [Rpd] | ---------- [4.7K] . | | | RST V+ | | . | | | | | . +------+--|THR OUT|----' . | | | | | . | | '--|TRIG | . / |1U | | . LDR \\ === | | . / |10VDC| GND | . \\ | ---------- . | | | . GND-----+---+----------+--------------------- . . . LDR,dark . 5x LDR,light

Reply to
Fred Bloggs

Thanks - I don't understand the diagram though.!

I am trying to find out.

Gav

Reply to
gavspav

You still haven't told us what you are trying to switch. If you want to use light to "press" a key then a simple static circuit will not work, the key circuit most likely has to be pulsed, you can't just hold it down indefinitely. You can get around this if the light source is a laser or something else that can be pulsed. Right now your question is too vague.

Reply to
Fred Bloggs

I want to replace the keys of a computer keyboard with a dark activated ldr ie when it is dark the key is held down, the switch is closed.

In normal usage a maximum of five 'keys' will be held down at a time.

I will ignore operation in total darkness for the present time.

For my purposes it is fine to hold the keys down 'indefinitely'.

I am looking for simple binary behaviour. Dark=closed circuit (the same circuit which a standard key would close); Light=open circuit.

I guess I am looking for some kind of inverter/not gate??

Thanks

Gavin

Reply to
gavspav

On a sunny day (Mon, 7 Apr 2008 01:59:49 -0700 (PDT)) it happened gavspav wrote in :

Keys in an IBM type keyboard are normally multiplexed in some way. This means you need a floating contact.

Something like this _could_ perhaps work:

1/4 74HC4016

\\ 0------------- +5 \\ from keyboard key contacts | \\0------------- R | |----------------- | LDR | ///

For opposite effect reverse R and LDR. It all depends on Rmin the micro in the keyboard accepts for 'on'.

Reply to
Jan Panteltje

I'm using a mame keyboard encoder which I don't think is multiplexed. Does this make it simpler? What is the role of the quad bilateral switch in the above diagram? I thought of using 74HC4049 - am I in the right area?

Gav

Reply to
gavspav

On a sunny day (Mon, 7 Apr 2008 04:58:33 -0700 (PDT)) it happened gavspav wrote in :

What is a 'mame' encoder? Are you not talking about a PC? If it has more keys then IO then it is multiplexed, else perhaps not.

To simulate a switch.

Depends if it is multiplexed.

Reply to
Jan Panteltje

Sorry - a mame encoder functions like a keyboard encoder - a computer recognizes it as such.

It has a smaller number of switches than a full keyboard but there is no multiplexing.

There is a 5 volt supply and when this is connected to each of the 32 pins, a keypress is sent.

So I may just be able to use a simple voltage divider?

Or TTL or Hex inverter?

As you can probably tell I dunno much about any of this stuff, just trying to pick it up from the net and come up with the simplest solution.

I don't think its very hard what I'm trying to do - just not very good at explaining it!

Gavin

Reply to
gavspav

On a sunny day (Mon, 7 Apr 2008 06:10:09 -0700 (PDT)) it happened gavspav wrote in :

OK, I googled for it.

OK

So then you need 5 V on an input.

+5 | LDR |------ perhaps Schmitt trigger gate? ---- 0 or +5 V | R | ///

LDR is slow, especially in low light. It should be fine with a lot of light. To make the key 'flip', perhaps use a chip with Schmitt trigger input. whats the number, 4093?

OK

It may be difficult in that I would expect the light switch not to work properly in may circumstances, like stray light, not enough light, slow, but have fun experimenting.

Reply to
Jan Panteltje

On Mon, 07 Apr 2008 01:59:49 -0700, gavspav top-posted:

This page shows one way to hack a keyboard; if you want to use an LDR you'll need a schmitt trigger of some kind. The keyboard I hacked was just looking for a contact closure, which could be done with a transistor.

formatting link

And please don't top-post.

Good Luck! Rich

Reply to
Rich Grise

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.