How to connect a 12864 screen to a Troodon V2 Printer

Overview

The information here is aimed at connecting one of the following Mini 12864 Neopixel type displays.

Wiring

Connect EXP1 to EXP1 and EXP2 to EXP2.

Board.txt modifications

Add the following lines to the board.txt file

//MINI 12864
lcd.encoderPinA=BTN_EN1
lcd.encoderPinB=BTN_EN2
lcd.encoderPinSw=BTN_ENC
lcd.lcdCSPin=LCD_EN
lcd.lcdDCPin=LCD_RS
lcd.spiChannel=1
//lcd.lcdBeepPin=NoPin

Config.g

Add the following line to the end of your config.g

M98 P"screen.g"

Add a file in your sys folder called screen.g and add the following contents

; ST7567 Init for Mini12864 Panel

; Configure Neopixel
M950 E0 C"LCD_D5" 
; Turn off backlight
M150 K0 R0 U0 B0 S3 F0
; Configure reset pin
M950 P1 C"LCD_D4" 
; hardware reset of LCD
M42 P1 S0
G4 P500
M42 P1 S1
; Turn display on
M918 P2 C30 F1000000 E4
; Fade in backlight
while iterations < 256
    M150 K0 R255 U255 B255 P{iterations} S1 F0
    G4 P20
; flash Button 3 times
while iterations < 3
    M150 K0 R255 U255 B255 P255 S1 F1
    M150 K0 R0 U255 B0 P255 S2 F0
    G4 P250
    M150 K0 R255 U255 B255 P255 S1 F1
    M150 K0 R0 U255 B0 P0 S2 F0
    G4 P250
; Display "ready" button state  
M150 K0 R255 U255 B255 P255 S1 F1
M150 K0 R255 U0 B0 P255 S2 F0

Menu files must be uploaded to allow the display to generate the correct information. This can be done in two ways. First, obtain the recommended menu files from here

Method 1 - WiFi Mode only

Extract the contents of the zip file you downloaded above and place them in a folder called “Menu” on the SD card of the Troodon V2 Printer.

Method 2

Activate the display using the config.g changes above.
On the “System” tab, above the list of files, is a dropdown menu that defaults to “System Directory”. Select this and change it to “Menu Directory”.

Dropdown Menu
Dropdown Menu

Then upload the menu zip file.

Troubleshooting

If the screen is showing artifacts/random characters on the screen, the following may improve/eliminate the issue

  • Lower the SPI frequency by half. This is the F value in M918.
  • Reduce the length of the cable between the screen and the board.
  • Ensure that the cable between the screen and the board is routed away from other cables, especially motor cables.
  • Add a ferrite ring to the cable between the screen and the board.

Using the SD card slot on the screen

It is possible to use the external SD card.
To do so, add the following lines to your board.txt

sdCard.external.spiChannel=1
sdCard.external.csPin=LCD_SS
sdCard.external.cardDetectPin=LCD_CD
Tags: