5″ capacitive touch panel with GSL1680 up’n running with arduino

I7D_3121

Some months ago I wrote about getting a 7″ capacitive touch LCD up’n running with Arduino. Since that time I’ve investigated 5″ displays with capacitive touch. There are some, such as the NHD-5.0-800480TF-ATXL#-CTP from Newhaven which uses the FT5306 capacitive touch controller. That one is interesting because I already have touch driver for the FT5x06 series. However, it costs $70.

A much cheaper alternative is i.e. the RA8875 based 5″ from BuyDisplay. It costs $35. Half the price. You can also buy separate touch panel to put on your own display for $8.50. The problem is that they use a Silead GSL1680 touch controller which is a bit tricky when it comes to writing drivers for it. Among other things it requires special firmware to work. I just gave up on it. That was until Tomek started the Has-anyone-tried-running-the-GSL16880-capacitive-touchscreen-controller-with-Teensy3 thread over at PJRC(Teensy) forum. January 14th, wolfmanjm got the buydisplay GSL1680 based board up’n running with a STM32L100 discovery board. He posted a video on youtube. After that it was tested on Teensy, and finally CosR1 managed to get it up’n running on an XMEGA AVR.

5_inch_multi_touch_screen_panel_with_controller_gsl16805_multi_touch_panel_screen_with_controller_gsl1680_6

After some help from wolfmanjm and CosR1, I managed to get a separate Buydisplay based GSL1680 touch panel up’n running on an Arduino Mega (1280) with only minor modifications to wolfmanjms code.

The firmware is an integrated part of the sketch. Instead of using ram, it is put in the flash memory using PROGMEM. Some, to me, special memory magic is used to read the firmware from the sketch flash (Thanks to CosR1). There might be other ways, but I haven’t investigated further. From there it is easy to write the firmware to the GSL1680 though the I2C bus. Initialization of the GSL1680 is also a bit special. It needs some special sequence of operations. I’m not sure if the code is optimal in that regard, but it seems to be stable. Linux-sunxi.org has a wiki with some info. There is even some information on the internal firmware registers here (haven’t verified if this info is correct).

I’ve forked the original wolfmanjm/GSL1680 github repo to hellange/GSL1680 and checked in the modifications needed for Arduino MEGA.

The sketch occupies 36K bytes of flash. The original wolfmanjm code also includes a “compressed” version of the firmware which brings the size down to 30K. That should fit into a UNO, but with almost nothing left for the real application. I haven’t tested the compressed version.

BuyDisplay have two versions of the 5″ capacitive touch panel. One 800×480 and 480×272.  I’m not sure if there are any big differences between the two because I’ve tried to use both 800×480 firmware and 480×272 firmware on the same touch panel (800×480). Both work, giving corresponding values at the extreme corners. They are, however, intended for two different 5″ screens that have slightly different dimensions.

The picture below shows the LCD with touch panel from BuyDisplay. I also ordered a “6 Pins 0.5mm Pitch ZIF Connector (FPC Connector)” to make it possible connect the thin “cable” to a breakout board. It has only 6 pins, but with 0.5mm pin spacing it’s a bit tricky to solder. Be careful with the amount of solder, and use flux. I’ve just started to learn. There are suitable breakout boards on Ebay, but I used a breakout board from another project. I didn’t use the display itself this time, I only cared about the touch panel.

I7D_3113I7D_3116 I7D_3119

Pin 1 on the “cable” from GSL1680 is clearly marked. The connector has the following pinout:

1 SCL
2 SDA
3 VDD (3.3V)
4 Wake
5 Int
6 GND

I used 10cm wires from the breakout to the Arduino MEGA. I didn’t connect any pullups. The code contains information on where the different pins should connect to Arduino MEGA.

After uploading the sketch, you can use the serial monitor in the Arduino IDE. You should see text indicating something like starting, waking, reset and load_fw. You’ll probably also get two or three i2c write error: 4 E0 that is probably caused by the controller not being ready after clearing or resetting. Doesn’t seem to be a problem even though it confused me at first.

When you touch the screen, the serial monitor will indicate number of simultanous touches with corresponding coordinates. The plastic on my panel caused some random interrupts, but it improved when I removed the plastic.

Make sure that your pins have good contact. I discovered that I had a less that perfect contact for my interrupt wire. More that once this have resulted in no data when I touch the screen, leading me to believe that the software did not work. So: Check your wires and connections !

You now have the power to use GSL1680 based touch panels for whatever you want.

(jan 2017) If you want to experiment with a standalone 7″ multitouch panel without display, you might take a look at 7″ standalone capacitive multitouch panel (800×480).

12 thoughts on “5″ capacitive touch panel with GSL1680 up’n running with arduino

  1. Hello Friend,

    Im using exactly the same touch controller and i also got an arduino UNO board for testing. but unfortunately im not able to get the program working that i have downloaded from your github repo.

    I am able to compile the program without any errors but the program is not waiting for the touch interrupt. As soon as i power the board even without touching the touch controller i my serial terminal reads the coordinates. some times 3 coordinate values of x and y, some times 5 and some times more than 12 and there is no pattern, most of the times its random.

    Can you please help me to figure out where im going wrong ?

    Thanks in advance

    Best,
    Krish

    Like

  2. Hi,
    I got the GSL1680 up and running on a Teensy, but now I would like to move to a Photon and when I copied the code over every thing looks good but the gsl does not send an interrupt. do you have any Ideas.

    Like

  3. I had lot’s of problems to put the firmware in different compilers and processors….so I put the firmware in a 24lc256/24lc512 eeprom…. so with another processor (like a due etc) i have only to read out the eeprom and send it directly to the gsl1680

    Like

  4. do you think it’s possible to connect in the same way you do but with using Silead GSL1680 touch controller already in board of a old tablet

    Like

Leave a comment