«

»

Oct 25 2012

LCD Image Viewer

This is a quick project I made to try out a 1.8″ colour LCD display from Ebay, the microcontroller code is very simple, after initializing the display it just waits for serial data and sends it straight to the display. Image processing is done by the host program, open your image (drag on to the program or click Open image), it gets resized, displayed in a preview box and converted to 12, 16 or 18 bit colour during upload. I’ve also added some extras like rotating, zooming and moving the image around in the preview box.

DIGITAL CAMERA

Setup is wired as follows –

LCD pin Arduino Uno pin
VCC 5V
BKL GND
RESET** RESET
RS 9
MISO* 12
MOSI 11
SCLK 13
LCD CS 10
SD_CS* 4
GND GND

* These are only needed if you’re using the SD slot on the back of the LCD
** Connect RESET to make the LCD reset along with the controller, if you don’t need that then leave disconnected or connected to 5V

Downloads

LATEST
Download
LCDImageViewer_20121026.zip (2.07 MB)
Host program and source (C# .NET), Arduino sketch code, Arduino LCD library and normal AVR C code (you can probably get it working on an ATtiny25)
Downloaded 451 times
MD5: DD6AC95ABD72318BFEA2B04F30F058BC

Further Development
Buffer to SD card
If you don’t like seeing the image slowly appearing on the LCD while uploading you could have it write to an SD card, once complete, load it from the SD card to the LCD.

Wireless
Adding wireless data transmission is easy, using cheap Bluetooth modules from Ebay you can simply connect one to your computer USB->serial converter and the other to the serial input of the microcontroller, the Bluetooth master module only needs to be configured once to connect to the slave module, then the modules do all the serial->Bluetooth->serial converting transparently. I think I might do a post about using Bluetooth modules sometime… and here it is.

Updates
27 Oct 2012
I just realised baud rates higher than 115200 can be used, for some reason I thought 115200 was the highest the chip could go, using the normal AVR C code it’s possible to go up to 921600, 1382400 also worked but didn’t seem to improve upload speed with the Arduino hardware. With the Arduino sketch 230400 will work straight away, to get 460800 a small edit will need to be done, in the loop() function change the line ‘tft.writedata(data);’ to

PORTB |= (1<<PORTB1);
PORTB &= ~(1<<PORTB2);
SPI.transfer(data);
PORTB |= (1<<PORTB2);

That code just reduces the number of CPU cycles it takes to send a byte over SPI so it has enough time to do everything else like receiving high speed serial data.

2 comments

  1. Panagiotis

    Hello Zak!
    Please could you provide some info of the sequence that it needs to initialize the display?
    And after that what should do to print a character on it?If you have a pdf datasheet i would appriciate it if you could send it to me.I am intresting of buying one of these and thats why ia ma asking……

    Regards Panagiotis

    1. Zak Kemble

      Hey, everything that you’re after is in the download above, datasheets, Arduino libs and examples for initialising the display and printing text and shapes are in /arduino/libraries/TFT18, but I think the libs are kinda old, best to download those from here – https://github.com/adafruit/Adafruit-ST7735-Library
      This will probably help too – http://learn.adafruit.com/1-8-tft-display

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Are you human? *