Interfacing SPI TFT with Arduino.

By
Advertisement
Hey fellas!
It's been long since our last blog...but worry not! Here I'm back again with something new to try this time around. This blog will let you know how to interface a 1.8 inches SPI TFT with arduino. The task may get a bit tricky if someone just starts without taking a few things in consideration. So here we go!




Now what's with this "SPI" term? Why not just a TFT?
Well, that's because like you all must have known, there are 2 modes of transferring data, SERIAL & PARALLEL. When there are separate multiple data buses for data transfer, that's a Parallel Data Bus TFT or more generally known as a normal TFT. These types of displays will have a comparatively large no. of pins to connect (quite obvious), as 8 or 16 pins are for data bus alone and then the other ones too.
They generally take up all the space on an UNO or even may require a shield as well.

When there is a single data bus to transfer all the data, all the data is streamlined in a series and then pushed towards the receiving end. This type of TFT is called an SPI TFT, where SPI stands for SERIAL PERIPHERAL INTERFACE. Now we know what that un-abbreviated form says!

Also remember that this 1.8 inches SPI TFT has different pin connections on an UNO (or similar) board and the MEGA board. On MEGA, the SPI pins lie at 50,51,52 and 53. 

First of all, list of required items is as follows:
* Arduino UNO (or similar) x 1
* 1k ohm resistances x 5
* One-2-One connectors x 8

The TFT library comes pre-installed in Arduino version 1.0.5 and later.

Make the connections as mentioned below-

Reset
8
Dc (A0)
9
Cs
10
SDA
11 (UNO) or 51 (MEGA)
SCL
13 (UNO) or 52 (MEGA)
BKL
3.3v
Vcc
5v
Gnd
Gnd


Now instead of making the first 5 connections directly to Arduino, put a resistor of 1k or similar value between the TFT pin and the Arduino pin. That’s because the IO ports are 3.3v tolerant while the Vcc required is 5v. It is quite possible because of it’s non-standard chinese manufacturing.

Now, open the IDE and run the any sketch except the “BitmapLogo”. This sketch uses the SD card function and requires you to hook up the TFT with an SD card as well, which is definitely not a part of this article.

I’m putting a demo sketch that I ran successfully-

#include <TFT.h>  // Arduino LCD library
#include <SPI.h>

// pin definition for the Uno
#define cs   10
#define dc   9
#define rst  8

// pin definition for the Leonardo
// #define cs   7
// #define dc   0
// #define rst  1

// create an instance of the library
TFT TFTscreen = TFT(cs, dc, rst);

// char array to print to the screen
char sensorPrintout[4];

void setup() {

  // Put this line at the beginning of every sketch that uses the GLCD:
  TFTscreen.begin();

  // clear the screen with a black background
  TFTscreen.background(0, 0, 0);

  // write the static text to the screen
  // set the font color to white
  TFTscreen.stroke(255, 255, 255);
  // set the font size
  TFTscreen.setTextSize(2);
  // write the text to the top left corner of the screen
  TFTscreen.stroke(255, 0, 0);
  TFTscreen.text("IoT Freaks!\n ", 20, 0);
  TFTscreen.stroke(0, 255, 255);
  TFTscreen.text("Sensor value\n ", 12, 25);
  // ste the font size very large for the loop
  
}

void loop() {

  // Read the value of the sensor on A0
  String sensorVal = String(analogRead(A0));

  // convert the reading to a char array
  sensorVal.toCharArray(sensorPrintout, 4);

  TFTscreen.stroke(255, 255, 0);
  TFTscreen.setTextSize(5);
  TFTscreen.text(sensorPrintout, 34, 50);
  delay(550);
  TFTscreen.stroke(0, 0, 0);
  TFTscreen.text(sensorPrintout, 34, 50);
}

This sketch requires a sensor at pin A0 to read it's value and then display it as text on  the TFT. So put any analog value sensor such as a potentiometer, an LDR, an IR pair or whatever you have.





Viola! I’m pretty much sure you’ll have it done then……

Be sure to buy the stuff mentioned in this blog by clicking on the link below-
http://www.ebay.in/usr/4d_innovations?_trksid=p2053788.m1543.l2754

The vendor's offering interesting and working hardware at quite handy rates. Go give it a try! :)

So until my next blog, this is it. As always, any problem you face and wish to discuss it, the comment boxes are always down there and you can reach me as well at iotfreaks@gmail.com

For more of these interesting stuff, like my page-
https://www.facebook.com/iotfreaks/

And our community,
https://www.facebook.com/projectsdunia/

20 comments:

  1. It’s actually a cool and helpful piece of info. I’m happy that you shared this useful information with us. Please keep us up to date like this. Thanks for sharing.PCB Prototype Service

    ReplyDelete
  2. Thanks for sharing cool idea of Arduino Project. "Cool Post, Interesting.. There are lot of Arduino Microcontroller Projects where you can take ideas for Final Year submission. Engineers Garage is also the website which is only for Electronics and Electrical Engineers. Where students can find various Projects ideas and tutorials on Micro controller, Electric Circuits and more. This is the good platform where you can post your projects. Its a very good portal for Electronics Projects for final year students. Visit :
    Engineers Garage
    "

    ReplyDelete
  3. thanks for sharing the information.Indian Cyber Army is announcing “ Summer Internship 2018” on “ Ethical hacking and Cyber Crime Investigation” for the enthusiasts of Cyber security. Here internship will give you on-the-job experience, help you learn whether you and Cyber security industry are a good match and can provide you with valuable connections and references. Here interns are usually exposed to a wide variety of tasks and responsibilities which allows the intern to showcase their strengths by working on projects for various managers that work on different parts of Indian Cyber Army. Becoming a high performing intern is a fantastic way to improve your employment prospects. This internship can be a great way to get your foot in the door of success with a prestigious or desirable Organization

    ReplyDelete
  4. They are having tremendous involvement in the field of Doha Escorts and attain demonstrable skill in their escorts work. With adoration and enthusiasm, they can every single client with their expert services and subsequently attain feeling with one another.

    ReplyDelete
  5. When I originally commented I clicked the "Notify me when new comments are added" checkbox and now each time a comment is added I get three emails with the same comment. Is there any way you can remove me from that service? Thanks a lot! pipe cladding

    ReplyDelete
  6. Great blog article informative I liked it

    We are the best piping design course in Hyderabad, India. Sanjary academy Offers Piping Design Course and Best Piping Design Training Institute in Hyderabad. Piping Design Institute in India Piping Design Engineering.
    best Piping Design Course
    piping design course with placement
    pipe stress analysis course in hyderabad
    piping engineering course in hyderabad
    piping stress analysis course
    best Piping Design institute
    best institute of Piping Design Course in India
    Piping Design Course
    Piping Design Course in India­

    ReplyDelete
  7. Thanks for the great article and post. Need a Servo Stabilizer Manufacturers in Hyderabad, india? Don’t go beyond Servomax Limited “A popular Power transformers which offers an extensive range of exceptional Servo Voltage Stabilizers.
    Feel Free to contact.

    ReplyDelete
  8. I just stumbled over this page and have to say - wow. The site is really good and kept up to date. Continue like
    BCOM 1st, 2nd & 3rd Year TimeTable 2020
    Agra University BCom 1st, 2nd & 3rd Year Time Table 2020

    ReplyDelete
  9. Website designing services help to improve user experience & conversions visit us : JAINAND DIGITAL POINT

    ReplyDelete
  10. Hi! I’m at work surfing around your blog from my new iPhone 11! I just wanted to say I love reading your blog and look forward to all your posts!
    Carry on the fantastic work!

    BSc 1st year result

    BSc 2nd year result

    BSc 3rd year result

    ReplyDelete
  11. Eumaxindia specializing in Radio Advertising like suryan fm,redfm,big92.7fm,radio city,hello106.4fm.we are provides all types of online radio advertising.

    Radio advertising services Chennai

    ReplyDelete
  12. Pulprolls is one of the leading 80x80 80x70 7950 7925 POS Thermal Paper Toll Rolls Exporter in India. Visit our website for more information.
    80x80 80x70 7950 7925 POS Thermal Paper Toll Rolls Exporter

    ReplyDelete


  13. Ourpcb design training in bangalore are delivered through a blend of classroom sessions, online tutorials, case study discussions, role-plays and other interactive exercises.

    ReplyDelete
  14. Awesome blog, thank you so much for sharing such an amazing information with us. Visit Preetidevelopers for Developers Real Estate, Royal Estate, Muda Mysore, and Villa Projects in Bangalore.
    Developers Real Estate

    ReplyDelete
  15. Amazing information, thank you so much for sharing with us. Visit Kalakutir for Commercial Vechicle Branding Services, Warehouse Painting, and Industrial Floor Marking. For more information in detail visit our website.
    Warehouse Painting

    ReplyDelete
  16. Get the best honda acura engines for sale, honda engines for sale, jdm lexus engine & trnsmission for sale, and Jdm Ej25 engine at best price. Visit our website for more information.
    Honda Engines for Sale

    ReplyDelete