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


Monday, 7 January 2019

Making Ruideng DPH5005 power supply case fan silent

I use Ruideng DPH5005 as a bench power supply and it is quite good for what I need, the only problem I have with it - 5V high speed fan of the original power supply case which runs always, regardless of load/temperature, making a lot of noise.

DPH5005 board has it's own small fan which kicks in only when power supply is overloaded, so probably I could disconnect the case fan completely or connect it to the heatsink fan, but I find no fun in doing so.

There are a couple of suggestions on the Internet how to deal with the noise of the fan - connect it in series of diodes to lover running voltage or to use Normally Open bi-metal thermal switch to turn on the fan at about +45 C.

I liked the latter, but decided to combine it with the first one to limit the driving voltage with a diode. And I had a nice and proven project for that: Madis Kaal tiny_pwm for ATtimy85 microcontroller.
Using pure PWM did not work with this fan - to run the fan stable at the lower speed I had to use quite low PWM frequency with clock divider 128, which was creating extra noise, diminishing the purpose of the project.

As power supply provides 5V, we can use bump-on-the-wire approach to control the fan. Modified schematics looks like this:

Sunday, 7 October 2018

Making Bose QC 25 USB friendly

I've been using Bose QuietComfort 25 for a couple of years now. They are great for watching movies on long transatlantic flights, but their miniature on-the-wire microphone and 3mm audio jack makes them unusable for long transatlantic Skype calls. Adding USB capability sounded like a good idea, and it wasn't hard at all with my new Prusa i3 MK3 printer.

For Skype I've been using Plantronics 626 for almost 8 years and finally ear pads started to disintegrate. Instead of soursing a new ear pards for this discontinued headset I decided to used Bose QC 25 as a replacement :)

First make a model in blender3d:


 Then print:

Making black visible on black

Yesterday I tried to print using black PLA on Prusa i3 MK3 and found that black PLA on black PEI is very hard to see :) But just a week ago I got my UV LED flashlight and it did the trick - turned black PEI heatbed coating to greenish and black PLA to blueish colour:


So no problems to control the first layer :)