Sunday, March 15, 2015

Some other lesson learnt...

After many years fiddling with Arduino, I found (or at least remembered) that "unconnected input pins float randomly between HIGH and LOW state". Thus this rig - and the accompanying sketch "assert a pin and watch if any of other 23 change" - was dismantled because useless (I didn't want to solder 24 pulldown resistors)...


...and then, while writing this blog page, I remembered the INPUT_PULLUP thing. I had to rewrite the sketch as "watch a pullup pin while writing LOW on some of the other 23".

Till today, I was ready to bet that a 24-pin interface for a keyboard had to be some row/column fitting. For example, one row-select pin, six row pins, one column-select pin, 16 column pins. The shown keyboard (a K9405076 produced in 1996) physically has:
- 17 keys on first row
- 14 on second
- 15 on third
- 14 on fourth
- 14 on fifth
- 12 on sixth
for a grand total of 86 keys. The extra physical key on the first row is easily reportable as being part of the second row. I guessed that to read a key, the BIOS scanned every column (write a logical "true" on one, watch for any "row" changed, identify the key combination in a matrix). I only had to figure out the pin numbers (any pin could be row, column or select).

My first attempt was wrong because on the Arduino an "unconnected" input pin floats randomly between high/low states, and the only available Arduino feature for unconnected pins is the INPUT_PULLUP thing. So I had to give a try with a different schema: "for every keyboard pin, set everything Low and check if an High appears somewhere" to identify the column-select or row-select (the former would react on more than six keys). I connected the 24 keyboard pins to the area containing Arduino Mega digital I/O ports from 22 to 51, and started this:
//
//      keytest.ino -- 24 pin keyboard test

void scan()
{
  int n, i;
  for(n=22; n<52; n++)
  {
    for(i=22; i<52; i++)               // set everything low
    {
      pinMode(i, OUTPUT);
      digitalWrite(i, LOW);
    }

    pinMode(n, INPUT_PULLUP);          // examine pin n: "unconnected" --> HIGH
    digitalWrite(n, HIGH);             // enable internal pullup

    if(digitalRead(n)==HIGH) continue; // just ignore unconnected pins

    Serial.print(n);                   // pin n is connected somewhere: announce it
    Serial.print(": ");

    for(i=22; i<52 && i!=n; i++)       // for any remaining output pin:
    {
      digitalWrite(i, HIGH);           // examined pin goes from LOW to HIGH ?
      if(digitalRead(n)==LOW) continue;

      Serial.print(i);                 // yes: announce the connection
      Serial.print(" ");
      digitalWrite(i, LOW);            // set to LOW again to continue checking
    }

    Serial.println();
  }
}


void setup()
{
  Serial.begin(115200);
}


void loop()
{
  scan();
}

I expected it output some numbers when pressing some keys. Alas, on many keys nothing happens, while a few keys (most notably on the right side) only show some pin numbers when pressed in combination of two or three, suggesting that row-select and column-select are the first two keyboard pins starting from keyboard center (the ones with longest vias). I'm currently stuck because I cannot understand if:

  • (1) my FPC to 0.1" adapter thing does not work correctly,
  • or (2) the keyboard is actually broken, maybe in the connector area,
  • or (3) the scheme requires more than a single row-select pin and a single column-select pin.
So I checked again and again the FPC-side connection and tested my adapter - everything is OK.

And then I finally tested the FPC connector keyboard. I wasn't able to verify a single key - this still does not add useful information. I will clean the connector and test again.

Cheap chinese keyboards come for less than five bucks - but, hey!, this project is meant to use the spare parts: buying a thing to replace a non-broken spare part is unacceptable...

Friday, March 13, 2015

Every time you start a project, someone did it better than you two or three years before

While I was drawing a plan like this one for my Emma interpreter/environment:
I stumbled upon the Bitlash project: an interpreted language only requiring some 16 kb code space, useful with as low as 512 bytes RAM, specifically tailored for Arduino hardware.

Just gitcloned it, I'm somewhat curious to see how much ideas I can get for my Emma - or even substitute it with Bitlash (while I would like to use anyway at least a large percentage of the 124k code space of the Arduino Mega).

Thursday, March 12, 2015

A small update

Any personal project starts enthusiastically but in a few days "something happens" and the enthusiasm level goes somewhat down. Geez, in five days I only soldered (in a hurry) the connector thing:


Sometimes I think that one of the most unheard life lessons is how to transform the "short-lived peak enthusiasm" graph into a "decent, constant and non-decreasing" one. Like the MPPT chargers and their wizardry to convert many-volts-few-milliamperes into many milliamperes.

I started this blog only to reminder myself what I am doing, what I've done, how many days passed since last interesting update. I bet geniuses are many more than we could guess - but 95% of them does not end a good project, or does not have time to decently publish it. Thus I started a blog to tell myself "go on!".

I've been featured on Hackaday - only once, and this is my biggest shame. A few days ago I was asked for a CV by a large firm (first time in many years: my DNA is a freelancer type) and I found that I am still unable to fill it with a "portfolio" section of completed projects to show my creativity.

Once again, this morning I decided that Cyprida project must go on. Its main objective is recycling some of my spare parts and telling my friends "When Men Were Men, They Built Their Own Computer, Language and Operating System".

Friday, March 6, 2015

Today's lesson: never underestimate the spare parts drawer

That old and slightly damaged notebook keyboard required a 1mm 24 pin FPC connector. I bought a DIP one (that is: two rows, 12 pins each, pins are 1mm-spaced; the second row has a 1mm offset) for easier soldering.

In my spare parts drawer I just found a 11-pin female-to-female 2mm spare cable (apparently cannibalized from a logic board of a VHS player bought some 30 years ago). I cut it and now have two 11-pin female jumpers: now I only need to solder two pins.
Just placed there to shoot a photo. I'll have to glue or tape them.
Never underestimate the spare parts drawer. But a couple minutes extra on the parts supplier website could have solved even better the "1mm to 1/10inch dilemma".

Anyway, this fits in the "building a portable computer using mostly spare parts" philosophy. Can't wait to get the keyboard up and running...

Thursday, March 5, 2015

A case for Cyprida

A dremelable black case for Cyprida, sufficient to accommodate the keyboard and the display on the largest side. I didn't even test the keyboard yet:


And also a DIP female connector for the 1mm flexible circuit of the keyboard. It will need a bit of work to "convert" those 2mm-spaced pins to a 0.1" pitch connector for the Arduino, but these FPC connectors were the nearest useable thing available (1mm to 0.1" pitch changer boards actually exist, but I would have had to wait 4-6 weeks for shipping; this came instead in 3 days):


Ordered on Monday, I got everything in Thursday morning: three days overseas shipping. Man, I will surely buy again stuff on Mouser.


Saturday, February 28, 2015

"Cyprida 2" already in the works?

While working on the Cyprida project I think about possible enhancements.

While searching for a retroilluminated 4x40 text LCD display I found this one on Futurlec ($44.90, ouch!): apparently its page has an error in the Interface Pin Connections because it only lists a single "E" (enable) pin, while a 4x40 LCD needs two (namely "E1" for the upper 2 lines, and "E2" for the lower 2 lines). And it does not say if the internal font is the Euro/USA one or the Japanese one:


So I started searching for a 320x200 display (320x200 is 64000 pixels with 16:10 aspect ratio), which I consider more interesting than a 320x240 display (76800 pixels and a 4:3 aspect ratio).

Futurlec also has some fancy blue 320x240 graphic display but the price is far from being interesting ($119.90); its controller accepts Seiko SED1335 commands, vaguely resembling Hitachi HD44780 ones, but with more operations about graphics and overlays. Apparently it does not have simple operations like "draw pixel, draw diagonal line", which need to be implemented in the Arduino (at a higher cost). This is because those displays were intended for monitoring data, not for experimenting with graphics or emulating home computers...


Spanish supplier of the Shenzen Topway has a nice 320x200 "green on black" monochrome graphic display. Sadly I can't find the commands list - I guess it is a SED1335-type. No pricing information available (grunt!).


It also features a nice "black on yellow" 4x40 text LCD display:


A very nice 5.7" 320x240 64k-color display is available as well, with a complete firmware (functions like "draw pixel", "draw line", "fill circle" and so on) and even a RS232 port for commands. It would be great to have it on my future "Cyprida 2" project. I am only unable to figure out a price...


Friday, February 27, 2015

Browsing components suppliers websites brings lots of ideas

I was searching Distrelec for a 4x40 LCD display (they don't have it, and their displays are quite expensive), and instead found this case:
I only need to apply something like it on Cyprida's 4x40 LCD display... which has a view area of about 154x28mm and a metallic black border of 173x48mm.

The above product has a 145x28mm window and is 161x40. Oops: too small! The biggest one available is 169x27mm, still too small.

But when I said "too small" i just had a look to my Dremel tool. I may cut my own cover to accomodate the 4x40 display.

I was also searching for some "notebook-sized" rigid plastic box. I found on Mouser this one that seems acceptable (not really on the cheap side) for my Cyprida project:
Its external size is 9.3" x 11.1" x 2.2", that is 236 x 281 x 56mm; I guess that the useful volume is 10mm less on every side. I did not choose a smaller one because I think I may accomodate one or two 5V batteries; I have two somewhat aged MobilePowerPack Li-Ion 5V batteries (USB-chargeable), 13 x 78 x 132mm.