Skip to the content
2 layers50.8 × 24.8 mmLaptopLCDAdapter, the printed circuit board in 3D

Trying to drive old laptop screen with the STM32 and little help from the FPGA (doing RGB to LVDS conversion).

Size
50.8 × 24.8 mm
Copper layers
2
Thickness
1.6 mm
Parts
3
Nets
41
Pads
82
Tracks, vias
136, 0
Pours
1
Routed
Yes
KiCad
KiCad 8.0 (file 20240108)
Created
15 Jul 2024
Updated
13 Dec 2024

Overview

LaptopLCDAdapter is an open-source printed circuit board by BornaBiro, from the BornaBiro/Laptop-LCD-STM32 repository on GitHub. It is a 2-layer board of 50.8 × 24.8 mm with 3 parts on 41 nets, routed with 136 tracks and 0 vias.

It is built around the BM40B-SRDS-G-TF.

Main components

1

README

README.md

Laptop-LCD-STM32

My little experiment trying to reuse old laptop LCD for some STM32 project.

 

NOTE before proceeding!

This is just an experiment and that being said, use it on your own risk! I'm not guilty if you set your house on fire, hurt yourself (or someone else) or something like that.

About the project

The main purpose of this project is to try to reuse old laptop LCD and drive it with STM32. The main reason behind this is to prove that reusing old LCD is not impossible nor it's complicated.

Structure

  • Docs - All documentation about this project
  • FPGA - FPGA project code (used to convert RGB666/RGB565 into LVDS, more on that later)
  • Hardware - Hardware related stuff (PCBs, Schematics, etc)
  • STM32 - Code for Nucleo-H743ZI2 board
  • extras - All other stuff that are not strictly code related (images, notes etc)

Docs

Self explanatory, documentation of this project. Need to add more stuff when I edit them.

FPGA

All project files for the FPGA IDE. FPGA used in this project is ULX3S board. Board is based around Lattice ECP5 Series, LFE5U-12F-6BG381C. Used Toolchain is Lattice Diamond with Lattice LSE as main Synthesis tool. Used verion of the Lattice Diamond is 3.13. FPGA is not strictly neccessery here, everything can be replaced by one of these ICs DS90C387, DS90CF388, DS90C385A or simmilar. But be careful on how to connect each RGB line of these ICs to the STM32. Follow LCD specifications on how bits are arranged inside the LVDS timeframe, not only the RGB to the LVDS IC datasheet! Main reason why I used FPGA instead of these dedicated ICs is flexibility - I can experiment with the pinout, I don't have to wait IC to arrive and I will learn something new while working with the FPGA. The whole FPGA code is written in Verilog.

Hardware

For now, there is only KiCAD files for the custom LCD breakout board to be able to use original LCD cable for the laptop. I connector is salvaged from the laptop (removed from the laptop motherboard, it's not a easy job, I will say that) and soldered back again on my DIY PCB (I made this PCB using the toner transfer method). Connector seems to be BM40B-SRDS-G-TF but I'm not 100% sure. I was using KiCAD v8.0.

STM32

STM32 is generating RGB565 signals for the LCD by using it's LTDC driver for color LCDs. Essentially, these RGB (LTDC) are encapsulated in LVDS. So LCD is actually getting RGB data signals. Main clock for this LCD is 50-70MHz. I choose 55MHz since everything above gives bad image quality due to absolutelly not ideal setup (just a note that main pixel clock is multiplied by the FPGA PLL 7 times to get one LVDS data line bit timeframe - 385MHz!). STM32 does not have enough memory for it to store whole LCD content - framebuffer. It's only displaying rectangle of 354*354 by using one of the LTDC layers. Why I chose this resolution - I have no idea. By making custom board, SDRAM can be attached to the STM32 where whole frame buffer can be stored and in that case, some graphical engine can be added (LVGL comes to my mind as well as Adafruit GFX). STM32 code is written in STM32CubeIDE and images are generated by the LCD image converter, RGB565 preset, 16bit packing. Note that STM32 LTDC has it's limitations on max pixel clock (75MHz in this case) and these LCDs have minimal pixel clock (in this case 50 MHz).

LCD

Yep, the star of the show! My LCD has a part number B154EW02-V2 by AUO. It's from old HP 6735b laptop. It's resolution is 1280x800, with 18 bit color? You can find datasheet on the web, but if needed, I can publish it here. Main issues were:

  • LCD Connector pinout (easy, datasheet) and LCD cable pinout (harder, reverse eng.)
  • LCD inverter pinout - yes, this is old-school LCD with CCFL and inverter is needed. Luckly, I have an original LCD inverter from the laptop, again pinout is missing. Little bit more reverse eng. and the pinout and working principle are known. I will post pinout for both LCD cable and LCD inverter as soon as possible. NOTE: LCD inverters are working with very high voltages >5kV, this can shock you or burn you! Be aware!
  • LCD bit arrangement inside LVDS time-frames - Again datasheet is your friend. If the datasheet is missing and LCD uses only 3 LVDS lines, can only be one of two standards; VESA and JEDIA (see potato image below that I found on the web). My LCD uses 6 bit color VESA standard. Trial and error method is your friend.

 

Known issues

  • Random green and red pixels - Due bad FPGA input voltage standards. It should use LVCMOS3V3 for all RGB input, but due my bad pinout arragment, this is not possible for all pins, so all pins are switshed to the LVCMOS2V5 and that causes some noise that traslates into wrong pixels being light up. For the green, this can be reduced to some exted by using 330R pull-down on MSB on the green color. I need to do this better.
  • Image full of noise and jitter - Switch STM32 to use XTAL as reference clock for the PLL for the LTDC. For some reason, HSI and MSI are very noisy and PLL inside FPGA amplify that noise and jitter and we get very unstable image on the screen. Using HSE at reference source for the STM32 PLL fixed the issue.
  • No full frame buffer - this one is not easy to fix, custom STM32 board with fast SDRAM is needed, maybe I make one.

How to reuse this on my LCD?

First, you need to find the resolution of your LCD. This should be easy. This is important to be able to calculate pixel clock. W * H * frameRate ~ Pixel Clock. In this case: 1280 * 800 * 50Hz = 51.2MHz. This is only rugh estimation, pixel clock is little bit higher due vertical and horizontal blanking intervals. Next, you need to find out the pinout for the LCD. In fact, the best thing is to get the datasheet of the LCD. There are two ways for this; google the part number of the LCD or open LCD and try to find the datasheet of the LCD controller. BUT be careful not to damage the LCD!

Now when you have the pinout, you need to connect the LCD to the FPGA or somekind of breakout board. I salvaged original LCD cable from the laptop and the connector from the laptop motherborad (hint - if you don't want to melt the connector while unsoldering, heat the board from the opposite side of the conncetor). I made a custom PCB [blocked] as a adapter for the cable in KiCad and made PCB at home.

 

Now you need to find out the pinout of the cable itself. By using multimeter and continuity function, put one probe on the LCD side of the connector and other one at the PCB adapter. Go one-by-one pin at the custom board until you hear the beep. You don't need go though all this trouble, you can just buy a LCD connector and solder the wires on it, or just a cut original LCD cable (motherboard side of course). But I wanted to make it the "right way".

Using exactly this LCD and this repo.

  1. Get the ULX3S board
  2. Get the Nucleo-H743ZI2 board
  3. Get the Lattice Diamond and install it
  4. Get the STM32CubeIDE and STM32H7 firmware package and install it both
  5. Sythesis the Verilog code and upload the .bit file to the UXL3S board. I used fujiprog. For Win machine I needed to install FTDI Drivers and Zadig (follow this for more info).
  6. Build and upload code to the STM32 board.
  7. Connect everything using this diagram
  8. Power everything up. With a little luck, there should not be any smoke, but instead image will be shown on the screen.

All diagrams (txt) for the LCD can be found here.

Power supply: You can use USB on STM32 and ULX3S boards for the supply, only LCD Inverter (backlight) is using 9V-12V, BUT EN and DRBT pins of the LCD inverter are 3V3!

I have a XY LCD, can you write the code for me?

Nope. I think that I gave you enough info to get you started. If I missed something, please let me know, I will try my best to fill in the gaps.

To-DO

  • Use graphics instead of the txt files for connections
  • Better LVDS module for FPGA
  • Custom STM32 PCB with SDRAM and dedicated RGB -> LVDS IC
  • Change the name of the FPGA project to something different than "blink" 🤦

Parts

3
QtyValueFootprintReferences
2CONN_1x20Borna KiCAD Library:CONN1X20CONN2, CONN3
1BM40B-SRDS-G-TFBorna KiCAD Library:BM40B-SRDS-G-TFCONN1

Similar boards

  • 2 layers40 × 30 mmBlinky, the printed circuit board in 3D

    Blinky

    earthtojake/text-to-cad

    Design physical products with AI

    3 parts26kMIT
  • 2 layers51.9 × 16 mmPassive2-rpi non standard adapter, the printed circuit board in 3D

    Passive2-rpi non standard adapter

    hzeller/rpi-rgb-led-matrix

    Controlling up to three chains of 64x64, 32x32, 16x32 or similar RGB LED displays using Raspberry Pi GPIO

    3 parts4.4kGPL-2.0
  • 2 layers16.3 × 16.3 mmSensor, the printed circuit board in 3D

    Sensor

    scottbez1/splitflap

    DIY split-flap display

    3 parts4.2k
  • 2 layersSub, the printed circuit board in 3D

    Sub

    atopile/atopile

    Design circuit boards with code! ✨ Get software-like design reuse 🚀, validation, version control and collaboration in hardware; starting with electronics ⚡️

    3 parts4kMIT
  • 2 layers85 × 30 mmDual stomp, the printed circuit board in 3D

    Dual stomp

    torvalds/GuitarPedal

    Linus learns analog circuits

    3 parts2.5kGPL-2.0
  • 2 layers124.5 × 33.7 mm172319-1 connector, the printed circuit board in 3D

    172319-1 connector

    rusefi/rusefi

    rusefi - GPL internal combustion engine control unit

    3 parts1.2k
  • 2 layers10.5 × 83 mmProgrammingAdapter, the printed circuit board in 3D

    ProgrammingAdapter

    stuartpittaway/diyBMSv4

    Version 4 of the diyBMS

    3 parts1.1k
  • 2 layers21.2 × 51.3 mmPico reset, the printed circuit board in 3D

    Pico reset

    hackclub/sprig

    🍃 Learn to code by making games in a JavaScript web-based game editor.

    3 parts1.1kMIT

Questions

How big is the LaptopLCDAdapter PCB?

It measures 50.8 × 24.8 mm and has 2 copper layers, 1.6 mm thick.

What parts does the LaptopLCDAdapter use?

3 parts, built around the BM40B-SRDS-G-TF. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the LaptopLCDAdapter KiCad files?

From the BornaBiro/Laptop-LCD-STM32 repository on GitHub, at the commit this page was made from: the board is Hardware/LaptopLCDAdapter/LaptopLCDAdapter.kicad_pcb and its schematic Hardware/LaptopLCDAdapter/LaptopLCDAdapter.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the LaptopLCDAdapter design in my own project?

Its repository states no licence, so its author keeps all rights: ask BornaBiro before reusing the design.