4d systems intelligent 3.2 lcd module with touch for arduino made in china
The uLCD-24PTU-AR is an Arduino Display Module Pack, which includes a uLCD-32PTU 2.8" LCD Display with Resistive Touch, a 4D Arduino Adaptor Shield and 5 way interface cable.
The uLCD-28PTU-AR customises the uLCD-24PTU Display specifically for interfacing with the Arduino, to provide a quick and easy interface without any wiring hassles.
The Arduino Display Module Pack enables an Arduino user to quickly connect the 4D Arduino Adaptor Shield to their Arduino, connect the 5 way cable between the Adaptor and the Display Module, and be connected in seconds to start programming their new 4D Systems Display.
The uLCD-28PTU-AR has a comprehensive range of serial commands ready to be received from the Arduino, to draw primitives such as lines, rectangles, circles and text, displaying images, playing sound and logging data to uSD card.
This hardware bundle includes the 4D Arduino Adaptor Shield II which allows fast and easy hardware interface to any Arduino board with the standard Arduino Headers and allows you to quickly and easily add a full colour HMI to your Arduino project.
These specific gen4 modules feature a 3.2” colour TFT LCD display, and come with options for Cover Lens Bezel (CLB), and resistive touch. They is powered by the well-known 4D Systems Diablo16 Graphics Processor, which offers an array of functionality and options for any Designer / Integrator / User.
The 3.2” Diablo16 Integrated Display Module features a TFT LCD Display, is capable of Touch Detection, microSD memory Storage, GPIO and Communications, along with multiple millisecond resolution timers, and Audio Generation.
The gen4 Series is 100% compatible with the Workshop4 IDE and its 4 different development environments, providing the User with a wealth of options for programming and controlling their system.
The gen4 series of Integrated Display Modules features a 30 pin ZIF socket, designed for a 30 pin FPC cable, for easy and simple connection to an application or mother board, or for connecting to accessory boards for a range of functionality advancements.
The gen4 series of modules has been designed to minimise the impact of display related circuitry, and provide a platform suitable for integration into a product. Application boards can sit flush on the back of the gen4 if required, as the display related electronics sit inside the plastic mounting base, leaving the application board surface clear for User circuitry.
These specific gen4 modules features a 3.2” colour TFT LCD display, and come with options for Cover Lens Bezel (CLB), and resistive touch. They are powered by the well-known 4D Systems Diablo16 Graphics Processor, which offers an array of functionality and options for any Designer / Integrator / User.
The 3.2” Diablo16 Integrated Display Module features a TFT LCD Display, is capable of Touch Detection, microSD memory Storage, GPIO and Communications, along with multiple millisecond resolution timers, and Audio Generation.
The gen4 Series is 100% compatible with the Workshop4 IDE and its 4 different development environments, providing the User with a wealth of options for programming and controlling their system.
The gen4 series of Integrated Display Modules features a 30 pin ZIF socket, designed for a 30 pin FPC cable, for easy and simple connection to an application or mother board, or for connecting to accessory boards for a range of functionality advancements.
The gen4 series of modules has been designed to minimise the impact of display related circuitry, and provide a platform suitable for integration into a product. Application boards can sit flush on the back of the gen4 if required, as the display related electronics sit inside the plastic mounting base, leaving the application board surface clear for User circuitry.
This hardware bundle includes the 4D Arduino Adaptor Shield II which allows fast and easy hardware interface to any Arduino board with the standard Arduino Headers and allows you to quickly and easily add a full colour HMI to your Arduino project.
These specific gen4 modules feature a 3.2” colour TFT LCD display, and come with options for Cover Lens Bezel (CLB), and resistive touch. They is powered by the well-known 4D Systems Diablo16 Graphics Processor, which offers an array of functionality and options for any Designer / Integrator / User.
The 3.2” Diablo16 Integrated Display Module features a TFT LCD Display, is capable of Touch Detection, microSD memory Storage, GPIO and Communications, along with multiple millisecond resolution timers, and Audio Generation.
The gen4 Series is 100% compatible with the Workshop4 IDE and its 4 different development environments, providing the User with a wealth of options for programming and controlling their system.
The gen4 series of Integrated Display Modules features a 30 pin ZIF socket, designed for a 30 pin FPC cable, for easy and simple connection to an application or mother board, or for connecting to accessory boards for a range of functionality advancements.
The gen4 series of modules has been designed to minimise the impact of display related circuitry, and provide a platform suitable for integration into a product. Application boards can sit flush on the back of the gen4 if required, as the display related electronics sit inside the plastic mounting base, leaving the application board surface clear for User circuitry.
This hardware bundle includes the 4D Arduino Adaptor Shield II which allows fast and easy hardware interface to any Arduino board with the standard Arduino Headers and allows you to quickly and easily add a full colour HMI to your Arduino project.
These specific gen4 modules feature a 3.2” colour TFT LCD display, and come with options for Cover Lens Bezel (CLB), and resistive touch. They is powered by the well-known 4D Systems Diablo16 Graphics Processor, which offers an array of functionality and options for any Designer / Integrator / User.
The 3.2” Diablo16 Integrated Display Module features a TFT LCD Display, is capable of Touch Detection, microSD memory Storage, GPIO and Communications, along with multiple millisecond resolution timers, and Audio Generation.
The gen4 Series is 100% compatible with the Workshop4 IDE and its 4 different development environments, providing the User with a wealth of options for programming and controlling their system.
The gen4 series of Integrated Display Modules features a 30 pin ZIF socket, designed for a 30 pin FPC cable, for easy and simple connection to an application or mother board, or for connecting to accessory boards for a range of functionality advancements.
The gen4 series of modules has been designed to minimise the impact of display related circuitry, and provide a platform suitable for integration into a product. Application boards can sit flush on the back of the gen4 if required, as the display related electronics sit inside the plastic mounting base, leaving the application board surface clear for User circuitry.
This hardware bundle includes the 4D Serial Pi Adaptor which allows fast and easy hardware interface to virtually any Raspberry Pi board with the standard Raspberry Pi headers and allows you to quickly and easily add a full colour dedicated HMI to your project.
These specific gen4 modules feature a 3.2” colour TFT LCD display, and come with options for Cover Lens Bezel (CLB), and resistive touch. They are powered by the well-known 4D Systems Diablo16 Graphics Processor, which offers an array of functionality and options for any Designer / Integrator / User.
The 3.2” Diablo16 Integrated Display Module features a TFT LCD Display, is capable of Touch Detection, microSD memory Storage, GPIO and Communications, along with multiple millisecond resolution timers, and Audio Generation.
The gen4 Series is 100% compatible with the Workshop4 IDE and its 4 different development environments, providing the User with a wealth of options for programming and controlling their system.
The gen4 series of Integrated Display Modules features a 30 pin ZIF socket, designed for a 30 pin FPC cable, for easy and simple connection to an application or mother board, or for connecting to accessory boards for a range of functionality advancements.
The gen4 series of modules has been designed to minimise the impact of display related circuitry, and provide a platform suitable for integration into a product. Application boards can sit flush on the back of the gen4 if required, as the display related electronics sit inside the plastic mounting base, leaving the application board surface clear for User circuitry.
The 4D Serial Pi Adaptor is a simple adaptor board designed to provide a serial interface in a convienent form-factor, enabling the Raspberry Pi to connect to a majority of the 4D System display modules with a single 5 pin connection.
The 4D Serial Pi Adaptor features a pass through header design, enabling existing Raspberry Pi products to connect to the Raspberry Pi, as if this adaptor was not installed. The 4D Serial Pi Adaptor utilises only the serial port on the Raspberry Pi.
Comes with 5 wire ribbon cable if ordered without a display module. Display module itself includes a 5 wire ribbon cable (this is not the programming cable).
This specific gen4 module features a 3.2” colour TFT LCD display, with resistive touch. It is powered by the well-known 4D Systems Picaso Graphics Processor, which offers an array of functionality and options for any Designer / Integrator / User.
The 3.2” Picaso Integrated Display Module features a TFT LCD Display, is capable of Touch Detection, microSD memory Storage, GPIO and Communications, along with multiple millisecond resolution timers, and Audio Generation.
The gen4 Series is 100% compatible with the Workshop4 IDE and its 4 different development environments, providing the User with a wealth of options for programming and controlling their system.
The gen4 series of Integrated Display Modules features a 30 pin ZIF socket, designed for a 30 pin FPC cable, for easy and simple connection to an application or mother board, or for connecting to accessory boards for a range of functionality advancements.
The gen4 series of modules has been designed to minimise the impact of display related circuitry, and provide a platform suitable for integration into a product. Application boards can sit flush on the back of the gen4 if required, as the display related electronics sit inside the plastic mounting base, leaving the application board surface clear for User circuitry.
Note: This is quite a long posting, so feel free to bookmark it for future reference! It’s taken me quite a bit of effort to put together, so I hope you enjoy reading it and following along.
If you’re like me, you are probably someone who have made a few Arduino and Raspberry Pi projects from time to time and are very familiar with HD44780 character LCDs and push button shields as a form of interface to the user.
In fact, you’re probably tired of the 16×2 character LCDs because they’re rather limited (in their number of characters and the things they can display), and you’re probably fairly tired of polling the buttons as well. If you wanted to do something graphical, there is the option of a Nokia LCD screen, but that’s still monochrome and limited in resolution. None of these options are particularly aesthetically appealing.
It’s at this point you realize that anything more sophisticated, say a colour graphics LCD, requires a lot more work. They require wide parallel interfaces and a display memory buffer, at a substantial clock rate, which are best handled by dedicated display driver hardware. The smaller microcontroller boards can’t really handle this on their own, and even then, you’d still need to code up some intelligence behind drawing bit-mapped letters or rasterizing lines and circles. Further to this, you would expect them to be pretty expensive as well.
4D Systems is an Australian company, headquartered in Sydney with manufacturing and regional office in Philippines, which produces intelligent graphic solutions based around OLED and LCD technologies with custom graphics processors. Their product portfolio is ever-expanding and centres around three of their graphic processors – Goldelox, Picaso and Diablo16. They are also beginning to provide accessories, such as cameras, sound modules and GPS units which can be integrated with the graphic solutions above or used with other development platforms. They retail directly to the customer and through a network of distributors at every level, from starter kits, to just the display module, down to the bare IC and bare LCD units for incorporation into a final design.
The Goldelox graphic processor is used in their smaller OLED displays, whereas the Diablo16 graphic processor is used in their largest LCD modules. The rest of the modules (at this time) use the Picaso processor which simplifies development by allowing easy (almost plug and unplug) interchange of larger and smaller LCD modules as required. The processor is the magic that allows for the screen to be controlled via a TTL serial port using either the Serial Command Set or the ViSi-Genie command set (or one you define yourself through native 4DGL code for the display’s controller).
The uLCD range feature LCD displays of 2.4″, 2.8″, 3.2″ and 4.3″ size (measured diagonally). The 4.3″ LCD is a wide-screen form factor, whereas the others are 4:3 with an identical resolution making interchange easy. The uOLED is an AMOLED display of 3.2″, and the uVGA-III is a graphics controller which provides a HD15 “VGA” port output for driving an external display at the listed resolutions, but is without touch capabilities.
The uLCD products ending with a two letter suffix of AR or PI are the Arduino or Raspberry Pi kits respectively. The kits include the display, the shield or adaptor to plug the display in, the 5-pin cable from the display to the adaptor, a 5-pin male to male adaptor plug and a quick start guide. This is enough to get started in the Serial environment (which the module will be pre-loaded with), but will not allow you to explore the Designer/ViSi/ViSi-Genie modes without buying the 4D Programming Adaptor and a microSD card at the least. In the case of the Arduino, you may need the 4D Programming Adaptor anyway to provide more power to the screen.
The SK products are full Starter Kits which additionallyinclude the microSD card, and programming adapter. The screens in these kits are provided with a demo application which is also pre-loaded onto the microSD card. These items are also available individually (although they may not be configured for the demo application).Item Price
Getting started with the 4D Systems Displays is easiest with a Starter Kit (which I would recommend to first time users). Choose the starter kit that targets your chosen platform, and you can add an additional adaptor for another platform should you wish to develop for both Arduino and Raspberry Pi. Optionally, add on any other accessories which you might need.
When I was contacted by 4D Systems to review their products, I was honoured as well as surprised to see such things existed. The idea that the Arduino could drive a full colour graphics LCD at a reasonable cost is not dead after all! When I was asked which products I would choose for this review, I decided upon the following:SK-32PTU-AR
The larger 3.2″ screen would provide ample room for touch buttons (so they aren’t too close together for comfort), and the addition of the Serial Pi adaptor allows me to use my display with the Arduino (as the starter kit targets the Arduino) and the Raspberry Pi as well. Finally, the addition of the Bezel provides a nice finishing touch when it comes time to mount the display.
The items were all securely packed in several sturdy glossy cardboard boxes padded internally with foam. If you see fewer boxes than you expect, don’t panic, as the microSD has been inserted into the screen, and the programming adaptor has been placed inside the LCD module box as well to save space and protect it. Interestingly, the bezel was packed in a static shielding bag (it’s not ESD sensitive!).
The largest box contains the actual LCD module, shipped with a protective film on top. You should remove this film using the green tab when you’re ready to put it in use, otherwise the protective film may cause a bit of haziness/reflection and show up some scratches.
The bottom corner of the front seems to be inscribed with BINGO 033201-A0 which may be a clue to the LCD or touch film manufacturer. The LCD itself is numbered 4DLCD-32Q-A, and is attached to the controller module on the rear.
The red PCB on the rear of the display module is what sets this apart from a “plain” graphics LCD. It contains the Picaso display controller, pins for power, I/O, and battery, a small speaker and a microSD card slot (with a card installed). The PCB is scored for their production use – it allows them to break off unused sections to fit the board to their smaller displays. The PCB is nicely coloured red to match the other 4D Systems products, and features useful silkscreen text which guides you in connecting to the pins, reducing the need to always refer back to the datasheet.
The display itself is connected to the controller PCB via the orange flexible ribbon pictured towards the bottom – you really should avoid touching, scratching, stretching or snagging this ribbon otherwise your display may malfunction. Inside the box, the Quick Start Guide, Programming Adaptor and the 5-way cable with Male-to-Male adaptor is also included.
The datasheet for the display module itself provides a tantalizing list of features including:Picaso processor with Extensible Virtual Engine (EVE) architecture and support for 4DGL, ViSi-Genie, Serial Environment.
You really don’t need any particularly high performance cards for this application, although highly reliable ones would be desirable. Because of the FAT16 support on board, it is really only able to utilize 2-4Gb with a file system. It is capable of accessing even larger SDHC cards but only on a raw sector basis.
In order to load your own files from the 4D Workshop, you will need to supply your own microSD compatible card reader. It is not possible to load the files through the display for performance reasons (as the files can be quite large), and this takes a little patience and getting used to.
Some additional signals are broken out to pads which may be useful in the future. There is an edge mounted female five pin socket for the male-to-male adaptor to mate with, which then connects to the female socket of the 5-pin cables. In that configuration, the programming adaptor provides power and data connection to the LCD module to enable 4D Workshop IDE to program the Picaso processor (e.g. PmmC updates, loading program code) or to interact with it serially (e.g. Serial Commander for SPE mode, GTX for ViSi-Genie mode debugging).
For Arduino users, this is their revision 2 shield which allows you to connect your display module to your Arduino. This shield may appear slightly confusing given the configurability and number of pins, but a quick consultation with the Arduino Shield Datasheet clears it up.J1 is used to select the reset source – either from the Arduino (left position) or the Programming Cable (right position). For most users, this is probably better set to the Arduino.
J2 is used to select the power source – either from the Arduino (left position) or the Programming Cable (right position). As the Arduino when connected by USB may not be able to source enough power to reliably run the display, I would recommend it be set to the Programming Cable and have that attached to a second USB port.
The RX and TX line selection is provided as D0 and D1 are the hardware serial port for the Arduino and is used for programming the Arduino. If you choose to have your display connected to D0 and D1, you must unplug your display while reprogramming the Arduino or the programming will fail. By choosing D2 and D3, you can use SoftwareSerial to emulate a serial port on those pins and provide a connection that does not interfere with programming the Arduino.
H1 is used for connecting to your display, and H2 is used to connect the programming cable for additional power only. Serial commands are not passed through!
I have been informed that this particular shield is a pre-production unit, and those which are shipped to consumers will be built to a higher standard. It still makes sense to take extra care when inserting and removing it from your Arduino to avoid damaging the pins! When using the hardware serial port, in order to reprogram your Arduino, you can just remove the cable from the shield to the display module – there’s no need to remove the entire shield.
The 4D Raspberry Pi Serial Adaptor is a very simple board which connects the 5V, RX and TX data lines while leaving the Reset line unconnected. The adaptor itself is intelligently designed as its output pins are at right angles allowing the cable to “snake out” while having a pass-through of all the pins on the Raspberry Pi’s GPIO header allowing you to still connect other I/O boards to the GPIO header. This is important for more sophisticated Raspberry Pi projects, however, the boards that rely on the ports of the Raspberry Pi for mechanical support will need to be supported through other means (e.g. standoffs). The package includes another 5-way cable and male-to-male adaptor, not that the male to male adaptor is strictly necessary as the Serial-Pi Adaptor and the LCD display both feature male pins.
The LCD is secured to the bezel by four included small screws and washers, and the bezel itself can be fastened to your enclosure by using the included springy-clips, screws and washers. All you need to do is make an appropriate sized rectangular cut-out in your enclosure.
Unfortunately, they have only supplied the exact number of screws and washers so be very careful otherwise you might lose them – they’re tiny! It’s a great way to add the finishing touch to your project.
After unpacking all the items, I decided to plug the display into the Programming Adaptor and plug that into a USB port. Immediately, the drivers installed (as they are a common FTDI chip, same as used by many other devices) but the screen booted up into a rather impressive 4D Demo Application which showed colour background images, text, button, sound and video capabilities. It was all very impressive, although the sound was slightly on the quiet side with some hiss (possibly due to the PWM technique used to generate the audio). Unfortunately, I didn’t take any photos of this because I was so interested in getting my feet wet with the IDE. Once you start loading things onto the board, the demo is erased.
The other half of the equation is the 4D Workshop Integrated Development Environment (IDE). This software is provided free and allows the user to work with their LCD module and load programs via the Programming Adaptor in one of four modes – Designer, ViSi, ViSi-Genie and Serial. It also allows the user to access tools which are useful for debugging, updating and working with microSD cards (Serial Commander, Genie Test Executor, PmmC Updater, SD Card Partitioning).
At the moment, this software is only available for Windows, which is unfortunate for users of other operating systems, especially because the device-access nature of the program makes it unlikely to work correctly in Wine under Linux.
For those who have purchased a Starter Kit, installing the 4D Workshop IDE is practically mandatory as the modules shipped with the starter kit have been configured to run a demo application. As a result, they seem to carry outdated firmware (PmmC) and are not in the Serial Environment (as you would expect to use initially with your Arduino).
Luckily, 4D Workshop is easily downloaded from the 4D Systems website (no need for registration) and seems to be frequently updated for bug fixes and feature enhancements. The version used for the review was version 4.1.0.28. It feels as if the software is pretty good, but is still not fully polished with the occasional glitch here or there.
Of course, I am definitely notperfect, and all of these minor imperfections are perfectly forgiveable as they are merely cosmetic. Functionality wise, 4D Workshop IDE is top notch.
The first thing you may be interested in doing is to update the Personality-module-micro-Code (PmmC) on the module. This is the firmware that controls the low-level operation of the display’s Picaso controller. In order to do this, you must connect the display to your computer using the 4D Programming Adaptor – using any other adaptor can cause damage to your module and void your warranty!
You will find that you need to perform the PmmC update when you try to put the module into Serial Mode by opening 4D Workshop and creating a new Serial Project like the below images shows. Not updating the PmmC to match the 4D Workshop version can cause mysterious errors, so make sure you do this!
You can perform the PmmC update via the Tools tab – it’s a simple process of following the prompts. Then you can return to load the Serial Environment using the SPE Load button.
As you can see, everything is easily accomplished – it’s a case of ‘simply follow the prompts’. Now, our module is prepared for use with the Serial Environment libraries.
For example, in the above, I was setting the colour to change to Red, Green, Blue, then Black to test the screen for bad pixels and I’m delighted to report there were none (although, up to four is considered acceptable).
While I made a passing mention of the Serial Environment in the last part, I didn’t actually explain what it was, and why you might want to begin with it. The Serial Environment is a fully documented mode which allows the display module to be slaved with a microcontroller or other computer controlling it over the serial link.
The serial environment commands are all byte-coded sequences (the codings are shown in the PICASO Serial Command Set Reference Manual) which represent the operation (or function), and the oprands (or arguments). The screen responds only with an ACK or a NAK. The screen basically does everything you tell it to do … it’s as simple as that.
There are commands for writing text, drawing shapes, setting values of pixels, reading the touch screen, amongst many others. As a result, your host is responsible forall of the layout logic down to each drawing command, and polling the touch screen.This is both a (small) burden, but also an advantage, as the development only takes place on your host and the display module does not require amicroSD card to function. You can also purchase the standalone module which will come pre-loaded with the SPE environment, thus developing and deploying these modules without a programming adaptor is possible when the serial environment is used.
It also provides a large amount of flexibility, as you are free to draw whatever you want to, although it can be performance limited due to the serial link (especially if you are trying to transfer a whole bitmapped image).
While the byte-sequences are well defined, they are not convenient to work with directly, which is why libraries have been developed and provided by 4D Systems to make it easier to work with. The Serial Command Set Reference Manual includes the library function names to refer to.
The GitHub repository for 4D Systems contains the latest version of all the available libraries. For the Arduino, there is a Picaso-Serial-Arduino-Library which can be used with Picaso modules in SPE mode, and there is also a ViSi-Genie-Arduino-Library for when you have configured your module with a ViSi-Genie project. You should probably grab both of them by clicking on the Download ZIP button on each of the library pages, but you will have to be careful as to how you unzip them. You should unzip them first, and move the Picaso_Serial_4DLib folder and genieArduino folder to your Arduino/Libraries folder like so:
The Arduino serial library has a single example file called bigdemo which illustrates almost every single command available. If you have the starter kit files still on your microSD card, the sound files are used by the demo as well and the card is used for testing the microSD commands so do leave that in the display.
Initially, having tried both the Arduino Uno and Mega2560 with the adapter shield and the cable to the screen, I was not able to get anything happening. I managed to load the program with the screen cable disconnected, plugged in the screen and rebooted the Arduino. After a while, the SPE splash screen came up, and the Arduino gave up, blinking the LED connected to Pin 13 as a sign the program had entered the error callback function.
I thought I might have misconfigured the jumpers, or had a bad wire, or screwed something up. The answer was a shortage of power!Upon measuring the voltage at the LCD module’s terminals, it measured an “unhealthy” 4.62v. I changed the jumper over to Programming Adaptor power, and plugged it into another USB port. Immediately, the screen came to life with the demo. It’s quite cool to watch it cycle through numerous tests. As a result, the connections now looked like this – please note that the pin order on H1 is the reverse of H2 – the 5v leads face towards the reset button. I had made the mistake of misconnecting the wires once – lucky there was no damage, but I recommend you double-check your connections before applying power!Note that this board was jumpered to the SoftwareSerial settings for the photo, I reverted back to the hardware serial configuration soon-after.
The comments on bigdemoimplied that the #define DisplaySerial Serialline should be changed to something like #define DisplaySerial SerialSbut I had no luck with that. Seeing the future declarations made me realize that you should just comment out that line, and uncomment the lines that say #include
The other reason to stick with the hardware serial port really depends on your board – Mega, Mega2560 and Leonardo boards are not capable of software serial on pins 2 or 3 due to hardware constraints, so for the Mega, you could try using a jumper wire from the centre pin to the second or third hardware serial ports or just live with the need to plug and unplug the display with each programming cycle.
Initially, when looking at the code for bigdemo, it is both impressive in terms of the features demonstrated and yet somewhat daunting in terms of the amount of code involved. Having never worked with a 4D Systems display module before, it takes a little bit of time to pick and tease out the sections which are most important when using it as a basis for your own coding. The demo itself is a little lacking in comments in some areas, although the function names for the library are logically chosen and consistent which is great. Referencing the PICASO Serial Command Set Reference Manualhelped immensely in understanding the graphics-related portions of the code.
Instead, I focused on trying to achieve some smaller (but ultimately useful) goals in order to illustrate just how simple it can be to get up and running. From there, you can slowly build up towards your final solution. That is the approach I often prefer when learning and coding up solutions – and I think it’s also the approach the Arduino’s inbuilt libraries try to take – by having numerous digestible examples which are obvious and building upon those.
This is the first thing I decided to code up for the 4D Systems module, and I called it _4dtextrandomposcol. It’s a program which writes a string with a random colour value to a random position on the screen, the result should be the one on the left. If you make a few edits, you can easily change the background to black, with the result on the right.
This is useful as a way to see just how colourful this LCD is, and as a demonstration of the fact that the LCD uses 16-bit colour values in 5-6-5 representation, as opposed to the 24-bit colour values (8-8-8) used by most other applications (e.g. graphic design, web design). As this is the first example, I will take a little time to go through what is being done.//#include
Initial LinesThe first two lines are commented out with // – these lines are for when the jumpering on the Arduino Shield is set for D2 and D3 “SoftwareSerial” use. If you uncomment these two lines, and comment out #define DisplaySerial Serialthen your program will switch over to using SoftwareSerial.
#include “Picaso_Serial_4DLib.h”and #include “Picaso_Const4D.h”add the library files in for use, so you can use the library functions, and add many useful defined values for use with these functions. You should really take a look at the Picaso_Const4D.hfile in the libraries folder to learn more about these values.
The display device itself is of Picaso_Serial_4DLibtype, and is declared with the name Display in the line Picaso_Serial_4DLib Display(&DisplaySerial);which allows us to access the display’s methods/functions by calling Display.something
I declare and initialize some variables for use – colourvalue for holding the colour value, and tempstring to hold the sprintf output string for passing into Display.putstr (to draw it onto the screen).
The first five lines are used to reset the display module and give it time to start up. This is necessary to ensure that the display responds correctly to commands (otherwise, it may miss or fail to execute some initial commands if the necessary wait period is not provided).
The link to the display is readied for use by DisplaySerial.begin(9600);which assumes your display is at its default baud rate configuration of 9600 bps.
Display.TimeLimit4D = 5000; sets the command timeout for the screen to 5 seconds. This may not seem necessary at first, but without it, touch commands do not perform at all.
Display.gfxBGcolour(WHITE);sets the display background colour to white. Note that a lot of colours are predefined inside the Picaso_Const4D.hfile, so do take a look. Analogously, the following line set the text background colour to White.
Display.gfx_ScreenMode(4);sets the display orientation to Landscape with the microSD card facing upward. This is my preferred orientation as it rests on a flat surface, propped up by the programming connector. All four orientations are catered for.
Display.gfx_Cls();clears the screen ready for drawing. This fills in the screen with the BGcolour. It’s easy to make the screen toggle between solid colours by alternately calling Display.gfxBGcolour(colour);and Display.gfx_Cls(); (so you can code up a bad pixel checker if you’d like).
Display.gfx_MoveTo(random(0,320),random(0,240));sets the display to move the place where the next element will be drawn to a random x value between 0-319 and random y value between 0-239. Note that Arduino’s random function is exclusive for the maximum value.
colourvalue gets a random value from 0-65535 (the full 16-bit colour range), which is then used to set the text foreground colour with Display.txt_FGcolour(colourvalue);
The text string is assembled using sprintf to the temporary location tempstring in the format of “Colour Value 0x%04X\n” which results in what you see in the animated GIFs above.
Hopefully that has helped you to follow along with what is happening – after looking at bigdemo and comparing it with this – it’s not so scary anymore! Note that I have stripped it to the bare essentials – you might also want to set the error callback function like bigdemo does as well, but is not
You can see that this uses the Display.gfx_RectangleFilled(x1,y1,x2,y2,colour) function in conjunction with values returned by random(min,max). You can always replace the function with another to get triangles, circles, both filled and not-filled.//#include
Note that you may be able to put the Display.touch_Set(TOUCH_ENABLE); and Display.touch_Set(TOUCH_REGIONDEFAULT); lines in the setup function rather than in the loop for an even tighter loop.//#include
In order to use the touch screen functionality, you must execute Display.touch_set(TOUCH_ENABLE);to enable the touch screen, and then set the area – by choosing TOUCH_REGIONDEFAULT, you can detect touches on the whole area of the screen. If you want to detect touches within a limited area, you can instead replace Display.touch_Set(TOUCH_REGIONDEFAULT);with Display.touch_DetectRegion(x1,y1,x2,y2);where (x1,y1) represent the top left co-ordinate, and (x2,y2) represent the bottom right co-ordinate.
The Display.touch_Get(TOUCH_STATUS)function is used to determine if there is a touch on the screen. It can be either one of NOTOUCH, TOUCH_PRESSED or TOUCH_MOVING. The X and Y co-ordinates can be retrieved with Display.touch_Get(TOUCH_GETX)and Display.touch_Get(TOUCH_GETY) respectively.
With those short examples in mind, we have demonstrated text, graphics and touch – it’s very easy to build upon the bare essentials to get even more sophisticated results. Almost anything is possible, although you might run out of space on your microcontroller or experience drawing delays due to the level of sophistication of your interface.
You can change the default baud rate for the serial environment by going to the Tools section of 4D Workshop and selecting the Serial tab where you can apply a new default baud rate. Then, you should reload the serial environment onto your board through the programming adaptor.
The serial environment has proved itself to be quite powerful, allowing you to perform drawing operations by sending commands to the module. Unfortunately, while there is a Serial Library for C available, the library itself is written for lcc compiler for Windows.
As a result, the library needs porting to make it workable under gcc in Linux, as it currently does not build. Unfortunately, my experience does not extend as far as this at the present time – but a few identified issues include the file name case (all capitals on GitHub, but expecting “mixed” case), use of Windows-specific libraries, and the use of Windows-specific datatypes (e.g. WORD).
As a result, I wasn’t able to get the Serial Environment working with the Raspberry Pi through the library. It should be possible to write your own C program utilizing the raw commands from the PICASO Serial Command Set Reference Manualbut it’s going to require more effort.
A particular specialty of the 4D Systems design environment is the ViSi-Genie mode. While it also operates over the serial link, its protocol is structured differently (detailed in the ViSi Genie Reference Manual). The Genie mode uses specially constructed frames including error checking. It is a sort of “message passing” system which operates on the host and the display module.
In order to work with the ViSi-Genie system, you should concurrently design the user interface with your host system code by working with a graphical editor to add certain elements to your virtual screen, each of which is given a unique index number. You can then assign actions (onChanging, onChanged) to your elements as well, which can include changing forms, meters or reporting a message to the system. Once your design is complete, you can build it and load it to the screen and microSD card which will allow the screen to present the interface as designed.
When operating, the host can transmit frames which can be used to query (poll) the status of an element on the screen (of a certain type) with a given index number, or to write a value or string to an element of a certain type with a given index number. Likewise, the screen can also transmit frames which informs the host that a certain action has happened – e.g. a button has been pushed.
One of the disadvantages of this mode is the requirement for the microSD card, and a need for the programming adaptor to write the program to the screen. Concurrent development of the interface with host software is a necessity which can result in some back-and-forth as both interface and host software evolve together.
Creating the ViSi-Genie project is as simple as following the prompts – also note that if you click on the LCD in the “Choose Your Product” screen, you can rotate the project for landscape display.
A ViSi-Genie project starts up with a single Form (you can think of this as a “page”), without any elements added. The visual representation of the screen is used along with the Object Inspector to build the ViSi-Genie design – no coding is required, merely a few changes to parameters.
Adding a button, for example, is as simple as selecting a button from the toolbar, and clicking in the screen area to add it. Then you can drag it around, resize it with the drag handles, and change its properties with the Object Inspector. You merely need to repeat this to add all the elements you need to your project, with each element receiving a serially indexed number (which you will need when coding up the program for your host).
The element properties are listed in the Object Inspector, and values can be changed to customize some of the elements (for example, button colour, gauge scales, gauge ranges). The Events tab is used to allocate what happens when the element is triggered (onChanged, on Changing) and is the way you can chain events together so that changes to a slider can change an LED display without the host’s interaction for example.
You can also develop multiple virtual screens by adding more Forms to your project, and allocate buttons that will change Forms. This provides massive flexibility to change button layouts and add more buttons than would fit on a page.
Once the project has fully been developed, it can be saved and then built. It will ask you to provide the drive letter for the microSD card so it can load the required resources to the card (as it cannot be done through the serial link due to performance reasons).
Once it has copied the files to the card, it will also load a program onto the display module. You will need to insert the card into the display module before it will start into the ViSi-Genie layout.
Under the Tools tab, there is a button labeled GTX which stands for Genie Test eXecutor. This allows you to test and debug the functionality of your ViSi-Genie design when connected through the programing adaptor. You can interact with the screen and see the data received from the screen, and you can execute queries of the buttons using the tool.
If you followed my suggestion in the Serial Environment with Arduino chapter, you would have already downloaded and set-up the ViSi-Genie-Arduino-Library from 4D System’s github repository. If not, you will need to download it and unzip it into the Arduino\Libraries folder.
The ViSi-Genie project has four 4Dbutton objects – Start is index 1, Stop is 0, Speed+ is 2, Speed- is 3, all of which send a message to the host. The index was determined by the order I added the buttons to the project. It also has an LED display index 0 and a meter index 0.
The breakdown of how the program works is as follows:#include
The loop function contains genieDoEvents(); which needs to be called periodically(preferably frequently) which is a library function which checks for serial port messages, does the required decoding of events. If an event happens, EventHandleris called.
The EventHandlerfunction is where you will be placing code that handles what each event does. The event type is returned by Event.reportObject.cmd, I have only focused on reported events – reading genieArduino.h for the full list of definitions would be advised. The object type is returned by Event.reportObject.object, I have only focused on 4D Buttons (as that’s the only thing used in my project). Then it filters down to the index number of the button, which is returned by Event.reportObject.index.
Note that it doesn’t seem like the genieArduino library works with SoftwareSerial – I did try passing a pointer to a SoftwareSerial object but it didn’t work. Notice how the project has no commands about drawing objects? That’s part of the beauty of ViSi-Genie.
For what it does, it’s an impressively small amount of code required. The majority of the legwork is hidden away in the ViSi-Genie Arduino library which is provided for you. You just have to remind yourself of how your ViSi-Genie layout on the LCD will correspond to how your host will action on those elements (e.g. 4D button 1 is on, 0 is off, 3 is decrement, 2 is increment).
The beauty of ViSi-Genie is that elegant buttons, meters and sliders are all available with no coding effort required. The elements are referred to by their type and serial index, and the message parsing, construction, sending and receiving are all handled by the library (with error checking robustness), leaving you to focus on your program. With ViSi-Genie, it is even possible to have elements on the display which interact with other elements in the display in a command chain (using onChanging/onChanged) without the involvement of the main host, and it is also possible to have elements on the display which inform the host whenever they have something to report (so that there’s no need to waste time polling them continuously). It’s also possible to have multiple forms which are multiple layouts which can be toggled between on host command or by buttons laid out on the screen. It’s almost as if I’m dreaming – it’s marvellous stuff.
Similarly to the Serial Environment as discussed earlier, the baud rate for ViSi-Genie projects can be increased to reduce bottlenecks due to the serial interface (where your other hardware is capable of it). This can also be accessed through the Tools option in 4D Workshop under the Genie tab.
Making a ViSi-Genie application with the Raspberry Pi is the same when it comes to working with 4D Workshop IDE (as above), however, you will need to get and install the Raspberry Pi ViSi-Genie C library.
The library is called ViSi-Genie-RaspPi-Library. If you have a Raspberry Pi handy, fire up the terminal and put ingit clone https://github.com/4dsystems/ViSi-Genie-RaspPi-Library
It seems that the ViSi-Genie library for Raspberry Pi may be a little older, as it doesn’t have the event number declaration for 4D buttons, hence why I added it to the beginning of the program. Note that these constants may change in the future. The structure is very similar to that used by the Arduino.#include
while(1) is equivalent to the “loop” function in Arduino, it runs in an endless loop. Instead, it constantly checks if there is a Genie reply available using genieReplyAvail(), and if so, the value is retrieved into reply (of type struct genieReplyStruct) using genieGetReply(&reply) and is passed into handleEvent(&reply).
As I have been extremely busy with my study and other related activities, I haven’t had a chance to thoroughly explore the Designer and ViSi modes of operation. In fact, for those who are most interested in working with Arduino or Raspberry Pi, the Serial and ViSi-Genie modes are likely to be preferred and sufficient for those purposes.
The ViSi mode allows for a visual representation of the native 4DGL code as you are writing it. This allows you to write code which will actually run on the processor inside the display module. This allows you to better take advantage of the integrated peripherals and functions (timers, bus I/O, GPIO, Li-Ion battery monitoring, microSD raw and FAT access) which might allow for you to eschew any other CPU altogether. The one LCD module can be the heart of your embedded device – how exciting! Working with the LCD module in this way is eased by the 4D Development Board (4DevBoard) which breaks out the connections on the back and provides a prototyping area.
The Designer mode resembles much older-fashioned programming, which is used to write code directly without any visual aid. All of these can be used to further customize the results you get from the module.
With the high quality of documentation available (see 4DGL Programmers Reference Manual and PICASO 4DGL Internal Functions Reference Manual at this page), it would not be hard for someone unfamiliar with the functions and syntax to begin coding in 4DGL, although ensure you do take the time to thoroughly read the documentationto save yourself frustration. A nice feature is that the commands available in the Serial Environment and through the provided libraries are very similar to those used in native 4DGL.
4D Systems have done a great job with their intelligent LCD displays. The displays themselves are high quality, and their designs are robust. The range of displays available caters for a wide variety of needs and the development environment is provided without additional charge. The documentation for their products is excellent – it’s clear, it’s comprehensive, and it’s easy to read, and a variety of libraries are available for use which speeds up development. The development environment is first-class, being well laid out visually, fully featured and intuitive to use (although, at times, it can be a bit slow and is currently only available for Windows).
The motto of 4D Systems is “turning technology into art” and I really think they’ve done that. By providing an easy to use system, it is possible to retrofit an impressive user interface an existing project with minimal burden on the system and on the designer. The pricing is also quite sensible, especially so when the additional capabilities of the modules (Sound, Video, Lithium-Ion charger, parallel interface, GPIO, microSD card logging) are used.
For those who are truly bored of the limited character LCDs, or need something more flexible and aesthetically pleasing, this is an excellent input and output device to complement an existing platform. With the use of native 4DGL, you can even build a complete solution around the display module without any other platform involved. It is pleasing to see that solutions are provided at every level, should the future need arise to produce a solution en masse or even just to mount the LCD onto a box neatly.
In order to get the maximum benefit, it is imperative that you set aside a significant amount of time to understand the documentation provided. At times, the learning curve does feel steep as the provided examples are very sophisticated and aim to show off almost all the functions. Instead, simpler examples may be more useful to introduce users to each peripheral or method in isolation for easier “digestion”.
There is some frustration with developing for Arduino due to the shared use of the physical serial port between loading code for the AVR and for receiving/sending commands to the LCD. I found that SoftwareSerial was not a very reliable solution (and is not a solution at all for the Mega/Mega2560), and hence prototyping with the Arduino requires patience with plugging and unplugging cables. Further to this, the need for additional power (while unavoidable, due to the voltage drop through the Arduino prototyping board) might need to be better documented on product pages to ensure people ordering just the kit (not the whole Starter Kit) or are transitioning from another platform to the Arduino are aware that the problems they are having may not be code related at all.
The provision of a working Serial-C library for the Raspberry Pi would also be a great addition, opening up the ability for the serial command set to be used to its full potential with a more powerful host (than the Arduino). While the documentation is quite well written, some of the examples have inconsistent comments, and can be slightly difficult to understand.
In all, even with the ViSi-Genie mode alone, the module itself makes a great replacement for many input/output devices (buttons, character LCDs) and the use of a message-passing protocol allows for a button-polling-free experience which frees up the microcontroller. It also means no need to worry about the intricacies of debouncing switches as well. I really like the simple method of integration, although the need to develop a ViSi-Genie project in parallel with a microcontroller project, and load it to the display and microSD card separately only comes naturally after a few tries.
Looking at the documentation and examples, it is clear that 4D Systems works very hard to try and add new features, fix bugs and improve on what they have. By the time you read this review, chances are, some of the things may have been fixed and new products available.
It’s been a wonderful experience working with this particular module – I could have never thought that making a touch-interface on a graphics LCD could be made this easy. I’d like to thank 4D Systems for the opportunity to review their products, and for providing the products for my impartial and unbiased review.
Recently, my wife informed me that sadly, it was time to throw her CHUMBY out. For those of you too young to remember, long before the ESP8266, Chumby came out in the USA as a cosy leather-box-glorified clock for the bedside complete with touch LCD display. You could get the time, an alarm, weather info and all sorts of other stuff – all neatly organised on a web page – the Chumby had a cult following – a bit like pet rocks (for those of you old enough to remember). Sadly over time the display got dimmer and dimmer and in 2012, Chumby Industries went into liquidation and a new company was formed to keep the torch burning – for a subscription. We never followed that up.
Well, I was just about to throw the Chumby in the bin when it occurred to me that the 4D systems display (Gen4-IoD-32T) seemed to be about the same size. I gutted the Chumby and… spot on – a little attack with the pliers and the 4D board fits nicely inside the case.
In essence the Gen4-IO-32T is an ESP8266-powered 3.2” display complete with SD card slot, on-board WIFI (plus external antenna if desired), and it is claimed that the board is compatible with the Arduino IDE (which it is once you’ve added the relevant board info and library) or you can use the company’s own Workshop4 IDE (it turns out that is only partly true as some of the features of the IDE are not applicable to this range of boards).
Those of you familiar with the Itead touch-screen product will know that it is a serially controlled touch-LCD. Well, this is a WIFI controlled touch LCD. The major difference being that I had to put together a design for an ESP8266 board to strap onto the back of the Itead product to talk to the original serially while talking to the outside world by WIFI. In this case the 4D product is all in one slim product. It is also more expensive.
You talk to the board initially via a small USB FTDI (i.e. USB to 5v serial convertor) which the company supply – and you can either use the Arduino environment – or their own Workshop 4 (which needs the Arduino IDE sitting in the background) to program up the boards.
On the good side you have an all in one product that is very slim, support is excellent (even at the weekend in my case – a very helpful chap based in the UK) and the documentation is excellent. The gfx graphics primitives they supply are fast and work well. Text, rectangles, circles – the usual but more importantly, there is potential to use some pretty amazing graphical “widgets” to take the pain away from, for example putting up a large 7-segment display or a meter, keyboard etc.
On the bad side, the WIFI software, identical to normal Arduino/ESP8266 Wifi – simply would NOT talk to one of my routers even though the same code in a normal ESP8266 worked a treat – it worked just fine with the rest (I have several). In addition, they’ve only fitted 512K of FLASH on this so your software can only be up to somewhat short of 0.5MB – a little limiting in 2017 as the SDK takes up a fair bit of room. So no OTA then!
I had a few issues at first getting the SD to work but it turns out that the formatting is pretty critical and I did ultimately with the standard Windows tool after ensuring the partition was small enough to let Windows 10 format as FAT16. One minor issue is that the Workshop software is designed to support a number of boards and not all features run on these little ESP8266-based boards. I was very lucky in that I managed to get quiet a bit of support from the company over the weekend.
The board works with standard Arduino/ESP8266 WIFI and other libraries and so getting MQTT up and running took no time at all. I managed to make it compatible with my home system which regularly broadcasts the time over MQTT – rather handy.
Presumably because of the FLASH memory limit (I’ve used half of the 43416 available bytes already just to get this far) – in order to use external graphics which are well supported by Workshop 4 (drop in code for graphical items) you need to plug a microSD card into your PC to load the graphics up – then put that into the board for general use. (So OTA with changes to said graphics is a non-starter – but this applies also to my setup with the Itead boards).
The workshop insists on formatting the cards to FAT16 so my 16GB card ended up as 4GB – that just seems daft in an age where 16GB cards are as cheap as the smaller ones and more widely available. However as stated above – Windows came to the rescue.
You need to be able to program in C# (i.e. typical Arduino-type coding) to make use of these displays – and some of the examples in the manual can look quite daunting to the beginner but after a couple of hours I was starting to get comfortable with most of it – I pulled in some standard ESP8266/Arduino MQTT code and had that running in no time. Note that in common with many libraries (due to board restrictions usually) the gfx library hardware scrolling feature only works in portrait mode – NOT in landscape. and the colour format follows the usual 5-6-5 bits for RGB.
Touch handling is as you might expect – you can get the X and Y coordinates of a touch event and use them along with your known coordinates of any buttons you may have – when using images and widgets, the ID is returned to save you some trouble. Graphics are polished and there are various buttons, dials and gauges to play with.
There is currently no sound from these units – a beep is on the wish list but not there right now – you can add in a “SomoII” module and there is software support for that but that is then pushing the price up.
So, lots you can do with the visual environment – NOT everything in that Workshop works with the small ESP8266-based boards but this manual gives an indication of what is hidden away in their libraries and I found it fairly easy to navigate and test.
The short summary? You see below you a resurrected Chumby complete with dimmable 7-segment display. Note that you can’t actually DIM the display (control over the backlight would have been nice other than on-off) but by having 2 lots of 7-segments sitting on top and selecting the brighter or dimmer one I achieved more or less the same result.
My feelings of being a “beginner” with this kit vaporised after about 4 hours and I think if I were in a hurry for an off the shelf solution for an inexpensive WIFI-controlled graphical display without soldering etc, I’d give this a shot.
That’s it for now, I’m on a go-slow as I have just returned from the doctor who diagnosed carpal tunnel – no doubt due to too much blogging – and decided to give me a cortizone injection there and then – let me tell you – it hurts.
The library for this board is under active development and there are many useful functions I could not even start to cover here- make sure you check out the docs.
More on this as I develop my reborn Chumby and in the future I’ll do a write-up about other displays in the range – for now, the links should provide plenty of information for those interested.
A library for driving self-timed digital RGB/RGBW LEDs (WS2812, SK6812, NeoPixel, WS2813, etc.) using the Espressif ESP32 microcontroller"s RMT output peripheral.
LiquidCrystal fork for displays based on HD44780. Uses the IOAbstraction library to work with i2c, PCF8574, MCP23017, Shift registers, Arduino pins and ports interchangably.
The most powerful and popular available library for using 7/14/16 segment display, supporting daisy chaining so you can control mass amounts from your Arduino!
A simple library to display numbers, text and animation on 4 and 6 digit 7-segment TM1637 based display modules. Offers non-blocking animations and scrolling!
Monochrome LCD, OLED and eInk Library. Display controller: SSD1305, SSD1306, SSD1309, SSD1312, SSD1316, SSD1318, SSD1320, SSD1322, SSD1325, SSD1327, SSD1329, SSD1606, SSD1607, SH1106, SH1107, SH1108, SH1122, T6963, RA8835, LC7981, PCD8544, PCF8812, HX1230, UC1601, UC1604, UC1608, UC1610, UC1611, UC1617, UC1638, UC1701, ST7511, ST7528, ST7565, ST7567, ST7571, ST7586, ST7588, ST75160, ST75256, ST75320, NT7534, ST7920, IST3020, IST3088, IST7920, LD7032, KS0108, KS0713, HD44102, T7932, SED1520, SBN1661, IL3820, MAX7219, GP1287, GP1247, GU800. Interfaces: I2C, SPI, Parallel.
True color TFT and OLED library, U