92 Silicon chip Australia’s electronics magazine siliconchip.com.au
ictest_kbv” sketch from the File -> Examples -> MCU-
FRIEND_kbv -> graphictest_kbv menu. This displays some
information to the serial monitor at 9600 baud, including
an identification code which is read from the board. In our
case, the code was 0x6814.
According to the “MCUFRIEND_kbv.cpp” file in the
library, this suggests that the controller in an RM68140,
which is similar to the ILI9488 but has a different initiali-
sation sequence.
In our case, this demo code initialised the display and
drew various test patterns, indicating that this sketch is
capable of working with this display board.
We took a look at the RM68140 data sheet but opted for a
sneaky trick to work out the initialisation sequence, with-
out having to read it in depth.
We embedded some extra code into the library men-
tioned above to see what commands and data were be-
ing issued to the display, then copied these back to our
sketch. This resulted in a working example sketch, named
“8bit_320x480_display_demo”.
Our download package also has a cut-down version of
the MCUFRIEND_kbv library demo sketch. You will note
that the sketch produces similar results to our example,
but is much larger due to the library having many features
that aren’t used.
Our sample code is designed to work on an Arduino Uno
board. Due to differing port and pin configurations, it will
not work on other Arduino boards; it depends on direct
port access for speed.
The sketch includes some code that should work on oth-
er Arduino boards, but it is very slow and has been com-
mented out for simplicity
Touch panel
The touch panel on this type of display is a simple four-
wire resistive type. It doesn’t even have a dedicated con-
troller IC, but instead, connects directly to the Arduino
analog I/O pins.
You can determine the touch location setting one of these
pins to 5V (high), another to GND (low), and then perform-
ing an ADC read on either of the two remaining pins. The
resulting value indicates the relative position of the touch
in the X or Y axis.
So the touch panel effectively behaves as a two-dimen-
sional potentiometer, with the “wiper” actually being the
point being touched.
As two of the wires are connected to the horizontal
edges and two to the vertical edges, the location in two
dimensions can be found by performing two readings as
described above, but changing which pins are driven and
which are sampled.
On this panel, the touch panel is connected to pins D6,
D7, A1 and A2. Interestingly, all of these pins are also used
for driving the display, so this is a very busy shield. This
does not interfere with their touch functions.
We’ve written a basic sketch that reads from the touch
panel and displays the raw ADC readings on the screen.
It’s called “8bit_320x480_touch_demo”.
These ADC readings would need to be converted into
display coordinates to implement a functional interactive
Fig.3: after unzipping the Z6527 resources from the Altronics
website, the library files should look like this. The three
selected folders starting with “U” are the ones being copied.
Fig.4: the ILI9488 library from https://github.com/jaretburkett/
ILI9488 can be installed using the Arduino Library Manager
by searching for “ili9488”.
The serial 3.5in touchscreen:
the reverse of the PCB is quite bare except
for an SD card socket and the touch
controller IC and its associated components.
The circle highlights the pin we had to
remove during testing to resolve a conflict
on the SPI bus (also shown at left). You
shouldn’t have to do this on your board!