Arduino acting as keyboard that has a demultiplexer

I have a old typewriter which I want to automate with an Arduino. The way I am trying to do it is to replace its keyboard with the Arduino and make the Arduino emulate the keyboard i/o.

The keyboard of the typewriter is using this demultiplexer. So the original keyboard setup has:

  • 4 pins mainboard outputs > demultiplexer input
  • 8 pins demultiplexer output > switches > mainboard inputs

How I imagine that it works:

  • demultiplexer set to 0000 - current tries to go through 8 switches

  • mainboard checks the 8 inputs to see if it receives anything

  • if any of 8 inputs is received, mainboard registers a character for according row/col combination

  • demultiplexer set to 0001 - current tries to go through another 8 switches

  • mainboard checks the 8 inputs to see if it receives anything

  • if any of 8 inputs is received, mainboard registers a character for according row/col combination

  • demultiplexer set to 0010 - current tries to go through another 8 switches

  • mainboard checks the 8 inputs to see if it receives anything

  • if any of 8 inputs is received, mainboard registers a character for according row/col combination

  • demultiplexer set to 0011 - current tries to go through another 8 switches

  • mainboard checks the 8 inputs to see if it receives anything

  • if any of 8 inputs is received, mainboard registers a character for according row/col combination

  • etc

My plan so far:

  • remove the keyboard (so also the demultiplexer) completely

  • the "8-pins" demultiplexer output > switches > mainboard inputs

  • replace them with Arduino digital INPUT pins > mainboard inputs

  • the "4-pins" mainboard outputs > demultiplexer input

  • replace them with mainboard outputs > Arduino analog INPUT pins

  • constantly read data from 4-pins

  • depending on their value (0001, 0101, 1011, etc) I would know which row is being "scanned" currently

  • if I need to type a character from that row - I would set an appropriate pin from the 8-pins to OUTPUT LOW and turn it back to INPUT after some milisecons *[1]

Where I am stuck:

  • If the previous are correct, it would mean that at any time that I "ping" any pin from the 8-pins, it should type on random character
  • What happens is - it types specific 6 characters depending on which one from the 8-pins I "ping"
  • Extra note: I can set for how long to "ping" the 8-pin and I have tried different values down to 1ms which does not trigger anything

My questions:

  • The demultiplexer specs says that pins E0 and E1 should be LOW in order for demultiplexer to operate, I measured what mainboard sends there and its HIGH. So what's up with that?
  • I imagine that the mainboard expects one of the 4-pins to be changed when a switch is triggered, any opinions/suggestions on that?
  • Any other suggestions on what to investigate/try?

Notes:

[1] The 8-pins being set to INPUT as initial state and being set to OUTPUT LOW for triggering, because of what is mentioned here in second paragraph

I have asked the same question on Arduino Stack Exchange