2.2" TFT Display. Created by Ladyada. Last updated on 2014-03-31 12:15:09 PM EDT



Similar documents
1.8" TFT Display Breakout and Shield

1.5" & 2.1" Monochrome 128x64 OLED Display Module

2.3" Monochrome 128x32 OLED Display Module

Adafruit BME280 Humidity + Barometric Pressure + Temperature Sensor Breakout

Adafruit MCP9808 Precision I2C Temperature Sensor Guide

Adafruit SHT31-D Temperature & Humidity Sensor Breakout

2.8" TFT Touchscreen. Created by lady ada. Last updated on :00:25 PM EST

A REST API for Arduino & the CC3000 WiFi Chip

TSL2561 Luminosity Sensor

Tiny Arduino Music Visualizer

Character LCDs. Created by Ladyada. Last updated on :45:29 PM EDT

Adafruit ATWINC1500 WiFi Breakout

Arduino Lesson 0. Getting Started

Adafruit Music Maker Shield

Arduino Lesson 14. Servo Motors

All About Arduino Libraries

Adafruit LED Backpacks

Part 1. MAX BIT DAC with an Arduino Board. MIDI to Voltage Converter Part1

DATASHEET. ADAM Arduino Display Adaptor Module. Arduino Compatible Shield P/N: 4Display-Shield-FT843 For the 4D Systems 4DLCD-FT843 Display

DS1307 Real Time Clock Breakout Board Kit

CAN-Bus Shield Hookup Guide

Adafruit Si4713 FM Radio Transmitter with RDS/RDBS Support

RGB LED Strips. Created by lady ada. Last updated on :00:18 PM EST

Arduino Lesson 13. DC Motors. Created by Simon Monk

Arduino Lesson 1. Blink

Matrix and 7-Segment LED Backpack with the Raspberry Pi

ARDUINO SEVERINO SERIAL SINGLE SIDED VERSION 3 S3v3 (REVISION 2) USER MANUAL

Arduino DUE + DAC MCP4922 (SPI)

DIY Pocket LED Gamer - Tiny Tetris!

Adafruit LSM9DS0 Accelerometer + Gyro + Magnetometer 9-DOF Breakouts

EvB 5.1 v5 User s Guide

AC-PG-USBASP USBASP AVR Programmer

Data Sheet. Adaptive Design ltd. Arduino Dual L6470 Stepper Motor Shield V th November L6470 Stepper Motor Shield

Arduino ADK Back. For information on using the board with the Android OS, see Google's ADK documentation.

3.2 inch QVGA TFT Color LCD User s Guide Version 1 & 2

PN532 NFC RFID Module User Guide

Arduino Lesson 4. Eight LEDs and a Shift Register

Arduino Lesson 9. Sensing Light

Eric Mitchell April 2, 2012 Application Note: Control of a 180 Servo Motor with Arduino UNO Development Board

AR1100 Resistive Touch Screen Controller Guide

How to setup a serial Bluetooth adapter Master Guide

WICE-SPI Hardware Operation Manual

Arduino Due Back. Warning: Unlike other Arduino boards, the Arduino Due board runs at 3.3V. The maximum. Overview

Arduino Lesson 5. The Serial Monitor

Using the Siemens S65 Display

Intro to Intel Galileo - IoT Apps GERARDO CARMONA

How to Make a Pogo Pin Test Jig. Created by Tyler Cooper

Adafruit's Raspberry Pi Lesson 5. Using a Console Cable

Arduino Lesson 16. Stepper Motors

INTRODUCTION TO SERIAL ARM

Adafruit's Raspberry Pi Lesson 5. Using a Console Cable

EARTH PEOPLE TECHNOLOGY SERIAL GRAPH TOOL FOR THE ARDUINO UNO USER MANUAL

Newhaven Display International, Inc Galvin Ct. Elgin IL, Ph: Fax:

Adafruit CC3000 WiFi. Created by Rick Lesniak. Last updated on :30:11 PM EDT

3.2 inch Arduino LCD Shield User Guide

Jianjian Song LogicWorks 4 Tutorials (5/15/03) Page 1 of 14

Adafruit Proto Shield for Arduino

Adafruit's Raspberry Pi Lesson 5. Using a Console Cable. Created by Simon Monk

PolyBot Board. User's Guide V1.11 9/20/08

After you complete the survey, compare what you saw on the survey to the actual questions listed below:

SainSmart UNO R3 Starter Kit

In-System Programmer USER MANUAL RN-ISP-UM RN-WIFLYCR-UM

IR Communication a learn.sparkfun.com tutorial

Work with Arduino Hardware

TEECES DOME LIGHTING SYSTEMS

Waspmote IDE. User Guide

Battery Power for LED Pixels and Strips. Created by Phillip Burgess

Board also Supports MicroBridge

Designing VM2 Application Boards

Adding a Real Time Clock to Raspberry Pi

Data Acquisition Module with I2C interface «I2C-FLEXEL» User s Guide

Adafruit VS1053 MP3/AAC/Ogg/MIDI/WAV Codec Breakout Tutorial

IOIO for Android Beginners Guide Introduction

The $25 Son of a cheap timer This is not suitable for a beginner. You must have soldering skills in order to build this kit.

Your Multimeter. The Arduino Uno 10/1/2012. Using Your Arduino, Breadboard and Multimeter. EAS 199A Fall Work in teams of two!

Quick Start Guide Vodafone Mobile Broadband USB Stick. Designed for Vodafone

The self-starting solar-powered Stirling engine

0832 Dot Matrix Green Display Information Board User s Guide

LCD I 2 C/Serial RX Backpack. Data Sheet. LCD to I2C/Serial RX Backpack I2C or Serial RX communication with Standard 16 Pin LCD modules

SP8 Programmers 硕 飞 科 技. User's Guide. TEL: FAX: WEB:

Bluetooth + USB 16 Servo Controller [RKI-1005 & RKI-1205]

A DIY Hardware Packet Sniffer

Wireless Security Camera with the Arduino Yun

Introduction to graphics and LCD technologies. NXP Product Line Microcontrollers Business Line Standard ICs

Introducing AVR Dragon

THE TOP TEN TIPS FOR USING QUALTRICS AT BYU

Microsoft Picture Manager. Picture Manager

FTDI Chip. VM800P Datasheet Embedded Video Engine Plus Module. VM800P Embedded Video Engine Plus Module Datasheet Version 1.0

MARTECH SPI Tools. MARTECH SPI Tools User Manual v1.0. User Manual

Sending an SMS with Temboo

Thermistor. Created by Ladyada. Last updated on :30:46 PM EDT

Web Ambassador Training on the CMS

Introduction. Getting familiar with chipkit Pi

Lab 3: PCB design with EAGLE

Select Correct USB Driver

OPERATION MANUAL. MV-410RGB Layout Editor. Version 2.1- higher

Upgrading from Windows XP to Windows 7

The goal with this tutorial is to show how to implement and use the Selenium testing framework.

Digital RGB LED Strip

SMART BOARD USER GUIDE FOR PC TABLE OF CONTENTS I. BEFORE YOU USE THE SMART BOARD. What is it?

Transcription:

2.2" TFT Display Created by Ladyada Last updated on 2014-03-31 12:15:09 PM EDT

Guide Contents Guide Contents Overview Connecting the Display Test the Display Graphics Library Bitmaps Alternative Wiring Downloads 2 3 6 9 10 10 14 15 Adafruit Industries http://learn.adafruit.com/2-2-tft-display Page 2 of 16

Overview This lovely little display breakout is the best way to add a small, colorful and bright display to any project. Since the display uses 3-wire SPI to communicate and has its own pixeladdressable frame buffer, it can be used with every kind of microcontroller. Even a very small one with low memory and few pins available! NOTE: This tutorial is for the older, discontinued version of the 2.2" display. We will have a tutorial for that display soon. If you have the newer display, please follow the wiring instructions in the example sketches! Adafruit Industries http://learn.adafruit.com/2-2-tft-display Page 3 of 16

The 2.2" display has 220x176 color pixels. Unlike the low cost "Nokia 6110" and similar LCD displays, which are CSTN type and thus have poor color and slow refresh, this display is a true TFT! The TFT driver (HX8340) can display full 18-bit color (262,144 shades!). And the LCD will always come with the same driver chip so there's no worries that your code will not work from one to the other. The breakout has the TFT display soldered on (it uses a delicate flex-circuit connector) as well as a ultra-low-dropout 3.3V regulator and a 3/5V level shifter so you can use it with 3.3V or 5V power and logic. We also had a little space so we placed a microsd card holder so you can easily load full color bitmaps from a FAT16/FAT32 formatted microsd card. The microsd card is not included but you can pick one up here (http://adafru.it/102). You can pick up one of these displays in the Adafruit sho p! (http://adafru.it/797) Adafruit Industries http://learn.adafruit.com/2-2-tft-display Page 4 of 16

Adafruit Industries http://learn.adafruit.com/2-2-tft-display Page 5 of 16

Connecting the Display Start by connecting a piece of header to the display. This will make breadboarding much easier. Break off a piece of 0.1" header 9 pins long and place it into a breadboard, long pins facing down into the breadboard. Place the display on top Solder all the pins Adafruit Industries http://learn.adafruit.com/2-2-tft-display Page 6 of 16

There are two ways to wire up these displays - one is a more flexible method (you can use any pins on the Arduino) and the other is much faster (4-8x faster, but you are required to use the hardware SPI pins) Since the display is quite large, we found that drawing would seem really slow if using 'software' SPI. For that reason, we'll show primarily how to wire up using hardware SPI and then how you can change the pins if desired. Hardware SPI means that we have to connect the CLK and MOSI pins to fixed digital pins. On '328 and '168 Arduinos, CLK must connect to digital 13 and MOSI must connect to digital 11. (If using an Arduino Mega, connect CLK to 52and MOSI to 51). Digital 10 (53 on Arduino Mega) must also be an output (but doesn't need to be connected to any particular pin). We'll use the following pin connections: GND connecs to ground - black wire VIN connects to +5V - red wire RST (reset) connects to digtal 9 - yellow wire Skip SDCS (SD card chip select - used for SD card interfacing) CS (chip select) connects to digital 10 (or pin 53 on Arduino Mega) - green wire MOSI (data out) connects to digital 11 (51 on Mega) - blue wire SCK (clock) connects to digital 13 (52 on Mega) - purple wire Skip MISO (data in - used for SD card interfacing) Adafruit Industries http://learn.adafruit.com/2-2-tft-display Page 7 of 16

You can later change the CS and RST pins but to match the tutorial, use this connection diagram. Adafruit Industries http://learn.adafruit.com/2-2-tft-display Page 8 of 16

Test the Display Once you have the display wired up, its time to test your wiring by uploading the example code we have written. Again, we suggest using an Arduino to test. Download our Arduino library (http://adafru.it/az0) from github by clicking on ZIP in the top bar. Uncompress the folder and rename it Adafruit_HX8340B - inside the folder you should see the Adafruit_HX8340B.cpp andadafruit_hx8340b.h files. Install the Adafruit_HX8340B library foler by placing it in your arduinosketchfolder/libraries folder. You may have to create the libraries subfolder if this is your first library. You can read more about installing libraries in our tutorial (http://adafru.it/ayg). You will also need to get the GFX graphics core (http://adafru.it/aja) and click on the Downloads button in the top right corner to download a zip of the library and examples. Uncompress the folder and rename it Adafruit_GFX make sure that inside that folder is the cpp and.h files. Then copy it to your arduinosketchfolder/libraries folder. Restart the Arduino IDE. You should now be able to select File > Examples > Adafruit_HX8340B > graphicstest sketch. Upload the sketch to your Arduino wired as above. Once uploaded, the Arduino should perform all the test display procedures! If you're not seeing anything - first check if you have the backlight on, if the backlight is not lit something is wrong with the power/backlight wiring. If the backlight is lit but you see nothing on the display make sure you're using our suggested wiring. Adafruit Industries http://learn.adafruit.com/2-2-tft-display Page 9 of 16

Graphics Library We've written a full graphics library specifically for this display which will get you up and running quickly. The code is written in C/C++ for Arduino but is easy to port to any microcontroller by rewritting the low level pin access functions. Here are some of the functions we've included in the library. The TFT LCD library is based off of the Adafruit GFX graphics core library. GFX has many ready to go functions that should help you start out with your project. Its not exhaustive and we'll try to update it if we find a really useful function. Right now it supports pixels, lines, rectangles, circles, round-rects, triangles and printing text as well as rotation. Read more about it here! (http://adafru.it/apx) Bitmaps In this example, we'll show how to display a 220x176 pixel full color bitmap from a microsd card. Adafruit Industries http://learn.adafruit.com/2-2-tft-display Page 10 of 16

We have an example sketch in the library showing how to display full color bitmap images stored on an SD card. You'll need a microsd card such as this one (http://adafru.it/102). You'll also need to be running Arduino 1.0 or later, as the SD library was updated. You'll also need an image. We suggest starting with this bitmap of a rose (http://adafru.it/cmm). If you want to later use your own image, use an image editing tool and crop your image to no larger than 160 pixels high and 128 pixels wide. Save it as a 24-bit color BMP file - it must be 24-bit color format to work, even if it was originally a 16-bit color image - becaue of the way BMPs are stored and displayed! Names for bitmap files must not exceed 8 characters with a 3 character extension. "mybitmap.bmp" is fine. "myotherbitmap.bmp" is too long and will not be readable by the SD file system. Copy the ro se.bmp to the microsd card and insert it into the back of the breakout board. Adafruit Industries http://learn.adafruit.com/2-2-tft-display Page 11 of 16

Wire up the TFT according to the high-speed SPI diagram above. Test that your wiring is correct by uploading the graphics test sketch with the high speed SPI line uncommented and the flexible-low-speed wiring commented. Once you are sure that the TFT is wired correctly, add the two wires for talking to the SD card. Connect CDCS (the unconnected pin in the middle) to digital pin 4 (you can change this later to any pin you want) that's the orange wire below. Connect MISO (last unconnected pin) to the Arduino's hardware SPI MISO pin, that's the white wire below. For Classic arduinos, this is pin 12. For Mega's this is pin 50. You can't change the MISO pin, its fixed in the chip hardware. Adafruit Industries http://learn.adafruit.com/2-2-tft-display Page 12 of 16

Now load the bitmap example sketch into the Arduino. It should display the parrot image. If you have any problems, check the serial console for any messages such as not being able to initialize the microsd card or not finding the image. Adafruit Industries http://learn.adafruit.com/2-2-tft-display Page 13 of 16

Alternative Wiring If you don't want to use the hardware SPI pins, its easy to adjust the example sketches. Look for the top section where you can call the constructor as Adafruit_HX8340B display(oled_mosi, OLED_CLK, OLED_RESET, OLED_CS).When all 5 arguments are passed to the display, it will automatically use the slower non-hardware-spi interface. So you could uncomment that line and use any 5 pins you want. // Option 1: use any pins but much slower //Adafruit_HX8340B display(oled_mosi, OLED_CLK, OLED_RESET, OLED_CS); // Option 2: must use the hardware SPI pins // (for UNO thats sclk = 13 and sid = 11) and pin 10 must be // an output. This is much faster - also required if you want // to use the microsd card (see the image drawing example) Adafruit_HX8340B display(oled_reset, OLED_CS); You cannot use software SPI if drawing image bitmatps from the SD card since the SPI interface is shared with the microsd card socket. There's one last pin, the BL pin, which is used to control the backlight. By default the backlight is always on. You can control it, turning it off or PWM dimming, by connecting a digital/pwm pin. The backlight draws up to 50mA but there's a transistor wired up so you will find that you can use a 'weak' microcontroller pin to drive all 3 LEDs. Adafruit Industries http://learn.adafruit.com/2-2-tft-display Page 14 of 16

Downloads You can download our Arduino library with examples from github (http://adafru.it/ahl). To install it, rename the downloaded and uncompressed library to Adafruit_HX8340B and place in the sketchfolder/libraries folder. See our detailed tutorial for more info (http://adafru.it/ayg). You will also have to get the latest Adafruit GFX library, (http://adafru.it/aja) which is the underlying graphics core. Install it just like the above. You may also be interested in the datasheet for the display (http://adafru.it/apc), and display driver chip (http://adafru.it/aw5). NOTE: This tutorial is for the older, discontinued version of the 2.2" display. We will have a tutorial for that display soon. If you have the newer display, please download the Adafruit_ILI9340 library, linked on the product page! Adafruit Industries http://learn.adafruit.com/2-2-tft-display Page 15 of 16

Adafruit Industries Last Updated: 2014-03-31 12:15:10 PM EDT Page 16 of 16