Pages: [1]   Go Down
Author Topic: photoresistors as input in 4x4 matrix keypad ! is it posible ?????????  (Read 186 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 1
Posts: 97
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello to everyone !

was thinking of putting 16 photoresistors in 4x4 matrix and take their data when i put my finger over them so i completely cover the light as a press of a button.

my question is " IS IT POSSIBLE " ????????????????????

if i am correct to a normal 16 btn 4x4 matrix keypad everything is connected to the digital connections, so the microcontroler knows every time on witch input what output is presenting.

photoresistors are analog, the close the circuit all the time ( for a digital input pin ) and an analog input ( witch is the most appropriate input for this project ) can not read digital outputs.

is my thinking correct ?
am i missing something here ?

is there a way to do something like that ?

i was thinking of some analog to digital converters, but everything is a little bit messy in my head at the moment.
can you help me ?
Logged

North of Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 267
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It is VERY possible.
If you choice pullup resistors in according to the photoresistor value (light/dark) you can get digitalsignals you directly can use in your arduino.

BUT the signals become inverse, all buttons give signal except the one you tap on, (thats a software problem)

Go on

Pelle
Logged

Offline Offline
Jr. Member
**
Karma: 1
Posts: 97
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

pelle thank you very much for your reply.

i'll give it a try this weekend !
Logged

Leeds, UK
Offline Offline
Edison Member
*
Karma: 80
Posts: 1729
Once the magic blue smoke is released, it won't go back in!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

and an analog input ( witch is the most appropriate input for this project ) can not read digital outputs.
Not at all correct.
There is nothing to stop you doing a digitalRead() on an analog input. Nor is there anything stopping you doing:
Code:
digital = (analogRead(pin) > 512);  //Assume logic 1 if > 50%
You could change the threshold for a the read to something like 128 or even less as you know that it will be almost 0 when the button is pressed, you can't be sure of the value when the button isn't pressed.
Logged

~Tom~

NSW Australia
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3647
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Note that because all of the "switches" will be on until you cover one, you will need diodes on each LDR in order for them to be disambiguated.

Two other things - given that the "on" resistance of the LDR is less than about 7k ohm, which would be less than the effective resistance of the internal pull-ups, you can simply use digital reads and use the internal pull-ups.

Finally, you can "charlieplex" a 4 by 4 keypad if you can wire the keys to suit.
Logged

Victoria, Australia
Offline Offline
Edison Member
*
Karma: 46
Posts: 1613
Electronics Engineer/Industrial Control
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, the only problem I can see is if you have a 4 x 4 array to make sure the shadow of  your hand when you cover the LDRs in the centre of the array, you will have to choose your threshold well.
Also place a mask over the LDRs so that they have a window over each one,covering the window with  your finger will then put the LDR in complete darkness, this will make sure you have a definite covered and uncovered in dull light transition.

Tom.... smiley

Logged

Everything runs on smoke, let the smoke out, it stops running......VK3DMK

Pages: [1]   Go Up
Jump to: