# Optical Touch Screen Code

1. Jul 30, 2015

Hello, I am looking into building a touch screen. I have been considering a capacitive touch screen but I am also interested in optical touchscreen using infrared like the ones one this link: http://www.ledsmagazine.com/articles/print/volume-10/issue-9/features/optical-touchscreens-benefit-from-compact-high-power-infrared-leds-magazine.html [Broken]

Since my programming skills are extremely limited (if I feel bold), or nonexistent (if I feel like comparing myself to the average programmer out there), I was wondering if anyone has tried to write some code for the two first types of optical touchscreens in the link (see images below), or knows of any free available open source code.

Thanks !

Last edited by a moderator: May 7, 2017
2. Jul 31, 2015

### Staff: Mentor

It looks like you'll need to understand some trigonometry in order to convert your scan data into x,y coordinates of the touch.

Have you thought about how to do that?

3. Jul 31, 2015

I have an idea, yes. My maths isn't to bad (especially trigonometry). I've written some code to handle data from a 3D model before. My concern is that all the code I've ever written was extremely unoptimised and took ages to run (with loops in loops in loops, combined to the very basic functions). I don't think I've got the coding skills to be able to code efficiently, especially if I have to do it using an Arduino which has limited memory. That's why I'm asking. If I'm provided with a code I'll be able to understand it with a bit of research and edit it to fit my needs.

4. Jul 31, 2015

### Staff: Mentor

I don't think someone here will be able to help you with the specifics of coding this algorithm. However, we can help you develop it if you show your work on it.

I'd start first with a diagram of the geometry. Basically you'd follow something like this:
Step 1: Read each sensor convert data to an angle measure
Step 2: Use the angle input to get the x,y positioning output

Also I'd start with 0,0 being the top left corner as a common convention for screen display with increasing going from left to right and increasing y from top to bottom.

5. Jul 31, 2015

Thanks,

I'll post again once I've done a bit of work and I know for sure which method I want to use. I also have to reassess my needs, because multitouch is fun, but when using it with a Windows desktop it is not that necessary. I also need to pick the IR emitter/receiver combination I want to use (budget and all).

Thanks for the conventions though. It will make it easier for people to understand.

6. Aug 4, 2015

I apologies in advance for not using the convention but I thought it would be better to keep it similar to the paper I got it from: http://www.google.co.uk/url?sa=t&rc...=TjaSiO67H9-u0xpDT6zI_A&bvm=bv.99261572,d.d24

Hi all so I plan on using the following method for my display. I might add a third camera to increase the accuracy and allow multitouch. I think that using scanning line cameras relatively low end should do the trick and avoid using a lot of wiring and connection unlike using IR-receivers.

Is it possible to output the image of the camera as a binary signal... i.e areas where the finger can be detected would output 1 and background would output 0 ? If not I will have to do some image processing which I'm not sure is an easy thing to do.

Figure 1: Coordinate System for Pointer Locater Using Stereovision

The original position of the pointer can be found by solving:

Where:

Where: d2x ; d2y are the coordinates of the focal point of the right camera

Dividing the original position by the pixel size of the display yields the cursor position of the pointer.

7. Aug 4, 2015

### Staff: Mentor

I think you need to display the image and use the x,y value you computed to get the pixel color value.

8. Aug 6, 2015

I'm not clear about what you mean ? I was thinking of using a monochrome camera. Why is the pixel color value needed ? I'm just interested in its position.

9. Aug 6, 2015

### Staff: Mentor

Sorry I thought you meant a color camera and I thought perhaps you were trying to locate something in an image.

As an example, a camera records the road in front of a car and the computer processes the image using a combination of filters to isolate and locate the road line markers for steering.

10. Aug 6, 2015