Driving The HY-1.8 SPI TFT 128×160 Display From A Netduino

18 Nov

This display, which is extremely similar to the AdaFruit ST7735, is frequently found on ebay and is a great 1.8 inch SPI TFT display.  It also includes an SD Card slot, also available via SPI.  The main issue with the display is the fact that the pin out marked on the PCB solder mask is completely wrong.

Despite having pins labeled SCK/SDA, this is not an I2C device.  It is an SPI device and the pin 8 marked “SDA” is actually MOSI, which would connect to Pin 11 (MOSI) on Arduino or Netduino boards.   Pin 7, marked “A0” is our “device command”, or “D/C” pin.

Here is how I hook it up to my Netduino 2.

1.8 SPI TFT Pin Netduino 2 Pin
1 Ground
2 VCC
6 – Reset 8
7 – “A0” 7
8 – “SDA” 11
9 – SCK 13
10 – CS 9
15 – LED+ 3.3V or PWM
16 – LED- Ground

Now what about software?  Over on the Netduino Helpers CodePlex project you’ll find this AdaFruitST7735 library.

Unfortunately it hasn’t been updated in a while and if you try to use the referenced ExtendedSpiConfiguration on .Net MF 4.3 (or likely 4.2) you’ll get an argument null exception.  Additionally the library includes some offsets in the frame buffer that must have been for some older iteration of the device, because they will cause offset or scrolling images.

I’ve gone ahead and put an updated library in GitHub here:

https://github.com/stefangordon/Netduino-HY-1.8-SPI-TFT-Driver

Usage is pretty simple – here is an example using the pin assignments I listed above:

var lcd = new HY18SPI(Pins.GPIO_PIN_D9, Pins.GPIO_PIN_D7, Pins.GPIO_PIN_D8, SPI.SPI_module.SPI1, 15000);
lcd.AutoRefreshScreen = true;
lcd.ClearScreen((ushort)HY18SPI.Colors.White);
lcd.DrawCircle(10, 10, 20, (ushort)HY18SPI.Colors.Red);
Tweet about this on TwitterShare on Google+Share on FacebookShare on RedditEmail this to someoneShare on LinkedInShare on StumbleUpon

3 thoughts on “Driving The HY-1.8 SPI TFT 128×160 Display From A Netduino

  1. Is there any way you might be able to give me a quick version on how to adapt this driver so I can run this on my arduino Due?

    I’ve had it for 2 weeks now and can’t get anything but fuzz when I try and pull a bmp off of the sd card.

    Thank you for any help.

    Dustin

  2. Hi Stefan,

    Impressive, and hopefulle the way to get my screen working! Now I am not a coder, so I don’t have a clue how to use the snippet of code above. How do I do that?

Leave a Reply

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