Early Designs: Wireless Retrofit for NES and SNES controllers

2014-12-07 19:46 - General

I learned about a fancy chip called the nRF24L01 a while back. It packages up all the hard work involved in wireless data transmission into one simple chip. And it's available online for quite cheap. I've also got a great collection of video game consoles. Most of them either came with wireless controllers by default, or it's easy to find aftermarket controllers that add wireless support. Not so for the original Nintendo console. Which set me down a bit of a path.

My first proof-of-concept, with two nRF24L01 chips each hooked up to an Arduino. I got some of those chips and hooked them up. Actually, I got what turned out to be some cheap knockoffs, which didn't work, first. But the second set I tried (ten for $5!) worked great. They were only sitting a couple inches apart, but I could reliably send data from one to the other, and observe the acknowledgement sent in reply. Overall, that was the easy part. I have to decide exactly how to read which buttons are pressed, plus when and how to transmit that data wirelessly to the receiver half, but there's plenty of good options to choose from, and software is easy to fix. What I really want is a good wireless controller that will work for the original NES. One for the Super Nintendo wouldn't be bad either. Turns out the controllers are almost identical (besides of course the extra buttons), so if I want I can make one SNES controller that will work (with the right receiver) on either console. So that's my goal.

The schematic for my design, so far. The PCB for my design, so far.

This weekend I've been working on the more complicated bit: the circuit. I've used Eagle once before. I put a few hours into the schematic before I tried to turn it into a PCB layout and realized that I want to make something about 13x5 centimeters, but the free version of that paid program is limited to 10x8. Too small! So this time I tried KiCad a similar, but open source and thus not limited, program. The picture above left is the schematic. The giant yellow box is the Atmel ATMega328 micro controller, above it two connectors (one for the nRF chip, the other a programming header), to the right all the buttons of the controller, and the rest is the power circuitry including an illuminated pushbutton switch to control power and display status. On the right is the PCB holding all of those. Credits to Andy Goetz who did the hard work of getting the outside cut edge to lay out the correct way for a very similar project. (Though I had to post-process his work a bit to import it, plus that's his most recent post and it's over two years old, so I wonder if he finished?)

I've still got a ton of work ahead. I want to be really sure that all this is right before I send it out to be made. It will cost in the range of $50 to make the PCBs, which I don't want to waste. Not to mention triple checking that all the parts really fit where I've put them, I especially need to double check the battery charging circuitry. Don't want to blow up a battery and ruin all this hard work!

Resolving hostid mismatch with ZFS

2014-11-29 18:59 - Linux

All of my ZFS-using Linux machines have recently started spewing ZFS status errors:

$ sudo zpool status
  pool: rpool
 state: ONLINE
status: Mismatch between pool hostid and system hostid on imported pool.
        This pool was previously imported into a system with a different hostid,
        and then was verbatim imported into this system.
action: Export this pool on all systems on which it is imported.
        Then import it to correct the mismatch.
   see: http://zfsonlinux.org/msg/ZFS-8000-EY
  scan: scrub repaired 0 in 0h30m with 0 errors on Sat Nov 29 04:51:59 2014

Critically, it causes various cron jobs to send mail (with this error) which were previously silent. So what's going on? What I know for certain is I can:

# dd if=/dev/urandom of=/dev/stdout bs=1 count=4 > /etc/hostid
# hexdump /etc/hostid
0000000 9872 1823
# hostid

This is running booted into a fully operational system. Notice the byte ordering! The contents of the file are in network (big endian) order. If I regenerate the initramfs after filling this file:

# xzcat /boot/initramfs | cpio -id
# hexdump ./etc/hostid
0000000 2318 7298

The hostid file in the initramfs does not match the input file from /etc/, due to genkernel's mangling of the hostid value. So you can't generate a host ID that way. Unless you work around that problem by copying the hostid file out of the initramfs into your live system! Once the files match, zpool status will no longer complain.

My Hand Made Video Game Frame

2014-10-26 19:32 - General

The huge lot of Japanese Super Famicom games that I started with. A while back I got a giant lot of one hundred cartridges for the Japanese game console Super Famicom. I wanted quite a few of them, some for collecting, some to play. (They work in a standard Super Nintendo, with just some small modification to make them fit.) But the rest had less of a purpose. But I noticed that the labels were colorful and fanciful, especially the ones with little to no English on them. I decided to treat them like art.

The router table was an invaluable tool. A router with table, $50 from CraigsList, was necessary to make this project work. The plan was for a lot of long dado grooves for the cartridges to fit in.

The first test to verify that the groove idea worked. The first step, with some scrap wood, proved the idea. I put some grooves in the scrap pieces (cut to size) and clamped them down at the proper spacing. It worked!

Clamping the rails together to sand them to identical length. So next I cut out all the horizontal rails to the proper length. By hand, so they weren't perfect. Next, clamp them together and sand the ends to make them exactly the same length.

The first step done, the rails have their grooves routed in. Then the rails were routed. Pro tip: set the proper depth of material to keep, then route the same piece from both sides. The groove ends up perfectly centered.

Here's the trick: grooves of different depths, shallow on bottom, hold the cartridges in, but lifting into the top groove leaves enough space to tilt them in/out. Here's the routed rails again, from their ends. Notice that each rail has one shallow groove, and one deep groove. Again, the shallow groove goes on the bottom. The deep groove goes on top, spaced to leave just more empty space than the bottom groove. When the cartridge is lifted, it's now out of the bottom groove and can tilt out.

Next step: dry fit. The sides were cut with dados to accept the horizontal rails. (This was hard, I screwed up the first one, but thankfully had enough spare material left.) Time to do a dry fit.

The dry fit showed a tiny gap around one rail that didn't fit.  Rearranging the rails made things perfect. The first dry fit works quite well. There's a little gap where one rail doesn't fit in, but rearranging which rails go into which slots made everything line up perfectly.

So of course, glue and clamp. Next step: put on some glue, then with the clamps! It sat like this overnight to make absolutely sure the glue was set.

After the glue dried, sand all the joints smooth.  Especially the very ends were left a bit proud on purpose, expecting this. Next morning, remove the clamps and give the joints a light sanding, so they are all smooth. Especially the ends of the vertical parts, they started a bit proud on purpose, because it was much easier to just sand afterwards than to get them exactly right!

All finished, cartridges inserted and on display! And there it is! A nice wooden frame to display some quirky Japanese video games!

It's 2014 and I Have a Huge New TV

2014-10-08 21:04 - General

Look at my new TV!  I

In December 2008 I bought a 60 inch DLP television and I've been using it happily for the intervening (nearly) six years. I use my television nearly every day, so it's one of the things I'm comfortable splurging on now and again. Some time ago as I was assembling my video game and console collection, I got a receiver that was not only capable of hooking them all up (with help), but displaying all the outputs through a single HDMI cable. Specifically to leave this option open: some of those consoles' best output is S-Video, but new TVs don't have S-Video inputs.

I've been keeping an eye on the market for some time, but didn't jump. I've got an array of cabinets around the TV, which you can see behind me in the picture, storing all my A/V components, game consoles, and games. It leaves 40 inches of vertical space between the two horizontal parts. The 60 inch DLP TV consumed most of that space, with a large bezel along the bottom. Newer flat panel TVs have small bezels on all edges, so a bigger TV will fit. The biggest size that will fit is 75 inches, and that's what I've just bought. It's 38 inches top-to-bottom, filling just about all of those 40 available. (Ok, there are some rare 77 inch TVs, but those are crazy expensive, they don't count.)

Setting it up was a whole story to itself. It arrived on Monday. The delivery guy called only that morning to announce that he'd arrive between 2PM and 4PM. Lucky I've got a workplace that will let me just skip out on the afternoon and work from home a bit. Then, of course, he was late and didn't arrive until nearly 6PM. I spent the next several hours installing the wall mount (it's 41 inches with the stand, so I can't use that!) and then hanging the TV onto the mount. Which was quite a challenge on my own. Then my stomach sank as I pushed the articulating mount back towards the wall and the TV bumped into the lower set of cabinets. I measured something wrong. I was instantly convinced I had to drill new holes in the wall, which I dreaded.

As I started to fall into despair, I realized that I was in fact not lost. The wall mount is flexible, designed to work with several sizes of TV. I can remove the bracket from the TV, slide it a bit, and re-mount the TV at a different height! I gave that a shot on my own, but it was a bad idea. I managed, barely, to get it further up just enough to fit in the space originally intended, but hard down against the cabinets, and very precariously mounted at best. The cherry on top: The mounting bracket blocks the power cable, which was not plugged in! Even if I had positioned it perfectly, I still needed to take it back down to get the power cable in, then the mount reattached over the plug. (Which was a 90 degree connector, seemingly predicting this problem.)

I begged for help and the following day my friend Zack visited. With a second pair of hands it was straightforward to remove the TV, without letting it fall. Then adjust the mount and ... I don't have nearly the play I hoped I would. The choices are limited by the position of the structural parts of the mounting plate, plus a rear bezel that flares out. I can move it only a bit, then I have to go so far to jump over the structural parts of the mount that it hits the flare and doesn't fit anymore. Oh no!

I think for a minute but see no way out, so I re-install the mount, in a position that will put the TV as high as possible, while still attaching securely. We hang it back in place and it just fits! I'd greatly prefer it to be centered vertically, which is around only half an inch higher. But it is in place now and it fits. Hurrah!

The two of us grab dinner and sit down to a movie to celebrate. By dumb luck, I pick a movie that was not saved properly. The whole thing is terribly dark and I worry for almost two hours that something about the TV is broken. Eventually I find out that the problem is really the movie that we happened to pick. Such a roller coaster!

But that's not all! I've got a "smart" power strip. I plug the TV into its control outlet, then the rest of the outlets switch automatically on (and off!) with the TV. This means all the power bricks and other bits of my game console collection are not wasting power all day and night long, when I couldn't possibly be using them (because the TV isn't even on). The new TV is too power efficient! Each time the display fades to black (or even simply some dark scenes) the power consumption drops too low and the strip is convinced the TV is off and powers everything down. Then right back on with a brighter scene. The resulting power ripple causes the receiver to lose sync, and the picture and audio flicker. Augh!

But finally, skipping that "smart" strip, picking well formatted content to display, and setting all kinds of settings, the TV is installed, and working great. It's been quite a ride these past couple days.

Video Game Collection Organization

2014-09-07 14:47 - General

These colorful boxes help me organize my giant collection of video games.

Yesterday was my birthday. My Mom got me this set of bright plastic boxes to help organize my giant video game collection. These cabinets are deep enough to (just) hold two rows deep worth of games. As a bare stack however, that means those in the back are pretty much inaccessible. These boxes both help me keep series organized (i.e. all the Gran Turismo in one box, all the Metal Gear in another, and so on), plus make it easy to take out just a box or two and get to the less used games in back if/when necessary. (You can just see this second row in the back, in the top right and middle bottom.)

Thanks, Mom!

Inside the Atari 800XL

2014-07-30 10:50 - General

Yesterday I added the third video in my Atari computer series. In this one we crack the computer open and take a look at its insides.

Giant Skull Painting

2014-07-24 18:07 - General

Simple wooden frame. Beginning to stretch the canvas. Canvas now on the frame. Whoops, frame finished for real, with corner reinforcements. Hung on the wall.

A little while back, a guy at work shared a project he was working on: to make and give away a ton of huge paintings. He picked up a cheap laser projector, originally designed for DJs/parties, and figured out how to make it shoot a pattern for an image of his choice. This was bright enough to see, without distorting colors, like a simple projector might be. Then he started making tons of paintings and giving them away! This is one of them. I decided to get enough lumber to make a frame to stretch the canvas onto, and now it's hung on my wall. I had to rearrange things to get it to fit, it's almost six feet square!

It barely worked. The tension of the canvas wants to twist the frame. I added the reinforcements on the corners from the scraps left after cutting the sides to length. That helped, but only a little. Luckily it's just heavy enough to hold itself flat against the wall by its own weight. Perhaps the tension might even out a bit over time as it remains in place.

Hello Deer

2014-07-13 13:37 - General

Visiting my mom for the weekend, and caught this visitor outside.

Voice Controlled Clock Experiment

2014-05-26 23:39 - Programming

As the video says, I spent this evening putting together a simple, successful, experiment in voice-controlled clocks. In the pursuit of the perfect alarm clock, I'm looking for something I don't have to squint at nor fumble with in the night (or lazy morning). I've got a ways to go before it's a usable alarm clock, but I was amazed to start and get this far in just one evening!