Close
0%
0%

MK-52 Resurrect

A Programmable Calculator from the USSR!

Public Chat
Similar projects worth following
The purpose of this project is to replant ESP-32 brains into a long-dead (and not easily fixable) Soviet-era programmable calculator MK-52.

The body in my graveyard was born in April 1991 and had rested in peace (RIP) since about 2010, after its wonderful lime-on-green vacuum fluorescent display was busted. Apparently these parts are still available... but looking for them is a pain, soldering one in is not much of a challenge, and the calculator itself is a bit dated.

The decision was to frankenstein the MK-52 body with ESP-32 for a brain and an ILI-9341 240x320 TFT screen for a display - both fit almost natively into the original plastic shell. The keyboard parts are being reused. The machine will not be an exact replica of the original MK-52, but rather a programmer fantasy of what the MK-52 could have been if there were no hardware limitations.

The brief explanation can be found at:  https://en.wikipedia.org/wiki/Elektronika_MK-52

Yes, the machine was not functional and repair questionable! I have preserved the original board rested in pieces (RIP) - if someone interested.

The machine can execute the standard MK-52 / MK-61 code, except for the "undocumented features" [ЕГГОГологии](https://ru.wikipedia.org/wiki/%D0%95%D0%B3%D0%B3%D0%BE%D0%B3%D0%BE%D0%BB%D0%BE%D0%B3%D0%B8%D1%8F)

The technical solutions will be used in more ambitious [Retro Calculator project] (https://github.com/ptravnik/Retro_CALC) with Terminal BASIC.

The software development path is as following:

1. Build quick, but fully functional prototype on C# without any hardware considerations, but with extensive automated testing capability. Document in Wiki as you go.
2. With Visual Studio, convert base classes into C++ for porting into ESP32. Update documentation in Wiki as you go.
3. Develop the hardware drivers on ESP-32 and test the actual hardware.
4. Port C++ classes and release ESP-32 solution.
5. Release the simulator if someone interested.
6. ???
7. PROFIT (have fun)

MK52_Resurrect.zip

Simulator install size: 743613b MD5 checksum: A0E2C9F95DFE61EEB887E09D6F79463E

x-zip-compressed - 726.18 kB - 02/21/2021 at 06:03

Download

MK52_Electronics.sch

KiCAD Schematics

sch - 14.14 kB - 01/22/2021 at 12:53

See BOM
Download

lib - 7.28 kB - 01/22/2021 at 12:53

Download

pro - 688.00 bytes - 01/22/2021 at 12:53

Download

  • 34 × 6-mm tactile switches To replace the original domes (1 switch for extra power button is optional)
  • 2 × 2N7000 Discrete Semiconductors / Diode-Transistor Modules
  • 1 × BS250 Discrete Semiconductors / Diode-Transistor Modules
  • 3 × Resistor 430R
  • 1 × Resistor 4.7M

View all 19 components

  • Speed test

    ptrav3 days ago 0 comments

    This is the "classic" MK-52 speed test adapted from Dr.Shelest book.

    On the actual ESP32 hardware, it executes about 175 times faster. Actually, the processor speed is even faster, but the Resurrect updates the screen and checks for the STOP button 3 times per second, so 60% of the time it is busy sending pixels via SPI.

    P0000: # TRIPLE SUMMATION LOOP
    P0001: # A.E.Shelest, "Programmable Calculators in Physics", p. 27.
    P0002: # On the original MK-52, this program took 35 minutes
    P0003: # ESP32 computes the same in under 12 seconds (x175 the speed)
    P0004: Cx
    P0005: X->M 9
    P0100: 7
    P0101: X->M L0
    P0102: 8
    P0103: X->M L1
    P0104: 9
    P0105: X->M L2
    P0106: M->X L0
    P0107: M->X L1
    P0108: X^2
    P0109: *
    P0110: M->X L2
    P0111: SIN
    P0112: *
    P0113: M->X 9
    P0114: +
    P0115: X->M 9
    P0116: WHILE L2>0 GOTO 106
    P0117: WHILE L1>0 GOTO 104
    P0118: WHILE L0>0 GOTO 102
    P0119: STOP
    P0120: GOTO 2
    

  • Simulator Install

    ptrav4 days ago 0 comments

    The simulator is fully operational, apart of the file Load and Save. The Alpha is available here:

    https://github.com/myak555/MK-52_Resurrect/tree/main/Install

    To install on Windows 7 or above:

    • Download MK52_Simulator.zip and unpack to any convenient location.
    • Navigate to the folder.
    • Right-click on the MK52_Setup.msi file and select "Install".
    • Follow the Wizard as below.

    To install on Windows XP:

    • Download MK52_Simulator.zip and unpack to any convenient location.
    • Navigate to the folder.
    • Right-click on the setup.exe file and select "Run as an administrator".
    • Enter admin credentials.
    • Follow the Wizard as below.

    To install on Linux under Wine:

    • Make sure Wine is installed. The instructions are here.
    • Download MK52_Simulator.tar and unpack to any convenient location.
    • Navigate to the folder.
    • Right-click on the setup.exe and select "Open with Wine Windows Program Loader".
    • Follow the Wizard as below.
    • Right-click on ~/.local/share/applications/wine/MK-52.desktop and allow "Execute:" under Permissions tab
    • If desired, copy the MK-52.desktop file from the Wine location into the /usr/share/applications:
    sudo cp ~/.local/share/applications/wine/MK-52.desktop /usr/share/applications

    Installation wizard steps:


    At this point, Windows will dim the screen and ask to confirm the install.

  • MK-52 is fully functional

    ptrav02/14/2021 at 12:24 0 comments

    Now the calculator can  enter programs, store them to SD card and read them back. Basically, everything works as planned. The English wiki docs is are about 33% cooked here:  https://github.com/myak555/MK-52_Resurrect/wiki/6.-AUTO-Mode.-Manual-Calculations./_edit

    I have started using the monster as my primary calculator. Based on the experience, some refinements may be needed. In particular, an automatic switch-off after a period of inactivity is a must. Also, it would be nice to allow a WiFi connectivity. I will build a laundry list and then do yet another coding session.

    The next big item is to make a full copy of the ESP32 into the C# emulator and release a Windows installer. Now the display is a pixel-to-pixel match:

    Programming editor:

    This is a test screen with all 255 symbols shown:

  • It's Alive!

    ptrav02/07/2021 at 09:37 0 comments

    -- Fully implemented all file functions, including program load and save.

    -- Run/pause is working

    All functions of the original MK-52 are defined:
    [#]  - Comment (equivalent of NOP)
    [DEG] - Degree mode
    [RAD] - Radian mode
    [GRD] - Degree mode
    [/-/] - Negate
    [Enter] - Push stack
    [X<->Y]  - Swap X and Y
    [+]  [-]  [*]  [/]
    [Cx] - Clear X
    [SIN]  [ArcSIN]
    [COS] [ArcCOS]
    [TG] [ArcTG]
    [EXP]
    [10^x]
    [LG]
    [LN]
    [X^Y]
    [LOG]
    [Rotate] - Rotate stack
    [X^2]
    [1/X]
    [SQRT]
    [pi] [e]
    [Bx]
    [RAND] [SEED]
    [[X]] - Whole part
    [{X}] - Fractional par
    [MAX] Max of X and Y
    [|X|] - Absolute value
    [SIGN] - Sign
    [AND] [OR] [XOR] [NOT]
    [DEG->DM] [DEG->DMS] [DM->DEG] [DMS->DEG]
    [DEG->RAD] [RAD->DEG]
    [mm->in] [in->mm]
    [M->X ] [X->M ] [K M->X ] [K X->M ] [A M->X ] [A X->M ]
    [GOTO ]
    [GOSUB ]
    [RETURN]
    [MEMSET ] [MEMSWP ]
    [ExToX ] [XToEx ] [ExToR ] [RToEx ] [MexCx]
    [STOP]
    [MKDIR ] [SAVE AS ] [LOAD ] [CHAIN ] [SAVE DATA AS ] [LOADDATA ]
    [GOMEM ]

    [IFNOT X<0 GOTO ]
    [IFNOT X=0 GOTO ]
    [IFNOT X>=0 GOTO ]
    [IFNOT X!=0 GOTO ]
    [IFNOT X<Y GOTO ]
    [IFNOT X=Y GOTO ]
    [IFNOT X>=Y GOTO ]
    [IFNOT X!=Y GOTO ]
    [WHILE L0>0 GOTO ]
    [WHILE L1>0 GOTO ]
    [WHILE L2>0 GOTO ]
    [WHILE L3>0 GOTO ]

    The remaining item is to finalize the program editor.

  • All RPN Fuctions Implemented

    ptrav01/31/2021 at 06:51 0 comments

    The AUTO mode (RPN Calculator) is fully implemented, with all math functions verified and operational. The calculator switches between AUTO, PROG, FILE and DATA modes. It stores data into and recalls data from the registers and the extended memory.

    The full list is here:

    https://github.com/myak555/MK-52_Resurrect/wiki/Appendix-1.-LIST-OF-FUNCTIONS

    DATA Mode is also complete. The user can edit all entries and post the data into the RPN stack:

    FILE Mode is working partially: the user can traverse the directory structure, create and delete directories. File loading and saving are not yet implemented - after this is done, the MK-52 will become an "operating system"!

    The PROG Mode is still a stub, but can execute a step-by-step operations with STEP (ПП) button.

    The next item is to store and load files and save the calculator state for "instant on".

  • RPN Running on ESP32

    ptrav01/22/2021 at 12:51 0 comments

    The keyboard and ESP32 have been assembled, apart from the power transistors (still missing one BS250)

    The wiring diagrams in KiCAD are posted here: https://github.com/myak555/MK-52_Resurrect/tree/main/MK52_Electronics



    The  C++ software on ESP32 currently can does 4 arithmetic operations, Swap, Enter, negation and SIN (the rest of engineering functions is coming tomorrow): https://github.com/myak555/MK-52_Resurrect

    The calculator supports Python-style typing logic: if the number is entered as integer, the logic tries to keep it as integer in the range from -9,000,000,000,000,000,000 to +9,000,000,000,000,000,000. Outside of this range, the number changes to a double-precision float between approximately -1e+300 and +1e+300. Plus and minus infinity are also supported. In the range from -1 to 1, 12 decimal points are guaranteed, with the exponent down to -300. For each computation, the calculator attempts to convert the result back to an integer. For example division 2/3 gives 0.666666666666.  Multiplication by 6 gives back 4 (as an integer). A SIN(90) in Degree mode is 1 (an integer), ArcTAN(-Infinity) = -90 (an integer), and so on. 

    The next major step is to finalize the extended memory and registers simulation. The original MK-52 had only 15 memory slots (each holding one floating point number). HP35S has 26 memory slots, but each can contain a vector. The Resurrect will have 4,000 64-bit numbers.

  • Emulator Running

    ptrav01/16/2021 at 22:59 0 comments

    The initial code for the emulator has been completed. The 320x240 TFT screen is emulated, identical to the hardware. Full AUTO mode is working, as well as a step-by-step program execution (with ПП). The Start/Pause (С/П) button is disconnected for now.

    In AUTO mode, the program performs all RPN functions, all functions marked with yellow letters (activated with F), and all functions marked with blue letters (activated with K). The calculator emulates "switching off" with A-Cx and "switching on" with Cx. Programs can be loaded with Program menu (the file manager on TFT screen is not yet done). Trigonometric modes can be changed with ↑↓ key between Degrees, Radian, and Grads.

    Note that buttons A↑ and ↑↓ have been swapped for aesthetic / logical reasons - this also will be done in hardware.  

    Now the plan is to port the AUTO mode into ESP32.

View all 7 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates