Reply to topic  [ 12 posts ]  Go to page 1, 2  Next
Elec Freaks 2.4" Colour TFT touch screen panel (HCARDU0083) 
Author Message
Site Admin

Joined: Sun Aug 05, 2012 4:02 pm
Posts: 632
Post Elec Freaks 2.4" Colour TFT touch screen panel (HCARDU0083)
Image
Image

Image

This feature rich 262K colour TFT module (HCARDU0083) has a resolution 320 x 240 pixels (QVGA) and includes a ILI Technology ILI9325D controller for easy interface to microcontrollers. Additionally this module also includes a resistive touch screen capability making this screen very versatile as configurable human interface for your microcontoller project. Finally to allow offloading of graphic information from your microcontrollers memory, an SD card interface is also included. Additionally if you intend to use this screen with an Arduino Uno we've also written a TFT graphic library (HCTFT) and a touch screen library (HCTFT_Touch) tomake writing applications for this screen as easy as possible. These can be downloaded from the software section of our support forum.

Please note: This screen is not 5V tolerant. If you wish to interface this screen to a 5V Arduino board such as an Uno or Leonardo please see our shield adapter board (HCARDU0084) which will not only allow easy connection of the screen to your Arduino, but will also level shift the interface pins to the correct voltage levels.


Image

ILI9325 240RGBx320 a-Si 262K color TFT controller
ADS7843 compatible touch panel controller
Standard SD card interface
Support 16 bit RGB565 format , can connect any 16 bit data bus
Onboard 3.3V regulator requires just a single 5V supply
3.3V I/O voltage level tolerance
Module Size (L * W * H): 76 * 54 * 14mm including connector




Example Arduino Sketch Using HCTFT Library:
Code:
/* FILE:    HCTFT_Example_1_Random_Graphics
   DATE:    17/06/15
   VERSION: 0.1
   AUTHOR:  Andrew Davies

   
This example will output graphics, text and bitmap data randomly to the screen.
The sketch demonstrates the use of these vairous functions including how to
set their colours and positions on the screen.

To use this sketch you will need to uncomment the appropriate initialisers below
for your particular display.

IF YOU GET AN OUT OF MEMRY COMPILE ERROR:
Library support for TFT screens can be quite memory intensive. If you are using
an UNO you may find that you will get and out of memory compile error. To get the
sketch to compile you will need to edit the MemorySave.h file in the HCTFT folder
to free up some memory.


You may copy, alter and reuse this code in any way you like, but please leave
reference to HobbyComponents.com in your comments if you redistribute this code.
This software may not be used directly for the purpose of selling products that
directly compete with Hobby Components Ltd's own range of products.

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
REASON WHATSOEVER.
*/



/* Include the HCTFT library */
#include "HCTFT.h"


/* Example bitmap */
const PROGMEM byte Tiny_Logo_Resistor[] =
{
  0xC0, 0xE0, 0x30, 0x30, 0xF0, 0xE0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x80, 0xE0, 0x38, 0x0E, 0x07, 0x1E, 0x78, 0xE0, 0x80, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x70, 0x1C, 0x07, 0x0F, 0x3C, 0xF0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0xF0, 0x3C, 0x0F, 0x07, 0x1C, 0x70, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x80, 0xE0, 0x78, 0x1E, 0x07, 0x0E, 0x38, 0xE0, 0x80, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, 0xF0, 0x30, 0x30, 0xE0, 0xC0,
  0x00, 0x01, 0x03, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0F, 0x3C, 0x38, 0x0E, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0x1E, 0x38, 0x1C, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0E, 0x38, 0x38, 0x0E, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0x1C, 0x38, 0x1E, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0E, 0x38, 0x3C, 0x0F, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x01, 0x00,
};

/* Options used to select one of the demos */
#define LINE 0
#define RECTANGLE 1
#define FONT 2
#define BWGRAPHIC 3


/* Uncomment one of the lines below to to create an instance of the TFT library
   to match your screen */
HCTFT HCTFT(ELECFREAKS_2_4_WITH_TFT01_UNO); // Elecfreaks 2.4" TFT (HCARDU0083)
//HCTFT HCTFT(ELECFREAKS_3_2_WITH_TFT01_MEGA); // Elecfreaks 3.2" TFT (HCARDU0097)
//HCTFT HCTFT(MCUFRIEND_2_4_UNO); // McuFriend 2_4" TFT (HCARDU0095)
//HCTFT HCTFT(MCUFRIEND_3_5_MEGA); // Mcufriend 3.5" TFT (HCARDU0096)


void setup()
{
  /* Initialise the TFT library */
  HCTFT.Init();

  /* Select one of the libraries fonts and seed the Arduino random function*/
  HCTFT.SetFont(LargeProp_25pt);
  randomSeed(analogRead(0));
}


/* Main sketch */
void loop()
{
  int Index;
 
  /* Draw lots of lines in random places and colours */
  for (Index = 0; Index < 500; Index++)
  {
    Draw_Graphic(LINE);
  } 
  HCTFT.Clear();
 
  /* Draw lots of rectangles in random places and colours */
  for (Index = 0; Index < 100; Index++)
  {
    Draw_Graphic(RECTANGLE);
  } 
  HCTFT.Clear();
 
  /* Draw the word HELLO in random sizes, places and colours */
  for (Index = 0; Index < 100; Index++)
  {
    Draw_Graphic(FONT);
  } 
  HCTFT.Clear();
 
  /* Draw an example graphic in random sizes, places and colours */
  for (Index = 0; Index < 150; Index++)
  {
    Draw_Graphic(BWGRAPHIC);
  } 
  HCTFT.Clear();

}


/* Function to randomly draw a graphic or test */
void Draw_Graphic(byte Type)
{
  /* Create some random X/Y coordinates and colours */
  int X1 = random(HCTFT.Max_X());
  int X2 = random(HCTFT.Max_X());
  int Y1 = random(HCTFT.Max_Y());
  int Y2 = random(HCTFT.Max_Y());
  byte Red = random(255);
  byte Green = random(255);
  byte Blue = random(255);
  byte Scale = random(4);
 
  /* Get the foreground colour */
  HCTFT.SetFG(Red,Green,Blue);
 
  /* Select a graphic function to draw */
  switch(Type)
  {
    /* Draw a random line */
    case(LINE):
      HCTFT.Line(X1,Y1,X2,Y2);
      break;
     
    /* Draw a random solid or outlined rectangle */
    case(RECTANGLE):
      if(random(2))
      {
        HCTFT.Rect(X1,Y1,X2,Y2,OUTLINE);
      }else
      {
        HCTFT.Rect(X1,Y1,X2,Y2,SOLID);
      }
      break;
     
    /* Print the text HELLO! in random sizes */ 
    case(FONT):
      HCTFT.Scale(Scale);
      HCTFT.Cursor(X1,Y1);
      HCTFT.Print("HELLO!");
      break;
 
    /* Draw the example bitmap in random sizes */     
    case(BWGRAPHIC):
      HCTFT.Scale(Scale);
      HCTFT.Cursor(X1,Y1);
      HCTFT.BWBitmap(84, 2, Tiny_Logo_Resistor);
      break;       
  }
}



The above example requires out HCTFT library which can be found below. To add touch screen support you will also need to download our HCTFT_Touch library.






Image

HCTFT and HCTFT_Touch libraries:

HCTFT Arduino library for above sketch is available for download from the software section of our support forum here:

http://forum.hobbycomponents.com/viewtopic.php?f=58&t=1854

Or from Github here:

https://github.com/HobbyComponents/HCTFT


To add touch screen support you can download our HCTFT_Touch touch screen library from our support forum here:

http://forum.hobbycomponents.com/viewtopic.php?f=58&t=1631

Or from Github here:

https://github.com/HobbyComponents/HCTFT_Touch
To use the above sketch, or the resistive touch screen feature of this module in your own sketches, please add our HCTFT_Touch library available in the software section of our support forum here:

viewtopic.php?f=43&t=1631&p=3724#p3724


Datasheets:

Attachment:
ILI9325D.pdf

Attachment:
TSC2046.pdf


You do not have the required permissions to view the files attached to this post.


Wed Jun 11, 2014 3:00 pm
Profile

Joined: Sun Jun 29, 2014 11:43 am
Posts: 3
Post Re: 2.4" Colour TFT touch screen panel (HCARDU0083)
Hi,
Does this TFT support backlight dimming? Usually there is a pin to send PWM to.

Thanks!


Sun Jun 29, 2014 11:46 am
Profile
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 626
Post Re: 2.4" Colour TFT touch screen panel (HCARDU0083)
You have access to the LED anode via the pin LED_A. You should be able to apply a PWM signal to this via a transistor or FET. One thing to note is that if you are using it with the Arduino adapter shield, the shield doesn't provide access to this pin as it powers the backlight via a permanent 3.3V supply.

_________________
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.


Mon Jun 30, 2014 9:25 am
Profile

Joined: Sun Jun 29, 2014 11:43 am
Posts: 3
Post Re: 2.4" Colour TFT touch screen panel (HCARDU0083)
Thanks!

I spotted that on the manual but couldn't find the pin.

Thanks :)


Mon Jun 30, 2014 10:34 am
Profile

Joined: Sun Jun 29, 2014 11:43 am
Posts: 3
Post Re: 2.4" Colour TFT touch screen panel (HCARDU0083)
andrew wrote:
You have access to the LED anode via the pin LED_A. You should be able to apply a PWM signal to this via a transistor or FET. One thing to note is that if you are using it with the Arduino adapter shield, the shield doesn't provide access to this pin as it powers the backlight via a permanent 3.3V supply.


I'm also guessing that 3.3v is the max.

So a transistor controlled by an arduino with the voltage of 3.3v from an external supply would do the trick? Because I'm guessing that the PWM max output from the arduino is 5v, which would be too much.

And all the I/O pins also take 3.3 rather than 5v that is usually output by the Arduino.

I'm planning to use this on a Mega board. How do I make this work without the shield (cos that's only for Uno etc)?

Apologies for my n00bness.


Mon Jun 30, 2014 2:42 pm
Profile
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 626
Post Re: 2.4" Colour TFT touch screen panel (HCARDU0083)
Quote:
I'm also guessing that 3.3v is the max.


Unfortunately we don't have a schematic for the TFT module itself, but the LED_A pin does require 3.3V and will draw approximately 50mA. This would be in excess of what an Arduino pin is capable of driving anyway. Based on these figures you could just add an additional current limiting resistor to drive the pin from a 5V source. You would need a value of about 33 Ohms. You may be able to increase this value to lower the current to be within the drive capability of the Arduino's I/O cell (40mA) but I still recommend using a PNP transistor to drive it such as BC212.

Quote:
So a transistor controlled by an arduino with the voltage of 3.3v from an external supply would do the trick?

Yes, or you could connect to 5V with an additional current limiting resistor as mentioned above. If you do connect it via the 3.3V supply just make sure whatever transistor you use can handle a -ve voltage of -1.7V to the base-emitter junction when your Arduino's 5V pin goes high.

Quote:
Because I'm guessing that the PWM max output from the arduino is 5v, which would be too much.


Yes, on a mega the PWM out will either be 0V or 5V.

Quote:
I'm planning to use this on a Mega board. How do I make this work without the shield (cos that's only for Uno etc)?


It would be wise to use level shifters to interface to a Mega. You can reference the schematic for the adapter shield for how to go about this which is available in this thread:

viewtopic.php?f=39&t=1633

We stock a 74HC4050 that is suitable for this purpose.

_________________
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.


Mon Jun 30, 2014 4:03 pm
Profile

Joined: Sat Aug 16, 2014 3:31 pm
Posts: 3
Post Re: 2.4" Colour TFT touch screen panel (HCARDU0083)
I have just purchased this screen and the interface board and plugged it into my UNO.

A couple of questions, if someone can answer please:

    * Where do you find out which pins are used for the board and therefore which pins are free to use for something else?

    * How do you plug, solder, connect or whatever to these free pins?

Thank you
Alan


Sun Aug 17, 2014 8:03 pm
Profile
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 626
Post Re: 2.4" Colour TFT touch screen panel (HCARDU0083)
Assuming you are using this display with the adaptor shield there is a schematic showing the connections to an Arduino board on that thread:

viewtopic.php?f=40&t=1633

Unfortunately all the available pins on an Uno are used. If you don't need the touch screen functionality you probably could free up a couple of pins by using the CS (chip select) to multiplex them if this is this is a possible solution.

_________________
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.


Mon Aug 18, 2014 8:09 am
Profile

Joined: Sat Aug 16, 2014 3:31 pm
Posts: 3
Post Re: 2.4" Colour TFT touch screen panel (HCARDU0083)
andrew wrote:
Assuming you are using this display with the adaptor shield there is a schematic showing the connections to an Arduino board on that thread:

viewtopic.php?f=40&t=1633

Unfortunately all the available pins on an Uno are used. If you don't need the touch screen functionality you probably could free up a couple of pins by using the CS (chip select) to multiplex them if this is this is a possible solution.


Have just checked through the schematic and, as you say, all the pins are used.

Just leaves me wondering what on earth I am going to do with it now :(


Mon Aug 18, 2014 8:17 am
Profile

Joined: Sat Aug 16, 2014 3:31 pm
Posts: 3
Post Re: 2.4" Colour TFT touch screen panel (HCARDU0083)
Disconnected the SD card which has given me D10 to D13 to work with.

Using a Nano or ProMini will give me two more analog pins.

Any possibility of doing without the shield since the Nano/ProMini route will require rewiring the project anyway?

Alan


Fri Aug 22, 2014 7:38 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 12 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Thank you to phpBB.com & phpBB.ro.
Design created by Florea Cosmin Ionut.
© 2011 All contents of this site are © Hobby Components LTD