-
Make: Electronics
03/13/2021 at 05:25 • 0 commentsOriginally published in 2012, this marked the start of my electronics journey.
This Christmas, I received a copy of Make: Electronics (First Edition) by Charles Platt, along with the accompanying Make: Electronics Components Pack 1a from Maker Shed. Just like that, I had a new obses^H^H^H^H^H hobby.
The book can be divided into three parts of roughly equal length. The parts in the first kit correspond to the first two chapters of the book. The kit comes with batteries, a solderless breadboard, hookup wire, a DC power supply and the various electronic components covered by the first section of the book. This part of the book covers basic theory of electricity and fundamental components such as batteries, switches, relays, resistors, capacitors, LEDs, and transistors. The kit and the first two chapters culminate in a siren circuit made only from transistors, resistors and capacitors.
I completed the projects covered by Component Pack 1 in about a week and ordered Component Pack 2a. The second kit, consisting mostly of soldering supplies and integrated circuits, includes the all the parts necessary for the next two chapters of the book. The third chapter starts by covering basic soldering skills. It then builds upon the siren circuit from the first section, eventually building it out into a full-fledged burglar alarm with magnetic window/door switches. Unfortunately, the burglar alarm did not survive the transition into a permanent project — a victim of my fledgling soldering skills. The lead-free solder in the kit may be the environmentally correct choice, but it didn’t make learning to solder very easy.
The fourth chapter delves into integrated circuits in the form of timers and discrete logic. It guides the reader through several projects including a reaction timer, a combination lock, a game show buzzer, and an electronic dice roller. All in all, the second kit took me another two weeks to complete. My favorite project from this section was the reaction timer, built from 555 timers, 4026 counters, and a seven-segment display. I’m pretty sure my partner thought I was building a bomb.
I really didn’t enjoy building the electronic dice out of 74LS TTL chips. The circuit was very flaky and I had to alter the resistor values given by the book to make it work. Maybe the point of this project is that TTL sucks (sorry old-timers). Apparently Charles Platt got this feedback from a lot of people, because the TTL chips have been replaced with CMOS HC chips in the second edition.
The fifth chapter starts by giving advice on how to set up an electronics workshop and suggests some additional books for further reading. It then covers an eclectic variety of topics including electromagnets, motors, generators, audio electronics, robotics, and microcontrollers. Maker Shed does not offer a kit to go along with this part of the book, but by this point, I felt confident enough in my skills to branch out on my own without slavishly completing the remaining projects in the book.
Overall I recommend both the book and the kits highly. The book provided a great hands-on introduction to hobby electronics by walking me through fun experiments without getting bogged down in theory, and the kits saved me the intimidation of placing my first order to Digi-Key or Mouser before I knew anything about the components I was ordering. While Make: Electronics definitely left me with some fundamental gaps in my understanding of electronics theory, it kept my interest long enough to get me hooked, and I believe that was precisely Mr. Platt’s goal.
Epilogue
With this blog, my aim is to bring you along on my journey as I learn electronics and share the interesting projects that I work on along the way. I have been working on a lot of great stuff since completing this book, and I hope to share more with you soon. I hope that others who are starting out will find my experience useful as my understanding grows.
-
My LED Matrix Needs a Little TLC
03/13/2021 at 05:22 • 0 commentsOriginally published in 2012.
I picked up a set of 10 Sure Electronics 8x8 red/green LED matrices for about $13 on eBay. I figured I could build an Arduino-powered 24x24 LED sign to show messages, run Conway’s Game of Life, and play simple games, and still have one more 8x8 matrix left over to experiment with. I did eventually get a working prototype, but I had no idea of the rabbit hole that it would take me down.
False Starts
The easiest way to get a matrix running on an Arduino is to drive the rows and columns directly from its I/O pins. For a quick introduction on how this works, refer to the Arduino row-column scanning tutorial. Although it’s very straightforward, this approach has two major deal breakers:
- The LEDs in a typical matrix are rated at 20 mA, so if all the LEDs in a row are on at once, the pin attached to the row would have to supply 160 mA to light the LEDs at full brightness. The Arduino can only source 40 mA per pin, so this limits us to 5 mA per LED, resulting in a dim display. Since only one row is lit at a time, the display is even dimmer.
- It requires 16 I/O pins just to drive a single color 8x8 matrix, so forget about driving multiple colors or scaling up to multiple matrices using this approach.
Another approach I investigated was to use the Maxim MAX7219 or MAX7221 LED display driver chips. The chip was originally intended to drive an eight digit, seven segment display, but can also drive an 8x8 matrix. Both Beginning Arduino and Arduino Cookbook cover this technique in depth. Arduino inherited a library from Wiring to drive matrices using these chips, so getting it working was very easy. Since these chips are purpose built for driving LEDs, they also provide plenty of current to drive the matrix at full brightness. Unfortunately, they also have several drawbacks:
- They’re expensive — the cheapest I found the MAX7219 was for $5.25 at Digi-Key.
- The chips were originally designed to drive eight digits on a seven segment display, so scaling up to multiple matrices is awkward. Driving multicolor matrices likewise requires multiple chips and is not straightforward.
- Each LED is either on or off using this chip, so it’s not possible to have multiple shades of color.
The Hardware
This brings me approach I finally settled on. I’m using a Texas Instruments TLC5940 16-channel LED sink driver for the columns and a Micrel MIC5891 8-bit serial input latched source driver for the rows. The TLC5940 has a number of advantages that sold me on it:
- This chip is a current sink, meaning that it attaches to the LED’s cathode and lights the LED by pulling the cathode toward ground. Since it can drive 16 channels, it is a perfect fit for an 8x8 bi-color common anode matrix like the ones I am using.
- It supports greyscale control using PWM, so the brightness of the red and green LEDs can be finely tuned to produce red, green, or any shade in between.
- It’s not exactly cheap, but it only requires three TLC5940s ($4.20 each) and six MIC5891s ($2.50 each) to drive a 24x24 bi-color matrix versus eighteen MAX7221s ($5.25 each). Therefore, at the best prices I could find we’re looking at a total of $27.60 for the driver chips with the TLC5940/MIC5891 combo versus $94.50 for the MAX7221s.
The MIC5891 is basically a standard shift register (a la 74HC595) which has PNP Darlington transistors built into its output stages, allowing it to source up to 500 mA per output. A standard 74HC595 could be substituted, but each of the eight outputs would need to be attached to an external PNP Darlington or P-channel MOSFET in order to source enough current for the rows.
One TLC5940 and one MIC5891 can drive one 8x8 red/green matrix or two 8x8 single-color matrices side-by-side. It is possible to add an arbitrary number of columns and rows by chaining together additional TLC5940s and MIC5891s. Eventually, my plan is to scale up to a single 8x8 matrix to a 24x24 matrix composed of nine individual 8x8 tiles.
... Read more -
LEDs, Take Two
03/13/2021 at 05:15 • 0 commentsOriginally published in 2013.
This blog post has been languishing half-written in my blogger account for a long time. I have since found an even better solution for driving a 32x32 LED matrix called SmartMatrix (more on that later), but I wanted to share what I had already written about my second attempt along the way.
With the red/green matrix I shared in my last post, I never got past the single 8x8 prototype that I demonstrated in my video. I eventually tired of the tedium of endless soldering and the frustration of trying to find a way to route all the wires required to connect the 216 pins of the 9 8x8 panels together.
I had taken a break from electronics for a while, but was looking for an excuse to dive back in. Then I found this video made by Henner Zeller, who has written some software to drive an RGB matrix from the Raspberry Pi.
Wiring
This matrix is already fully assembled so the only wiring required is a power cable and 16-pin data cable. The pins were not labelled on the matrix I got, so I looked at Adafruit’s instructions to get the pinout for the matrix. I found the GPIO pinout of the Raspberry Pi on the eLinux wiki, which is a great resource for all kinds of information about the Pi.
With this information in hand, I wired up a prototype using breadboard jumper wire to connect the appropriate pins on the Raspberry Pi’s 26-pin ribbon cable to those on the 16-pin ribbon cable provided with the matrix. I connected each pin from the matrix’s cable to the corresponding pin on the Raspberry Pi’s cable as documented in the software’s README. The important thing to remember when making these connections is that the pinout is flipped when looking at the connectors of the ribbon cables.
Once I had the prototype working, I wanted something a little more permanent, so I got some female to female pre-crimped wires plus some 2x8 and 2x12 connector housings from Pololu. To make a custom cable, you just snap the end of the wire into the appropriate place in the housing. Before doing this, I decided to move OE- from pin 2 to 27 on the Pi and CLK from pin 3 to 11 so that pins 2 and 3 remain free for the I2C expansion bus.
Adafruit now offers a Raspberry Pi LED Matrix Hat that is a much tidier solution, but if you don’t like to solder, you may find the technique I used above more to your liking.
Software
I started with Henner Zeller’s original code is on Github. I have forked his code on Github and made a few changes:
- Swap blue and green pins so they match wiring shown in Adafruit’s documentation
- Changed OE- from pin 2 to 27 on the Pi and CLK from pin 3 to 11 so that pins 2 and 3 remain free for the I2C expansion bus.
- Added support for the TPM2.net protocol for streaming video from your PC to the matrix over UDP.
- Compiled against the Xenomai real-time kernel. Instructions for building a Raspberry Pi linux kernel with Xenomai support are here. There is also a Github repository with some helpful scripts here.
Results
It works pretty well, but because Linux is a multitasking operating system, getting precise timings is not always possible, and when the loop gets preempted, it causes noticeable flicker on the display. Compiling with Xenomai helps this somewhat but it’s still noticeable at times. Also, a bare Raspberry Pi with a wire connected to a bare matrix doesn’t really feel like a finished project; however, it’s a lost farther than I ever got with my last attempt.
Eventually, I found a better solution the SmartMatrix kit that I mentioned at the beginning of the post. I’ll talk more about that in my next post.
-
The Matrix Gets Smart
03/13/2021 at 05:12 • 0 commentsOriginally published in 2014.
In my search for a better LED matrix, I’ve finally arrived at what actually feels like a finished product: the SmartMatrix from PixelMatix. This comes in a complete kit for $130 with everything that you need to build a nicely finished project. The only thing you have to add is an 8x8 shadowbox frame that sells for less than $10 on Amazon. Since I have sold off my soldering equipment during my move, I opted to order the pre-assembled kit for an additional $20.
With all the hardware taken care of for me, I could focus on the software to make interesting displays, which is what I’ve really wanted to do all along. The SmartMatrix is driven by a Teensy 3.1 from PRJC, which is a tiny ARM microcontroller board that can be programmed with Arduino. It comes with some really nice software called Aurora that has lots of interesting visual displays. I have made my own fork of it to which I’ve added several features.
TPM2 Streaming Mode
One of the first things I wanted to do was add TPM2 streaming over the Teensy’s serial USB connection. This allows the matrix to be controlled from PC software such as Jinx!, PixelController, and Glediator. I made a YouTube video showing off the results:
Instructions for using Streaming Mode are on the Aurora wiki.
The Game of Life
Finally I come full circle to the goal I had stated for myself in my very first LED Matrix post: to run Conway’s Game of Life. Aurora came with a basic game of life implementation that only had one color that cycled through as the generations progressed. I decided I could make it more colorful so I tweaked the algorithm a bit. Each cells is colored according to the number of times it has come to life. Also, as a cell dies, it slowly fades into darkness instead of immediately disappearing. It’s definitely more colorful and feels more, well, organic. I find the effect quite mesmerizing.
Munching Squares
After I was satisfied with my changes to the game of life, I went on to implement what is perhaps the original display hack, Munching Squares. This interesting pattern is simply the result of applying the XOR operator to the X and Y coordinates on the grid. It was discovered by the O.G. Hackers at MIT who were programming the PDP-1 in the 60's.
Coincidentally, these same hackers went on to become obsessed with Conway’s Game of Life and discovered and cataloged many of the interesting emergent patterns that the Game of Life produces.
Gifs
There is an alternative LED Matrix Kit called PIXEL, which has a lot of really cool animated gifs that were designed by artists especially for a 32x32 LED Matrix. I loaded up my SD card with these so now I have a lot more animations to look at.
Troubleshooting
At one point, I had a scare while uploading a new Aurora sketch and thought my Teensy had bricked itself during reprogramming, but I was eventually able to revive it. Being a tech support engineer by day, my natural instinct is to share my experience in case it helps anyone else out with a similar problem.
When I hit program on the Arduino UI, it encountered a program error, and went completely unresponsive. The matrix wouldn’t light up, Windows said I had connected a USB device that had malfunctioned, and the COM port no longer shows up. I tried disconnecting the power and USB, reconnecting it, reconnecting only the power without USB, hitting the program button multiple times, switching to a different USB port and nothing worked.
I went to the PJRC Teensy forum and found this thread. It seems to be a fairly common problem. Some of the people on the board suggested to either “double-click” the programming button or hold down the button while plugging in the USB cable. I’m not quite sure which, but one of these worked.
When I did it, Windows no longer showed the “one of your USB devices has malfunctioned and is not recognized” error, but I still didn’t see it show up as a COM port. However, I noticed...
Read more -
Meet Elbert
03/13/2021 at 05:09 • 0 commentsOriginally published in 2015.
And now, for something completely different. Lest you think my interest in electronics begins and ends with blinkenlights, I’d like to introduce you to Elbert.
The Elbert V2 from Numato is an entry-level FPGA board. The best way to explain it for someone new to the game is that while you tell a CPU what to do, you tell an FPGA what to be. The FPGA is basically a blank slate of basic logic elements which can be wired together to create almost anything. Video cards, CPUs, digital signal processors, you name it. Your imagination — and the size of the FPGA you can afford — are the only limits.
I have been interested in FPGAs for quite some time, but until recently, the barrier to entry has been pretty high, and there hasn’t been much information available for the hobbyist. Several enterprising makers are committed to bringing FPGAs to the masses with projects like the Papilio and the Mojo which sell for around $75 and provide a lot of hobbyist-friendly projects and tutorials.
Unfortunately, neither of the above boards includes any peripherals beyond some basic buttons and LEDs. To add peripherals, you must buy an external add-on board that plugs into the FPGA board’s headers. Generally, these peripheral boards cost $40 or more, depending on the peripherals. This adds quite a bit to the price of entry, and was a little more than I wanted to pay for something I was still unsure if I would get into.
When I found the Elbert V2 FPGA board from Numato Lab for only $30, it seemed like a safe jumping off point. The board includes a number of built-in peripherals and connectors, including dip switches, push buttons, seven segment displays, VGA and audio output, and an SD card slot. The XC3S50A FPGA in the Elbert is tiny; probably one of the most basic chips you can buy. However, I would argue that’s a not a bad thing because you need to learn the basics before you take off on any really ambitious projects, and having a limited platform forces you to do that.
The low price plus built-in peripherals make Numato’s products an excellent value, and I have had a great experience so far with their tech support.
Learning FPGAs
Once I got my Elbert, I started looking around for resources on the web that would teach me how to use it. I have documented the best resources I found on my wiki.
Once I had studied the resources I found, I started writing Verilog to operate the various peripherals. I started simply with buttons and LEDs, and from there progressed to the 7-segment display. I wrote some Verilog that reads the 8 dip switches on the Elbert, converts the value to decimal, and outputs the result on the 7 segment display. This was a considerably more complicated since it required implementing clocked logic.
Next I tackled the VGA output, and wrote some Verilog that displays munching squares and color bars. Although generating video sounds complicated, it’s really not much more difficult than the 7-segment display. I also wrote some simple logic to generate a tone on the audio output.
By far the most complicated peripheral on the Elbert is the SD card, which requires implementing an SPI interface, and then implementing a CPU so that you can write code to send the SD card commands and access a filesystem. Elbert has limited resources both in terms of memory and logic gates, which makes using doing this challenging.
On my Wiki, I have documented in detail the steps I took to get the various peripherals working, and I checked my code for the various peripherals into the numatolib Github repository.
Some say the best way to learn is to make mistakes, and I made a big one, by which I managed completely brick my Elbert by accidentally outputting a signal on the FPGA’s clock input. This interfered with the microcontroller that is used to program the FPGA and rendered the board effectively useless. Luckily I figured out a way to disable the FPGA long enough to allow the...
Read more -
Sears Silvertone
03/13/2021 at 05:07 • 0 commentsOriginally published in 2016.
My third antique radio project is a 1949 Sears Silvertone AM/FM radio (model 8020) that I restored for my father-in-law. This was his family’s radio when he was growing up.
As par for the course with radios of this vintage, it had a lot of electrolytic and wax paper capacitors that needed replacing.
Before
I ordered replacement caps from DigiKey and replaced each of them. Wiring up the replacement electrolytics required a little creativity since there as a shortage of mounting tabs available.
After
This radio was the first I’ve come across that uses a solid-state selenium rectifier instead of a tube diode. The rectifier is the stack of orange plates on the left.
Top Side
These rectifiers can be unreliable and when they fail they release noxious smoke that smells like rotten garlic, so it’s advisable to replace them with a silicon diode. Usually a high-wattage resistor is wired in series with the diode since it only drops 0.6V instead of the 10–15V drop of a selenium rectifier. I cut the leads off the old rectifier but left it mounted for appearance’s sake.
Silicon Diode and Series Resistor
The final step in my initial repairs was to replace the power cord as well as several internal wires whose insulation had become brittle and started falling off. To remove the power cord, I had to break the rivets that were holding the connector to the back of the radio and unfortunately damaged the back in the process.
Once I finished the initial repairs, the radio powered up and the AM played pretty well, but the FM was totally dead. Upon closer inspection I found that the radio had a 6AK5 tube where it was supposed to have a 6C4 for the FM RF amplifier. These are not even the same type of tube — the 6AK5 is a pentode and the 6C4 is a triode — and they have different pinouts, so it’s unlikely that the radio ever worked with this tube. I ordered a replacement 6C4 from Tube Depot.
Replacing the 6C4 didn’t do the trick so I turned to the folks at Antique Radios Forum once again for help. They suggested that the local oscillator (12BE6) might be weak and unable to reach FM frequencies. I tested the radio with a tube borrowed from another radio and after confirming that it fixed the FM, I ordered another 12BE6 so I could return the loaner to its original home.
After replacing the tube, the FM was still very quiet. The video below was taken with the volume turned all the way up.
FM Before Alignment
At this point, someone on the forum suggested aligning the FM coils. My signal generator isn’t capable of FM modulation, but I was able to perform a decent alignment by ear simply by tuning to a weak station and adjusting each coil up or down until I peaked the volume and minimized distortion. After the alignment, the FM band was as loud as AM and was picking up a lot more stations. The results can be seen in the video below.
FM After Alignment
The only remaining issue I haven’t fixed yet is the back of the radio. Unfortunately the particle board was quite brittle after all these years and began crumbling due to all the handling.
My plan is to find someone with a jigsaw who can cut out a replacement panel from new wood and then trim the old back around the AM antenna and attach it to the replacement back.
-
Air Castle
03/13/2021 at 05:04 • 0 commentsOriginally published in 2016.
This 1949 Air Castle AM/FM radio (model 149654) was was my second restoration project after my maiden voyage with a Motorola All-American Five.
Air Castle AM/FM Radio
The radio was a gift from my dad, who got it from a customer at his pharmacy several years ago. Originally, the radio was sold by Spiegel department stores in Chicago.
Initially the radio didn’t play at all. Opening it up, I discovered the inside was in pretty rough shape. Both the chassis and transformer were quite rusty.
Rusty Chassis
The advice I found online stated that I shouldn’t attempt to remove the rust from the transformer because the rust forms a layer of insulation between the laminations and removing it can cause magnetic eddy currents. The rust on the chassis was just cosmetic so I decided to leave it alone too.
The biggest problem was the rust along the track of the dial indicator, which kept it from tuning smoothly. To address that, I sprayed it with WD-40 and rubbed it with a cloth until all the loose rust came off. Once I did this, it tuned a lot more smoothly.
The radio contained several electrolytics and quite a few wax paper capacitors that I needed to replace. I left all the ceramic caps alone.
Before
As I replaced the capacitors, I also replaced any resistors that shared a solder joint with the caps. However, I didn’t disturb the rats nest of caps and resistors on the left. Since all of the caps there were ceramic, they were still working fine and they were packed so tightly that working on them would have been a nightmare.
After
All the tubes were in good working order so I didn’t have to replace any of them. I just wiped them down with a wet cloth to remove the years of dust.
Tubes Lit
The radio had a 6" paper cone that was in remarkably good shape considering how rough the rest of the radio was.
Speaker
Once I got everything replaced the radio powered up and played beautifully — no alignment necessary. All told, this was the easiest restoration I’ve done so far despite the rough appearance. The entire process only took me about 8 hours.
With the electrical restoration complete, I turned my attention to the exterior of the radio. Initially, the Bakelite was pretty dull and had a milky appearance to it. I wiped the case down with isopropyl alcohol to remove the years of grime, and then polished it up with Maguire’s Auto Wax to restore the shine. I used a toothpick to remove the wax from the grooves on the knobs and along the edges of the speaker grille.
Final Results
In the end, I was really surprised by how great this radio sounds. It has a rich, beautiful tone, with solid midrange. It’s my favorite of the three radios I’ve restored so far and I listen to it almost every day. It goes to show you can’t judge a book by its cover or a radio by its rust.
-
Vintage Motorola
03/13/2021 at 05:01 • 0 commentsOriginally published in 2016.
My husband inherited this early 1950’s vintage Motorola AM radio from his grandfather. I’ve always thought it was really beautiful radio, but it spent 17 years sitting on our shelves as nothing more than a conversation piece. Recently, I decided I wanted to get it playing again.
This type of radio is called an All-American Five, so named because it uses five vacuum tubes, and American manufacturers mass-produced millions of radios based on the same basic design from the mid-1930s until the early 1960s. The radio was physically in pretty good shape before I started restoring it. It has always been kept indoors and never subjected to any abuse. However, I would soon learn that 60+ year-old radios that have been sitting idle for 20 years still require a lot of effort to get them working again.
Reading Up
I read all the restoration advice from Phil’s Old Radios and read a lot more about the All-American Five on Fun With Tubes before I got started. I also found the schematics for my radio (Model 5X12U) on a site called Nostalgia Air that provides PDF scans of the schematics and service manuals for antique radios. When restoring an old radio the schematics are nearly mandatory.
First Steps
In my initial assessment of the radio, I found that the power cord’s insulation was crumbling, it was missing two vacuum tubes, and it still had all the original wax paper and electrolytic capacitors. Capacitors are typically the least reliable parts of any electronic circuit, and most restoration experts recommend replacing them before you even try power on an old radio. I had already replaced one of the capacitors (the orange one) before it occurred to me to take a “before” picture, but you can still see most of the original components in the picture below.
(Almost) Before
I replaced all the paper and electrolytic caps, the power cord, and ordered replacement tubes for the rectifier (35W4) and the IF amplifier (12BA6) that were missing. I believe the remaining tubes (12BE6, 12AT6, and 50C5) were original to the radio. I checked them visually for oxidized getters and tested continuity their heaters, and everything checked out, so I decided they didn’t need to be replaced.
Before powering up the radio for the first time, I built a dim bulb tester. The basic idea is that you wire a light bulb in series with the radio, and if anything is shorted out, the light bulb limits the amount of current that can flow through the radio and prevents any major fireworks. If the radio does short out, the bulb will glow brightly, but if everything is OK, it will be dim — hence the name.
Full of anticipation, I hooked the radio up to the tester and powered it on. The the bulb glowed dimly — a good sign that I hadn’t botched anything — but then… nothing. All the tubes lit up but I got no audio — no static, no hum, just silence. This was a major disappointment and it took me a few days to figure out what to do next. Then I discovered that the 22 ohm series resistor in the B+ line had drifted up to around 70 ohms, which meant that the radio was getting less than a third of the current it was supposed to.
After replacing this, I tried again and the radio slowly crackled to life. But something was wrong… it definitely worked, but it was temperamental. The station would play for a while and then suddenly the volume would cut out to almost nothing.
First Audio
I checked all the other resistors and found several more out of spec, so I decided to replace them and ended up replacing all the other resistors while I was at it, but there was no appreciable difference afterwards. I tested the voltages at all the points indicated in the schematic, and most of them are within a few percent of the specified voltages. Unsure what to do next, I turned to the Antique Radio Forums for help. I made a several videos showing the audio problems I was having and...
Read more -
Keeping up with the Commodore
03/13/2021 at 04:55 • 0 commentsOriginally published in 2016.
The Commodore 64 was the first computer that really got me interested in programming. I first used one in my 6th grade classroom while pretending to be sick so I didn’t have to play dodgeball! I never had one of my own; when I asked my dad for one and he gave me his old Heathkit XT compatible instead. Thanks Dad, but CGA graphics and a PC speaker were not what I had in mind! Eventually, I upgraded from the XT to a 386SX with VGA and a SoundBlaster, and moved up from there. Instead of CBM BASIC, I learned to program in GW-BASIC and then QuickBASIC and eventually went on to a fruitful career in computers. But I have had a soft spot for C64 ever since and always wanted one of my own.
Isn’t She a Beaut?
I finally bought my first C64 for $40 earlier this year. Mint condition, it looks like it spent most of its life in the box in a closet. The keyboard is still matte and looks like it never really got typed on. The power supply was DOA with an open primary on the transformer. Luckily failing open meant it didn’t take the C64 with it. I ended up replacing it with separate 5VDC and a 9VAC wall warts that I wired up to the original 7 pin DIN connector. Eventually, I’d like to mount the guts of the wall warts inside the original power supply housing for a bit more authenticity, but I’m not sure how to mount them to ensure they won’t come loose and short out on each other.
Makeshift Power Adapter
Since they don’t tend to like sitting unpowered for years, I went ahead and replaced all the electrolytic caps as the next step in my restoration, but I’m not sure it was really necessary. My mind has probably been warped by all the old tube radios I’ve restored.
The RF modulator wasn’t working, and I had to desolder it in order to replace the caps. I decided not to put it back in yet since my C64 model doesn’t require the it to produce composite video. Instead, I built a my own video cable from a DIN connector and an old AV cable. Sadly, the 5-pin model doesn’t have an external chroma connection, so someday I may wire up one up, similar to this s-video mod, which would improve the picture quite a bit. I’m torn between wanting better video and wanting to preserve the C64 in as close to its original state as possible.
After hooking the C64 up to my LCD TV, it worked, although the video was awful. Initially, I thought something was wrong with it, but after some research, I’m beginning to realize that’s about as good as it gets with composite video and an LCD screen. I recently picked up two 1702 monitors off craigslist, and the video looks much better on them.
The same guy also sold me a couple joysticks, 4 game cartridges, 4 spare CIA chips and 2 spare SIDs. He was also the former editor of Twin Cities 128, a Commodore 128 newsletter, so he threw in three issues of that as well. At $45 for the whole lot, I feel like he gave me a great deal, and he was a really interesting guy to talk to.
The SIDs were rattling around in the bottom of a box without any static protection, so I’m just praying they still work. If they do, I’m going to hook them up to an Arduino and build my own stereo SID player.
Of the cartridge games, Star Post is pretty fun. Kickman is OK as long as you play it on mute; I didn’t know it was possible to make a SID sound that bad! And Tooth Invaders? Wellll, is certainly an interesting historical curiosity. The Epyx 500XJ is an excellent joystick — much better than the Atari 2600 trash I was using before!
Disk Drives: Takes One and Two
Next order of business: I didn’t have a disk drive or tape drive, so I decided to build one. I had an Arduino lying around so I built a 6-pin DIN serial connector and hooked it up to my PC using Uno2Iec. Initially it worked OK and allowed me to load up some basic software but most of the games hung half-way through, and eventually I couldn’t get the C64 to recognize it at all.
A more advanced solution is the sd2iec, which uses...
Read more -
Hello World, 60s Style
03/13/2021 at 04:50 • 0 commentsOriginally published in 2017.
PDP-1 at Lawrence Livermore National Laboratory
As you might have gathered from my projects, I am a bit of computer and electronics history buff. I’m old enough to actually remember using an 8-bit Heathkit H-89 computer running CP/M (when I was five!), but I know of an earlier era of computing history only through books like Steven Levy’s Hackers.
The first several chapters of this book tell the story of revolutionary computers like the TX-0 and PDP-1, and the people who worked on them at MIT in the 1960s. There, they created — among other things — the very first digital video game, Spacewar! If you haven’t read Hackers, or even if you have and want to know more, you can read a detailed account of Spacewar’s origin online.
Several years ago, the Computer History Museum restored one of MIT’s PDP-1s to operation and they demonstrate it every weekend. Sadly, they weren’t giving a demo while I was there, but there are several videos online, of which this is the best:
The Computer History Museum’s PDP-1 in Action
Even better, Norbert Landsteiner has created a very accurate online emulator for the PDP-1 so you can play Spacewar! yourself. Also on his site, you can see Minskytron, Munching Squares, and Snowflake in action. He has painstakingly documented the inner workings of Spacewar as well.
Watching the videos and playing the game and the demos on an emulator really brings the stories from Hackers to life, but how could I consider myself a true PDP-1 aficionado until I had programmed one? And as K&R famously tell us, “the first program to write is the same for all languages: print the words ‘hello, world’.”
Since the only functional PDP-1 still in existence resides at the Computer History Museum, I’ll be using a cross-assembler and emulator instead. SIMH is an collection of emulators for mainframe and minicomputers made from the late 50s through the late 70s, including the PDP-1. Also available on the SIMH website is a collection of tools, including cross-assemblers for the PDP-1 and several other computers. After getting the tools, I found and read the manual for the PDP-1 and the assembler.
In case you don’t have quite the same level of commitment I did, here are the Cliff’s Notes: The PDP-1 has an 18-bit word length (this was before computers standardized on multiples of 8 bits), and uses a 6-bit character code called FIODEC (this was also pre-ASCII). Therefore, it’s possible to pack three 6-bit characters into a single 18-bit word. The term “word” could be a bit ambiguous when discussing a program that prints out English words, so to clarify, I am henceforth referring to 18-bit computer words every time.
The PDP-1 has two registers: the accumulator and the I/O register. The accumulator is where it does all the math, and the I/O register is where it stages data for input or output. The tyo instruction will type out the character represented by the right six bits of the I/O register. Since three 6-bit characters are packed into an 18-bit word, outputting them requires some low-level bit manipulation. When doing bit shifts, it’s possible to treat the accumulator and the I/O register as a combined 36-bit register, with the I/O register on the left, and the accumulator on the right.
To print the entire string of characters, the program will start by loading a word containing three characters into the accumulator and clearing the I/O register. It will then shift the left six bits from the accumulator into the right six bits of the I/O register, and print out the character. This shift and print sequence is repeated twice more, until the accumulator is empty. At this point, the address of the current word is incremented and compared against the address at the end of the string to determine whether the entire string has been output. If so, the program halts; otherwise it repeats the entire process.
Each line of the assembly...
Read more