# Macintosh Tiny

Back while I was preparing for /dev/world this year, I had split my attention in a few variations on a theme:

• Fixing original Macintosh hardware (the Macintosh Plus);
• Emulating Macintoshes on modern machines;
• Constructing a Raspberry Pi case that looks sort of like a scaled-down Mac.

Since I ran myself out of time at /dev/world to talk about “Macintosh Tiny”, that’s what this entry is about.

## The goal

The goal was to shove a Raspberry Pi, a small LCD panel, and maybe an amp and speaker, into a case that looks sort of like a miniature Macintosh Classic, and then run an emulator on it. Peripherals of the era, namely, floppy disk drives, hard disks, SCSI ports, serial ports, ADB ports, and so on, are not part of the project. While everything that could run on 5 volts could easily be battery powered, that was also not a consideration.

Other than the Raspberry Pi 3, I found a couple of cheap 5-inch LCDs (800x480 resolution, unnecessary resistive touch feature). The HDMI and micro USB connectors for these panels sit on one of the long edges - it’s designed to mount the Raspberry Pi directly, consuming the GPIO pins and 5V from the Pi, and get HDMI over a small nub of a circuit board which has two HDMI connectors back to back.

However, my case idea called for the Raspberry Pi to go in the bottom of the case so the USB and Ethernet ports could be exposed (analogous to where the logic board and ports are situated on a real Macintosh). This meant one thing I was worried about early on in the process was how I was going to cram a whole bulky HDMI cable and power for the screen into the front of the case, especially if the display’s natural rotation had the connectors coming out the top (Narrator: it was), because then the “head” of the Tiny would have to be made unnaturally tall to hide the cable connectors. Turns out, money solves all known problems, and later on I ordered some 15cm-long flat-ribbon HDMI cables with right-angle connectors on both ends.

I started by thinking I’d 3D print something, so began messing around in OpenSCAD. I feel like I “get” the program-like, constructive solid geometry style of OpenSCAD. However, I’ve never 3D printed anything before in my life, nor have I successfully designed the mini Mac case, so started thinking about ways to shortcut the process.

## The case: balsa wood

Someone suggested balsa wood. So I went and got some. 100% Australian plantation-grown balsa wood, and a bottle of PVC glue, from Lincraft.

Benefits of using balsa:

• It’s lightweight;
• Soft and easy to work with, using a regular blade and cutting mat;
• Not very expensive;
• Nails go in very easily;
• No need to wait for a 3D printer to print;
• Various glues stick easily, including PVC and hot glue, and
• Comes in a variety of cross-sections (flat, square, circular).

Downsides are:

• Due to how easy it is to work with, it can be easy to break;
• It’s a reasonable insulator of heat, which isn’t great for electronics;
• It burns easily, and
• I cannot saw straight to save myself.

To start making a case out of balsa, I was inspired by the Macintosh construction: the computer internals are bolted to the front case, and the back shell then slides on to cover it all up. So for the first two attempts, I started with a sheet of balsa, put the display face-down on top, and then tried to assemble a case upwards.

This approach didn’t work very well. For one thing, the 5 inch display is relatively heavy compared with the Raspberry Pi, so when the proto-Tiny was upright it was unbalanced and liked to topple onto its front again.

The third attempt at constructing a case was successful, probably because I started from the bottom instead of the front face, and used longer pieces of balsa that I cut from a square rod. This lowered the centre of gravity to avoid toppling the Tiny. It also looked more like a scaled down Macintosh at this point, because the slope of the top could be judged more easily.

At this stage I had the display locked into the balsa wood case, the Raspberry Pi mounted on the bottom, and the Pi could be powered via a USB cable coming out the back. The display was then powered via some breadboarding cables from the Pi. This mostly worked, but had some low power issues.

One problem with making a scaled down Macintosh and preserving the angles is the display: with my cheap panel, which didn’t have a great vertical viewing angle, the unit is only really usable at eye level. I fixed this after finishing the audio system by giving it some balsa wood “feet” at the front, making it look a little less like a Classic and more like a Colour Classic.

## The power supply

Once I decided to have inbuilt sound, and thus an amplifier which used more than 5 volts, the power situation became more complex - I didn’t want to run off a regular USB power source any more. The solution was to take an input of e.g. 12 volts, and feed it into a combination of a 9V regulator for the amplifiers, and a step-down converter for the Pi and display, providing an ample 3 amps (badum-tish).

## The audio

Original Macintoshes have an inbuilt speaker and line out. I didn’t much care for the line out but thought an inbuilt speaker would be a nice touch. Ultimately I ended up with stereo, mounting the speakers with glue onto some holder balsa which I then glued to the side panels. Given the emulator was outputting mono audio anyway, the second speaker is overkill, but a nice touch.

There are some major issues with the Raspberry Pi as an audio source:

• The Pi uses “PWM out” for the digital-analog conversion, which generally sounds kind of bad. Not much I can do about this issue, but it’s good enough for an emulated old computer.
• The Pi likes to detect the HDMI screen as an audio output. This behaviour can at least be tamed with the /boot/config.txt.
• The Pi cannot drive low-impedance speakers directly for very long, and even if you force it to, it sounds crap (ask me how I know). The sound chip shuts down when overloaded (good). You can’t turn the volume back up with alsamixer when this happens.
• If you use standard earbuds, the sound from a Pi is generally OK, but if you use an amplifier on the same power supply there are two huge sources of noise which overwhelm the signal: power supply noise, and ground loop noise.

I found that a 7809 regulator wasn’t enough to reject the power supply noise, and ended up making an additional C-L-C filter to remove power supply noise from the Pi and display. I wanted to remove noise down to at least 100Hz (possibly overkill), so using this old formula:

$$f = \frac{1}{2\pi\sqrt{LC}}$$

what I wanted was something like ~47µF capacitors (easy to obtain, even as tantalum caps) and 20mH of inductance. I figured the best way of producing that much inductance was to get a spool of copper wire, a toroidal ferrite core, and wind a coil myself. After wasting a few meters of wire in frustration, Hannah suggested winding it onto a pen, and then feeding the pen through the toroidal core instead of wrangling lots of loose wire. Because the ferrite and wire is kind of heavy, the centre of gravity is lowered even further depending on placement.

To get rid of the ground loop noise, I did some quick research on how ground loop isolators are implemented. The easiest seemd to be with coupling transformers, and Jaycar sold those too. Jaycar also sell pre-made isolators with 3.5mm connectors in a case, which are only a few extra dollars compared to the transformers alone.

Actually, Jaycar stocked all the electronics I ended up using for the audio system, including two cheap 1 watt amplifier kits. A single one of these and one speaker would have been fine, as would a stereo amp, but these boards are tiny. The only downside is demanding more than 5 volts, which meant the power supply was slightly more complicated.

The full-range speakers I shelled out for were pricier than a “regular” 8-ohm hobby speaker, but more compact (36mm on each edge) and pack a decent punch across the frequency spectrum.