3.2" TFT Shield with resistive touch (HCARDU0109 & HCARDU0111)

Post Reply
admin
Site Admin
Posts: 777
Joined: Sun Aug 05, 2012 4:02 pm

3.2" TFT Shield with resistive touch (HCARDU0109 & HCARDU0111)

Post by admin » Fri Feb 22, 2019 1:43 pm

Image




This 3.2" Colour TFT is an Arduino compatible shield that will plug directly into common types of Arduinos, including Uno, Leonardo, and Mega. It includes level shifters so no additional adaptor board is required for connecting to 5V Arduinos. The shield also includes a resistive touch screen sensor allowing your application to include touch screen controls. If using with the above Arduino devices we have also written an Arduino library (HCDisplay) to help you develop your project with minimum time and effort.

ImageImage


Specification:

Product code: HCARDU0108 (HX8352B) / HCARDU0111 (ILI9327)
Display size: 3.2 inch
Resolution: 240X400
Colours: 65535
Display controller: HX8352B (HCARDU0108) or ILI9327 (HCARDU0111)
Operating voltage: 5V
Operating current: 150mA (max)
Touch screen type: resistive touchscreen
On board Micro SD slot, supports Micro SD / TF Card
Compatibility: As the SD card is connected to SPI pins of ICSP interface it is compatible with Arduino UNO R3 / Arduino Mega2560 / Arduino Leonardo
Touch Pen: length 9cm







  1. /* FILE:    HCDisplay_Hello_World
  2.    DATE:    22/02/19
  3.    VERSION: 0.1
  4.    AUTHOR:  Andrew Davies
  5.    
  6. 20/12/18 version 0.1: Original version
  7.  
  8. A simple hello world sketch to demonstrate the minimum amount of code needed to
  9. display some text to the screen.
  10.  
  11. Open-Smart 2.4 Inch TFT shield (SKU: HCARDU0108)
  12. Open-Smart 3.2 Inch TFT shield with ILI9325 controller (SKU: HCARDU0109)
  13. Open-Smart 3.2 Inch TFT shield with ILI9327 controller (SKU: HCARDU0111)
  14.  
  15. NOTE: TO USE THIS SKETCH YOU MUST FIRST SELECT THE VERSION OF DISPLAY YOU HAVE BY
  16. UNCOMMENTING THE APPROPRIATE LINE IN THE OPTIONS.H FILE WHICH CAN BE FOUND IN THE
  17. HCDISPLAY LIBRARY FOLDER. For windows users avoid using the Windows Notepad editor
  18. as it doesn't format things properly.  
  19.  
  20. More information about this library can be found in the software section of our support
  21. forum here:
  22.  
  23. http://forum.hobbycomponents.com/software
  24.  
  25.  
  26. You may copy, alter and reuse this code in any way you like, but please leave
  27. reference to HobbyComponents.com in your comments if you redistribute this code.
  28. This software may not be used directly for the purpose of selling products that
  29. directly compete with Hobby Components Ltd's own range of products.
  30. THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER
  31. EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
  32. MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
  33. HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
  34. INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
  35. REASON WHATSOEVER. */
  36.  
  37.  
  38. #include "HCDisplay.h"
  39.  
  40. HCDisplay HCDisplay;    //Creates an instance of the HCDisplay library
  41.  
  42.  
  43. void setup()
  44. {
  45.   HCDisplay.Init();   //Initialise the display
  46.  
  47.   HCDisplay.Pos((HCDisplay.ResX() / 2) - 48, HCDisplay.ResY() / 2);
  48.   HCDisplay.Print("Hello World!");
  49. }
  50.  
  51.  
  52.  
  53. void loop()
  54. {
  55.  
  56. }



Image


The HCDisplay library for the above sketch can be downloaded from the software section of our support forum here:

http://forum.hobbycomponents.com/viewto ... =58&t=2827

TFT Shield 3.2inch 8352B Schematic_HCARDU0109.pdf



Libraries, example code, and diagrams are provided as an additional free service by Hobby Components and are not sold as part of this product. We do no provide any guarantees or warranties as to their accuracy or fitness for purpose.

Descriptions and diagrams on this page are copyright Hobby Components Ltd and may not be reproduced without permission.
You do not have the required permissions to view the files attached to this post.

lifescape
Posts: 4
Joined: Tue Jun 30, 2020 8:13 am

Re: 3.2" TFT Shield with resistive touch (HCARDU0109 & HCARDU0111)

Post by lifescape » Tue Jun 30, 2020 9:05 am

Hi, Just received the HCARDU0109 version 3.2 TFT display and one of the UNO+ compatible boards.

Have tried 2 examples but the display remains as it is when power is applied, just the backlight on.
(have un-commented the appropriate line in the options.h file)
Have also tried uploading without the display connected, power off, connect display and power back on.

Have also tried some UNO examples without the Display and the UNO+ seems to be working ok with the simple Led blinking sketches etc.

The sketches compile and upload ok, tx rx led's flickering. When finished display still just showing white backlight.

Any ideas on where to check or try next ?

many thanks in advance,

andrew
Site Admin
Posts: 976
Joined: Sun Aug 05, 2012 4:15 pm

Re: 3.2" TFT Shield with resistive touch (HCARDU0109 & HCARDU0111)

Post by andrew » Tue Jun 30, 2020 11:58 am

I assume you uncommented the following line:

  1. #define HX8352B_SHIELD                      //3.2 Inch TFT shield (SKU: HCARDU0109)

If so can you uncomment the line for the HCARDU0111 (ILI9327 controller) instead and give that a try:

  1. #define ILI9327_SHIELD                          //3.2 Inch TFT shield (SKU: HCARDU0111)
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

lifescape
Posts: 4
Joined: Tue Jun 30, 2020 8:13 am

Re: 3.2" TFT Shield with resistive touch (HCARDU0109 & HCARDU0111)

Post by lifescape » Tue Jun 30, 2020 3:24 pm

Hi,

Yes that has sorted it, does this mean the chipset is IL9327 and not the HX8352 , for future ref.


Many thanks,

Mike

andrew
Site Admin
Posts: 976
Joined: Sun Aug 05, 2012 4:15 pm

Re: 3.2" TFT Shield with resistive touch (HCARDU0109 & HCARDU0111)

Post by andrew » Wed Jul 01, 2020 8:45 am

Yes that's right, it is using the IL9327 controller. The confusion is our mistake - Open smart changed the controller it used in the 3.2" displays some time ago. We updated our HCDisplay library and as the display had a different controller listed the display under a new SKU (HCARDU0111). However it looks like the last batch got added under the wrong SKU.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

lifescape
Posts: 4
Joined: Tue Jun 30, 2020 8:13 am

Re: 3.2" TFT Shield with resistive touch (HCARDU0109 & HCARDU0111)

Post by lifescape » Fri Jul 17, 2020 12:50 pm

Hi, Been getting on ok with the display on one of the HC Uno boards.
Found a problem i cant seem to get around, it is more likely to be me than the boards but i cant seem to get

HCDisplay.Print(a string); to work.
I can display a message as in HCDisplay.Print("a message");
and i can use HCDisplay.Print(x); as in a number.

But when ever i try HCDisplay.Print(string); (EG where string is "a message to show" approx 20 characters.)
it reports no matching function.
Have also tried this with the RTC module connected, HCDisplay.Print(HCRTC.GetDateString());
and this returns the same.

Have looked through the library and cant find anything else to try,
any pointers would be great,
Mike

andrew
Site Admin
Posts: 976
Joined: Sun Aug 05, 2012 4:15 pm

Re: 3.2" TFT Shield with resistive touch (HCARDU0109 & HCARDU0111)

Post by andrew » Sat Jul 18, 2020 9:41 am

Are you by any chance defining your string variable as type String? If so the HCDisplay library doesn't support String functions because they take up too much memory. In something like a Mega this isn't a problem but in a Uno there isn't much space left after including a relatively bulky graphics library so every byte saved matters.

So to clarify passing a character array should work....

  1. char exampleString[] = "Hello";   //Note that this is a c++ string with a small s
  2. HCDisplay.Print(exampleString);

But passing a String won't....

  1.  String exampleString = "Hello";  //Note that this is an Arduino String with a big s
  2.  HCDisplay.Print(exampleString);


If you really need to use String functions you can simply convert your string to a character array before passing it to the print function like this:

  1. char charBuffer[10];
  2. String exampleString = "Hello";
  3.  
  4. exampleString.toCharArray(charBuffer, 10);
  5.  
  6. HCDisplay.Print(charBuffer);

I'm not sure why printing the HCRTC.GetDateString() isn't working though. Without checking it should just return a character array which shouldn't be a problem. If you still have issues can you post the actual error message your seeing.
Last edited by andrew on Sat Jul 18, 2020 10:49 am, edited 3 times in total.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

lifescape
Posts: 4
Joined: Tue Jun 30, 2020 8:13 am

Re: 3.2" TFT Shield with resistive touch (HCARDU0109 & HCARDU0111)

Post by lifescape » Sat Jul 18, 2020 10:36 am

I think you've answered the problem, I can use char array so it's not a problem.
I will try the HCRTC(GetDateString)
As I thought that should work but on both sketches it didn't. Although I had some strings defined in one sketch. I think I commented out most of that tho?!?
Will try again and post error message.

Many thanks,
Mike

andrew
Site Admin
Posts: 976
Joined: Sun Aug 05, 2012 4:15 pm

Re: 3.2" TFT Shield with resistive touch (HCARDU0109 & HCARDU0111)

Post by andrew » Sat Jul 18, 2020 11:12 am

That would be better. My advise is to avoid using Stings (big S) if you can. The String functions are part of the Arduino core and I believe they were added to make it easier for novice Arduino users to handle strings. The problem with them (besides taking up extra memory) is that if not used carefully they can lead to out off memory errors at run time which is problematic to say the least. The irony being that a novice user is probably not going to know these potential pitfalls are.

If you need to manipulate character stings there are several c functions that you'll find useful assuming you don't already know about them:

strcpy() copies one string to another
strncpy() copies a specified number of characters from one string to another
strcat() concatenates two strings
strncat() concatenates a specified number of characters from one string to another
strcmp() compares two strings
strncmp() compare the first specified number of characters between two strings

You just have to be careful that the string you are moving data into has enough space (including A null terminator character). That's the tricky bit about using strings (small s).
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Post Reply