July 8th, 2024

A Mini Monitor for a Pi

The author shares a project using a 2-inch display as a Raspberry Pi monitor, creating a handheld console. Details include wiring, SPI communication, display mirroring for tasks like coding and web browsing, hardware setup, communication protocol, and a system service for seamless display experience.

Read original articleLink Icon
A Mini Monitor for a Pi

The post describes the author's project of using a 2-inch display as a monitor for a Raspberry Pi, aiming to create a handheld "console" with display functionality. The setup involves wiring the display to the Pi, communicating with the display using SPI, and addressing issues encountered during the process. The display mirroring program allows for tasks like code editing, web browsing, and using the terminal. The author details the hardware used, the wiring setup, and the communication protocol with the display. Additionally, instructions are provided for setting up the hardware and software components required for the display mirroring program. The program includes features like handling X11 display, terminal tty display, and managing power consumption through the X display power management system. Challenges such as X errors and handling display modes are addressed in the program. The project involves creating a system service that switches between rendering modes based on the user's activity on the Pi, ensuring a seamless display experience.

Link Icon 18 comments
By @hiisukun - 3 months
I love these projects but when I have had a need for a display at home, I struggled to find a case! Small displays complete with a case, that was also slim and of decent material, seemed incredibly elusive.

I suppose the modern workflow is to 3d print one: but perhaps other consumers, like me, buying a $20 SBC and a $20 display have not outlayed for a 3d printer... Or purchase a 3d printed one to spec? Unfortunately I don't yet have the confidence in the quality of materials of a purchased 3d printed item, nor enough familiarity with the materials and process to choose from the many options online. They also did not seem particularly cheap.

Most recently, I ended up finding a 2nd hand (refurbished) small tablet, and simply used that as the display for a small system. It pulls the display content over wifi and displays it in a browser, which is incredible overhead for such simple content. But it is slim, has a touch screen, comes complete in a case, and was cheaper than purchasing a similar waveshare or other unnamed-brand display with a matching case (where one could even be found!)

By @zevv - 3 months
Although this is a fun project, this seems like a silly amount of work to get this to work: this display controller has been supported in the Linux kernel for ages. Why not just add the panel to the device tree and let the kernel handle all that for you?
By @_Microft - 3 months
Tip for working with Dupont connectors: if you have N cables connecting to a pin header next to each other, then remove them from their 1x1 plastic housings and put all cables into a single Nx1 housing (there are very cheap sets with a couple of dozen different Nx1 and Nx2 housings each). It will almost completely prevent cables disconnecting themselves from the pin header.

Feel free to modify this as needed, e.g. by having a 6x1 connector on one side splitting into 4x1 and 2x1 on the other if that’s how the cables group. Or use a …x2 connector if the pin header has two rows like here.

You will love it, believe me.

By @mafuyu - 3 months
Awesome! I think the next step for this project would be to implement a proper DRM kernel driver and device tree overlay, instead of copying the framebuffer in userspace.

For reference, take a look at the Beepy display driver module: https://github.com/ardangelo/sharp-drm-driver. It's for a monochrome Sharp memory LCD, but still uses the SPI interface on a RasPi.

By @jgrahamc - 3 months
I've used a Raspberry Pi 400, an Adafruit CYBERDECK HAT and a Joy-IT 3.5" display to make a small, portable computer for when I don't need a laptop: https://blog.jgc.org/2023/10/cyberdecking-raspberry-pi-400-o...
By @nsteel - 3 months
Waveshare have a lot of good options these days: https://thepihut.com/collections/adafruit-lcds-displays?sort...

I like the look of 1.83" IPS LCD Display Module (240 x 280) for £9. But as another comment already mentioned, they are often limited to RGB444, RGB565 and RGB666 formats.

By @megous - 3 months
Problem with these small displays is that lot of them are pretty bad.

It's possible to find good cheap (~$8-10) IPS panels with parallel 24-bit interface with wide viewing angles and good contrast, but these common cheap SPI ones are not it.

A lot of people would be less interested if the author moved the camera a bit from the perfect 90° position. :)

By @johnklos - 3 months
This is precisely what I've been considering! I want a physically small display that can do 80x25 (at least) text, for those times when a laptop isn't available or is too cumbersome.

Because many of the SPI screens don't have the resolution to do at least 80x25, I'm currently using a small composite display, but if I find something that does at least 480x200, I'll give it a go. This'll be a good reference :)

By @iamflimflam1 - 3 months
Nicely done.

I’ve used this before - https://github.com/goodtft/LCD-show

Supports a whole bunch of different LCD displays along with touch.

There’s also this really useful site: http://www.lcdwiki.com/3.5inch_RPi_Display

By @0x1ceb00da - 3 months
If your Pi has an hdmi port, you could get an hdmi to usb adapter, connect it to your phone, and install a usb webcam app to use your phone as a display. The latency will be horrible if you cheap out on the adapter but it doesn't look too good for this setup either.
By @jmmv - 3 months
Nice project! I recently did something similar by porting the EndBASIC console to show up in a tiny LCD. Making it work at all was fun, but then optimizing the driver to be fast enough was a really cool exercise. I've submitted the story here: https://news.ycombinator.com/item?id=40906201

And while working on this, I also found out that NetBSD has a native LCD driver for its wscons framework, so presumably you can trivially get the full system's console on the LCD as well: https://man.netbsd.org/ssdfb.4

By @bouvin - 3 months
I use one of the small plug'n'play displays (well, nearly – you run a script) for my Pihole RPi to show stats and state. For mere interactive work, I have found that tablet displays packaged in a case from Aliexpress work nicely.
By @antirez - 3 months
In case somebody is interested: there are decent ST77xx based displays for a lot less than $20 for the 2" size. Otherwise, with $20 you can get a much larger one on AliExpress, always based on the same chip so compatible with the code in this post. If you are ok with paying a bit more and want to be sure to get a quality product, for $20 you can get a solid color display on Pimoroni if you are in the UK or are willing to wait forever for the shipment in Europe.
By @throwaway71271 - 3 months
Amazing!

Is it possible to use square magnifying glass to get to 7-8 inch or even 14? I want to make old school vibe amber color mini computer with a PI, and was thinking of using either 5" spi or one of the smaller ones 3.5 or so.

PS: we have been bombarded with AI so much that I misread the title as 'AI monitor for PI' :)

By @lawlessone - 3 months
The browser .gif reminds me of browsing WAP pages on a Nokia back around 2004-6
By @CodeWriter23 - 3 months
Fooling the GPU into working and copying the framebuffer, interesting approach. Really simplifies implementation.
By @contctlink - 3 months
Definitely something I could use as an external display for a pomodoro timer
By @sciencesama - 3 months
Now do triple display