Wednesday, May 30, 2007

Coin door elctronics

The coin door has a real mech behind it and correctly validates 10p coins. When the correct coin goes through, it triggers a microswitch. Nice. However, that click ultimately has to press a key on the keyboard to notify that a coin has been inserted. I use the term electronics looseley, as I didn't do any actual electronics myself, but it took some doing to create an intermediary that would be abte to communicate between the door and the PC.

First things first, the X-Arcade owns the PS2 port. No point trying to change that. It has a PS2 pass-through (also used for programming the buttons) and I had an old PS/2 keyboard I could hack. However, pull out the joystick to fit the wheel and you either lose the coin door or have to do some rewiring. Ugh.

Add to this the wireless keyboard and mouse combo needed both USB and PS2 to function and it was clearly time for a visit to PC World.

I'm not a fan of the place, I think it's overpriced and stuffed with unemployable teemagers who can't spell "PCs" and, despite the marketing, really isn't that helpful for non-computer literates, taking advantage of them in that standard ugly "good business" consumer way.

However, I wanted some gear and I was prepared to pay a little extra not to have to wait a week before being able to move ahead. In fact, I don't have any clear weekends left before the party, so this is pretty much it.

I laid my hands on the cheapest USB keyboard I could find. At £6-something it was going to be rough, but I just wanted that USB interface and keyboard encoder. RSI, comfort and style were not considerations today.

As it happened, I also found rather good looking wireless keyboard and mouse in aluminium with a single USB dongle for about £30. I barely hesitated. With Logitechs going up to £150, this seemed a bargain for something that a) wouldn't be seen much and b) looked allright even if it was. I just hoped it wasn't rubbish. I grabbed a USB hub whilst I was at it and headed home to do some wrecking.

I was surprised at how many screws there were in the bottom of the cheap keyboard (surely that drives up the price?) but I soon had it in pieces. Now I discovered how they make 'em so cheap - there are no switches. Nothing to hook the coin door up to. Rats.

The internals of the keyboard consisted of one tiny PCB and three sheets of plastic. It is a fiendishly good design. 3 independent layers of plastic. Top and bottom layer have PCB-style conducting tracks painted on them and the middle layer has holes in it at opportune points. The middle layer acts as an insulator and spacer. When you press down on a key, it pushes the top and bottom contacts together through the spacer hole.

Ingenious, but how was this goung to work for me. Short of sellotaping wires between the sheets, it was looking a bit grim. So much for cheap keyboards.

I puzzled over it a while and then realised that all the tracks led back to a couple of dozen contacts on that tiny PCB. It seemed that connecting the right pair combination of contacs would give you the keystroke you want.

So I spent half an hour tracing the tracks. It was tough going. i decided to use dabs of permanent marker to stop me squinting and losing track (bu-bum) of where I was.

Finally, I had identified the pins - 3 from the left and far-right. I popped the board out and stripped down an old CD audio-to-motherboard cable to make the connections.

Before setting to work on the precise pins, I gave it a go on the machine. PCB in one hand, I plugged the lead into the PC and up popped the little installation baloons. Once completed, I opened Notepad and used the two ends of the wire to scrape across the pins.

Supe enough, I got some characters output on the screen. Hurrah. I must have done something unusual to it because the next thing I knew, the machine had shut down. Hmm. Not sure what I touched there, but the principle was sound.

I set to with masking tape and scisors and soom had the wires all bandaged into place. I plugged it back in to the machine and touched the exposed tips together as if connected by the microswitch and.. nothing. Seems the sellotape was a bit loose.

A few adjustments later I had better luck. When I later mounted it into the cabinet, I had the same problem again. I think I need some mini clips over the masking tape to clamp the wires to the pins.

Top tip of the encoder was this, though: before sellotaping the wire to the pins, cut some small pieces of tape and cover up all the other pins so you can be in no danger of contact. Had I not done this, it would have been infuriatingly fiddly to tape the wire to one and only one pin. As it was, I coul splash the wire sideways across the pin and jam it down. Nice.

No comments: