Sunday, 6 June 2021

Making OLED Display for Elektronika MK-52

In the previous article I described how to scan Elektronika MK-52 (Электроника МК-52) VFD with STM32F108C8T6 and dump to serial port what is being displayed on the VFD. In the last couple of weekends I made some progress with 256x64 16 Grayscale SH1122 based OLED display which looks like a good fit for the original VFD replacement with respect to both dimensions and brightness:

This OLED uses 7 wires SPI interface and works quite stable up to 8MHz. There are a couple of non-essential problems though:

  • On-board DC-DC converter does not produce enough current to driver OLED when all pixels are on
  • When lowest gray color is used one half of the display looks a bit more dark, probably because 256x64 are actually two separate 128x64 drivers?

SH1122 controller support 16 shades of gray, which could be useful to animate the display when program is running. On the real VDF you can see some flashing digits when you start a program execution. On this OLED we can use gray color for flashing digits and white for solid ones.

There are a few tricks I used to make this OLED work:

  • SPI initialized used STM HAL, but then all writes are done using CMSIS for direct register access – works almost 3x times faster
  • Font is coded using 0x0F color, so with a simple mask it can be easily converted to any other color
  • Frame buffer size is 256x37 – just enough to store font full height and speed-up frame flushing over SPI

Shadow frame buffer stores symbols being displayed, so only changes are rendered

Putting everything together.

This is how OLED look like compare to VFD:

OLED is very bright, so even using gray level 0x07 it looks quite good behind the original MK-52 green filter:

Next step is to mount STM32 board, OLED display and isolating DC-DC to power them inside MK-52 body.

Projects's github got updated with OLED support.

P.S. Famous МК-52 ЕГГОГ:

Sunday, 23 May 2021

Making Elektronika MK-52 VFD scanner

One of my Elektronika MK-52 (Электроника МК-52) Soviet era micro calculators decided to show its age by turning off a couple of VFD positions. In this case the ‘minus’ sign and the first digit are almost invisible, so instead of ‘-123’ you can see only ‘  23’. I have a few spare VFDs and could just replace the faulty one, but that would be a bit boring. Plus, all spare ones I have are from Soviet era as well and there is no guarantee that they will last.

So I’ve decided to replace original VFD with something else, preferably some ready to use parts. Having a few STM32F103C8T6 boards laying around it was the obvious choice – use STM32 to scan VFD pins to read the values being displayed and send them to anything connected to the STM (to be yet decided).

MK-52 drives its VFD using -27V, so direct connection with STM is not possible. But simple resistive voltage divider works just fine. There is how I’ve connected VFD to the STM:

Note that only of VFD grid controls is connected, below I’ll explain why.

This is how VFD digits multiplexing works:

Saturday, 20 March 2021

Making XY-LPWM display serial port friendly

Popular PWM generator XY-LPWM has a small, but heavily packed LCD display:

driven by Holtek HT1621 LCD Controller, driven by Nuvoton N76E003 - 8051 based MCU.

This MCU runs on 16 MHz internal RC oscillator and provides 18 KB Flash ROM, 1 KB SRAM, 18 I/O pins supporting two UARTs, SPI , I2C, 6 channel PWM and high resolution 12-bit 8 channel ADC. Sounds very interesting to hack into.

Unfortunately out of box only Keil and IAR supported as development tools. But with Small Device C Compiler (SDCC) happily compiling for 8051 MCUs for years it can be fixed quite easily.

So here it is: Nuvoton N76E003 SDCC BSP.

With this BSP it is quite easy to make XY-LPWM display serial port friendly, just compile and upload xy-lpwm-lcd example, connect the board to UART at 38400 baud and type

 > lcd @0GoodByte