IR LED Keyboard

Hello all,

I am looking to program an Arduino Uno to control an infrared LED keyboard.
The short story: I have a six-by-six grid of LEDs and receivers. There are twelve LEDs and twelve receivers, six on each side of the keyboard.
I have assembled the keyboard, and now need to look into wiring and programming. I understand enough of the basics of the programming that all I need is some guidance.
To begin, I should be able to use digital pins 2-13 as inputs for the receivers, while using the 5.5V out to power both the LEDs and receivers.
Would there be any problems with current?
Also, in terms of the code, is there any way to initialize multiple pins as inputs, rather than do each one individually?

I apologize if I am using the wrong terminology, and please let me know if I need to supply more information.

Thank you for your help.

TheAaronTF:
Hello all,
I am looking to program an Arduino Uno to control an infrared LED keyboard.
The short story: I have a six-by-six grid of LEDs and receivers. There are twelve LEDs and twelve receivers, six on each side of the keyboard.
I have assembled the keyboard, and now need to look into wiring and programming. I understand enough of the basics of the programming that all I need is some guidance.
To begin, I should be able to use digital pins 2-13 as inputs for the receivers, while using the 5.5V out to power both the LEDs and receivers.
Would there be any problems with current?

Before we address any of this, we need more information.
What is the layout of the LEDs and receivers?
How much current will each LED consume?
What type of IR receiver are you using?
How will you differentiate a 'keypress' from a hovering finger?

This bit's easy enough:-

Also, in terms of the code, is there any way to initialize multiple pins as inputs, rather than do each one individually?

for(int i=2;i <= 13;i++)
    pinMode(i, INPUT);  // Or INPUT_PULLUP - whichever you need.

OldSteve:
Before we address any of this, we need more information.
What is the layout of the LEDs and receivers?
How much current will each LED consume?
What type of IR receiver are you using?
How will you differentiate a 'keypress' from a hovering finger?

The LEDs will be laid out along the perimeter of the keyboard, LEDs facing receivers.
The attached image is the actual SolidWORKS drawing and was used to cut the parts out of acrylic. The green lines point to there the LEDs will go, while the orange show where the receivers will go.
Each LED will consume 100mA of current. (See here).
Each receiver will consume 0.7mA of current. (See here)
I have not yet worried about differentiating keystrokes from hovering fingers, as I think this may be beyond the function of the keyboard.

Thank you again for your help.

Sounds like this old pre Arduino project of mine
http://www.thebox.myzen.co.uk/Hardware/The_Sound_Square.html

Here's the pic, so everyone can see it easily:-

You're aware that the IR LEDs must all be driven with a modulated 38kHz signal, I assume? It can't even be a continuous 38kHz - there's a maximum burst length that the receivers can detect. Any longer and the output returns high, (inactive). (I use TSOP4838 receivers myself.)

I have not yet worried about differentiating keystrokes from hovering fingers, as I think this may be beyond the function of the keyboard.

It is beyond it's function. Maybe it is time to worry about it. Your keyboard will not work if you can't sort out this problem.

I've attached the TSOP4838 datasheet, in case you don't already have it. (You probably do, but it does no harm to be sure.)

TSOP4838 IR Receiver.pdf (276 KB)

OldSteve:
You're aware that the IR LEDs must all be driven with a modulated 38kHz signal, I assume? It can't even be a continuous 38kHz - there's a maximum burst length that the receivers can detect. Any longer and the output returns high, (inactive). (I use TSOP4838 receivers myself.)

It is beyond it's function. Maybe it is time to worry about it. Your keyboard will not work if you can't sort out this problem.

I've attached the TSOP4838 datasheet, in case you don't already have it. (You probably do, but it does no harm to be sure.)

I'm not aware of that, nor do I understand what that means. As I said, I have very little understanding of all the intricate technicalities of running something like this.
So assume I don't know much.
Also, understand that this does not have to be entirely functional. At this point, it is going to be a proof-of-concept prototype. I just need to be able to show that this is possible with the equipment I have.

TheAaronTF:
I'm not aware of that, nor do I understand what that means.

The receivers are tuned to only detect IR at 38kHz, and to reject continuous IR. In a remote control, a 38kHz carrier is used, then that's modulated, (quickly turned on and off), to generate an output that is pulsed according to the digital bits that are being sent. Then, because you want to drive the IR LEDs with a current of 100mA, you need to use a suitable driver for each, a transistor, MOSFET or multi-channel driver chips like ULN2003, ULN2803 etc.

The next point is that the IR LEDs are wide-angle and not a tight beam, so moving your finger towards a given key will not necessarily be recognisable as that key. You could consider laser rather than IR LEDs maybe, if it weren't for the point I mentioned earlier - even if you did get that aspect working, how does your system differentiate a valid keypress from a finger just above the key?

Also, understand that this does not have to be entirely functional. At this point, it is going to be a proof-of-concept prototype. I just need to be able to show that this is possible with the equipment I have.

I'm afraid that under the circumstances, you have the exact opposite situation. It's not possible with the equipment that you have.

TheAaronTF:
At this point, it is going to be a proof-of-concept prototype. I just need to be able to show that this is possible with the equipment I have.

Did you look at my project? That did not use modulated IR but the emitters and sensors were down tubes to narrow the angle. Also the emitter and sensor were alternated along each side to isolate them a bit more. Finally strong light did interfere with it.
Also note that you can not press two keys at once because that turns into four beam crossings.

For a keyboard it would not work so consider your concept not proven.

OldSteve:
The receivers are tuned to only detect IR at 38kHz, and to reject continuous IR. In a remote control, a 38kHz carrier is used, then that's modulated, (quickly turned on and off), to generate an output that is pulsed according to the digital bits that are being sent. Then, because you want to drive the IR LEDs with a current of 100mA, you need to use a suitable driver for each, a transistor, MOSFET or multi-channel driver chips like ULN2003, ULN2803 etc.

The next point is that the IR LEDs are wide-angle and not a tight beam, so moving your finger towards a given key will not necessarily be recognisable as that key. You could consider laser rather than IR LEDs maybe, if it weren't for the point I mentioned earlier - even if you did get that aspect working, how does your system differentiate a valid keypress from a finger just above the key?

I'm afraid that under the circumstances, you have the exact opposite situation. It's not possible with the equipment that you have.

I do have access to a ULN chip. I'm not yet sure of the exact model, but it is something close to the ULN2003/ULN2002.
I believe I can remedy the angle problem one way or another.