Wednesday 29 February 2012

Do Not Press This Button

This is an old post, preserved for reference.
The products and services mentioned within are no longer available.

I've recently had a new boiler fitted, and it came with a nifty RF remote thermostat.
The receiver at the boiler end was labelled with the following warning 'Do Not Press This Button'. Now come on, you can't give someone like me a box with a button on it marked 'Do Not Press This Button', it's just too tempting!
Sadly, it just resynchronises the remote device, no fireworks, no nuclear armageddon, not even a little sign lighting up to say 'Please Do Not Press That Button Again'.

Thank you the marketing division of The Cirius Cybernetics Corporation Siemens.

Friday 24 February 2012

Acorn Electron Repair

This is an old post, preserved for reference.
The products and services mentioned within are no longer available.

I was wandering around our local second hard market at Tynemouth Station and something grabbed my attention on one of the stalls.
It was an Acorn Electron, in its polys, complete with mains adapter and manual. The polys were a bit worn and the cardboard outer was missing, but the Electron seemed in decent condition.
The cover on the expansion port was still present, this is a good sign as they often get lost if they have had a hard life.
I was told it was 'working the last time it was used' (but that was probably 20 years ago). So I haggled the price down a bit and took home my bargain.
Before I powered it up, I tested the PSU and got about 20V AC off load which is about right from what I remember. All the other's I've had were fitted with beige cable, this one was black, so I had a quick check inside, all seems ok, so I gave it a go. Nothing. Blank screen.
Inside all looked well, the voltages were correct on the pins of the PSU, + and - 5V, so no problems there. From past experience, it is usually the ULA in these things.  The Spectrum suffers similarly with the ULA, it's service manual seems to suggest 'Replace IC1' as the solution to at least every other problem. The Electron's ULA doesn't seem to go as often, but is quiet prone to bad connections.
They used a number of different sockets throughout the production, but none seem to solve it. A quick blast of the air duster inside the socket and a clean of the contacts with IPA usually does the trick, but not in this case.
My next step is usually to try a known good ULA, so I borrowed one from a spare Electron (as you do). Same there, no display. I also tested its ULA in the other Electron and it worked fine, so it wasn't that. The CPU, RAM and ROM were all soldered in, otherwise I would have tried exchanging those.
Head scratching time, and time to dig out the Acorn Electron Service Manual from Chris's excellent site. I followed through the steps, checked all the voltages and clocks etc. and the only things that was left on its flow chart was 'Replace 6502 (unlikely)'.
This was looking like another potential candidate to be turned into a USB keyboard, but I thought I would persevere. None of the chips in this Electron were socketed (some board had CPU and / or ROM in sockets), but in the absence of anything else, I desoldered the CPU and fitted a socket. I borrowed the CPU from the other Electron (which was socketed) and tried again.
And there it was, a beep followed by Acorn Electron BASIC and a flashing cursor. So unlikely as the authors of the service manual (and its reader) though it, it had been the CPU. A few more tests and no faults found; one more Acorn Electron returned to full health.

Friday 17 February 2012

USBtiny ISP Review

This is an old post, preserved for reference.
The products and services mentioned within are no longer available.

After using the ATMega328 from my Arduino UNO in the ZX81 USB Keyboard, I needed to replace it. The chips themselves are only £3-4, so is much cheaper than buying a whole new Arduino. The only issue is the chip needs to have the bootloader burned into it before it can use the USB Serial programming in the Arduino. You can actually by them with the bootloader already programmed for about £5, but I was looking  to burn it myself to give me more options in the future.
This needs to be programmed using the standard 6 pin AVR ISP header. I was planning to get a programmer at some point in the future, but I though I might try to see if I could knock one up quickly. I found a few designs online for parallel port, but the one I tried didn't work, probably due to the length of the cables, or the drive capabilities of the parallel port. I had the same problems back in the early days of PIC work before I got a PIC Start. So I had a look around at other options and found the USBtiny ISP from adafruit, as a kit from .:oomlout:. in the UK, so this is just a quick review of that.
It arrived as kit this morning, it would have been nice to have a single sheet schematic or something, but the step by step build instructions are online,
It didn't take long to build up the board, clip it into the case and away it went. and worked first time.
It's nice to find things that just work without having to hack about with anything!

Thursday 16 February 2012

ZX81 USB Keyboard Schematics

This is an old post, preserved for reference.
The products and services mentioned within are no longer available.

Following up my previous posts about the ZX81 USB keyboard, I've been trying out Fritzing to do the layouts, so here are a couple of schematics. This is the initial testing with a couple of rows of switches:
This is the complete circuit with the 8 pin row connector and 5 pin header connector.
This is a schematic - I haven't figured how to get the lines straight - better read the manual!
Creative Commons Licence
ZX81 USB Keyboard by Dave Curran is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

ZX81 USB Keyboard Source

This is an old post, preserved for reference.
The products and services mentioned within are no longer available.

I started the code for the ZX81 USB keyboard, with the USBKeyboardDemo1 sample in the Arduino Version of the V-USB library. As stated in the original post, either change the config.h file in the library to set USB_CFG_DMINUS_BIT to 3 rather than 4 or wire up the circuit with 2 and 4.
The ZX81 has just 40 keys arranged as 8 rows of 5 columns. 26 letters, 10 numbers leaves just 4 keys, shift, period, space and new line (enter). The columns are arranged as 5 4 3 2 1 1 2 3 4 5, and the rows aren't in order either.presumably to aid layout of the tracks on the membrane.
In order to get additional functionality, I've included 2 keymaps. One is the keys as the are, the second is when shift is held. Most of the keys, at least all the letters, are send as key with the shift modifier, but for the numbers I've added escape as shift 1, and used the arrows on the original keyboard overlay to make left, down, up and right from shift 5, 6, 7, 8, and delete as shift 0 ('rubout'). I don't have need for the symbols so have left them alone to allow upper and lower case letters. As a side note, the quotes are on the P key, and with the tokenised BASIC, when you were in keyword mode P was PRINT, so it made sense, you pressed P and PRINT came up, then next thing you generally wanted was a quote, so that was also there on the P key, you just needed to press SHIFT as well. It is because of that quick that even though when I need to type ", my hands go for SHIFT and 2 but I still think SHIFT P.
Initially testing had no debouncing in the code, so press P and you get ppppppppppppppppp. I wanted to maintain the option to press multiple keys, so I have an array of counters. Whenever the keypress is detected, the counter is incremented. If I go through a scan and it isn't pressed, the counter is zeroed. Once the counter reaches a set value the key is sent. I did reset the counter at that point, but the last revision of the code added a repeat option, so the counter continues to increment and every 500 detections, another keypress is sent. These values need to be tweaked to get the best results for the particular switches being used. I had two types of tact switches in the breadboarded version, they looked the same, one type clicked louder and needed lower debounce and repeat values that the other (cheaper) ones. The membrane again needed the values tweaking to get it so it would not miss fast presses, but wouldn't repeat too quickly on slow presses.

Download the source code here: ZX81_Keyboard.ino

Creative Commons Licence
ZX81 USB Keyboard by Dave Curran is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

2022 Note:
This was a very primitive version of the USB keyboards I produced later on. The code has been left here for reference, but suffered due to the way the keyboard library worked. I later rewrote the whole thing to have more control over the ways the keys were mapped. That version has not been open sourced.

Wednesday 15 February 2012

Arduino based ZX81 USB Keyboard

This is an old post, preserved for reference.
The products and services mentioned within are no longer available.

Here's the first Arduino based project, or at least developed on an Arduino.
Yes, it looks like a ZX81, and it is a ZX81, or at least it was many years ago. This is in fact the remains of my very first computer, a Sinclair ZX81, which I got around 1982. It served me well, and I learned to program on it, first in BASIC and then in Z80 assembler. At one point it stopped working, and with the help of a family friend we traced the problem to a failed 7805 voltage regulator. That was replaced, and that was my first computer repair, probably around 1983. It lasted another couple of years but was replaced by my second ZX81, which is still complete and in working order.  I expect I was keep to learn how things work, and one of the best ways is to take them to bits and find out, and many experiments were carried out in my youth and the sadly this ZX81 didn't come out of it well. I think the plans to put it into a new case with a proper keyboard were probably its final downfall.
Roll forward 25 years, and I still have the bits. I did look at getting it up and running again. The keyboard was a write off, but I managed to find new replacement keyboard membranes from RWAP and bought one. They are very good replicas, the only noticeable difference I could see is the © date at the top, 1980 vs 2008.
The main board was pretty much a write off as well. I tried to revive it, but youthful enthusiasm and the passage of time we working against me. The case was OK though, and I did have the membrane, so I thought why not make it into a USB keyboard (as you do). This was one of the things I tried to do a couple of years ago with the PIC, and that wasn't having any of it.
The Arduino USB Library seems to be in good order, a port of V-USB, and little is required to get a USB keyboard up an running. I built the circuit on a propto shields and added some keys on breadboard. The major stumbling block for me was most of the sample circuits on the net used pins D2 and D3, where as the config file supplied used D2 and D4. Once I'd changed that, my little 6 key keyboard was up and running. I also tested it with the new membrane and that was working as well.
I ended up writing my own keyboard scanning and debouncing code as I wanted multiple button presses and rollover repeat. A bit of tweaking of the timings was required but I soon got it down a comfortably usable level.
One of the neat things about the Arduino is that once it's working on the Arduino board, you can transfer the ATMega328P onto another board and use it there. If you leave the bootloader in place and add the appropriate headers, you can use a FTDI or one of the new Arduino USB Serial boards to program it in place. I've put together the circuit on a piece of padboard and to all intents and purposes, with the USB-Serial board plugged it, you can treat it like the Ardunio Uno and continue development, upload new software and use the serial monitor.
I was able to continue this once installed in the final unit and sort the final key mappings. Once complete, I unplugged the USB to Serial board and screwed the lid on and there you have it, a USB keyboard from a ZX81.
It was never going to be fantastic to use, due to the fact it is a membrane, although the new one seems to be better to use the the one on my other ZX81. The application I have for the ZX81 USB keybaord is on my HTPC, which is mainly controlled from the remote. I occasionally will pause or change programs in Myth TV using the keyboard if it is nearer that the remote, and for that it works fine and looks better than the standard keyboard it replaced.

I was probably watching the same thing the last time I used the original ZX81, just on a slightly smaller TV.

2022 Note: this was a very primitive version of the USB keyboards I produced later on, with custom PCBs and custom firemware. I have left this post here for historic reasons, but I have got rid of all of the other USB keyboard posts as I think there time is over, and I don't want to get any more requests for them.

2023 Note: Still getting requests, so I have listed some of the newer custom ZX81 USB keyboard controllers on my SellMyRetro store.

Two versions, one for use within a ZX81 case, and one to use a ZX81 membrane standalone for your own project not in a ZX81 case.

Thursday 9 February 2012

PIC vs Arduino

This is an old post, preserved for reference.
The products and services mentioned within are no longer available.

Well, there's a contentious title!

After many years programming microprocessors like the Z80, the 6502 and the 68K back in the 80's, I first met the microcontroller in the form of the PIC16C84 in the mid 90's. I built a homemade parallel port programmer and away I went. Since then I've used various PIC's in personal and commercial projects, initially in assembler, and later in C. It's the usual story of 'which microcontroller should I use?', and well, there's a bunch of PIC's in the box, the official programmer, home made prototyping boards, the IDE is setup and working and I know my way around them. So, as long as there is a PIC variant that has the requisite features, it's the easy (read 'lazy') choice. However, a couple of years ago, I had a couple of ideas for projects using USB, so I got some PIC's with USB support and built some prototypes. These never went anywhere, there seemed to be loads of problems, the USB framework seemed to be in a state of flux, so the examples were based on a different version to the current one, the latest version didn't work with the IDE, there were incompatibilities with the core framework, and when it did compile, it didn't work! I spent ages with various libraries and versions of MPLAB and a couple of different types of PIC and got nowhere, so they were put on the shelf.
Recently, I've been evaluating the Arduino as a way for beginners to get into hardware and software, and it seems to be really well thought out. Someone who doesn't know electronics or programming can pick one of these up for £20-£30 and have an LED flashing in a few minutes. It's then quite easy to follow some simple examples and add more complex hardware and software, and they seem to have the libraries sorted out so thinks like driving an LCD or even a LAN connection are taken care of with a simple code interface.
After only a couple of minutes of plugging at the breadboard, an HD44780 based LCD display is up and running, not a bad start. I can see a couple of failed PIC projects being resurrected on the Arduino - watch this space!

Wednesday 8 February 2012

Samsung LCD TV's - power supply fault

This is an old post, preserved for reference.
The products and services mentioned within are no longer available.

My parent's bought a Samsung LE40R74 the same as mine, because I'd been into Curry's and peered through the grill on the back and seen that inside was the LTA400WT-L01 panel. At the time I worked with large LCD panels as part of public information displays (bus stations, airports etc.), and that was one of the panels we had chosen to use, so I knew the were fairly decent and had seemed to stand the test of time.
They got it and it did the job very well. Then it went off, or rather it started occasionally switching off, and sometimes wouldn't switch on. So I took the back off and had a look around, and there seemed to be a couple of dried up capacitors which had opened their vents. Capacitors work the opposite way around to mussels, if you cook them and they open up, you throw them away. I noticed that the ones that had gone were very close to a heatsink. It seemed to be a poor design, that close to a heat source, they are bound to dry up over
The duff capacitors were filters on the low voltage and standby side of the power board, so presumably as they had dried out their capacitance reduced and so it was failing to generate sufficient power to keep the TV on.
I popped out to my wonderful local electronics shop (ESR) and got some replacement caps, 105C rated and replaced all those in the area around the heatsink and away we go, the TV is back up and running.
That was a couple of years ago, but since then a couple of people have come to me with similar Samsung TV's with similar symptoms. I don't normally repair TV's, but in this case, it sounded like it was the same issue. And indeed it was, these ones also had dried up capacitors, in the same place around that heatsink. The later models seemed to have gone for 2200uF rather than 1000uF, and yesterday, another one arrived, an LE40R88, same problem, but in this one they had used 25v caps rather than 10v as before, which was still sufficient for the 5v rail. So it sounds like they are trying to fix this problem by changing the caps, but they seem to have moved them closer to the heatsink!

Thursday 2 February 2012

Universal Laptop Power Supply Further Update

This is an old post, preserved for reference.
The products and services mentioned within are no longer available.

After using this for a while, I've made a few changes. The power LED was wired in place of the original on the unit and wasn't ideal. As there is a delay in starting, it doesn't light immediately, and if there isn't much load it doesn't go off immediately. The combined with a possibly dodgy mains switch led me to make a change. I also thought a couple of 4mm posts would actually be a good idea, to make the unit more general purpose, so time for a bit of rework.

I added the 4mm posts and a new 'output on' LED wired across those (well almost +V is taken from the input side of the ammeter so as not to show up on there. I also removed the original 10K divider resistor from the main PCB and replaced it with one directly on the output, to remove any voltage drop from the internal wiring and the ammeter.
I replaced the faulty mains switch with a chunkier one and added a mains LED. I replaced the mains socket on the PCB with a 0.156" header to tidy up the wiring.

And now here is the finished unit, next to my existing 5V / 12V bench supply.

Note from 2022: This is still in regular use, still with the "temporary" pencil labelling.