This project is a part of embedded systems design-1 at DESE IISc Bangalore. This project aims to use various peripherals on analog add-on board like UART, LED’s, Buzzer through touchscreen. The board used is stm32-LCD .
Hardware Platform
The hardware’s used are
- STM32 LCD from olimex
- Analog Add-on board
STM32 LCD features
– Microcontroller – STM32F103ZE – high-performance ARM® Cortex™-M3 32-bit
RISC core operating at a 72 MHz frequency, high-speed embedded memories
(Flash memory – 512 Kbytes and SRAM – 64 Kbytes), and an extensive range of
enhanced I/Os and peripherals connected to two APB buses.
– JTAG connector
– EXT connector
– UEXT40 connector
– UEXT1 connector
– UEXT2 connector
– EXT_PWR connector
– Mini SD/MMC
– Mini USB
– LCD TFT 320×240 pixels coloured with touch screen
– Power source connector
– Accelerometer
– 8 MHz crystal oscillator
Analog Add-on board features
This Add-on board has various features. The features used in this project are
- Buzzer
- Led’s
- RS232 connector
Touchscreen
The touchscreen used is resistive type.It works based on resistance on two layers of thin plastic sheets which has to be pressed.Works with finger nails, stylus, pen tip etc.Multiple touches are not supported.
As shown in above figure resistive touchscreen has two conductive sheets with small gap in between two.
To detect the co-ordinates of touch 4-wire method is used
The 4-signals indicated are X+,X-,Y+,Y-.
Each sheet has finite resistance from one side to other side. The thick conductor on sides make sure resistance is linear
The procedure to detect touch coordinates is as follows
1. Detection
- Connect X- & X+ to VCC and check for Y- & Y+ for any voltage
- Once voltage detected, proceed to X and Y resolution
2.Resolving X
- Connect X+ to VCC, X- to GND
- Short Y- and Y+ and measure its voltage as ratio of VCC which is proportional to X
3.Resolving Y
- Connect Y+ to VCC, Y- to GND
- Short X- and X+ and measure its voltage as ratio of VCC which is proportional to Y
Once co-ordinates of X and Y are detected various applications can be implemented like Led on/off etc.
Software Algorithm
The flow chart of software algorithm is given below.
after each state it will will come back to main menu upon pressing back->home.
Project Description
When powered on the STM32L-LCD board, the LCD display will come up with the menus shown below.
——————–
| LED | PAINT |
|———-|———-
| UART | |
|———-|———-
| BUZZ | TS |
|———-|———-
LED: This function is used to turn ON or OFF 8-LEDS present on the board.
if pressed it will take to another display shown below
———————-
| L0on | L1on |
|———-|———-
| L2on | L3on |
|———-|———-
| L4on | L5on |
|———-|———
| L6on | L7on |
|———-|———-
| Back -> home |
|———-|———-
The captions L0on , L1on ….. if pressed ,turns on respective Led and also
displays L0of …. to off that led.
The caption Back->home takes to main menu.
UART: THis function is used to send or receive data to or from terminal using UART.
if pressed , displays another menus as shown below.
|———-|———-
| data—>UART |
|———-|———
| UART—->data |
|———-|———-
| Back -> home |
|———-|———-
The caption “data—>UART” sends predefined messages , “UART—>data” receives
data from the terminal and Back -> home takes to main menu.
BUZZ: This function turns on the buzzer for 3 sec on the adon board.
PAINT: This is a small paint, here painting and drawing can be done with diffrent colors.
To watch demo of this project follow this link Touchscreen based applications
Images
Library Functions used
ts_poll(&x,&y,&pressed) : returns touch co-ordinates in x and y and also sets pressed=1 when touch is detected
void LCD_SetCursor(unsigned int x, unsigned int y): Sets cursor at x and y position
void LCD_SetPixel(unsigned int x, unsigned int y, u16 color): sets pixel color represented by pixel pixel position X and Y and color.
Void LCD_DrawRect(int x, int y, int w, int h, u16 color): draws rectangle at position indicated by X and Y of width w and height h and fills with color represented by color.
void LCD_ConSetPos(unsigned int row, unsigned int col): sets the position of cursor in terms of rows and column to write string or character.
void LCD_Printf(const char *fmt, …): prints the character string on lcd pointed by pointer fmt.
References
Project Team
- Pradip Kapure
- Nagaraj Madotu
Recent Comments