3.5 inch tft lcd with an arduino nano manufacturer
Hello! I am currently trying to interface the LCD shield from the UNO to the Nano Every. It currently is a white screen and reads an ID of 0x0 when using the "tft.readID()" command. I am writing this post since my other post got removed as spam.
//Since we only want our port pins we can have the following: PB0[D9], PB1[D10], PA1[D7], PF4[D6], PB2[D5], PC6[D4], PF5[D3], PA0[D2]... [] is on board digital pin
This module is a 3.5-inch TFT LCD module with “320X480” resolution and 65K color display. It is suitable for Arduino Uno and Mega2560 development boards, and also supports SD card expansion function. It uses 8-bit parallel port communication, and the driver IC is ILI9486.
The 3.5-inch display is a ready-made shield for Arduino Uno, which can also be placed on the Arduino Mega. The pins of this shield are designed to be easily installed on the Arduino. The bad point about these modules is that they use all Arduino Uno pins.
my_lcd.Fill_Triangle(x_spec+i*side_len-1,y_spec+(i+1)*h_len-1,x_spec+side_len/2+i*side_len-1,y_spec+i*h_len-1,x_spec+(i+1)*side_len-1,y_spec+(i+1)*h_len-1);
my_lcd.Fill_Triangle(x_spec+i*side_len-1,y_spec+(5-i)*h_len-1,x_spec+side_len/2+i*side_len-1,y_spec+(4-i)*h_len-1,x_spec+(i+1)*side_len-1,y_spec+(5-i)*h_len-1);
my_lcd.Draw_Line(2+random(my_lcd.Get_Display_Width()-4),17+random(my_lcd.Get_Display_Height()-34),2+random(my_lcd.Get_Display_Width()-4),17+random(my_lcd.Get_Display_Height()-34));
my_lcd.Draw_Rectangle(2+random(my_lcd.Get_Display_Width()-4),17+random(my_lcd.Get_Display_Height()-34),2+random(my_lcd.Get_Display_Width()-4),17+random(my_lcd.Get_Display_Height()-34));
my_lcd.Draw_Round_Rectangle(2+random(my_lcd.Get_Display_Width()-4),17+random(my_lcd.Get_Display_Height()-34),2+random(my_lcd.Get_Display_Width()-4),17+random(my_lcd.Get_Display_Height()-34),5);
my_lcd.Draw_Triangle(2+random(my_lcd.Get_Display_Width()-4),17+random(my_lcd.Get_Display_Height()-34),2+random(my_lcd.Get_Display_Width()-4),17+random(my_lcd.Get_Display_Height()-34),2+random(my_lcd.Get_Display_Width()-4),17+random(my_lcd.Get_Display_Height()-34));
my_lcd.Fill_Round_Rectangle(my_lcd.Get_Display_Width()/2-1-120+1, my_lcd.Get_Display_Height()/2-1-60+1, my_lcd.Get_Display_Width()/2-1+120-1, my_lcd.Get_Display_Height()/2-1+60-1,5);
Afghanistan, Algeria, American Samoa, Andorra, Angola, Argentina, Armenia, Bahrain, Bangladesh, Belarus, Benin, Bermuda, Bhutan, Bolivia, Botswana, Brunei Darussalam, Burkina Faso, Burundi, Cambodia, Cameroon, Cape Verde Islands, Central African Republic, Central America and Caribbean, Chad, China, Comoros, Congo, Democratic Republic of the, Congo, Republic of the, Cook Islands, Côte d"Ivoire (Ivory Coast), Djibouti, Egypt, Equatorial Guinea, Eritrea, Ethiopia, Falkland Islands (Islas Malvinas), Fiji, French Guiana, French Polynesia, Gabon Republic, Gambia, Georgia, Ghana, Gibraltar, Greenland, Guam, Guernsey, Guinea, Guinea-Bissau, Guyana, Hong Kong, Iceland, India, Indonesia, Iraq, Jersey, Jordan, Kenya, Kiribati, Kuwait, Kyrgyzstan, Laos, Lebanon, Lesotho, Liberia, Libya, Liechtenstein, Macau, Madagascar, Malawi, Mali, Marshall Islands, Mauritania, Mauritius, Mayotte, Micronesia, Mongolia, Morocco, Mozambique, Namibia, Nauru, Nepal, New Caledonia, Niger, Nigeria, Niue, Oman, Pakistan, Palau, Papua New Guinea, Qatar, Reunion, Russian Federation, Saint Helena, Saint Pierre and Miquelon, San Marino, Saudi Arabia, Senegal, Seychelles, Sierra Leone, Solomon Islands, Somalia, South Africa, Sri Lanka, Suriname, Svalbard and Jan Mayen, Swaziland, Tajikistan, Tanzania, Togo, Tonga, Tunisia, Turkmenistan, Tuvalu, Uganda, Ukraine, United Arab Emirates, Uzbekistan, Vanuatu, Vatican City State, Venezuela, Vietnam, Wallis and Futuna, Western Sahara, Western Samoa, Yemen, Zambia, Zimbabwe
TFT LCDs are the most popular color displays – the displays in smartphones, tablets, and laptops are actually the TFT LCDs only. There are TFT LCD shields available for Arduino in a variety of sizes like 1.44″, 1.8″, 2.0″, 2.4″, and 2.8″. Arduino is quite a humble machine whenever it comes to process or control graphics. After all, it is a microcontroller platform, and graphical applications usually require much greater processing resources. Still, Arduino is capable enough to control small display units. TFT LCDs are colorful display screens that can host beautiful user interfaces.
Most of the smaller TFT LCD shields can be controlled using the Adafruit TFT LCD library. There is also a larger TFT LCD shield of 3.5 inches, with an ILI9486 8-bit driver.
The Adafruit library does not support the ILI9486 driver. Actually, the Adafruit library is written to control only TFT displays smaller than 3.5 inches. To control the 3.5 inch TFT LCD touch screen, we need another library. This is MCUFRIEND_kbv. The MCUFRIEND_kbv library is, in fact, even easier to use in comparison to the Adafruit TFT LCD library. This library only requires instantiating a TFT object and even does not require specifying pin connections.
TFT LCDs for ArduinoUser interfaces are an essential part of any embedded application. The user interface enables any interaction with the end-user and makes possible the ultimate use of the device. The user interfaces are hosted using a number of devices like seven-segments, character LCDs, graphical LCDs, and full-color TFT LCDs. Out of all these devices, only full-color TFT displays are capable of hosting sophisticated interfaces. A sophisticated user interface may have many data fields to display or may need to host menus and sub-menus or host interactive graphics. A TFT LCD is an active matrix LCD capable of hosting high-quality images.
Arduino operates at low frequency. That is why it is not possible to render high-definition images or videos with Arduino. However, Arduino can control a small TFT display screen rendering graphically enriched data and commands. By interfacing a TFT LCD touch screen with Arduino, it is possible to render interactive graphics, menus, charts, graphs, and user panels.
Some of the popular full-color TFT LCDs available for Arduino include 3.5″ 480×320 display, 2.8″ 400×200 display, 2.4″ 320×240 display and 1.8″ 220×176 display. A TFT screen of appropriate size and resolution can be selected as per a given application.
If the user interface has only graphical data and commands, Atmega328 Arduino boards can control the display. If the user interface is a large program hosting several menus and/or submenus, Arduino Mega2560 should be preferred to control the TFT display. If the user interface needs to host high-resolution images and motions, ARM core Arduino boards like the DUE should be used to control the TFT display.
MCUFRIEND_kbv libraryAdafruit TFT LCD library supports only small TFT displays. For large TFT display shields like 3.5-inch, 3.6-inch, 3.95-inch, including 2.4-inch and 2.8-inch TFT LCDs, MCUFRIEND_kbv library is useful. This library has been designed to control 28-pin TFT LCD shields for Arduino UNO. It also works with Arduino Mega2560. Apart from UNO and Mega2560, the library also supports LEONARDO, DUE, ZERO, and M0-PRO. It also runs on NUCLEO-F103 and TEENSY3.2 with Sparkfun Adapter. The Mcufriend-style shields tend to have a resistive TouchScreen on A1, 7, A2, 6 but are not always in the same direction rotation. The MCUFRIEND_kbv library can be included in an Arduino sketch from the library manager.
The 3.5-inch TFT LCD shield needs to be plugged atop the Arduino board. The Mcufriend-style shields are designed to fit into all the above-mentioned Arduino boards. The shields have a TFT touch screen that can display colorful images and interfaces and a micro SD card reader to save images and other data. A 3.5-inch TFT LCD touch screen has the following pin diagram.
The drawFastVLine function draws a vertical line that starts in x, y location, and its length is h pixel and its color is t. The drawFastHLine function draws a horizontal line that starts in x and y location, and the length is w pixel, and the color is t. The drawLine function draws a line that starts in xi and yi locationends is in xj and yj, and the color is t. These methods draw lines with 5-pixel thickness.
The fillRect function draws a filled rectangle in x and y locations. w is width, h is height, and t is the color of the rectangle. The drawRect function draws a rectangle in x and y location with w width and h height and t color. The fillRoundRect function draws a filled Rectangle with r radius round corners in x and y location and w width and h height and t color. The drawRoundRect function draws a Rectangle with r radius round corners in x and y location and w width and h height and t color.
The drawCircle function draws a circle in x and y location and r radius and t color. The fillCircle function draws a filled circle in x and y location and r radius and t color.
The drawTriangle function draws a triangle with three corner location x, y and z, and t color. The fillTriangle function draws a filled triangle with three corner location x, y and z, and t color.
How project worksThe code fills a rectangle, then draws a rectangle within which text “EEWORLDONLINE” is displayed. Then, lines, circles, rectangles, and squares are drawn on the screen. The project ends with a greeting and a message.
By continuing to use AliExpress you accept our use of cookies (view more on our Privacy Policy). You can adjust your Cookie Preferences at the bottom of this page.
Displays are one of the best ways to provide feedback to users of a particular device or project and often the bigger the display, the better. For today’s tutorial, we will look on how to use the relatively big, low cost, ILI9481 based, 3.5″ Color TFT display with Arduino.
This 3.5″ color TFT display as mentioned above, is based on the ILI9481 TFT display driver. The module offers a resolution of 480×320 pixels and comes with an SD card slot through which an SD card loaded with graphics and UI can be attached to the display. The module is also pre-soldered with pins for easy mount (like a shield) on either of the Arduino Mega and Uno, which is nice since there are not many big TFT displays that work with the Arduino Uno.
The module is compatible with either of the Arduino Uno or the Arduino Mega, so feel free to choose between them or test with both. As usual, these components can be bought via the links attached to them.
One of the good things about this module is the ease with which it can be connected to either of the Arduino Mega or Uno. For this tutorial, we will use the Arduino Uno, since the module comes as a shield with pins soldered to match the Uno’s pinout. All we need to do is snap it onto the top of the Arduino Uno as shown in the image below, thus no wiring required.
This ease of using the module mentioned above is, however, one of the few downsides of the display. If we do not use the attached SD card slot, we will be left with 6 digital and one analog pin as the module use the majority of the Arduino pins. When we use the SD card part of the display, we will be left with just 2 digital and one analog pin which at times limits the kind of project in which we can use this display. This is one of the reasons while the compatibility of this display with the Arduino Mega is such a good news, as the “Mega” offers more digital and analog pins to work with, so when you need extra pins, and size is not an issue, use the Mega.
To easily write code to use this display, we will use the GFX and TFT LCD libraries from “Adafruit” which can be downloaded here. With the library installed we can easily navigate through the examples that come with it and upload them to our setup to see the display in action. By studying these examples, one could easily learn how to use this display. However, I have compiled some of the most important functions for the display of text and graphics into an Arduino sketch for the sake of this tutorial. The complete sketch is attached in a zip file under the download section of this tutorial.
As usual, we will do a quick run through of the code and we start by including the libraries which we will use for the project, in this case, the Adafruit GFX and TFT LCD libraries.
With this done, the Void Setup() function is next. We start the function by issuing atft.reset() command to reset the LCD to default configurations. Next, we specify the type of the LCD we are using via the LCD.begin function and set the rotation of the TFT as desired. We proceed to fill the screen with different colors and display different kind of text using diverse color (via the tft.SetTextColor() function) and font size (via the tft.setTextSize() function).
The Adafruit library helps reduce the amount of work one needs to do while developing the code for this display, leaving the quality of the user interface to the limitations of the creativity and imagination of the person writing the code.
That’s it for this tutorial guys, thanks for reading. If you made some cool projects based on this or you just want to ask questions about this tutorial, feel free to reach out via the comment section below.
Thank you for your purchase. We hope you are happy with your purchase. However, if you are not completely satisfied with your purchase for any reason, ELEGOO provides a straightforward warranty that is processed in the most hassle-free way possible. Please refer to the chart below for the warranty timelines of various products, as warranty periods differ according to models.
All returns for refund must be postmarked within fourteen (14) days of the date the item was delivered to the designated shipping address. All returned items must be in new and unused condition, with all parts & accessories included and all original tags and labels attached.
All returns for exchange must be postmarked within thirty (30) days of the date the item was delivered to the designated shipping address. All returned items must be in new and unused condition, returned with all parts & accessories included and all original tags and labels attached.
To return an item, please email customer service at service@elegoo.com / euservice@elegoo.com to obtain the address information you need regarding of returning the products. Please place the item securely in its original packaging, and mail your return through a trackable method.
After receiving your return and inspecting the condition of your item, we will process your return. Please allow at least 7 days from the receipt of your item to process your return. We will notify you by email when your return has been processed and refund you the payment via Paypal.
Regarding defective or damaged products, please don"t hesitate to contact us at the customer service channels below to acquire technical support, refund or exchange.
When contacting our customer service team, buyer must provide sufficient proof of purchase (order number from online purchases made through ELEGOO, Amazon or other ELEGOO"s authorized resellers), tell us which product you purchased, and describe the problem as clearly as possible through text, images or short videos. This will help our team to process your inquiries and help you solve the problems more efficiently.
This paper describes data acquisition with an Arduino Nano from eight DS18B20 temperature sensors and four DHT11 relative humidity sensors. The data are displayed on a 3.5″ 320×480 pixel color TFT screen.
As a home owner living in a country with a moderate, often moist climate I am interested in the continuously changing relative humidity conditions and in the daily change in temperatures inside and outside my home. Monitoring various temperatures became more interesting when I acquired a solar thermal water heater together with several solar panels that each have their (micro)inverter. The temperature of a solar device is directly related to how successful it is running. Think about hot ‘solar’ water for your shower! Failure of such a device reveals itself by a flat temperature or a temperature that stays close to the ambient room temperature. Keeping an eye on temperatures may thus save energy.
Recently I started an attempt to reduce central heating energy use through playing with the unit’s hot water circulating water thermostat. For this I needed multiple temperature sensors at various strategic positions. An additional condition was that data should be displayed neatly arranged and immediately visible in an aesthetic manner.
With an Arduino microcontroller board equipped with temperature and relative humidity sensors my aim should be attainable. The condition to display all data permanently and visible at a single glance is better provided by a 320×480 pixel color TFT display than with a 16×2 or 20×4 character monochrome LCD display. This was a decisive factor to go for a TFT display.
The ‘Arduino’ marketplace supplies us with many cheap temperature and humidity sensors. For the relative humidity data acquisition I selected the DHT11 sensor and I decided to use this device in pairs to cope with their inaccuracy. While a DHT11 measures also temperature next to humidity they do so with a miserable accuracy range of two degrees Celsius. A much more accurate temperature sensor (tenth of degrees Celsius) is Maxim’s Dallas DS18B20. Its clever design allows multiple sensors running on a single bus. This is a very valuable feature given the fact that a TFT screen ‘consumes’ many digital pins on an Arduino board.
As TFT displays are typically marketed as shields, the Arduino Uno Mega would be the typical platform of choice. However, for the purpose of building an ultra compact monitoring device and also to challenge myself I started a project aiming at the creation of a multi-temperature- and humidity display with a 320×480 color TFT screen using the Arduino Nano as its microcontroller platform. The Nano’s attractiveness lies in its reduced dimensions which makes it a microcontroller board that can be hidden behind a big TFT display in a small assembly mounted in a modest, attractive casing.
Two DHT11 breakout boards were mounted back to back, with an insulating foil in between, in a plastic vial (figure 1). The pins were soldered on a piece of cut-out prototyping soldering board. Pins 1 (VCC) and 3 (GND) of the pair were connected while the DATA pins (pin 2) remained separated. An assembled pod has four wires: VCC, GND and for each of the DHT11s a separate DATA wire.
These sensors can be purchased as individual parts or as ‘ready to use’ wire thermometers. I bought the parts and constructed my own sensors (figure 2) by soldering a color-coded wire to each pin of the sensor (red: Voo; black: GND; white: DQ) and protecting the soldered connections with a crimp sock. DS18B20s operate at 5V.
I bought a nameless 3.5 inch color TFT LCD shield for the Arduino UNO (figure 3). Doing so is risky because there is no uniformity in TFT controllers, and nameless displays usually arrive without any documentation or software drivers. This particular display had two advantages: 1) it appeared compatible with the mcufriend.kbv library, 2) background lighting is very uniform, which makes this screen particularly attractive. Note that ordering this screen was a gamble. If gambling and experimenting are is not your favorite occupations an Adafruit 3.5″ 320×480 pixel color TFT touchscreen breakout with its lavish documentation and company support is recommended.
The TFT shield plugs nicely into an Arduino Uno but then covers non-connected pins that are necessary for getting sensor data. Wire connectivity between the microcontroller board and the TFT screen uses 16 wires, and an additional four wires are necessary for the SD slot to function. The total amounts to 20 wires capturing almost all available pins on an Arduino Nano! In my configuration I needed next to TFT connectivity another four pins on the microcontroller board to connect the four DHT11s, plus one pin for the one-wire DS18B20 connectivity. To free pins I sacrificed the SD connectivity. Pin connectivity between TFT display shield and the Nano is shown in figure 3.
Gear whose operating temperatures I wanted to monitor is mostly located in the loft, approximately 10 meters away from my tiny hobby office. The loft currently hosts five DS18B20 probes at various locations. An 8-wire twisted pair cable (cable #1) obtained from a computer store (plain network cable without connectors) was drawn from my office to the loft. Of the 8 available wires, only three were used: one 5V line (orange wire), one GND line (blue wire) and one wire for the DS18B20 data bus (white-blue striped wire). One advantage for the DS18B20 one-wire concept is that considerable cable distances are supported. I assume that twisted-pair cable favors signal separation as it does in fast computer networks.
A wiring diagram is shown in figure 4. ‘Attic’ temperature probes were taped onto the hot water and return pipes of the central heating (CH) unit (probes 01 and 02), on casings of solar energy grid tie inverters (probes 03 and 08), one sensor was left hanging loose (probe 04, ambient loft air temperature), and one was taped onto the hot tap water pipe coming out of the storage tank of the solar water heating system (probe 06) (as close as possible to the hot interior of the tank).
In addition I ran a twisted pair cable (cable #2) in my office to a distribution box from which wires run via a drilled hole in a window frame to a DHT11 pod mounted outside. This pod (fIgure 1) holds a pair of DHT 11s and it is mounted in a weather-shielded, shady spot. Immediately next to this ‘outside’ pod I installed one DS18B20 temperature sensor to measure the temperature outside the home. Of the eight available wires in the connecting cable I used five: orange (5V), blue (GND), white-brown striped (DHT11-1-DATA), white-orange striped (DHT11-2-DATA), and white-blue striped (DS18B20 data).
Both cables were connected to a junction box on the wall in my office and from here a common final cable (#3) runs to the Arduino Nano. Because I wanted to measure the relative humidity and air temperature in my office, the junction box was decorated with an add ional DHT11 ‘pod’ and apart from that with a DS18B20 probe (probe 07). The data pin of probe 07 was connected to the white-blue-striped wires whilst the two DATA wires from the pair of DHT11’s inside the pod were connected to the wires green and the white-green-striped wires of cable #3. In summary the color codes wires in the common final cable #3 that leads to the Nano correspond with the following sensors:
Pin connectivity between the Arduino Nano and the sensors and display are illustrated in figure 5A. The pin layout is mostly standard TFT shield connectivity (i.e., as if placed on an Arduino UNO). The only difference here is that the wires belonging to the SD part of the shield are not connected since I needed five pins to connect sensors to. The tradeoff of assigning these pins to the humidity and temperature sensors is that the SD functionality of the TFT shield is not available.
The DHT11 DATA wires were connected to Nano pins D10, D11, D12 and A5 (which can be programmed to function as pin D19, see sketch). Intuitively one would connect the four DHT11s with pins D10 through D13, but using the D13 pin caused errors in the sensor reading (“nan”). Reading DS18B20’s via Nano pin D13 was without problems if a pull up resistance of 2kΩ-3kΩ was placed between 5V and pin 13. Usually a DS18B20 requires a 4.7 kΩ pull up resistor, but pin 13 has a built-in 1,000 Ω resistance to accomodate led-blinking. If necessary a 10K pot meter may be used here.
The result of the entire project is shown in figure 5B. The seven temperature sensors and four humidity sensors provide a clean and continuous data stream concerning temperatures and relative humidities on various spots inside and outside the home. The 3.5 inch TFT display has even space to accommodate more readings. It is tempting to add more DS18B20 sensors to the one-wire bus to measure temperatures of more solar inverters. keeping an eye on casing temperatures of solar tie grid inverters is very convenient because an inverter produces heat and, conversely, if an inverter malfunctions its temperature goes down to the ambient temperature. The sensor can be considered a good ‘health’ indicator for solar inverters!
The next challenge is to log the acquired data. One way to do so could be via data transfer to another Arduino equipped with a logging shield. Another option is to send data via the home computer network to a network storage unit for later analysis. However, the sketch controlling the TFT display and the data acquisition contains code that draws heavily on the Nano’s ATmega328 storage space and the available dynamic memory. The sketch consumes 74% of available program storage space (23k out of 30k) while global variables take 1,364 bytes of 2,048 available bytes of dynamic memory. The most urgent action for the moment may be compression of the sketch to reduce the use of memory storage in the Nano as much as possible.
By continuing to use AliExpress you accept our use of cookies (view more on our Privacy Policy). You can adjust your Cookie Preferences at the bottom of this page.
All the products supplied by Makerkart are genuine and original. We offer 14 days replacement warranty in case of manufacturing defects. For more details, please visit our cancellation and returns page.