ESP32 Drives Controllerless Display Using I2S Hack

It’s possible to find surplus LCDs in all kinds of old hardware. Photocopiers, printers – you name it, there’s old junk out there with displays going to waste. Unfortunately, unlike the displays on sale at your favourite maker website, these often lack a controller and can be quite difficult to drive. [pataga] took on the challenge to drive a LCD of unknown provenance, using the power of the ESP32.

The LCD in question is a 240×160 monochrome device, that was initially being driven successfully with a Microchip PIC24 with a dedicated LCD driver peripheral. This allowed [pataga] to study the display interface under working conditions with the help of an oscilloscope. Inspiration was then taken from a project by [Sprite_tm], which used the I2S peripheral to drive a small LED display without placing load on the CPU.

Using the ESP32’s I2S peripheral in parallel mode makes it possible to shift data out in the correct format to drive the LCD without bit-banging IO pins and using up precious CPU time. This leaves processor cycles free to do interesting things, like generating 3D images using [cnlohr]’s routines from the Channel 3 project. There’s a little extra work to be done, with the frame signal being generated by an external flip flop and some fudging with the arrangement of various registers, but it’s a remarkably tidy repurposing of the I2S hardware, which seems to be the gift that keeps on giving. (Here it is spitting out VGA video through a resistor DAC.)

Code is available on Github for those looking to get at the nuts and bolts of the hack. It’s another build that goes to show, it’s not the parts in your junk box that count, but how you use them.

14 thoughts on “ESP32 Drives Controllerless Display Using I2S Hack

  1. That’s a nice project and I’m glad to see it here, but i’m not too sure all the project relying on the I2S peripheral of the ESP32 should be considered a “I2S hack” especially with the ESP32 TRM showing the use of the I2S peripheral for driving an LCD screen. Again, nice to see the article here just the title might be a bit misleading.

    If some people are interested in this: I’ve recently spent quite a lot of time modifying the Marlin firmware to support I2S for driving stepper drivers using some shift registers. Using the I2S DMA it’s possible for the steppers to reach a very high step rate very accurately without having to use the timer and interrupt (the way it’s currently done). The code for this is now in the mainline bugfix-2.0.x branch of Marlin.

    1. Not that surprising for driving LCDs, since this “I2S LCD mode” had its own section in the ESP32 documentation (and sample code available) for 18 months now… but here, this is (ridiculously) “posted in classic hacks” anyway !

    1. This is a picture which was accepted as a test image by JPEG consortium back in a day to verify image compression algorithm and tweak its parameters. Somewhat similar to what Tom’s Diner song is for mp3. So somehow on a deeper level it kind of makes sense..:)

  2. ” Unfortunately, unlike the displays on sale at your favourite maker website, these often lack a controller and can be quite difficult to drive. ”

    Some due to the custom nature of the product.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.