ReadyPlanet.com
dot dot
DIY photo frame with BL-TFT240320PLUS

Build photo frame with AVR and BL-TFT240320PLUS

Build it self photo frame. Display on QVGA 240x320 pixel using AVR small 8 bit microcontroller. \

 

Objective

  • DIY photo frame
  • Using AVR microcontroller.
  • Display on QVGA TFT 3.2” 240x320 pixel 16 bit color
  • Using BMP file format with out convert.
  • File store on SD card.
  • Keep small program size.
  • Fast display as fast as possible.

 Hardware

  • Atmega8,16,32 8 bit microcontroller from www.atmel.com
  • SD card
  • QVGA BL-TFT240320PLUS from circuitidea.com. It come with include SD card slot. 8/16 bit interface.

  

Understanding BMP file format

BMP file contain 4 group of data structure.

  1. BMP File Header Stores general information about the BMP file.
  2. Bitmap Information Stores detailed information about the bitmap image.
  3. Color Palette Stores the colors use for indexed color bitmaps. This is for 1,4,8 bits per pixel.
  4. Bitmap Data Stores the actual image, pixel by pixel. 

In this project we are interesting in part 1, 2 and 4. The color palette take more ram to keep color index table.

The yellow mark is interesting point for project.

BMP File Header

00h

2 bytes

the “BM” characters identify the BMP file.

02h

4 bytes

size of the BMP file in bytes

06h

2 bytes

reserved; actual value depends on the application that creates the image

08h

2 bytes

reserved; actual value depends on the application that creates the image

0Ah

4 bytes

the bmp data offset starting address

 Bitmap Information

0Eh

4 bytes

size of this header ( 40 bytes ).

12h

4 bytes

bitmap width in pixels (signed integer).

16h

4 bytes

bitmap height in pixels (signed integer).

1Ah

2 bytes

number of color planes being used. This must be set to 1.

1Ch

2 bytes

number of bits per pixel. values are 1, 4, 8, 16, 24 and 32.

1Eh

4 bytes

compression method being used.

22h

4 bytes

image size. This is the size of the raw bitmap data.

26h

4 bytes

horizontal resolution of the image. (Pixel per meter, signed integer)

2Ah

4 bytes

vertical resolution of the image. (Pixel per meter, signed integer)

2Eh

4 bytes

number of colors in the color palette, or 0 to default to 2n.

32h

4 bytes

number of important colors used.

 

To understand raw data format. . You can found example, The Example of a 2x2 Pixel Bitmap with 24 bits/pixel encoding ) at http://en.wikipedia.org/wiki/Windows_bitmap#Example_of_a_2x2_Pixel.2C_24-Bit_Bitmap.

Schematic

AVR Atmega16,32

AVR atmega8 (ARDUINO hardware)

Software

            Concept is very easy. Read BMP files from SD card and display to LCD.

LCD driver

            BL-TFT240320PLUS TFT LCD board (4) using SSD1289. The code from www.circuitidea.com

SD card driver

            AVR microcontroller has a small ram. Our scope is reading and display BMP file with out convert. It’s take more ram and give more speed to display. I found many SD card libraries for AVR on internet. Petit FatFs(3) is good for this solution. It’s take a small code.

Petit Fatfs Features:

  • Read only file system.
  • Very small RAM consumption (46 bytes work area + certain stack).
  • Very small code size (2.5K-3.5K bytes).
  • FAT12, FAT16 and FAT32.
  • Single volume and Single file. 

Display BMP

1. Start scan SD card to find bmp file.

2. Open file and check condition to fit in solution. 

Check image to fit screen

 

Address 0x12h contains the width of the bitmap in pixels.

Address 0x16h contains the height of the bitmap in pixels.

Display 24 bit per pixel

Address 0x1Ch contains number of bit per pixel.

No image processing function.

Address 0x1Eh contains the compression.

MUST be 0.

       3. Scan data and put to LCD 

Set area to display.

Adjust center image if need.

Image size must be equal or less than screen area.

Start of picture data

Address 0x0Ah keeps the point to bitmap data.

Scan and display from bottom to top

Image data store from the bottom line of the image

Scan each line of image.

Image data store in each lines.

Address 0x12h contains the width of the bitmap in pixels.

Convert color to RGB

Color is present in BGR

Skip padding data form some image

There are padding data to keep the line of data in multiples of four image width.

Compiler

            SD buffer set to 512 byte. Using AVR atmega32 program size is 8166 (24.9%). Data size 23 byte ( internal buffer use 512 byte ).

Atmega16 program size is 8166 (49.8%).  Atmega8 (using 8 bit mode) program size is 7220 (88.1%).

 

Source code

Release 01

            Atmega16,32 schematic and hex include in Photoframe.zip

            Atmega8 ( using only arduino hardware ) schematic and hex include in Photoframe Arduino

Release 02

           Atmega8 ( using only arduino hardware ) schematic and hex include in Photoframe Arduino R02

Arduino

          Arduino atmega168 ( Source code in Arduino library, LCD and demo. Must use with SD card library) ( board Version 1)  www.circuitidea.com/dev-board/BL-TFT240320PLUS.html

          Code and library for Arduino ( board Version 1 and 2 ) www.circuitidea.com/dev-board/BL-TFT240320PLUS-V2.html

 

Sample picture

 

Reference

(1) hackaday : How-to: Digital picture frame, 100% DIY

(2) BMP file format : en.wikipedia.org/wiki/Windows_bitmap

(3) Petit FAT File System Module : elm-chan.org/fsw/ff/00index_p.html

(4) LCD TFT BL-TFT240320PLUS: www.circuitidea.com/dev-board/BL-TFT240320PLUS.html

 




Article

using streamming for arduino lcd shield
Calibrate touch screen BL-TFT240320PLUS with arduino
How to use LCD TFT Arduino shield BL-TFT240320PLUS LCD article



[1]

ความคิดเห็นที่ 1 (11669)

Hello dear;

I want to driving TFT8K1556FPC-A1-E with AVR.

Can you help me?

mnaghshine@yahoo.com

0098 913 310 8628

Mehran Naghshine

ผู้แสดงความคิดเห็น mnaghshine@yahoo.com วันที่ตอบ 2009-11-19 16:17:34 IP : 85.185.107.251


ความคิดเห็นที่ 2 (134685)

โครงงานนี้ ค่าใช้จ่ายเท่าไหร่ครับ ไม่รวม จอ TFT  สนใจ

081 6088451  Paramin

paramn9@gmail.com

ผู้แสดงความคิดเห็น paramin วันที่ตอบ 2010-08-11 18:31:14 IP : 182.52.223.152


ความคิดเห็นที่ 3 (134687)

แก้ไข e-mail  paramin9@gmail.com

ผู้แสดงความคิดเห็น paramin (paramn9-at-gmail-dot-com)วันที่ตอบ 2010-08-11 19:00:51 IP : 182.52.223.152


ความคิดเห็นที่ 4 (142483)

I want the sample code of format the mmc...

 Can anybody help me???

 

Harmandeep Singh

+919888886489 

India

ผู้แสดงความคิดเห็น hr_dotcom_dotnet@yahoo.com (hr_dotcom_dotnet-at-yahoo-dot-com)วันที่ตอบ 2012-06-21 17:54:12 IP : 124.253.20.133


ความคิดเห็นที่ 5 (145588)

 Hello dear;

I bought from china an hy-tft320 lcd with  ssd1289.

i want to drive it with AVR.

i tried too much to figure out how could i do it..

i donot know where to start:

i found this

http://www.electrodragon.com/w/index.php?title=Category:3.2_TFT_LCD 

could you please explain for  us how or where to start 

1-

2-

3-

specially they sent for me a programm zimo221 in chines 

I dont understand chines .

thanks a lot for your help

basiln1@yahoo.com

 

waitning your reply

 

ผู้แสดงความคิดเห็น bassel วันที่ตอบ 2013-06-27 14:11:00 IP : 70.51.8.33



[1]


แสดงความคิดเห็น
ความคิดเห็น *
ผู้แสดงความคิดเห็น  *
อีเมล 
ไม่ต้องการให้แสดงอีเมล
รหัสป้องกันสแปม *CAPTCHA Image





dot
Service/บริการ
dot
bulletออกแบบวงจร
bulletออกแบบแผงวงจร
bulletประกอบแผงวงจร
dot
Product/สินค้า
dot
bulletDevelopment board
bulletElectronic component
bulletCar Accessories
bulletHome Accessories
bulletSale equipment
dot
OEM Product/สินค้าจ้างผลิต
dot
bulletบอร์ดควบคุมตู้เติมเงิน
bulletบอร์ดควบคุมตู้จำหน่ายน้ำ
bulletบอร์ดควบคุมตู้จำหนายน้ำมัน
dot
Newsletter

dot
dot
รวมลิงค์เว็บเพื่อนบ้าน
dot




Copyright © 2010 All Rights Reserved.