A Basic Touch-screen driver for STM32

Today I completed the basic touch screen driver. The task included

  • Learning the "Theory of Operation" of 4 wire resistive touch screens.
  • Learning the about the working of AD7843 touch screen controller IC.
  • Learning about the SPI peripheral of STM32
  • Writing basic SPI drivers (to init, read and write to SPI1)
  • Writing basic drivers to command and read AD7843 touch screen controller.
  • Filtering the touchscreen data using Median Filter to remove noise.
  • Learning about the three point touch screen calibration method.
  • Writing a routine to convert touch screen co-ordinate (ranges from 0-4095 in X and Y direction) to LCD co-ordinates.
  • Finally ploting a cross-hair at the touched point.

The final result is shown below.

Then I moved on to implement a GUI 3D Button.

After that I went to try a “Free Hand Drawing” application. And what I made is shown in the video below.

Free Schematic & PCB Design Software - EasyEDA
Just try EasyEDA editor, Start to design your own circuit and PCB easily
JLCPCB Prototype: Only $2 for 10pcs 10×10cm PCBs, 2-3 days delivery
Electronic Parts Online Store LCSC: Save 50% on cost, Wide selection in-stock

Facing problem with your embedded, electronics or robotics project? We are here to help!
Post a help request.

Avinash

Avinash Gupta is solely focused on free and high quality tutorial to make learning embedded system fun !

More Posts - Website

Follow Me:
FacebookLinkedInGoogle Plus

lcd
AVRDEV28

12 thoughts on “A Basic Touch-screen driver for STM32

  • By Ashwani Lohiya - Reply

    sir i have tried n made ur most of the projects about atmega by learning from ur tutorial. please provide tutorial about this also…..

  • By Ashwani Lohiya - Reply

    can we use atmega 32 in place of STM32 MCU?

    • By Avinash - Reply

      @Ashwani Lohiya

      Yes you can use ATmegs32 only it approx 27 times slower.

      Theoretically you can go any place in the world on your foot. But we generally choose a bicycle, car, train or flight depending on the distance.

  • By Andrei - Reply

    Hi,
    Can you please share the code and tell me what compiler are you using?
    Regards,
    Andrei

  • By Uttam Dutta - Reply

    Its Amazing! Your innovation is limitless is it possible to get the details of the project so that I can also feel the excitement of this experiment,
    Regards,
    Uttam Dutta

  • By Avinash - Reply

    @Uttam Dutta

    Currently the hardware is NOT available publically so its hard to build. The MCU is in LQFP100 package (finest leaded SMD). And the LCD Connector are also in FPC form. These experiments are impossible without the fine build hardware.

  • By Avinash - Reply

    @Andrei

    The compiler is Real View ARM (32KB Demo) under Keil uVision system. Sharing the code has no use as you cannot build the circuit easily.

  • By Vish - Reply

    hello sir, your work is really great…. can you submit some tutorial for ARM programming also.. the codes like Timers, adc,
    RTC, spi, i2c etc….

  • By Lo - Reply

    Hi,
    This seems interesting, could you share the code? i know your platform is specific, but c code is not specific at all, and i use an stm32 + ad7846, so no problem to test it on my dev. board.
    I’m curious to see how you implemented the calibration (computation matrix?) and the median filter.
    Kind regards,

  • By Curious - Reply

    Hi, i’m a newbie at ARM, after (just a little) working with sam7 now i want to switch to STM32 and i’m seeking of some good tutorials . . .
    could u plz help me to find some? could u plz suggest me some sites or ebooks for STM32 learning?
    tnx

  • By nikita - Reply

    Sir, I want the code of finding x-y coordinates of 4 wire resistive touchscreen and display it on lcd. can u tell me code please sir..

  • By Muhammad - Reply

    hello
    please where i find the details about that project ?

Leave a Reply

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


× 7 = seven

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>