Touch Screen Coffee Table DIY With Low Cost CCD

Build your own touch screen solution adapted on your TV by using a CCD sensor from an old scanner

Similar projects worth following
This tutorial is about helping people to build their own touch screen solution based on any flat screen TV. It uses light triangulation technology to read the coordinates. This method is quite cheap ( the priciest part is the TV), with a good quality image and you can make the table almost as small and as thin as your TV is.

Of course, nothing is perfect and with this solution it's probably not possible to build a 100% multi-touch screen and it's hard to cover the entire screen area. But depending on the way you make it you can have some interesting results. Plus, I am sure there are a lot of possibilities I haven't thought about to improve this. ;-)

This solution implies the use of light triangulation to read a very precise coordinate. Basically, it's like having a huge number of IR receptors with some IR LED. You turn on every LED one by one and read the sensors. When one receptor can't see any light, it means that an object is blocking the light. With enough LED and sensors you can get a much more precise solution.

But for this project, I was looking for something more suited for the reading. A CCD sensor, is in every scanner. In those devices, it's basically a black and white camera which reads only one line of pixels. To scan a color document, a RGB LED blink in the three colors and the CCD reads all of them for every line of the document. Then it can calculate the exact colors depending of the Red Green and Blue reaction.

Using a CCD sensor gives you access to 2700 light sensors on a 20cm line. Most people who take sensors and actuators from an old printer/scanners only take the RGB LED and the light conductor from this part, as we can see here. If you like recycling, you could examine the possibilities of CCD. Not having found many DIY projects on the internet using them, there are probably a lot of different ways with which you could use these sensors! In this tutorial I will also explain how to hack your own scanner.

For this touch table, I used one CCD sensor with 24 IR LEDs. The object is detected on a 740x380mm surface by a Teensy board (which works under Arduino environnement). This board turns the IR LED ON, reads the CCD and calculates the exact position of an object. Then it sends the coordinates as a mouse, a keyboard, a Python program or just as Serial on a Raspberry Piwhich shows the interface through the HDMI on a 32" TV screen.

Vectorial Link illustration

postscript - 1.12 MB - 09/05/2017 at 18:24


Touch Table

Serial software to communicate with the python interface

Zip Archive - 299.89 kB - 09/05/2017 at 18:24


Vectorial Toad illustration

postscript - 196.90 kB - 09/05/2017 at 18:24


This Processing program shows 20 different cluster of the CCD sensor. If the average analog value of the zone is close to 1024, the cluster is white. If it is lower it gets darker

Zip Archive - 7.56 kB - 09/05/2017 at 18:24


Final code for Teensy board

Zip Archive - 5.55 kB - 09/05/2017 at 18:24


View all 7 files

  • 1 × Raspberry Pi
  • 1 × Teensy 3.X
  • 1 × CCD sensor From a scanner
  • 20 × Led IR
  • 1 × TV Frequency Control / Oscillators

View all 6 components

  • Videos added

    jean.perardel09/13/2017 at 18:12 0 comments

    Just added some videos on the project description. I am not fully satisfied so I am currently working on a better one ;-)

View project log

  • 1
    Part list

    When I am working on a project, I like to build things that are the most cost efficient possible but still of good quality. So even those on a tight budget can afford to build their own. It's hard to give the exact amount of money spent, as many things are second hand or from the tip. Here is an approximation :

    Electronic :

    • Raspberry Pi (41$). I built my project with a Pi 2, but the B+ should also be fast enough.
    • Teensy 3.X (20$). I love building projects with my Arduino UNO. But the specifications of this tiny Teensy board are really crazy! (32 bits cortex M4, 72MHz, 256K Flash, 64K RAM, 34 digital PIN...). I think it's very useful to keep one at home. If one of your projects needs more PIN, more memory, more speed or just needs to be smaller, you can easily switch as it's fully Arduino compatible! Just install the Arduino plug-in and keep developing! The only little thing you have to be careful of is the access to the button to reprogram. I had to wire an external button when the table was built and I still needed to calibrate and debug.
    • The CCD sensor. You can easily get one from any old scanners which can be found everywhere :)
    • LED IR (0.1$). I used some 950nm.
    • The TV. It's hard to give a price, mine is a LG 32" that I bought second hand for 80$.
    • Wire
    • resistor
    • Computer Fan. You can find some in most old computers, you don't need to buy one.

    Some parts can be a bit difficult to solder, I recommend having a good soldering iron. At home I have been using a WS81 from Weller. A bit expensive to buy but it's precise and you can keep it for 20 years ;-)

    The wooden box and table :

    This part is gonna depend on your TV screen. This is for my 32" LG TV :

    The TV box :

    • 2 panels of MDF wood 10mm for the sides : 140 x 845mm
    • 2 panels of MDF wood 10mm for the sides : 140 x 560mm
    • 1 panel of MDF wood 10mm for the top : 950 x 650mm
    • 1 panel of MDF wood 3mm above the top : 950 x 650mm
    • 1 panel of Pine wood 18mm under the TV : 825 x 560mm
    • 2 large Framing lumber supporting the TV : 37 x 54mm (300mm long)
    • Small Framing lumber to ease the screw 15 x 20mm
    • Screws

    The Table under :

    • 1 panel of MDF wood 18mm for the top of table : 670 x 350mm
    • 1 panel of MDF wood 10mm for the layer under the table : 670 x 350mm
    • A very large framing lumber for the table's feet 37 x 54mm, 280mm long(2 for each feet)
    • Screws

    Approximate cost of the wood 70$

    I also used a Trotec laser cutting machine to engrave some characters on it and to cut several small parts of the wood. You can rent it for 25$ an hour from the Fablab next to my place. As I often help them on electronic projects I can sometime have it for free :-)

    Touch detection :

    • 1 Plexiglass 5mm for the support : 750 x 460mm
    • 2 Plexiglass 2.5mm, 735 x 12mm
    • 1 Plexiglass 2.5mm, 430 x 12mm (protecting the sensor)
    • 1 Plexiglass 5mm, 430 x 12mm (with the LED on it)
    • 8 mirrors 150 x 15mm (approximately as it's hand cut)
    • To create a IR lighting paper filter I combined a 106 primary red paper filter with a 181 congo blue paper filter
    • black masking tape
  • 2
    CCD Reverse engineering Part 1

    As Wikipedia is way better than me on explaining :

    "A charge-coupled device (CCD) is a device for the movement of electrical charge, usually from within the device to an area where the charge can be manipulated, for example conversion into a digital value. This is achieved by "shifting" the signals between stages within the device one at a time. CCDs move charge between capacitive bins in the device, with the shift allowing for the transfer of charge between bins.

    The CCD is a major piece of technology in digital imaging. In a CCD image sensor, pixels are represented by p-doped MOS capacitors. These capacitors are biased above the threshold for inversion when image acquisition begins, allowing the conversion of incoming photons into electron charges at the semiconductor-oxide interface; the CCD is then used to read out these charges. Although CCDs are not the only technology to allow for light detection, CCD image sensors are widely used in professional, medical, and scientific applications where high-quality image data is required. In applications with less exacting quality demands, such as consumer and professional digital cameras, active pixel sensors (CMOS) are generally used; the large quality advantage CCDs enjoyed early on has narrowed over time."

    Basically, the CCD you find in a scanner doesn't read lights in two dimensions, but on one line. With the one I tried, there are 2700 different light detectors that we can use as 2700 pixels on a X position.

    As I couldn't find any tutorials explaining how they work on the internet, I tried to understand the logic by myself. I started by taking a printer scanner from the trash and opening it. Please be very careful with these devices, they use 220V! Don't do it if you are not sure of what you are doing. Always manipulate them when it's not plugged in and isolate any high power part.

    By visually checking all the lines going from the control board to the CCD you can try to identify the 4 lines controlling the RGB LED, they are generally located at the extremity of the CCD board. With a multimeter, you can check where those lines are going on the communication flex.

    Then you can check if some lines are bigger than others (it's probably going to be the power and the ground, you can verify which one it is with your oscilloscope when the power is ON). Plug an oscilloscope between the other lines and the ground to understand what they are doing.

    I tried two CCD sensors from different brands and they where both using the same communication protocol but not on the same "line order on the flex". When I turned the scanner ON, I could see some data passing. It means that the device was probably testing the sensor when it is turned ON.

    - One line was giving a perfect square signal, I deduced that it was a signal clock.

    - One signal was turning ON and OFF at the beginning of the clock transmission, it's the Latch signal

    - one signal was sending a lot of analog value. Those values changed when my hand was next to the sensor. It is the values from the CCD.

    So I made a test program the on a Arduino UNO board. You can download it at the end with the project.

    With this, you can read on the serial port 16 average values (I call them pixels) of 168 light sensor on the sensor, so almost the 2700 total. Just plug in the lines as explained at the beginning of the above file on any Arduino board and read the data on the serial monitor.

  • 3
    CCD Reverse engineering Part 2

    Last week, I was trying to find some solutions to improve the cover of the detection area. To do this, I wanted to have a second sensor to test new configurations and speed. So I went back to the tip and I took several printer/scanner from different brands.

    I was a bit frustrating to discover that some scanner have a different kind of CCD sensor. No need to open the entire device, they are pretty easy to recognize, as the black plastic package is way bigger (picture 1). Inside, they have a way more complex mirror architecture, a lens and... a very tiny CCD sensor! I will try to hack those one to see the possibilities soon, but for now, I needed another "normal" 22cm CCD. So I moved on!

    Second printer I opened was from EP*** brand (Picture 2). The flex connection had 12 lines on 5V :

    • 1 Analog OUTPUT to 4 are big lines easy to identify for the LED
    • 2 (large) VCC? 5 (large) seem to be VCC
    • 3 GND 6 GND
    • 4 (thin) has a square signal with a 100ns period, the clock!
    • 5 (thin) has a short square signal every 20us.
    • 6 (thin) has a short square signal every 20us, another latch?? the latch.
    • 7 (GND)
    • 8 VCC
    • 9-12 RGB LED

    After few hours of test, I couldn't find the good protocol to have the OUTPUT response. Even when the CCD was plugged in the scanner, the analog wasn't giving any clear response (on startup test as the printer was then reporting an error).

    So I moved on to a third printer from H* brand. The flex had 14 lines on 3.3V :

    • 1 The analog
    • 2 VCC
    • 3 GND but not linked directly to the other GND
    • 4 VCC but not linked directly to the other VCC
    • 5 A latch every 40us
    • 6 GND
    • 7 ?
    • 8 GND
    • 9 CLK (clocking every 500ns)
    • 10 VCC
    • 11 - 14 RGB LED

    I could access some PAD from the different line (picture 3). After a bit of testing I succeed to have a clean answer on the analog line (pictures and explanations 4 and 5).

    The CCD I was using since the beginning is from CA*** brand. Here are the lines :

    • 1 Analog
    • 2-3 GND
    • 4 VCC
    • 5 ?
    • 6 Latch
    • 7 Clock
    • 8 ?
    • 9 - 12 RGB LED

View all 16 instructions

Enjoy this project?



jean.perardel wrote 3 days ago point

Yes, this concept of light triangulation already exist in industrial products... but when you have time, DIY is more fun! :p

  Are you sure? yes | no

adria.junyent-ferre wrote 09/13/2017 at 20:26 point

Nice project. I've been looking for reasonably priced touchscreens to make an interactive (waterproof) table and I really haven't found any good solution yet. Have you checked those touch frames they sell? The concept looks similar to yours and they promise multi-touch.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates