Building an IR touch frame… faisability

Hi everybody !

I'm working on building my own IR touch frame, for those who are wondering what is it, let's check for PeauProductions products :

I have been working for few days on some solutions and I would like to show you what I want to do... The main question is "Will this mess work ?" I am not an expert so feel free to tell me things that are going wrong. Instead of asking you a question without any context, I will try to show you my reflexion, maybe that could help...

(And I'm sure you've already guessed that english itsn't my first language :p)

So take a cup of tea or coffee and let's go !

An Infrared touch frame is based on an array of IR Leds and photodiodes (or phototransistors but I'm currently working with photodiodes) forming a grid, when a person touch the screen, he stops the IR flow horizontaly and verticaly, puting some diodes in the shadow, we can then compute the actual position of the finger on the screen.

My frame is a 64*64 points touch screen, that means 64 IR leds facing 64 photodiodes verticaly and another 64 IR leds facing 64 photodiodes horizontaly. The microcontroller is an arduino micro acting as a HID device.

This projet has many concerns, basically the IR leds draw 100mA EACH ! So the deal is to power them one by one and to check the facing photodiode(s).

=> - IR LED
)= - Photodiode

=>                                     )=
=>                                     )=
=> Only one powered on                 )=
=> =================================== )=
=>                                     )=
=>                                     )=
=>                                     )=
(64 times)

This post isn't about powering the IR LED but about dealing with the photodiodes (and reading 128 values !!!)

Let's start with one photodiode, so easy, here is the basic usage schema of a photodiode (thank you the internet)

Yeah ! It is mount "reversed", basicaly, as light hits the photodiodes a reverse current flows into it. So the more light hits the photodiode, the more current can flows and the voltage of the photodiodes changes (and the resistor too).

The A0 wire is connected to the A0 pin of an arduino, I have already tested this design and it works :slight_smile:

Oh and the photodiodes I am using are BPN10NF from Vishay.

As mentioned before, there is 128 photodiodes, 64 on the vertical side and 64 on the horizontal side. Lets focus on one side only, so 64 photodiodes, 64 times the previous schema...

Hum.... No !

It is pointless to measure the 64 values (and to power on the 64 photodiodes) "at the same time". Let's remember that there is only one IR Led ON, I could measure only the facing photodiode, I will actually measure the one facing and some adjacent photodiodes to increase precision. Let's say... 8 of them :wink:

Actually, I will power on 8 photodiodes and read their value using a demultiplexer like the CD4051BE.

So basicaly, a PNP transistor is controlled by the Digital Pin D5 of the arduino, by puting D5 to LOW the transistor will let the current flow and power on the 8 photodiodes (there might be one resistor missing between D5 and the base, true ?) The transistor hasn't be choosen yet, so don't considerate its name.

The DEMUX is controlled by the arduino through D2, D3, D4 and the value of each photodiode is read on A0 (obsviously not exactly at the same time but the DEMUX and the Arduino are fast enought to get something interesting).

The transistor seems to be useless... but it is not... Let's imagine I would like to measure 8 more photodiodes, I could duplicate this schema... or I can try something like this :

Lovely isn't it ? The deal is to wire up 8 others photodiodes in parrallel with the first ones and to "switch on" only one transistor to read the value from the photodiodes wired to it.


???? DOES IT WORK ????

I have a massive concern about potential current leaks... For instance if I power on the second line of photodiodes (D9-D16), is there any risk of a current leak to D1-D8 photodiodes ? And how the other transistor will react, will I break it ?

If the answer is NO, IT WON'T WORK... it is useless to go any further...

If the answer is YES, IT WILL WORK ! The next step is to use 8 lines of transistors wired to 8 photodiodes each, and here we go ! 64 diodes on a single Analog In on the Arduino !

Of course I won't use 8 Digital Out pins to control each transistor. Instead I will use another CD4051BE (or maybe a stronger one) but this time as a MULTIPLEXER to ground the required transistor's base with only 3 Digital Out of my arduino.

Here we are ! It is such a long post, I know... But I hope you could help to make it real !

Thx a lot !


This is an interesting concept that I have never seen before. I think it could absolutely work, but is it efficient and worth it? But, to answer your question - I think you are right with many of your assumptions in terms of the reverse-bias photodiode. However, if you plan to use Arduino for the 128 values, you will need some sort of multiplexer to spread out the 6 available on the Arduino Uno (if that's what you're using). Then, from there, you will need to setup the LEDs and photodiodes to measure an interrupt.

I wrote a blog article on the basics of distance measurement with IR LEDs and photodiodes, so if you're interested in continuing your project, my blog article could help you get started:

I would try to do more in the discrete circuitry. Instead of using an analog input for the individual photodiodes, use a comparator to give you a direct digital signal. Maybe latch that into a flip-flop or other memory device so that the Arduino can scan the memory to find the data, making a parallel-to-serial conversion.

The trick will be to compensate for the ambient light hitting the photodiode and distinguishing the pulse of wanted light. Maybe instead of comparing to a fixed reference, it compares to a long-term average reading stored on a capacitor - a low-pass filter. You could even "gate" that so that it only stores the reference level when there are no other LEDs on, not just the desired LED for that column/row.

For more ambient discrimination, the vertical photodiodes should be at the top, looking down. The sides may still get direct light.

You can answer some of your questions yourself.

How sensitive are the photodiodes? Which voltage difference will you get with and without IR light? What if you use a phototransistor instead? Do the wavelength of the sender and receiver match?

Most probably the sensitivity is very low, that's why you need 100mA on the IR diode for noticeable voltage change. I doubt that the diodes support such a continuous current. Also multiplexing so small voltage differences is not so easy, you better amplify the voltage before multiplexing and ADC. Or you use analog comparators, which may be sensitive enough, and read their digital outputs using shift registers.

Also the IR beam should be as narrow as possible - it should only hit the opposite photodiode, not anything else. Then 1-10mA may be sufficient already.

A carrier frequency will be required, so that ambient light can be filtered out. You also can try RC receiver circuits, which should be sensitive enough, and include the required filter and detection.