• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Arduino with TFT screen problems ..

Wp100

Well-Known Member
Thread starter #1
Hi,

We have been running some tests using the 320x240 tft screen as below, to which w e have added a 3v3 regulator and pot dividers on the signal lines.

Have loaded in the Adafruit libraries and run their Graphictests.ino on the Uno without any problem.

https://github.com/adafruit/Adafruit_ILI9341

We could not get the TFTs onboard SD card to work, but had a little sd card board with its own regulator and signal converter chip and it also works fine and were able to run the spitftbitmap ino and load a sd card bmp image to the screen ok.

As the our main project is on the Mega with ran the code on it with all the SPI lines move over to mega pins 50-53 plus D/C and RST.

When we run the graphics test it works, but is about 6 times slower than the Uno ?

When we run the bitmap is appears to load the image from the sd card but nothing displays ?

Any ideas why these are not working on the Mega2560 ...?



000937.jpg 000938.jpg 000936.jpg IMG_0897.JPG
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
#2
Been there, done that... Are you supplying V to the TFT board... If you are supplying 5v it wont work well.. If you're supplying 3v3 it wont work good.. The little reg on the board isn't worth didly.. I run mine direct from 3v3 and bridge out their reg.. On the board under the reg, next to R6 is a jumper to do just that!!
 

Wp100

Well-Known Member
Thread starter #3
Hi,

Have just tried your suggestion and bridged those pads and fed a linear regulated 3v3 direct to the tft screen, seems to use between 35 -42ma.

Ran the same tests again on the Uno , the graphic test takes 18 secs, but on the Mega it take 128 secs ??

Then when comparing the code differences it became clear what might be the problem,

On the Uno this was used,

#define TFT_RST 8
#define TFT_DC 9
#define TFT_CS 10

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC,TFT_RST);


But on the Mega we had this,

#define TFT_DC 46
#define TFT_CS 49
#define TFT_RST 48
#define TFT_MISO 50
#define TFT_MOSI 51
#define TFT_CLK 52

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);


Changing the Mega Code to this and it now works fine .

#define TFT_DC 46
#define TFT_CS 49
#define TFT_RST 48

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);


Would seem its not happy about the 'double' defines, though not sure why the compiler does not generate an error message ?

Still , worth the post just for your advice on the tft regulator, Thanks
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
#4
Right... The second tft init is for software SPI hence the pin numbering!! The Uno one is correct... You have to just change CS DC and RS as you have done..

Glad to see its working!!
 

Wp100

Well-Known Member
Thread starter #5
Thanks,

We can now show him that we got his image onto the screen, for use as a Splash ; ideally need to place it in Flash memory rather than SD which he wants to use for Stats, so probably a few more headaches sorting that out, always seems easier to do in the Pic Assembly days :) must be getting too old :D

IMG_0898.JPG
 

Pommie

Well-Known Member
Most Helpful Member
#6
If you switched to a Wemos board you would have 4Meg of flash (16 on pro) to store images etc. It can be setup to have 1M for code and 3M as a flash drive (SPIFFS). You can simply ignore the wifi part of it and if you don't need lots of I/O you could use the mini version. A wemos mini with SD shield would give you the best of both worlds. Did I mention that it runs at 80 or 160 MHz?

Mike.
 

Wp100

Well-Known Member
Thread starter #7
Hi,

I'm helping a friend get going with Arduino C++ and he had to use the Mega because of the prog memory size and the number of I/O, at least 22 before even considering SD or Touch Screen add ons.

I did look at the STM32 103 module but seems its still a development area more suited to advanced users like yourself and Ian.

The Wemos with its wifi would be a useful addition, but even the D32 board only has 22 i/o so a port expander would be needed and as on the STM board thats were I came unstuck in being able to address i/o pins to the port expander where they were already allocated to library functions.

The other thing about the Wemos, from what I had previously read about them on the web was they could be a bit flaky ? but from your comment it sounds like they can be stable .

As my friends project is for livestock environment control he does need something reliable.
 

DirtyLude

Well-Known Member
#8
Setup one of these with an ESP32 and the thing refreshes lightning fast. Using a LPC1114 at 32Mhz before and it wasn't that slow, but this is pretty much instant full screen refresh.
 

Wp100

Well-Known Member
Thread starter #9
Hi Again,

Have been using the Adafruit Adruino GFX and ILI9341 libraries ok, but am having to use URtouch library for the resistive touch screen.

Tried using Adafruits STMPE610 touch library but seems that does not like to work with this TFTs HR2046 touch controller.

Wondered if there was any better library to match all this boards functions in one ?
 

Wp100

Well-Known Member
Thread starter #13
I know this may seem old fashioned but have you considered reading the datasheet and writing your own code?

Mike.
Hi,

Yes, have done that from scratch years ago with Pic Assembly, but a big job then and as with many tft screens they soon become obsolete as the technology brings out newer models with different controllers etc.

As shown above we are newish to C++ and do not have the skills etc to write full libraries like the clever folk who post their work on Github such as Rinky Dink etc

Wonder if our NHS (free health service) do brain cell implants yet :D
 

Latest threads

EE World Online Articles

Loading

 
Top