25 March 2016

Apple Keyboard II Modification

The first computer my family owned was a Apple Macintosh Performa 550, which died before I was able to revive it (I had played around with the registry too much and killed the OS). The computer was tossed/recycled, but without the keyboard.

I picked it up and kept it at my desk, figuring there'd be a way to hack it to work with USB or something, but it sat for quite some time before I actually looked it up.

I was right, there's an ADB (Apple Desktop Bus) to USB convertor that can be made with a Teensy 2.0, and also a pre-made one by Griffin (which seemed to not work very well). Last month I finally broke down and got the Teensy 2.0, but didn't do anything with it besides grab the 1k ohm resistor that I would need for the mod.

When upgrading Triela to Windows 10, I got bored and decided to work on the mod, first with the wires and resistors. I used 22 AWG wire, and I noticed that the resistor legs were just thin enough to enable sticking in the hole with the wire. It was a lot easier said than done, but I managed to do it with it looking fairly nice.

"Top" and "bottom" of the Teensy 2.0 with the wires and resistor (the shield drain wire is being used for GND, but is hard to see).

After soldering, it looked quite nice.

"Top", "bottom", and the unit ready for the next step.

I then figured out the pins on the keyboard, checked numerous times, and soldered the wires appropriately to some filter/isolation block thing (because it was easier than de-soldering it).

Closeup of the solder-work, board overview, board in its proper location.

I then played around with the casing to see how much free space was left, which was quite a bit, and the location I figured worked just as planned.

<
Teensy 2.0 lined up to some pre-existing groove, spacing inside (nothing close enough to short anything), cable plugged into the Teensy (with the ferrite choke being held by the ground strap thing, and the inside view.

I loaded the firmware to the Teensy and got nothing, and trying different firmwares also yielded no results. I checked the pinout again, checked the resistor was across the correct pins, checked the Teensy itself with the LED flash firmware, and then looked closely at the keyboard PCB. I found absolutely nothing visibly wrong.

I then played around with a multimeter and looking at resistances and found there was absolutely no resistance reading between the voltage in and ground pins of the keyboard's microcontroller ("OL" on the display, not a short). From what I kinda remembered from work, there should be some resistance between those pins, but there wasn't anything. Now that I think about it, I don't recall if I changed the resistance reading range or not.

Anyway, I was a bit upset that the microcontroller was dead, since I wouldn't be able to revive the old keyboard. I'll have to check again with my auto-ranging multimeter, but I'm fairly certain the microcontroller's dead. If it is confirmed dead, I'll probably use the Teensy 2.0 for a PS/2 to USB convertor instead.

CFS

Late last year, sometime after learning SSHFS, I realised that it would be very convenient to have a centralised file server. Yes there is the NAS, but I prefer using it for backing up, considering RAID 1.

Anyway I bought another Banana Pi and hard drive, and poked around Amazon to find a box sized appropriately. Once I had all the parts, I got to work. I used the fan from the smaller Raspi "case" since it was the best option. I did a bit of prototyping and figured out the best locations for the Banana Pi and the fan, drilling the mounting holes soon after confirming.

It took quite a bit of time and effort to get the hole for the ethernet lined up correctly to cut, and after was finished cutting (not much less awkward than the double drive pi), I realised I cut too much, so placed a piece of tape on the inside, so that not much air would enter from the ethernet hole. For the power cable, I drilled a couple holes next to each other and cut out the plastic in between them before cleaning it up with a needle file. Once I was done with that, I taped the mesh over the intake hole and began prototyping a bit more.

Inside view, intake hole, fan hole, power and ethernet holes, and inside of the ethernet hole.

While the power cable fit just fine through its hole, there wasn't anything that would stop it from being pulled out, nor would there be anything to keep the air from entering. I was wanting to use Plastimake, but I didn't feel like working with it. I looked around for some relatively thick plastic that I could use, and eventually came upon some picks for bass guitar, which I decided would be the best to use, as it would be the most time-efficient to modify. I drilled a hole, cut a slit to the hole, and made a couple more cuts to make a right-angle. While it's not entirely perfect, it was good enough.

Stopper orientation, and as prototyped.

The fan was a bit annoying because the closest hole saw was slightly larger in comparison to the fan, but I used some thin plastic from a blister pack to make a shim to minimise the air leakage. I think I used some leftover metric screws to mount the fan to the box, and the screw was much longer than needed, but I decided to leave it, as I didn't want to spend forever and a half cutting it down with the saw.

I used some small washers between the screwhead and fan, as well as between the nylon locknut and the box. I didn't really need the one between the screw head and the fan, but since the head was kinda large, I wanted the pressure a bit more even (or maybe something else... I can't really remember). I probably didn't need the washer between the nylon locknut and the box ether, but the fact that I had to drill the hole for the exhaust larger than I wanted made me a bit weary.

Inside and outside of mounted fan.

With that finished, I played around with running the cable in the box, finally finding a good path that wouldn't become a problem, but left little slack.

Not sure what caused the bottom edge to be blurry in some of these shots.

I then mounted the Banana Pi, plugged the fan in, and plugged the power in to test the fan. The connector I used is a 3-pin connector and the wire ties the two 5VDC pins together; the wires were taken from a "salvaged" IEEE 1394 (A.K.A. Firewire) header cable, and I didn't feel like chopping off the extra connector. I found the fan to be a lot noisier than I remember it being, and while it did confuse me a bit, I didn't really care that much.

Banana Pi with power (and without a micro SD card) and spinning fan.

I then moved onto figuring out the location for the hard drive on the lid, and at first, I was going to mount it directly above the Banana Pi, but the SATA cable made that idea more awkward than I wanted it to be. I then mounted it longitudinally along the length of the lid, keeping the hard drive as far away from the fan as possible.

Red marks was where I originally wanted the hard drive to be.

Once I put the stand-offs on the hard drive and had the hard drive mounted to the lid, I plugged the SATA cable in on both sides.

Just about finished.

Once the lid was fastened, I connected everything and set it up a bit before moving it to its final location. Something happened between power down and powering it back up after the move, and so I had to re-image the micro SD card and get everything set back up. But once that was done, I had a nice, easily-mountable file server.

The screws ended up spacing the box away from the interior side of the shelf it sits on, so it has plenty of space for the exhaust. Unintentionally genius.

I think it was earlier this year I updated it, and after rebooting, it wouldn't boot into openSUSE Tumbleweed properly. I diagnosed it a bit before taking the micro SD card to my room to grab the vsftpd.conf file (and I think fstab as well) before re-imaging it with the latest image. Luckily it only took a couple hours to get it back up and running, so it wasn't a horrible time loss. Luckily with the Banana Pi side of the 2(DrivePi), I didn't reboot, so the update that broke the CFS wasn't applied.

SSD from 10 Micro SD Cards

The article I read is: This Brando Adapter Turns Ten microSD Cards into a SATA SSD (which appeared as "Memory Card Hard Drives" when I viewed it on my phone).

 It's not really a new concept (there's CF to IDE adaptor cards floating around the net), but I was just surprised to see it come up.

While it's not the most cost-efficient way to make an SSD, it does give micro SD cards some use if you happen to have a ton laying around.

While it'd be nice to have, considering it could (probably) make a 5TB SSD, I feel like it probably wouldn't be worth my money, since I don't have extra micro SD cards laying around.

Ribbon Cable Tester

I can't  remember if this was the first PCB I designed, but it was definitely the first one that I had made. At work, there's a couple 10-pin (5 pins by 2 rows) IDC connectors that we use, one of which I can access the crimp terminals from the lid, and the other where the lid provides no access. Every so often, there'd be a short between the wires, which is caused from a bad crimp.

The first-mentioned style (let's call this "TE-styled" based from the manufacturer's abbreviated name) I can easily check for shorts with a multimeter after crimping the cable(s), but the second-mentioned style ("Kobiconn-styled") I have to insert a header far enough into the connector to make contact for use the multimeter. While I could insert it all the way, it makes it that much harder to remove once finished.

So I had thought of making something that would it make it much quicker and easier to check for shorts for the Kobiconn-styled connectors, and there's a bag of red/green LEDs that aren't being used for anything, so I grabbed what I needed for the project along with an unused LM317M.

It took a bit to design the board, but once I was done and checked it a couple times, I sent the design out to OSH Park. It took a bit of time, but once I received the PCBs, I was a bit awestruck - mainly from just seeing something that I designed look so professional.

Standard order of 3 boards, top of the board, and the bottom.

I soldered the voltage regulator on first, then the resistors, and then the LEDs before the 10-pin header (which was actually 16-pin, but I trimmed it down). I didn't take into account of the minimum length of the resistor with bent legs, so I had them close to the board on one side and angled upward on the opposite side.

The completed board with test cable attached.

I also had gotten a case and drilled the necessary holes to mount the board, but wanted to leave the final assembly for when I was at work, considering the voltage regulator is ESD sensitive. I then tested the board to make sure everything worked just right, and the green side of the LED was much brighter than I expected - flooding the nearby LEDs.

Power on, pins 1 and 2 shorted, pins 1 and 6 shorted, and all pins shorted.

When designing, I realised that I used a bad reference, which caused me to mis-mark the top-left pin as pin 1 and the bottom-right pin as pin 10. It was the last thing I fixed before sending it out. While I could have fixed the LEDs to correspond correctly, I didn't feel like taking the time to.

Not long after I completed the test, I realised that there were some 3mm LEDs at work as well, and in quite a large quantity. I wasn't too happy with myself, considering I had just spent about 15 USD for the test board, but I was determined to make it better.

The next set of boards.

If you're paying attention, you'll notice that "R3" is missing. I had omitted it because I figured that I would just lower the voltage appropriately and the power LED would light without needing a resistor. I should have given another day before sending the design out, considering I would've caught the mistake.

When testing this version of the board, none of the LEDs (beside the power LED) lit up, and I was confused, trying whatever I could to diagnose the problem. When I was about to give up, I saw a very quick flash and was quite confused, trying a few thing before shorting the legs of the LED, which is when I realised my mistake - the forward voltage of the LED is 2 volts, which is what I had the regulator output.

No other pictures for this version...

I was a bit stressed, now that I've spent another 8 USD in addition to the previous 15. I think I played with the adjustable voltage regulator unit that I made and found that I couldn't make 4 volts from 5.2, so I looked at all the adaptors that I had and coming across the adaptor from the Ikea lamp. I measured the output voltage, and it was just barely over 4 volts (4.02), which I figured would be more than enough, so I went back to my computer to design another revision.

Since the supplied voltage would be exactly what was needed, I only needed one resistor for the power LED, which helped make the board that much smaller. I decided to get rid of the ground pad that I had with the previous revision, since there wasn't going to be anything ESD sensitive on the board. When I received the boards, I set one on the soldering station, and the other two in the pile of tools and stuff next to my benchtop power supply.

It sat for a while, since the company had just moved buildings and I wasn't entirely operational yet (mainly the fact that I didn't have a need to make any ribbon cables). When I was doing the Windows 10 upgrade on Melty, I was bored and decided to solder the parts and then work on whatever I could. I forgot to take a picture of the boards themselves, but it's not horribly different from the previous version.

Parts soldered.

For testing, I didn't feel like messing with the cables because the cable from the adaptor wasn't very long (maybe about 15cm at most?), so I just clipped it together with some alligator clips to my "testing" cable (it's a cable that normally "connects" to my benchtop power supply and is inserted into a couple breadboard holes), stuck a couple of the legs into the appropriate holes, and carefully fed the legs through the power holes of the PCB.

Not entirely the best idea, but I didn't care too much.

After plugging in the cable to the adaptor, the power LED lit up, which was nice to see, but didn't mean anything at all to me. Before I was actually able to properly test it, the ends of the test cable had a mind of its own and wanted to short themselves while I tried to set it up. I tested pins 1 and 2 as usual, and the tested all the pins which gave a good result, as all test LEDs were the same brightness.

Pin 1 and 2 short test, and all pins short test (camera app I use has a weird glitch that crops the image weird when viewing right after taking).

I was quite pleased that I didn't muck up as badly this time, and proceeded to drill the new mounting holes in the case, as well as the holes for the on-off switch and the hole for the cable. I took the parts to work and did the final assembly not long after.

Completed unit, and switch in the on position.

I was going to cover the other holes with electrical tape, but I forgot and didn't care after the board was mounted to the case. I also realised that I mounted the switch backwards (I wanted on to be toward the board), but considering I used the anti-torque washer, I didn't care to have extra holes.

After 30 USD, I think I learned to be entirely certain well enough.

24 March 2016

2(DrivePi)

With how long it's been with these projects and everything happening else between then and now, it's really difficult to remember all the details - please bear with me. (A quick notation to those that haven't noticed by now.)

Early February of last year, I wrote a couple posts that I was considering a Raspberry Pi 2, and the fact that it was six times faster than the B+ made it more appealing.

At some point I ended up finding a dual-core ARM board that was released as competition to the Raspberry Pi called the Banana Pi, which has gigabit ethernet and a SATA port. I was quite interested in it for using it for my bittorrent server, considering I can properly hook up a hard drive and be able to pull files off of said hard drive over the LAN much quicker.

I believe it was around early May that I began thinking of how to mount everything - the Raspberry Pi 2, the Banana Pi and the 2.5" hard drive. I drew quite a few designs and my friend at work gave me the suggestion for a 3D-printed case, which I didn't feel was going to be worth it. I originally wanted the case to have separate layers for each item and have the airflow in a certain way where it would effectively cool each item (there would be a fan that pushes the air out). I eventually realised that it would be space efficient to have a case that mounts to the back of a monitor, so it takes up less table space, and I took quite a bit of time to pick out a good box before drawing up anything else.

I then spent quite a bit of time figuring out how I wanted to arrange the parts inside the box, since I wanted to try to have a good airflow so the parts stay relatively cool. I think I went through a few ideas with the fan on the side wall (in relation to the box itself) before realising the fan hole would be fairly difficult to cut.

Eventually I found a couple of unused blower fans back from when I was trying to keep Ziggy cool, one of which didn't have wires because they broke off. I soldered a pair of wires to it and tested it, finding that it worked just fine, so I decided to use that instead of the regular case fan.

Since I was going to have another hard drive to keep my music files local for the Raspberry Pi 2, I had to keep the arrangement simple enough, and using an adaptor for mounting two 2.5" hard drives in a 3.5" bay was the way to go. I eventually decided to have the hard drive stack sit in the middle of the box, toward the side (again, in reference to the box), have one of the single-board computers (SBC) to one side of the stack, and the other to the other side (upside-down), with both SBC toward the opposite side (in sort of parabolic curve); the fan would be attached to the lid and blow out of the side.

Luckily, I waited long enough and a new version of the Banana Pi came out which had a bit of improvements, and so I bought it along with most of what I needed. I carefully drilled the hole patterns for the hard drive, the Raspberry Pi 2, the Banana pi, and VESA mounting before doing a bit of prototyping with the boards and box.

I used some of the stand-offs that I bought to mount that PCI-E adaptor thingy that I put in Melty to stand off the SBCs, and eventually found that I was going to need more than just one to properly run all the cables. I ended up using four for the Raspberry Pi 2 and six for the Banana Pi. Since using a bunch of the stand-offs wasn't exactly straight, I decided to look for something similar in height for both. For the Raspberry Pi 2, I used a 30mm stand-off (which accepts screws on both sides, lowering the height from the prototyped 32mm), and 50mm for the Banana Pi (accepts a screw on one side, raising the height from the prototyped 48mm). Luckily, the two millimetre difference of both stand-offs were really negligible when I prototyped it again.

When prototyping the first time, I realised that the adaptor brackets blocked the lower holes for the VESA mount, so I originally came up with that I would mount the lower hard drive to the box, mount the box to the monitor, then mount the bracket-attached upper hard drive to the lower one in a really awkward way. Eventually I had a "kickself" moment and grabbed some scrap aluminium sheets from work and made my own mounting plates, so that the lower screws wouldn't be blocked off (and also saves the adaptor bracket for its intended use).

With that, I carefully drilled the intake hole horizontally centre between the holes to the hard drive mounting a bit toward the bottom of the box (in relation to it's mounted configuration), cut the hole for the blower fan, and drilled the holes for mounting the blower fan. I think I also cut the holes for the cables at this time as well. The holes that I cut were awkward to do, since I was using a jeweller's saw, and if I had the right bits for the high-speed drill, I probably would have used it.

Inside, backside, and inside bottom of the box.

Since the only button-head screws I had were metric (there's a very small selection of small button-head screws at work), they ended up being much longer than I needed, and I prototyped a bit to figure out how much I'd have to cut off, which definitely easier said than done. I used button-heads because of the low profile, and I wanted to keep air resistance to a minimum since the heads were to reside inside the fan.

I made the mistake that I wouldn't be able to tighten the nylon locknuts or properly assemble the fan while doing this, and so I had to drill a couple more holes in the fan's case, so that I could access the screws. I obviously covered the holes with electrical tape and cut off the angled part of the metal bracket (which can partially be seen in the top view picture).

Inside, outside, and top of lid with fan attached.

Though it wasn't really needed, I kept the silicone seal piece in the lid (I had to actually remove it to cut the hole because it was annoying). I then cut a square of the mesh stuff that I bought as a filter for the side panel for Mei-chan and taped it on the outside of the box over the hole. I tried not to cover the holes, but I found I hadn't much choice and cleaned the holes with an X-acto knife.

Inside and outside of the box with the mesh (I propped the box up for the inside view because the mesh blended into the carpet).

With the mounting plates, I taped the two pieces together, so that I could drill two holes at once, and it was somewhat awkward to mark the holes from the adaptor bracket, but the holes came out just fine. It was a bit tough to position the holes right, because I wanted to where it directed the airflow some, keep the drives apart enough, so that it wouldn't interfere too much with each other (because I had it planned where the tops of the hard drives would face each other), and not have the holes too close to the edge of the metal.

Adaptation bracket, and the two mounting plates.

Sometime during testing, the Raspberry Pi 2 wasn't able to power the hard drive I wanted to use, so I was forced to buy an SSD for it (the Raspberry Pi 2 literally puts out no more than 500mA, and the hard drive I was trying to use needed another 50mA :T).

I just remembered that I wanted to space the hard drive apart from the SSD so that the SSD has a less likely chance to absorb heat from the hard drive (in retrospect, just something that really wouldn't matter). Anyway, after assembling the hard drive unit together, I realised that I could've lowered the mounting plates a bit more to really direct the airflow. Que sera sera.

Top 3/4 view and "bottom" view of the unit.

Since the stand-offs are screwed into the bottom mounting holes of the hard drive, I had to use some washers to reduce the length of the screws to the mounting plate. The threaded portion of the stand-offs were too long for the bottom mounting holes of the hard drive, so I used the included nut to reduce the length. I believe I used thread-locking compound for (at least) the bottom mounting screws to the mounting plates, so that the vibration doesn't loosen the screws.

3/4 view of the washers, and bottom view of the unit.

After assembling the hard drive unit, I mounted it into the box.

Inside and outside with the hard drive unit mounted.

Then I mounted the SBCs (after plugging the fan into the Banana Pi, since it's "upside-down") and mounted it to the monitor. I used a washer between the screw-head and the box since the plastic was a bit soft (I don't remember if it's ABS, poly-carbonite, or a mixture of both). I used a spacer between the box and the monitor, so the intake wasn't clogged, along with keeping the screws and nuts from pressing into the monitor (or worse, warping that side of the box). As I positioned the lid, I routed the cable to the fan, so that it wouldn't get sandwiched on any of the seams. It turned out quite well, minus the hand-cut screws protruding from the nylon locknuts.

Finished inside, outside, and top.

I had the Raspberry Pi 2 hooked up to the DVI port and the Banana Pi to the VGA port, and use the monitor's menu to switch between them (when needed).


Later, I got the button-head screws in the right length, so that it would be flush with the "top" of the nylon locknut to look nicer.

Colour is slightly off because of the flash.

Later I did some experimentation with the command-line interface of transmission and found it wasn't all that bad, so I decided to redo the Banana Pi a bit, so that I wouldn't need the monitor (or Bluetooth adapter). While I thought it'd be simple, it was a bit different than I was expecting (the folder was a bit different because the folder the CLI uses is transmission-daemon and not transmission. Once that was figured out, it was up and running in openSUSE Tumbleweed instead of the Banana Pi openSUSE image.

The Raspberry Pi 2 is better than the original Raspberry Pi (generation one), but still don't see the 1080p playback (again, with XFCE and VLC)... Whatever.

With the announcement/release (I don't remember off the top of my head at the moment) of the Raspberry Pi 3, it will be replacing the Raspberry Pi 2 after some testing. I might run Debian testing on the Raspberry Pi 3, but we'll have to see. The reason why I want to do this is because the Raspberry Pi 3 has built in Bluetooth (and also WiFi, which will be turned off), which saves me a USB port. It also has a bit of a performance increase, but I'm not expecting much. There's also the ARM64 architecture, but I'm doubting it'll have any visible impact either.

As far as the name goes, I took a few days to think about it, eventually turning "double drive-by" to "double drive-pi" because there was two "pi's" and two hard drives. I quickly put the "official" name in mathematical notation - 2(DrivePi) - where "DrivePi" is each Pi and hard drive combination, and the 2 in front of the parenthesis multiples the parenthesis' contents by two (in other words, doubling). I kinda want to have it on the lid, and use the screw/nylon locknut protrusion for the dots of each "i", but it wasn't going to be doable. Well, I had thought about it again, and I could very well put the two at the end, though it technically would be read "drive-pi doubled" instead. I'll worry about it when I actually care.

That's all on the 2(DrivePi) for now. It's not 100% complete, but at least it's well over 90%.