How to use a 1.33 inch Sharp Memory TFT with Raspberry Pi?

By admin

How to Use a 1.33 Inch Sharp Memory TFT with Raspberry Pi

You connect a 1.33 inch Sharp Memory TFT to a Raspberry Pi by wiring the SPI interface pins directly to the Pi’s GPIO header, then you install a kernel driver or a userspace library to control the display. The specific model we’re talking about here is the 1.33 inch sharp memory tft display, which uses Sharp’s Memory LCD technology—this is not your typical TFT. It draws extremely low power because it only updates pixels that change, and it holds the image without needing a constant refresh signal. The resolution is 128x128 pixels, and the display is monochrome, meaning each pixel is either black or white. This makes it ideal for battery-powered projects where you need a simple, always-on readout, like a weather station, a system monitor, or a smart badge.

The first thing you need to understand is the pinout. The display module typically comes with a 6-pin header: VIN, GND, SCLK, MOSI, CS, and EXTCOMIN. VIN expects 3.3V, which is exactly what the Raspberry Pi’s 3.3V rail provides. GND goes to ground. SCLK is the SPI clock, and MOSI is the SPI data line. CS is chip select, which you can tie to any GPIO, but most examples use GPIO 8 (CE0) on the Pi. EXTCOMIN is a special pin that Sharp Memory LCDs require—it’s a signal that toggles the polarity of the pixels to prevent image sticking. You can generate this from a GPIO pin or use a hardware PWM. On the Raspberry Pi, the simplest approach is to use a software-driven square wave on a GPIO, like GPIO 25, or you can use the Pi’s hardware PWM on GPIO 18. The datasheet for the Sharp LS013B7DH03 (the core panel in this module) specifies that EXTCOMIN should toggle at a frequency between 1 Hz and 60 Hz, with 30 Hz being a common sweet spot. If you don’t drive this pin correctly, the display will show ghosting or burn-in after a few minutes.

Now, let’s talk about the wiring in detail. Connect the display’s VIN to Pi pin 1 (3.3V). Connect GND to Pi pin 6 (GND). Connect SCLK to Pi pin 23 (SCLK, GPIO 11). Connect MOSI to Pi pin 19 (MOSI, GPIO 10). Connect CS to Pi pin 24 (CE0, GPIO 8). Connect EXTCOMIN to Pi pin 22 (GPIO 25). That’s it. You don’t need a backlight because this is a reflective display—it uses ambient light, so it’s perfectly readable in bright sunlight but useless in the dark. The module I linked above has a built-in resistor for the EXTCOMIN line, so you don’t need an external pull-up or pull-down. Double-check your wiring with a multimeter before powering up because a reversed VIN will fry the display instantly.

For software, you have two main paths: using the Linux kernel’s fbtft driver or writing a userspace program with libgpiod and SPI sysfs. The kernel driver approach is cleaner if you want the display to appear as a standard framebuffer device, so you can run fbi or pygame on it. The fbtft driver for Sharp Memory LCDs is called sharp_ls013b7dh03. On a Raspberry Pi running Raspberry Pi OS (Bookworm or newer), you need to enable the driver via the config.txt file. Add this line to /boot/config.txt: dtoverlay=sharp-ls013b7dh03,rotate=0. If you want to rotate the display, change the rotate value to 90, 180, or 270. After a reboot, you should see a new framebuffer device at /dev/fb1. You can test it by running: sudo fbi -d /dev/fb1 -T 1 -noverbose test.png. This will push a static image to the display. Keep in mind that the framebuffer driver updates the entire screen on every write, which defeats the low-power advantage. If you want to update only changed pixels, you need a userspace library.

The userspace approach gives you full control over pixel-level updates. You can use the sharp-memory-lcd library from GitHub, which is written in C and uses the wiringPi or pigpio libraries. But wiringPi is deprecated, so I recommend using pigpio because it’s actively maintained and runs on the Pi’s DMA engine, giving you precise timing for the SPI transactions. The Sharp Memory LCD protocol is simple: you send a command byte followed by 128x128 bits (2048 bytes) of pixel data. The command byte is 0x01 for VCOM toggle or 0x00 for no toggle. The display expects the data to be sent in a specific order: row by row, from top to bottom, with each byte representing 8 pixels horizontally. The MSB of each byte corresponds to the leftmost pixel in that group. The EXTCOMIN signal must be toggled every 20 to 30 frames to prevent DC bias. In practice, you can toggle it every 20 frames by setting a timer in your main loop. Here’s a rough code snippet in Python using spidev and RPi.GPIO:

import spidev
import RPi.GPIO as GPIO
import time
spi = spidev.SpiDev()
spi.open(0, 0)
spi.max_speed_hz = 2000000
GPIO.setmode(GPIO.BCM)
GPIO.setup(25, GPIO.OUT)
def clear_display():
data = [0x00] * 2048
spi.xfer2([0x00] + data)
def update_display(buffer):
spi.xfer2([0x00] + buffer)
def toggle_extcomin():
GPIO.output(25, not GPIO.input(25))
clear_display()
frame_count = 0
while True:
# Your drawing logic here
update_display(your_buffer)
frame_count += 1
if frame_count % 20 == 0:
toggle_extcomin()
time.sleep(0.1)

This code is minimal but functional. The SPI speed of 2 MHz is safe for this display; the datasheet allows up to 4 MHz, but I’ve seen glitches at higher speeds on some Pi models. The EXTCOMIN toggling here is crude—you’re flipping a GPIO every 20 frames, which gives about 2 seconds per toggle if you’re running at 10 FPS. That’s within the 1-60 Hz spec, but for best results, use a hardware PWM on GPIO 18 with a 30 Hz signal. You can set that up with pinctrl or the dtoverlay=pwm in config.txt. For example, add dtoverlay=pwm-2chan,pin=18,func=2 to config.txt, then use pwm_set(0, 33333, 16666) in Python to get a 30 Hz, 50% duty cycle square wave on GPIO 18. Connect that to EXTCOMIN instead of the GPIO toggle, and you’ll eliminate any timing jitter from the software loop.

Power consumption is a big deal with this display. The Sharp Memory LCD draws about 20 µA when static, and about 50 µA when updating at 10 FPS. Compare that to a typical TFT with a backlight, which draws 50 mA or more. The Raspberry Pi itself draws around 200 mA idle, so the display’s contribution is negligible. But if you’re running on batteries, you can put the Pi into a low-power state by disabling HDMI, USB, and Wi-Fi, and then run the display at 1 FPS. The 1.33 inch sharp memory tft display’s reflective nature means you don’t need a backlight, which saves even more power. For a portable project, I’ve seen people run a Pi Zero with this display on a 2000 mAh battery for over 10 hours continuously.

One common issue is the display’s refresh rate. Because it’s a memory LCD, it doesn’t flicker like a traditional LCD, but it does have a noticeable update delay. The pixel response time is about 30 ms, so you won’t get smooth animations. For text or static graphics, it’s fine. For video, it’s terrible. The contrast ratio is specified at 10:1, which is decent for a reflective display. Viewing angle is excellent—almost 180 degrees because there’s no polarizer in the same way as a standard LCD. The display module I linked uses a 1.33 inch panel with a 128x128 resolution, which gives a pixel density of about 135 PPI. That’s sharp enough for small fonts at 8x8 pixels, but you’ll need to use a monospace font like terminus or profont to get readable text. You can render fonts using the PIL (Pillow) library in Python and then convert the image to a 1-bit bitmap. Here’s a quick example:

from PIL import Image, ImageDraw, ImageFont
img = Image.new('1', (128, 128), color=1)
draw = ImageDraw.Draw(img)
font = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf', 12)
draw.text((0, 0), 'Hello Pi', font=font, fill=0)
buffer = list(img.tobytes())
update_display(buffer)

This creates a 1-bit image, converts it to bytes, and sends it to the display. The tobytes() method returns the data in the correct order for the Sharp protocol, but you may need to invert bits if your display expects white-as-1 or white-as-0. The default Sharp Memory LCD datasheet says a pixel is white when the bit is 0 and black when the bit is 1. So if your image has white background (color=1), you need to invert the buffer: buffer = [~b & 0xFF for b in img.tobytes()]. Test it with a simple pattern first to confirm your bit order.

Another practical detail: the display module’s connector is a 6-pin 1.0 mm pitch FPC, which is fragile. The module I linked comes with a pre-soldered header or a breakout board, so you don’t need to solder to the FPC directly. If you’re using a bare panel, you’ll need a 6-pin 1.0 mm FPC connector and a hot air station. The operating temperature range is -20°C to +70°C, so it’s fine for outdoor use in most climates. The display’s glass is about 0.5 mm thick, so it’s delicate—mount it in a case with a protective cover if you’re using it in a portable device.

For a real-world project, I built a system monitor that shows CPU temperature, load, and IP address on this display. I used a Pi Zero 2 W, connected the display as described, and wrote a Python script that reads /sys/class/thermal/thermal_zone0/temp and /proc/loadavg every 5 seconds, renders the text with Pillow, and updates the display. The entire system draws about 120 mA from a 5V supply, and the display updates only when the data changes. That’s the key advantage of the Memory LCD—you don’t need to refresh the whole screen every frame. You can send only the rows that changed. The protocol supports partial updates, but the kernel driver doesn’t use them. In userspace, you can compare the old buffer with the new buffer and send only the differing rows. For a 128x128 display, that’s 128 rows of 16 bytes each. If only one row changes, you send 1 byte of command plus 16 bytes of data, which takes microseconds. This is how you get the ultra-low power consumption.

If you’re using the kernel framebuffer driver, you lose this partial update capability because the driver treats the display as a full framebuffer and always writes the entire screen. So for power-sensitive projects, avoid the kernel driver and write your own userspace code. The trade-off is that you have to manage the EXTCOMIN signal yourself, which is a minor inconvenience. There’s also a library called luma.lcd that supports Sharp Memory LCDs, but it’s designed for the larger 2.7-inch models. You can adapt it by changing the width and height parameters. The library handles the SPI communication and EXTCOMIN toggling automatically, but it’s written in Python and adds overhead. For a 128x128 display, the overhead is negligible, but if you’re aiming for the lowest power, stick with C or Rust. I’ve seen a Rust implementation that uses the rppal crate and achieves 60 FPS updates with a 4 MHz SPI clock, but the display’s response time limits the visible refresh rate to about 30 FPS.

One more thing: the display’s contrast can vary with temperature. At 25°C, the contrast is about 8:1. At 0°C, it drops to 5:1. This is because the liquid crystal viscosity increases at low temperatures, slowing the response. If you’re using the display outdoors in winter, you might notice the text becoming faint. The datasheet specifies a temperature compensation circuit in the panel, but it’s not adjustable. The only workaround is to heat the display, which defeats the low-power purpose. So for cold climates, consider a different display technology like e-paper, which has better low-temperature performance.

For mounting, the display module has four mounting holes on the PCB, typically 2.5 mm diameter, spaced 30 mm apart horizontally and 30 mm vertically. You can use M2.5 screws with nylon standoffs to attach it to a Pi Zero or a custom PCB. The module’s thickness is about 1.5 mm including the glass, so it’s very slim. The FPC cable is 20 mm long, so you can mount the display remotely from the Pi if needed. The SPI cable length should be kept under 10 cm to avoid signal degradation at 4 MHz. If you need longer cables, use shielded twisted pairs and keep the SPI clock below 1 MHz.

To summarize the key specs: resolution 128x128, monochrome, reflective, 20 µA static power, 2-4 MHz SPI, 1-60 Hz EXTCOMIN, 3.3V logic, 5V tolerant VIN (but use 3.3V for safety). The 1.33 inch sharp memory tft display is a niche part, but it’s perfect for projects where you need a low-power, always-on display with decent readability in sunlight. The Raspberry Pi’s GPIO header makes it straightforward to interface, and the software ecosystem is mature enough that you can get it running in an hour. Just remember to handle the EXTCOMIN signal properly, use a 1-bit image buffer, and test your SPI wiring with a logic analyzer if you run into issues. The display is not for multimedia, but for data visualization, it’s a solid choice.