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?
for(int i=2;i <= 13;i++) pinMode(i, INPUT); // Or INPUT_PULLUP - whichever you need.
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?
I have not yet worried about differentiating keystrokes from hovering fingers, as I think this may be beyond the function of the keyboard.
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.
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.
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.
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.