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.
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).
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.
Pin 1 on the “cable” from GSL1680 is clearly marked. The connector has the following pinout:
3 VDD (3.3V)
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).