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 Installer. 1,246,469 bytes, MD5=8e932e311123dbe3887a6eb13bcf090b Instructions: https://github.com/myak555/MK-52_Resurrect/wiki/Appendix-5.-SIMULATOR-INSTALL

x-zip-compressed - 1.19 MB - 04/06/2021 at 07:28

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

  • Simulator: recording macros

    ptrav04/06/2021 at 07:38 0 comments

    Just added macro recording capability to the the Simulator:

    The green buttons at the bottom allow to record, temporary pause or execute macros in memory.

    The macro can be saved to disk or loaded from disk via Buttons menu.

    The "Copy X" is to copy the content of X-register into Windows buffer.

    The installer is available on Hackaday (see files) and also on GitHub

    The instructions are in Git Wiki

    The ESP32 code is also fully operational.

  • User Manual and Wiki

    ptrav03/20/2021 at 03:21 0 comments

    The original Russian manual has been translated.

    It came as two thick books, about 3x6 inches, 180 pages each - the book size allowed to bundle them under the calculator. The manual featured excellent content combined with terrible printing quality. For what I understand, the books were printed directly at the calculator factory in Kiev (Ukraine) using the East Germany's "Rotaprint" equipment. The book original was produced on a typewriter, with some manual drawings!

    Hopefully my translation features slightly better graphics:

    All programming examples are tested on both the Simulator and the actual ESP32 machine.

    The (almost) full text is featured at Github

  • MK-52 Goes to Chemistry Class

    ptrav03/07/2021 at 12:45 0 comments

    A simple program that was tricky on the original MK-52, but easy on the Resurrect:

    #
    # MK-52 program
    #
    PC=0000
    P0000: LBX> ENTER N.X:
    P0001: LBY> MOLAR WEIGHT:
    P0002: Cx
    P0003: Enter
    P0004: STOP
    P0005: X->M L0
    P0006: M->X L0
    P0007: -
    P0008: 100
    P0009: *
    P0010: K M->X L0
    P0011: *
    P0012: +
    P0013: Enter
    P0014: GOTO 0004
    #
    # MK-52 data
    #
    MC=0001
    M0001: 1.008
    M0002: 4.0026
    M0003: 6.94
    M0004: 9.0122
    M0005: 10.81
    M0006: 12.011
    M0007: 14.007
    M0008: 15.999
    M0009: 18.998
    M0010: 20.18
    M0011: 22.99
    M0012: 24.305
    M0013: 26.982
    M0014: 28.085
    M0015: 30.974
    M0016: 32.06
    M0017: 35.45
    M0018: 39.948
    #... and so on through the Periodic table 

    Start by pressing B/0, S/P, then enter the <element number>.<number of atoms in molecule>, S/P.

    For example, glucose (C6 H12 O6):

    B/0, S/P,

    6.06,S/P,

    1.12,S/P,

    8.06,S/P

    The same calculation manually (in the most efficient RPN way) looks like this:

    12.011 Enter

    15.999 +

    1.008 Enter

    2 * + 6 *,

    and each element weight (12.011, 15.999 and 1.008) has to be punched-in. With the program, obviously, still need to keep the Periodic table in hand, but no need to type the numbers with decimal places.

  • MK-52 goes to zee Moon

    ptrav03/05/2021 at 23:43 0 comments

    The simulator is fully tested, (still needs the keyboard macro function). Now it can save and load files!

    The installer is here: https://github.com/myak555/MK-52_Resurrect/tree/main/Install

    To test the compatibility, the old LUNOLET-1 (MOONFLY-1) game has been used:

    Those who can read the language, can see the original at http://epizodsspace.airbase.ru/bibl/tehnika_-_molodyoji/1985/6/put.html

    I probably do a shortened translation to English later. At this point, the story is about a ground technician at the Moon base in 2087, who by accident flew a tiny spacecraft (number 22, as above). The program can be loaded from https://github.com/myak555/MK-52_Resurrect/tree/main/MK-52_Sample_Programs/LUNOLET

    Note there are two programs: LUNOLET-1.MK52 - is the original from the magazine, LUNOLET-1B.MK52 is slightly modified to utilize the new screen with 4 lines of stack.

    Back in the day, the owners of B3-34, MK-54 and MK-61 had to enter the program every time the power was cycled. The program looked like this:

    The proud owners of MK-52 entered the program just once and then saved it in the memory module! So we pretend it has been entered (press A-ABT to enter FILE mode):

    Select the program name with ШГ-> and <-ШГ buttons and press П->X

    Here, just press F-ABT to return to the AUTO mode.

    After loading, press [B/0], [C/П]; and check/enter the parameters: Moon gravity, dry mass of the MOONFLY (including 2 people in space suits), specific impulse in m/s and the maximum g-force the pilot tolerates. According to the story, the technician did not qualify for a pilot because he blackouts at 3 g.

    Press [C/П] again and enter/verify the parameters: fuel mass, life support time, initial speed and altitude.

    Press [C/П] again, and now you are ready to fly. Each command consists of 2 or 3 inputs: first, enter the amount of fuel to burn, press [ПП], then enter the number of seconds for the burn. If reversed thrust is not needed, just press [C/П]. For the reversed, press [ПП], followed by [/-/][C/П].

    The first command was issued by the technician's son, "soon will be 12"! Entering 65, [ПП], 3 [C/П] gives us

    Hit [C/П] to "wake up".

    You've been in blackout for about 3.5 seconds.

    According to the story, the technician tried to land the thing. The full sequence of commands in the story:

    * 65 kg for 3 sec (blackout), v=+84 m/s, H=169 m (this command is already done)

    * 0 kg for 2 sec (the technician climbs into the chair), v=+80 m/s, H=334 m

    * 65 kg for 3 sec (blackout), v=+166 m/s, H=916 m

    * 0 kg for 120 sec, v=-28 m/s, H=9175 m

    * 25 kg for 2 sec, v=+5 m/s, H=9151 m

    * 10 kg for 10 sec (reversed thrust, use /-/), v=-26 m/s, H=9044 m

    * 25 kg for 5 sec, v=+3 m/s, H=8984 m

    * 0 kg for 90 sec, v=-143 m/s, H=2652 m

    * 100 kg for 3 sec (blackout), v=-31 m/s, H=2123 m

    * 10 kg for 20 sec, v=-49 m/s, H=1314 m

    * 10 kg for 15 sec, v=-57 m/s, H=515 m

    * 35 kg for 1.5 sec (blackout), v=-17 m/s, H=390 m

    * 22 kg for 22 sec, v=-17.5 m/s, H=13.5 m

    * 22 kg for 0.7 sec (blackout), v=-17 m/s, H=7 m (this was a panic press)

    * 22 kg for 0.7 sec (blackout), and:

    The MOONFLY ran out of fuel (press C/П), but still landed with some reasonable speed of 3.6 m/s:

  • Speed test

    ptrav02/22/2021 at 04:03 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

    ptrav02/21/2021 at 06:02 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.

View all 11 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