Friday, 19 September 2014

Simple battery powered, LCD clock / calendar

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

In a similar style to the battery powered LCD clocks I made a while ago, I have been asked to make some LCD calendars.
The desk clock used an 8x2 LCD, but I went for something different for this, the display from an Nokia 5110 phone. These are 84x48 graphical LCDs using the Philips PCD8544 controller. These is a simple interface, but it runs at 3,3V. I followed the guides on the Adafruit site to use a 4050 as a level converter and drive this from an Arduino Uno.
The plan for this is to run from 2x AA batteries, so the 4050 will not be required, and the LCD can be connected directly. As usual with these things you can't have everything, so it's 'cheap, lower power, accurate - pick two. In this case, it's cheap and low powered, so I'm running the ATmega328P with it's internal 8MHz RC oscillator, divided down to 1MHz, As with the previous clock, I'm using a 32768Hz watch crystal on a timer interrupt to count seconds.
The crystal is hidden under the chip socket, and that's all that's required for the final unit, one display, the watch crystal, 4 buttons and one 100nF decoupling capacitor on the back. The switches and display lines are wired to the nearest pin on the ATmega328P, as usual switched to ground and using the internal pullup resistors.
I've used a three pin connector for power, the centre pin is the blue backlight which isn't currently used, but could be wired up if required, obviously reducing battery life
Normally it just shows the date, but the yellow button switches into date / time mode so the time can be set. The other buttons increments day/month/year or hours/minutes/seconds, depending on mode.
I also build a portrait version, to be used on a different project.
So far testing has shown this may be out by a few seconds a day. That's not ideal for a clock, but this is to be paired with an analogue clock movement, so will mainly be used to show the date. In which case, it should be fine as long as it changes date around midnight and not at three o'clock in the afternoon.
Since there is no battery backed real time clock, it will not remember the time. I've added a function to write to the EEPROM when it changes at midnight. This is checked on power on, so the date will be correct and just the time will need to be set when the batteries are changed. The EEPROM has a limited life of 100,000 writes, so storing the time would wear it out too soon.

Saturday, 13 September 2014

Commodore PET transfer cable

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

The Commodore Pet 4032 is now complete, and ready to use, I just need to get some software on there.
I have some Pet software on 8250 style floppy disks, but have yet to repair the 8250 drive. For other Commodore computers, I use the SD2IEC which plugs into the IEC port and provides easy access to .PRG and .D64 files.
The Pet doesn't have an IEC port, so unfortunately, I can't use that. It does have IEE488, which is parallel, and is what the IEC serial interface was based on. I have a few ideas for an SD card based solution, but for the moment, I'm relying on the cassette ports, and the recently refurbished Datasettes. Looking around, I found this page, where the author had used a Commodore 64 to assist in the transfer process.
The idea was to load the program into the Commodore 64, and then save it to tape. The tape could then be loaded on the Pet. Not quite as straight forward, as the load addresses are different, so there is a series of steps to follow on the Pet.

  1. NEW - clears existing programs
  2. 0 REM - start a new program with line 0
  3. LOAD - load the program
  4. SYS 1024 - start the system monitor program
  5. M 0401 0408 - display memory from address 0x0401 to 0x0408
  6. cursor up and change the line to start :0401 01 08 - this points to 0x0801, the address where the code from the C64 was loaded
  7. X - exit the monitor
  8. 0 - remove line 0 and relocate the rest of the code
  9. SAVE "name" - save the program to tape

It looks a bit of a faff, but once you've done it a few times, it's quite quick.
To get programs on the C64, I added a directory to the SD2IEC SD card and copied on a selection of Pet .prg files. After a few successful transfers, I wondered if I could cut out the step of saving to tape on the C64, rewinding it and then loading it into the Pet. The cassette port is quite simple, It is a 12 pin connector, but the top and bottom rows are the same, so it's only 6. Would have been nice if they had reversed the bottom row, so the connector could go either way up, but never mind. The connections are as follows;

  1. GND
  2. 5V - permanent 5V supply
  3. Motor - switched unregulated 9V
  4. Read - data in
  5. Write - data out
  6. Switch - connect to GND when play (or any of the other keys) is pressed

So there is a data in and a data out, both TTL level, both pretty much direct to PIA I/O pins. All the analogue stuff is handled in the datasette. So can I just connect them together? It turns out no. Whether by design or mistake, the signals are inverted. I inverted the signal using a 74LS04 inverter and fed the inverted signal into the Pet.
Bingo, it worked. I wanted to make a lead up, and didn't think I would fit a 14 pin chip into the plug, so I tried a simple NPN transistor inverter, and that also worked fine,
It actually gave a slightly cleaner signal than the TTL gate did as it was pretty much full swing on the supply rails (top is output, bottom is input, both 2V per division).
I built this up into a cable, with the components wired directly to the plug. I used a 2N3904 but any NPN transistor should do. The emitter is wired to 0V. The base is wired via a 1K resistor to the write output of the C64. The collector is connected to the read input of the Pet, and pulled high via a 10K resistor to 5V.
The switch input on both plugs is wired to 0V.
And that's it. I found 15 way D connector hoods were a close fit. The screw holes didn't match, so these are just held on with cable ties.
With the cable in place, it simplified the process as I could load the program on the C64. Setup the Pet with 0 REM and then LOAD and as soon as I start the SAVE on the C64, it loads on the Pet. Then just sort out the load address as above and save to cassette.
Another nice thing about the Pet is that is has two cassette ports, the rear is port 1, the side is port 2. So I can do LOAD (which is short for LOAD "",1), and then when finished, SAVE "name",2. So no unplugging is required for the whole transfer process.
Finally some new software, here I'm trying some of the newly written Pet games from Revival Studios.
These are now free downloads. I particularly like Down, a very simple but fast and addictive game. Too fast in fact to be able to take any decent photos. Sorry.
Update: This doesn't seem to work with some machine code only programs, and ones that load at unusual addresses. Bit it's fine things like space invaders, fire, blitz etc. Also watch out for ones that include the 'killer poke' code 'POKE 59458,62'. That normally appears at the start of the code, so just remove the offending code before saving. On early Pets, it can speed up the video. This isn't required on the later CRTC based pets, where it causes monitor to lose vertical sync, generating a bright spot or line which could damage the monitor after a while.

Commodore PET Repair Part 12 - Datasettes

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

Now that my restoration of the Commodore Pet 4032 is complete, it's time to start using it.
This is one of the original Commodore Datasette drives I got with the 4032 long ago.
I love the plaited cables on these. I don't know if they were supplied like that, as I haven't seen any others like these. They appear to be three pieces of speaker cable plaited together.
Also unused for 20 years, all these needed was a general clean up, a new belt and a head clean and they worked fine.
The other was the same, just a different plug. The DYMO labels are original by the way.
The same design was used with early VIC20s, black and grey replaced by white and gold, and the addition of a tape counter (like the imperial Daleks in Remembrance of the Daleks, apart from the tape counter that is)
The white seems to sit better with the Pet, and the tape counter is useful. These also seem a lot more solid that the later 1530 Datassettes (or C2N, they seem to use the name interchangeably).
During the testing, I've been using a tape with space invaders on it. It is a good game, and has sound and reasonable graphics. But mainly because last time I was working on a Pet, I tried various methods to transfer from a PC to tape, and this was the only one that transferred successfully.
Now all I need is to get some more software onto tape.

Thursday, 11 September 2014

Commodore PET Repair Part 11 - Finished

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

The Commodore Pet 4032-32N is now complete again, for the first time in about 20 years. It's taken about a month to get this far, but I think it's been worth it. The full story starts in Part 1.
I've always liked the distinct 'Commodore Pet' shape, it looks rather smart now it's all cleaned up and working.
I've left the badge off for the moment, I think I'll try and make something like the standard 4032 one, since the original one is damaged.
Inside, the new parts are as close as I could get to the originals, which I didn't have.
Most of the parts are dated 1982 or 1983. The replacement board is a 'Universal' 40/80 column one this would probably have started off with the fixed 40 column board.
I do, however, have the original datassette drives from this Pet, more on those later.
For the moment, I've been using a standard Commodore 64 one
So there it is,
Commodore Pet 4032-32N serial number WG 0018 lives again.

2022 Update: This PET is still sat on the bench next to me in regular use. These days the mainboard is stored safely away and it is running with a Mini PET 40/80 D.

Commodore PET Repair Part 10 - Monitor Refurbishment

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

I'm almost finished restoring a Commodore Pet 4032. All it needs now is it's monitor.
The original monitor for this 4032 is still going strong, and has been used through the repairs of the mainboard. However, the frame of the monitor is a bit rusty, and could generally do with a clean.
There was some black tape would around the base (which is visible when the Pet is assembled). Under that, I found another Currie & Maughan badge.
I carefully removed that as well, cleaned up the frame and sprayed it white.
With that fitted to the case, the cleaned board can be reinstalled.
And then the tube.
Now it's starting to look like a Commodore Pet again.
Good to know it's still working.
Whilst cleaning the monitor shroud, I found a date stamp. 27th October 1982. That seems about right.
With the shroud in place, you finally get to see what it should look like from the front, and the width and height can be correctly adjusted.
With the back on, that's is complete. Some better pictures will follow.

Commodore PET Repair Part 9 - Building a 4032

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

This is the ninth part of the repair and restoration of a Commodore Pet 4032. This is where it is all coming together. To recap from way back in Part 1, this early 1980's Commodore Pet 4032-32N computer has not been a Commodore Pet for probably 20 years.
When it arrived here, it had a PC installed inside it. The original board, had failed and been removed so I didn't have it. Last year, I removed the Pentium 75 board and tried various options for turning it back into a useful computer, and for a while, it ram a Z80 CP/M system. However, it should be a Commodore Pet, so I looked around to replace the missing parts. Parts being in short supply, I ended up getting them from a couple of different computers. Now everything is complete, time to put it together.
The bottom part of the case was a little rusty and have a few additional holes added from the PC board. I sanded this down and resprayed it.
Now that's nice and shiny, time to add the power supply I refurbished back in Part 2. This was partly from an 8032-SK, with the bracket from an 8250.
The capacitor is tied down to a couple of cable tie mounts. I think these would have been riveted originally, but I've bolted some on instead.
Next comes the main board. This originated from an 8032-SK that was incomplete, rusty and had some cosmetic damage.
Various problems have been fixed on this board, including various corroded components, dodgy sockets, broken tracks, faulty 6520, 6545, 74LS00x2, 74LS74, 74LS244x2, 74154, 8x4116, 1xmask ROM (901474-04). See Parts 3, 4, 5 and 7. It was originally an 80 column board, but was converted to 40 column to match what would originally have been fitted, back in part 6.
That's all looking good.
Nice to see the edge connectors sticking out at the back. Probably 20 years since this had working Pet board in it. Next, the top case needs a bit of a clean.
Now I remember why I put that tux badge there, the label beneath was damaged.
Not sure what to do about that. For the moment, I've carefully removed it cleaned the rest of the case. Now to install the keyboard that was refurbished in part 8.
One of the unique features of these computers is a car bonnet style case prop, which allows you to hold open the lid.
That's the base and the lid done.
The hole on the top is for the monitor, and the cables run through that.
Now for the monitor, but it needs a bit of a clean first.