ApplePi Update, now with ADB

Greetings dear readers, today we are going to cover something I worked on at least two years ago but always felt there was room for improvement. I’m of course referring to my Apple Classic, super charged with a Raspberry Pi3b motherboard inside. Now before I continue, I want to make one thing clear, I only mod old computers that are beyond repair or have been gifted to me by friends in a state worse than death. So no working or repairable system is ever broken, we don’t rip SID chips off working C64’s around here you know! Anyone found doing so would be given a stern telling off and sent to bed without any beer!

So where was I? Ah thats right, the Apple Classic! So last time we visiting this topic, I had been gifted a partially modded Classic and by partial, I mean it had everything floating loose inside the case and was in dire need of TLC. The amp cut out when you cranked it up or worse took the screen out and the RPI2B was awful slow, emulating an old mac on it was not a nice experience. It now sports a reasonably nippy Pi3B over clocked to 1.3Ghz, emulating an 020 mac the Pi doesn’t even break a sweat, idling at about 45 degrees for both the CPU and GPU. Seriously I’m sat here typing all this on AppleWorks, running Mac OS 7.5.3 and it’s pretty much like using a supercharged Classic on steroids.

I might have to cover compiling and using Basilisk II on a Raspberry Pi as there isn’t that much written online about getting a decent build. It took me a few false starts until I was able to get the emulator working without mouse stutter. This could just be down to the fact I was trying to use a RPi2, which should theoretically be powerful enough, but past experience with my AmigaPi has taught me things are never straight forward.

Ever since I finished or almost finished the ApplePi, I’ve wanted to do more. I wanted to fit an internal ADB socket so I could use a real Apple keyboard for a start. Luckily there is code available online and with a £7 Teensy 2.0 board, I was able to solder together a USB – ADB adapter. ADB is a funny socket, in that its the same pin out as S-video, which means picking up connectors isn’t that hard. Plenty of people have made these adapters but most the time they’re either inside the keyboard or inside a tiny external box. That’s all well and good, but firstly you’re modding the keyboard so that it’s no longer ADB and secondly, I lose USB pens to my sofa on a monthly basis. I’d lose my keyboard adapter and not be able to type on my ApplePi! For me there was no question how I wanted it, the ADB port would go on the back of the computer, as part of the custom laser cut rear I/O shield. It wouldn’t be a true Apple + Raspberry Pi hybrid without ADB nestled along side the USB ports.

My Keyboard of choice Apple Keyboard II

For this mod I opted to use the source code by Shay Green (https://github.com/gblargg/adb-usb), while his code doesn’t include mouse support like some others did. I had think whether using a single button mouse was really all that practical in a modern Linux environment. I think I’d eventually tear my hair out with it’s limitations.

All in the Code

Programming the Teensy board isn’t that hard, you can do it on a Mac, Windows, Linux and the Raspberry Pi. To program a Teensy on a Pi you’ll need something called “Teensy Loader” (https://www.pjrc.com/teensy/loader.html). This software makes programming the tiny boards a breeze. On their website it says to run the program from the linux terminal, however I found this to be a fiddly method, constantly typing the same command in each time. Instead I made a script that allowed me to click an icon to load it up right away. Using a text editor of your choice, Nano (from within the terminal) or Text Editor from

Teensy 2.0

the desktop. Create a text file in the same directory as teensy loader, call it something like “Teensyflash.sh”. Inside the text file paste the following, leaving out the speech marks.

“./teensy &”

Save the file off and close the editor. Now assuming you still have the window open, you should see a new file called “Teensyflash.sh”. Right click on the file and select Properties and then select the Permissions tab. Next to the “Execute:” field, click the drag down menu and select “Anyone”. Click the “ok” button to close the window and save your changes. You’ve now told Linux this file is an executable, so next time you double click on it, Linux will ask if you wish to run it. Tell it yes and the loader should pop up, voila no terminal commands involved.

Using a Teens 2.0 not 2.0++

Unpacked, Shays program is designed to run on a Teensy 2.0++, if you have one of those fine skip this part. However I had a Teensy 2.0, the same board I used to make my custom USB Amiga Joystick last year. The two boards use different chipsets and as such will not run the same programs, you have to compile a HEX specific to 2.0 and 2.0++. If you wish to use a Teensy 2.0 board, you will need to edit a file before you can compile your HEX. Inside the “adb-usb-master” folder, you should find a file called “Makefile”, open it with a text editor and edit it to look like this.

#MCU = at90usb1286 # Teensy++ 2.0
MCU = atmega32u4 # Teensy 2.0/Pro Micro

#FLASH = teensy_loader_cli -mmcu=$(MCU) -w main.hex # Teensy
FLASH = avrdude -p atmega32u4 -c avr109 -P /dev/ttyACM0 -D -U main.hex # Pro Micro

Save the file off and close it, the program is now ready to compile for the Teensy 2.0.

I’m not going to bother covering using Teensyflash, as there is plenty of information online covering the subject, however I do wish to briefly go over building the hex file. This is essentially the program you are going to load in the memory of the Teensy, without it your dead in the water. When I first tried to compile Shay’s ADB software, my Raspberry Pi threw a fit, telling me I was missing files. It took me a while to nail down what I was missing, running the following command in the Linux terminal did clear up my problems.

“sudo apt-get install libusb-dev gcc-avr binutils-avr avr-libcapt-get install libusb-dev gcc-avr binutils-avr avr-libc”

heat shrink, prevents shorts

I think Shay’s code might expect the command line version of Teensy loader to be present in the same folder as his code, because after my Pi successfully compiled the hex, it threw up an error about not finding Flash. Don’t be too concerned about this as the HEX has still been created and is ready to load in the GUI loader.
Once you have Teensy Loader up and running, it’s just a case of loading in your HEX file, pressing a button and a mouse click later the program is stored on the tiny board. With the code loaded in the memory of the Teensy, it’s just a matter of wiring the correct pins together between the board and the four pin s-video connector. Given the size of the connector, I highly recommend using some heat shrink around your solder joints. This will prevent any of your wires shorting and frying your Teensy or Keyboard. A Data line is no place to stick your 5 volt input and certain components might take offense and die as a sign of protest. Then my friend you be wading in the brown smelly stuff without any wellies on! Don’t forget to solder a 1k resister between the data line and your 5v. Apparently some ADB cables suffer with signal drop and the 1k resister helps, if a jobs worth doing, do it right and fit a resistor!

After it was all wired up, I had to modify my rear panel as there was no hole for the ADB port. With a lot of cursing and armed with a dremmel, I was able to make a half decent circular hole, just wide enough to accept the end of the ADB cable. Oh a word on plugging your Teensy to your computer, make sure you use the cable that came with it. I made the foolish mistake of using a spare mini USB cable I had laying around, the darn thing wouldn’t load up properly. Twenty minutes spent testing for breaks in my wiring and it all came down to a tiny USB lead.

Conclusion

When it works, the ADB-USB adapter is amazing, switching from a Bluetooth Apple Keyboard to an original Apple Keyboard II is a massive difference. It feels better, keys are spread out and in general I’m not finger typing any more. It also looks a million times better in front of the ApplePi, seriously you would be forgiven for thinking it was a real Apple computer when Basilisk II is running. Shay Green has my thanks for posting the code

A new panel to cover those holes.

up that made this hack possible. Were it not for him, I wouldn’t be sitting here typing to the sound of klacky keys! Thanks dude!

Next up I shall be designing a rear panel to cover the holes left behind by the old power switch and power socket. In their place, I plan of installing a control panel for the IPS screen, allowing me to change the brightness, contrast etc.


Professor Thomas H, Lee – Keeping The Light On

Apple Macintosh

If you own an Apple Macintosh computer such as the 128k, 512k, Plus or SE, the chances are at some point you have needed to repair it, be it from a faulty power board or seized up floppy drive. The fact is these vintage computers are getting old and were not built that well to begin with, which makes repairs inevitable.

So what do you do when your Macintosh develops a problem? Well, if you search the internet you will discover a wealth of sites and forums dedicated to collecting and maintaining a variety of vintage Apple machines.

The Guide

sadmac
Something you might encounter whilst you search the net trying to fix your poorly computer, is the classic mac repair guide. This handy PDF has been around since 2000 and is part of every classic mac owners library. For many it is almost the holy grail of computer guides, packed with useful information and guidance. I carry it around on my tablet all the time and use it extensively to repair my Plus.
The golden nuggets held within its pages offers any Macintosh owner the chance to bring back their computer from the jaws of silicon death and if that wasn’t good enough, this guide book is completely free!

In Search Of The Creator

Using this book for reference for well over a year, I came across a fault with my Plus that wasn’t covered. Before breaking in to a full blown panic, I decided I would try to seek out the author for their input. As all I had to go on was a name, Thomas H, Lee, I have to admit, at the time I wasn’t sure how successful I was going to be.

After a few days of searching online, I had a couple of results. Picking the most promising, I shot an email out to a professor working at Stanford University. I admit, I was pretty skeptical that I had the right person and even if I did, whether the Professor would have time to spare on a crazy hobbiest trying to repair an  obsolete Apple computer.

Imagine my surprise when several days later, I found an email waiting for me in my inbox. The email confirmed I had indeed found the same Thomas Lee who had written the repair guide and best of all his passion for these old machines was as strong as ever.

After exchanging several emails, Thomas, was also a little puzzled over the behaviour of my Plus. He recommended I replace the transistor controlling the horizontal voltage, along with the C1 capacitor. This fixed my problem and the Plus fired back up. It was during these emails back and forth, that I decided to ask Thomas if he would care to do an interview for ByteMyVdu. Given how much I’d used his guide over the past year, I felt it was only right to give something back. The author behind this amazing guide certainly deserves a place on BMV. His thorough and tireless work has mostly likely led to the resurrection of more then a few old Macintosh systems around the world, including the one at BMV!
I’m not aware of any other interviews with Professor Lee regarding his passion for classic Macs, so I hope you will all enjoy this little peek at the man behind that fantastic repair guide.

When did your interest in Macintosh computers begin and for what reason?

The Mac’s debut in 1984 was closely watched by my fellow geeks at university. Once an actual Mac showed up for sale at the student center, a group of us spent an afternoon playing with it. It intrigued and baffled us. We argued about whether it was a toy, whether a GUI was an advance or a gimmick, and whether this represented the future of computing or a passing fad. We all complained about Apple’s religious and short-sighted opposition to users upgrading the machine’s hardware. But we all liked the quasi-portability of the little guy. I really wanted one, but its $2495 price was just beyond what I could afford at the time. Luckily, I had richer friends who bought Macs, so I got to play with these marvels from time to time. I was finally able to buy a Plus in late 1988 (at the bargain price of $999) as they were reaching the end of their manufacturing run. I thought I got the deal of the century, and just in time, too, to write my PhD dissertation on that machine.

What caused you to make the repair guide?

Within a fairly short time, my friends started to complain about their Macs failing. Apple was good about providing warranty service, but once the warranty period ended, I started getting a steady stream of friends (and their friends) swinging by for me to “take a quick look” at their dead Macs. For my own use I documented the repairs I did, and after a few years I realized that I had come close to having reverse-engineered the entire analog board. So one weekend I just decided to finish the job. A couple of years later, the Web took the world by storm and Mac fans gathered together to share tips. I noticed the same questions popping up about classic Macs and their problems, so I decided to add some pics and hints to the schematics I’d extracted and write it all up in a document for others to use.

Did you expect it to be so popular and used by so many people?

I didn’t really think that it would get used too much. Classic Macs are long past their prime and I figured that only a few diehards would have the interest and ability to make use of my little repair guide. But the price is right, so I guess that has helped get it in the hands of more people. I’m grateful to the late “Gamba” for having hosted the first picture-less version, and the 68k Macintosh Liberation Army for hosting the second version.

Early macs are only getting older, do you still think computers such as the Plus have their uses in 2013?

I have to admit, sadly, that I power up my Plus less frequently than I used to, and then mainly out of nostalgia. It still works just fine as a writing machine, so that’s what I still use it for from time to time. My undergraduate students are fascinated by how much an 8MHz CPU can accomplish (they are astonished that it can run a browser). It just increases their admiration for all things Apple. It really amazes them to compare the capabilities of a Plus to those of contemporary DOS machines. I also use bits and pieces of the analog board design as lessons in good (and less than good) engineering (“Lesson 1: Why you have to do a bit more than just eliminate a fan”).

How do you feel about Apples decision to class G3/G4 and even some early intel Apple computers as obsolete? Are they as important to preserve as the early 80’s macs, such as the 128k, 512k and Plus?

That’s a tough question, and I suspect that different people would give quite different answers. Those whose work depends on cutting-edge performance probably shed no tears when older gear is consigned to the scrap heap. I am a sentimental type with a deep interest in the history of technology, so I tend to go overboard in preserving older machines. Thanks to the “use and discard” philosophy that prevails in society today, I can pick up interesting and still-useful machines for nothing or next to nothing. Just last month I was given a dead 17″ G4 “iLamp” in beautiful cosmetic condition. Its only problem was a bad stick of RAM. It now spends much of its time converting my CD collection into MP3 files. Its 1GHz single-core CPU is more than capable enough to handle that job with grace. And it meets the all-important spousal acceptance criterion of looking nice.

I would like to thank Thomas for all his help and for also providing so many of us with the tools that keep our beloved computer alive and kicking, and finally for being a good sport and participating in this little interview.

Until next time, keep geeking!