Using a TFT screen with an I2C input expander

Hi, I'm trying to get a 3.5" TFT screen (like this one) to work with a MCP27018 input expander (datasheet) and I've not had any luck so far.

I realise that I probably should have bought the MCP23017 instead, as this is more commonly used with Arduino projects, but looking at the datasheets, they seem nearly identical except the MCP23018 has open drain outputs, so it should work right?.

I can get the screen to work just fine when it's connected directly to a UNO with the MCUFRIEND_kbv library, that's not a problem. The problem is that it uses up all the pins, so I'd like to run it on the input expander so I can use more pins.

The MCP23018 is working over I2C, flashing some LEDs with the MCP2301X library.

I've done a fair bit of research but I can't really find much in the way of info on getting them to work together, (or infact much in the way of parallel displays on input expanders).

I'm not asking for someone to do it for me, I'm just wondering now if am I barking up the wrong tree? Is this a feasible thing to do for someone with little programming experience? Or has no one done it because it's a bad idea?

Thanks in advance!

I assume that you know that you have to use pullup resistors with the open drain outputs?

For the display you have to study the display data sheet and use it without the library. Find out which pins to set to the required values before toggling the clock pin. It had been simpler if you use a I2C display instead of a parallel one.

Yeah, I understand about the pull-up resistors.

I was hoping to be able to extract the info I needed from the MCUFRIEND library but it's designed to be used with lot of different driver chips and the code isn't very obvious to me, so I think I'm going to go with your suggestion of rolling one from scratch.

I did want to get a screen with I2C built in but I couldn't find any that were of a reasonable size (+3").

Thanks for your help.

I did want to get a screen with I2C built in but I couldn't find any that were of a reasonable size (+3").

There's a reason for that. Larger screens generally have higher resolutions. High resolution screens have lots of pixels. Updating all those pixels means sending a lot of data to the display. If you want to update the whole screen quickly, you need to send a lot of data quickly. This is not i2c's strongest point. Most displays like this have SPI or parallel data bus interfaces. They are many times faster than i2c.

If you were an advanced level programmer, you could adapt the libraries to use i2c. But the update speed of the display would be disappointingly slow. So forget i2c for large displays.... Unless...

Some displays are intelligent and have their own MCU built-in. They often have serial or i2c interfaces. The Arduino can send instructions to such a display to draw the desired image without needing to send large amounts of data.

PaulRB:
….If you were an advanced level programmer, you could adapt the libraries to use i2c. But the update speed of the display would be disappointingly slow. So forget i2c for large displays....

Right, this is basically what I wanted to know, looks like I need to explore other avenues. Thanks