CommonSense: matrix LCR meter with a HID interface

User avatar
Techno Trousers
100,000,000 actuations

31 Jul 2018, 07:51

5 wide by 4 high could make for a really sweet model F game pad.

User avatar
Sangdrax

01 Aug 2018, 01:19

So, I've been tooling around with the Kitprog convertor. Figured out dumb stuff I didn't realize like you have to use the Bootloader Host option in PSoC Creator under the Tools tab to load custom firmware on the kitprog. But got it built and loaded.

I'm using my ITW Sperry as a guinea pig. It runs on +5VDC and has 5 wires (what looks like the old power/ground and clock/data/reset). Got the first two figured out. Trying to figure out the last three. But I need to understand the kitprog pins first.

Default pinout in the kitprog lines up with the board silkscreen.

SDA is 12[1] (Data?)
SCL is 12[0] [Clock?]

Or these are supposed to be for I2C and you use SWDCLK for clock and RST for reset with RX for Data?

N_RX is 12[6] (regular RX on silkscreen, serial receive)
N_TX is 12[7] (regular TX on silkscreen, serial transmit)
RX is 12[2]
TX is 12[3]

Which receive and transmit pins are supposed to be connected to the keyboard?

Just trying to walk myself through this. I'm not a programmer in the least. Also, how are custom keymaps and layers and stuff done with the kitprog convertor? Flightcontroller?

User avatar
DMA

01 Aug 2018, 03:50

SDA/SCL is I2C slave, for cases where CS is the scanner (read: BLE). It outputs "p[USB scancode]" or "r[USB scancode]" for press and release.

N_TX/RX is negated UART (because sun keyboard is RS232 with negated levels). Used in sun converter.
TX/RX are normal UART. Not used.
P12.5 is ADB data for ADB converter.
But you don't have to use those pins. Rip away what you don't need from the TopDesign, create your own stuff.

Unfortunately if you're not a programmer it will be hard.

Keymaps, layers, macros - everything is done via FlightController. It's just the scanner that gets replaced - and matrix monitor no longer works (because nothing to output).

User avatar
Sangdrax

01 Aug 2018, 05:02

What I mean is if I have a a keyboard with RS232, how is that hooked up? Does it detect X-baud rate (I think default was 96K?) and start bits/stop bits/asynchronus, etc.? I don't mind fiddling with configuration files, just trying to wrap my head around the basic hardware connections.

What I particularly have outside the power/ground is 3 wires going to one of these. One to the 1A input and the other two from the 4W 4Y outputs. I figured the input was clock since it can be used as a clock generator chip and the outputs would be TX and something else. Though it has a LED locklight for caps so there should be two way communication to the board.

Or would it be Kitprog TX to 1A, RX to 4W or 4Y and some 3rd pin to to the remaining slot?

Image

User avatar
DMA

01 Aug 2018, 05:35

If you have a keyboard with RS232, you need first to make sure that this RS232 is 5V (not 12). Then you connect TX to RX, RX to TX, set baud rate either in properties of the UART component or by calling smth like UART.SetRate(), and then write a scan module which would do GetChar/PutChar needed to talk to your keyboard. Just having electrical connections right is not enough - you'll need to write actual protocol implementation.
See sun_scanner - sun keyboard needs to be told to reset on start, for example, and it replies with "I'm reset" - all of this needs to be handled.
Nothing super-special, but coding is required.

KitProg with default kitprog firmware is an USB-UART bridge, btw. 12.6/12.7
So you can talk to keyboard using it - but to make it talk to computer you'll need some more effort.

User avatar
DMA

01 Aug 2018, 07:11

update: Y = !W, so you don't need third wire. try 1A and 4Y. Y+W are there to create a differential pair - you don't need that.

User avatar
Sangdrax

01 Aug 2018, 23:43

Good news. The board talks to the convertor, even if it's just muddled release codes for like two keys with every press because it doesn't have the protocol implemented. Just nice to know the board works. The last owner had cut the cord so I never knew if something was actually toasted.

Not even sure how I would go about protocol stuff for this kind of proprietary thing. Looking at the sun scanner code, it seems like I need some of the hex codes for start and stop and release and such, and I don't know how I would get that kind of thing without a logic analyzer, unless they're always the same.

User avatar
DMA

02 Aug 2018, 03:45

Sangdrax wrote: Good news. The board talks to the convertor, even if it's just muddled release codes for like two keys with every press because it doesn't have the protocol implemented. Just nice to know the board works. The last owner had cut the cord so I never knew if something was actually toasted.
Good! There's "Bridge Control Panel" application that can be started from PSoC Creator menu. It works with kitprog and will allow you to see bytes as they come. You'll likely see some pattern in those codes. Like, "first byte is 1 or 0, second byte is scancode", or "high bit is "key released"", or like in ADB, 2 scancodes per packet.
Or, if you already programmed everything, put
xprintf("%d", code) after GetChar and "if (!code) return".
and program again. You will see codes in FlightController log window.
Sangdrax wrote: Not even sure how I would go about protocol stuff for this kind of proprietary thing. Looking at the sun scanner code, it seems like I need some of the hex codes for start and stop and release and such, and I don't know how I would get that kind of thing without a logic analyzer, unless they're always the same.
You just need to squint a little at the data that comes to you from the keyboard. Usually those protocols are very logical (unless it's fucking ADB).
Lighting LEDs can be a challenge. No one is going to hint you on what keyboard expects to hear from you.

So.. if the cord is cut anyway.. just rip out the controller and replace with CS. It will work for mechanical contacts, just set ADC resolution to 8 bits.

User avatar
Sangdrax

02 Aug 2018, 04:41

They're magvalve switches. Otherwise, I would have thrown in a teensy for contact or another cypress board for capsense. Capsense might actually work, I just didn't want to totally desolder and possibly break the board when I haven't seen anyone else convert them that way. They're built to be a current sense type of thing.

Also, a lot of the integrated circuits and discrete through hole components are under the plate and impossible to get at without desoldering the entire thing. And these switches are liable to crack and break the ceramic ring magnets if you don't do that just right. I trust myself to get it right 95% of the time, but that's still like 5 busted switches on a hundred switch board.

The Capslock LED actually seems to work on its own. Just not sure how it's supposed to sync. It seems to stay locked until you hit shift to unlock it even thought it's a momentary switch.

I'll try adding in the extra code to KitProg Convertor and seeing what the Flightcontroller log spits out. I remember Haata saying this kind of board had something odd like a 21bit proprietary serial protocol. But I guess weird stuff is par for the course with pre-XT boards.

Thanks again for all the help. All this functionality out of one piece of kit is something else.

User avatar
DMA

02 Aug 2018, 07:40

Sangdrax wrote: They're magvalve switches. Otherwise, I would have thrown in a teensy for contact or another cypress board for capsense. Capsense might actually work, I just didn't want to totally desolder and possibly break the board when I haven't seen anyone else convert them that way. They're built to be a current sense type of thing.
OIC. Converter it is then.
Sangdrax wrote: The Capslock LED actually seems to work on its own. Just not sure how it's supposed to sync. It seems to stay locked until you hit shift to unlock it even thought it's a momentary switch.
The controller is smart enough to maintain status. Prepare to see different scancodes for capital letters.
Sangdrax wrote: I'll try adding in the extra code to KitProg Convertor and seeing what the Flightcontroller log spits out. I remember Haata saying this kind of board had something odd like a 21bit proprietary serial protocol. But I guess weird stuff is par for the course with pre-XT boards.
Telegram @thedma, I can teach you some programming in realtime. You seem smart so not much teaching would be needed.

User avatar
DMA

04 Aug 2018, 05:04

Sangdrax, ExpToggle fix:
https://github.com/dmaone/CommonSense/c ... 7a8638e0d8

I just forgot to add ExpToggle handling in scancode processor.

User avatar
Sangdrax

04 Aug 2018, 13:19

It works! Now it turns on and off on the fly. One thing I noticed. The pins count columns forward instead of backwards now. I thought I had broke something when I first did the update. I think it's much more intuitive this way though. Counting up makes a lot more sense.

I'll bug you a bit more about the ITW convertor when I get a little more time this weekend if you're available. So far the print codes are just 1254/1252/1253 with different thing pressed and 0000 when nothing pressed. It doesn't seem like the whole deal it should be giving me. I just don't know if I have the baud rate wrong, its not showing me the full bit set or what. I can't find the factory reset or base firmware for the kitprog to try the other stuff either. But I'm tired and probably not thinking my best.

User avatar
DMA

04 Aug 2018, 18:59

Sangdrax wrote: One thing I noticed. The pins count columns forward instead of backwards now. I thought I had broke something when I first did the update. I think it's much more intuitive this way though. Counting up makes a lot more sense.
Sorry about that. I'm trying to make things easier for the next user and it occured to me that I can flip a couple of things and make columns go in the natural order. So I did that. Also made a good default pinout so that one can just solder things on and try.
Sangdrax wrote: I'll bug you a bit more about the ITW convertor when I get a little more time this weekend if you're available.
I'm likely available. Have couple of chores to do, but no big plans.
Sangdrax wrote: I can't find the factory reset or base firmware for the kitprog to try the other stuff either. But I'm tired and probably not thinking my best.
It's in psoc programmer - utilities - update firmware. You might need to put kitprog in bootloader mode tho.

User avatar
Sangdrax

10 Aug 2018, 16:38

I was able to reload the default firmware and swap back and forth between when I needed now, but I couldn't get the Bridge Control Panel to talk UART and show me what was going on. It kept wanting to use the I2C lines to the main kitboard that's disconnected now. Am I supposed to use something else to listen? Just not sure how I'm supposed to go about viewing the keyboard talking to the kitprog board.

User avatar
DMA

11 Aug 2018, 01:29

Sangdrax wrote: I was able to reload the default firmware and swap back and forth between when I needed now, but I couldn't get the Bridge Control Panel to talk UART and show me what was going on. It kept wanting to use the I2C lines to the main kitboard that's disconnected now. Am I supposed to use something else to listen?
12.6/12.7
Anyway, if you have one of those boards with long serial packets - you'll need to bit-bang. Count delays manually, like adb_scanner does. The hardware UART expects 7 or 8 bits.
Which is probably a bit more programming than you want it to be.
I'll try to write bit-banging serial for kitprog, but give me some time as I'm leaving for PTO in a week and will not be available.

User avatar
Sangdrax

11 Aug 2018, 02:34

Yeah, 12.6/12.7 is hooked up to the board. Just didn't seem like Bridge Control was listening to that. But if that's a result of the nonstandard size packet then that sure makes sense.

Thanks again for all the help. Take all the time you need and let me know if I can do anything to help out with my limited knowledge. This won't just be a big deal for me, anyone with an early 80's Cortron board will finally be able to get these things running. Might be a good time to grab a few because linear switches this nice will take a quantum leap in value once they're usable, just like beamsprings went from cheap curiosity to insanity for the same reason. :lol:

User avatar
DMA

11 Aug 2018, 02:39

Sangdrax wrote: Yeah, 12.6/12.7 is hooked up to the board. Just didn't seem like Bridge Control was listening to that. But if that's a result of the nonstandard size packet then that sure makes sense.

Thanks again for all the help. Take all the time you need and let me know if I can do anything to help out with my limited knowledge. This won't just be a big deal for me, anyone with an early 80's Cortron board will finally be able to get these things running. Might be a good time to grab a few because linear switches this nice will take a quantum leap in value once they're usable, just like beamsprings went from cheap curiosity to insanity for the same reason. :lol:
Having actual device would help. Any pointers to ebay or something?

User avatar
Sangdrax

11 Aug 2018, 03:01

DMA wrote: Having actual device would help. Any pointers to ebay or something?
This is what I've got hooked up at the moment photos-f62/1982-sperry-univac-uts-40-it ... 19430.html I also need to convert my Pr1me keyboard with the same setup.

That particular one seems to pop up on ebay every six months or so. There were also a bunch of caseless Cortrons up for about sixty bucks the last few months too. I don't see any current ones. Last one seems to have been sold at the end of June.

Worst case, I can probably loan you the module, but I figure with that work, you'd rather own what you're working on.

User avatar
DMA

11 Aug 2018, 04:25

Sangdrax wrote:
DMA wrote: Having actual device would help. Any pointers to ebay or something?
This is what I've got hooked up at the moment photos-f62/1982-sperry-univac-uts-40-it ... 19430.html I also need to convert my Pr1me keyboard with the same setup.

That particular one seems to pop up on ebay every six months or so. There were also a bunch of caseless Cortrons up for about sixty bucks the last few months too. I don't see any current ones. Last one seems to have been sold at the end of June.

Worst case, I can probably loan you the module, but I figure with that work, you'd rather own what you're working on.
Hmm. Actual usable layout. Not a fan of linear switches tho. Also, looking at $237 last univac keyboard on ebay fetched.. I'd pass. A keyboard shouldn't cost more than $100.

If I were you - I'd hook up logic analyzer to that big DIP-40, figure out how it talks to the smaller ones, rip it out and replace with a teensy w/kiibohd. Though I'm too cheap for teensy - I'd replace it with the same PSoC kit CS is made of, and modified CS to steer the remaining logic.
If I were me though - I'd figured out how actual switches work and made a scanner for those, so there's no more logic.

Pr1me - like this https://imgur.com/gallery/u7nu2 ? Are those switches magvalves? Looks like something CS will work with w/o much changes.

I'll figure out bit-banging rs232 - with 8-bit stuff. 21 bit should be an option then.

User avatar
Sangdrax

11 Aug 2018, 05:24

Yeah, I like linears even more than my beamspring. Good ones are my favorite.

My Pr1me looks like this photos-f62/1983-prime-pr1me-esa-5146-it ... 19441.html. Same switches and whatnot. The one you posted also looks like magvalve from the PCB but not the ITW intermediate type.

Also, I only paid $30 shipped for my Univac. It just happened to not be listed as one. I think it was something generic like vintage keyboard which happens so often. The Pr1me was a good deal more though.

The switches themselves are probably compatible with CS with no mods. It's just desoldering can be very difficult with the fragile ferrite ceramic magnets and it has a lot of IC stuff you can't get at without doing that.

I do have a very old Teletype coming in as well that's supposed to have some kind of metal plate capacitive switches. I'll see about a direct conversion on that one .

njm

05 Oct 2018, 16:09

Hi DMA, thanks for building CommonSense, it looks awesome and I'm keen to give it a go. I have an IBM model F that looks like a 3178 without the blue switch, but the PCB layout is a bit different. It has 4 rows and 23 columns, as far as I can tell. I thought I'd have a go at getting it wired up using CommonSense on the Cypress board, and I'm trying to figure out the pinouts.

Using the default pins in the current git project, I think I need to do something like this:

- Connect PCB rows to the first 4 row pins (P2_0, P2_3, P2_4, P2_5)
- Connect PCB columns to the last 23 column pins (P1_1, P1_2, ... P0_5)
- Connect both PCB ground & plate ground to controller GND
- Connect P0_2 and P0_4 to VDD
- Connect P0_7 (D0) to GND

Does that sound about right, or did I miss anything? The recommendations in the readme mention that D1 should be grounded too, but I couldn't find D1 in the default pinouts in the Cypress project.

I think I also need to remove C41, C42, and R5 because I have more than 17 columns. Any tips on the best way to remove them?

User avatar
DMA

06 Oct 2018, 05:00

njm wrote: Hi DMA, thanks for building CommonSense, it looks awesome and I'm keen to give it a go. I have an IBM model F that looks like a 3178 without the blue switch, but the PCB layout is a bit different. It has 4 rows and 23 columns, as far as I can tell. I thought I'd have a go at getting it wired up using CommonSense on the Cypress board, and I'm trying to figure out the pinouts.

Using the default pins in the current git project, I think I need to do something like this:

- Connect PCB rows to the first 4 row pins (P2_0, P2_3, P2_4, P2_5)
- Connect PCB columns to the last 23 column pins (P1_1, P1_2, ... P0_5)
- Connect both PCB ground & plate ground to controller GND
- Connect P0_2 and P0_4 to VDD
- Connect P0_7 (D0) to GND

Does that sound about right, or did I miss anything? The recommendations in the readme mention that D1 should be grounded too, but I couldn't find D1 in the default pinouts in the Cypress project.
Sounds about right. D1 is no longer there, it was there about a year ago :) I'll clean this up.
njm wrote: I think I also need to remove C41, C42, and R5 because I have more than 17 columns. Any tips on the best way to remove them?
Just desolder them. They're pretty small, so just heat both ends and move it away from the pads they occupy.

njm

06 Oct 2018, 05:08

DMA wrote:
njm wrote: Hi DMA, thanks for building CommonSense, it looks awesome and I'm keen to give it a go. I have an IBM model F that looks like a 3178 without the blue switch, but the PCB layout is a bit different. It has 4 rows and 23 columns, as far as I can tell. I thought I'd have a go at getting it wired up using CommonSense on the Cypress board, and I'm trying to figure out the pinouts.

Using the default pins in the current git project, I think I need to do something like this:

- Connect PCB rows to the first 4 row pins (P2_0, P2_3, P2_4, P2_5)
- Connect PCB columns to the last 23 column pins (P1_1, P1_2, ... P0_5)
- Connect both PCB ground & plate ground to controller GND
- Connect P0_2 and P0_4 to VDD
- Connect P0_7 (D0) to GND

Does that sound about right, or did I miss anything? The recommendations in the readme mention that D1 should be grounded too, but I couldn't find D1 in the default pinouts in the Cypress project.
Sounds about right. D1 is no longer there, it was there about a year ago :) I'll clean this up.
njm wrote: I think I also need to remove C41, C42, and R5 because I have more than 17 columns. Any tips on the best way to remove them?
Just desolder them. They're pretty small, so just heat both ends and move it away from the pads they occupy.
Ok great thanks! I'll give it a go.

User avatar
wcass

06 Oct 2018, 05:29

This has got CommonSense. Works wonderfully. Thanks!
CSSK.jpg
CSSK.jpg (586.3 KiB) Viewed 6926 times

njm

08 Oct 2018, 14:43

I just finished wiring this up and reassembled the keyboard. After a bit of tweaking the hardware parameters in FlightController it's all working perfectly!

I misread the wiring instructions initially, and thought that I had to wire up the last 23 columns (as opposed to the first 23). Luckily figured this out after wiring up only a few columns. Other than that, it went really well. My wiring is not the neatest, but seems to have done the job :)

Thanks DMA!
IMG_3715.jpeg
IMG_3715.jpeg (2.26 MiB) Viewed 6881 times

User avatar
Sangdrax

08 Oct 2018, 18:05

The old way used to be that you wired them in reverse order but the firmware was updated where that's fixed now. I don't think the readme had been updated though. DMA adds so much cool stuff, I bet it's hard to keep up on all the documentation. Even now, he's been working on some really interesting controller stuff for magvalves that should be a pretty big gamechanger.

Board looks great though. How you liking it?

njm

09 Oct 2018, 00:10

Thanks Sandrax. Great work on your 3178 by the way. I think it was your post that gave me the idea to use CommonSense. I was was previously thinking of using an xwhatsit, but wasn't sure if it could be configured to handle 23 columns.

I think I might need to adjust my wiring a bit, as I'm finding it hard to close the case (there's not as much vertical space in there as I thought). I really like the board though, it has a nice feel to it, and it seems like the layout has potential. Interestingly the blank keycaps are not pressable, so I might swap out the one in the top left at least, for a working tilde key.

njm

11 Oct 2018, 09:13

CommonSense is working so well on my Model F that I was thinking about using it to convert my DisplayWriter as well. My plan was to desolder the 30 pin connector from the original controller, and hook that up to a Cypress board. Just wondering if anyone has tried this, or if there's any reason why it wouldn't work? I don't suppose there's any way to buy a replacement 30 pin connector so that I could avoid damaging the original controller?

User avatar
wcass

11 Oct 2018, 14:19

Search for for "60 pin 3.94 card edge connector". Your pad card is 0.8 mm thick and all of these edge connectors are designed for 1.6 mm thick PCB, but you can get a 0.8 mm PCB shim made cheaply through OshPark. I have gerbers for that around here somewhere.

njm

11 Oct 2018, 14:57

Thanks for the tip. Would something like this do the job?

https://www.ebay.com/itm/1-Piece-60P-2x ... SwLVZVjKvq

I'd be interested to see the gerbers if you have a chance to dig them up.

Post Reply

Return to “Workshop”