2015-04-11 14:54 - Making
I've been continuing work on my nesRF project, slowly. It's time to start modifying the original NES controllers, part number NES-004. I need to plan out the PCB, to get everything lined up exactly correct. All the mounting holes of course, plus the overall shape, makes it fit into the original plastic shell correctly. Then I need to know where I can put all of the components, without bumping into any of the plastic supports or structure, the buttons, and so on.
I haven't found a similar project online to start from, like I did for the SNES version I started with. So here's the beginning of this phase. I took the original PCB out of the controller, removed all the components, and put it into my scanner. The full size images that the thumbnails above link to are exactly 1000 DPI, making planning sizes in mil (thousandths of an inch) hopefully straightforward.
There's a fairly good amount of room to work with. Almost everything above the start/select and a/b buttons is empty space, with just a few sparse supports to get in the way. Locating most of the parts should be straightforward. I'm worried about my power button though, the vertical arrangement of this controller may be incompatible with that part.
2015-02-22 15:23 - Making
I've been working since Thanksgiving on my nesRF project, which I've posted about several times already. The point is to retrofit the innards of a real original Nintendo controller to support wireless communications, functioning with a real console. The long story short is that I'm very close to having the project done. Well, the first phase at least. Here's all the juicy details of the whole thing, as one nice self contained post which serves as a nice summary. Of what went well, and what went less well. It runs roughly in chronological order over the things I actually did, and is chock full of pretty pictures.
First here is some physical layout. This is one of the things I was most worried about. It's worth noting that there are plenty of similar projects already online. They generally aren't pretty outside, and occasionally downright ugly inside. I wanted mine to both look and work great, but I have limited "machining" capabilities. I specifically selected a latching push button to control power, with a round button cap (so all I have to do is drill a round hole), with integrated dual-color LED for status indication.
These pictures show me first planning and then the result of drilling the hole for this push button. Note the tiny divot visible in the first picture. It was simply placed with a utility knife, then I progressively drilled smaller-to-larger holes guided first by that divot and then by each previous hole. It worked mostly perfect. The final hole was clean and round and fit the button perfectly. Except, it was in the wrong spot. My best attempt to measure the position was not good enough, it was too high, so I had to expand the hole a bit. This was operating on the one spare controller shell I had, so I thought it was OK: I learned to be careful on the real one. Somehow on the first real controller I made almost exactly the same mistake. So my hole isn't terribly pretty. Since things didn't line up perfectly first time, I had to expand the hole even further to really get proper clearance enough to allow the button to push in and out.
Next, the internals and the connector. Several plastic supports inside the case exist to route the cable where it needs to go, and absorb any strain of pulling on the cable. My plan is to remove the wire and put new components in that space, so they have to go. If you look carefully you can see the slightly rough edges where I've cut various bits out of the plastic case. Almost all the removed material is just inside the original cable hole, on both the top and bottom sides.
Next up is the connector end of the controller. My plan is to fit the entire receiver circuit inside this connector. The first step is opening up the connector and freeing the individual wires of their strain relief device. Opening the connector is quite difficult, I managed to design and 3D print a tiny jig to press in both of the catches on a side at once which helped tremendously. Then there's lots of plastic to remove, to make room. The original connector has a large hinged assembly, which fits around the metal connector pins to hold them in place. I used a dremel to cut off that hinged assembly, and plenty of the extra plastic bits besides. Then super glued the pins back into place.
Fitting the receiver circuit into the small connector was a challenge. It was one of my main goals however, as it will look much nicer than anything else I could build myself. So all the electronic parts are surface mount varieties. These are much smaller than the alternative, which I need. But it makes working with them extra difficult. I'm lucky enough to have access to a laser cutter, which I used to create a stencil. The stencil is used with solder paste, which is a set of microscopic balls of metallic solder mixed with a paste of other active and inert ingredients not completely unlike toothpaste. With the solder paste spread over the stencil, it sticks to the circuit board in just the right places. This is the first time I've ever worked with surface mount parts or solder paste so I was operating mostly in the dark. The solder paste result looked pretty good to me, but I was concerned about how much paste was left for the pins around the microcontroller.
Here's a pair of microscope shots. Only ten times magnification, but it reveals quite a lot of detail. On the left is the board assembled with the paste. The solder paste is just sticky enough that you only need to touch the components into the right spot and they stick in place. With that done (all my parts go on one side) it's time to melt the solder and permanently attach the parts. I used the "hot plate" technique. Actually with an old skillet (now clearly marked "NO FOOD" due to my use of leaded solder) on the stove. I mostly just set it to medium heat and waited. The inert ingredients (I'm thinking the petroleum jelly) in the paste started to melt rather quickly. It took a few minutes and then shiny molten solder began to appear. The second shot is after everything cooled down. The small components all stuck wonderfully. As I feared, the pins on the microcontroller were bridged. There was so much excess solder that it ended up climbing the legs (capillary action) and leaving blobs of solder connecting various pins. Some careful work with solder braid sucked out the excess.
It's also worth looking very carefully at the two pictures and comparing them. Especially note the position of C2. When the solder melts into a liquid, it has a surface tension just like water. This tension will actually act to pull the components into the proper place! The solder mask (the purple stuff on this board) repels the molten solder, but the solder sticks to the exposed metal pads as well as the components, lining them up with each other like magic! This makes assembling tiny surface mount parts by hand more practical.
So here's the first "fully working" part! I forgot about the pins on the RF daughter board (bottom left of the first image), so they got dremeled down to fit only afterwards. And three of the wires awkwardly snaked around the edges because they were attached second, but should have been first. But it fits and works! Almost... It turns out that using super glue to affix the pins was a bad idea. In this first unit they don't quite line up correctly anymore, so I can't actually put this connector into the port on the console. I've assembled a second working one, by connecting all the pins into the port before gluing. This works, but it's very difficult to insert/remove the connector. So I plan to do a third with just hot glue, which is a bit flexible. I hope that will hold everything together enough, but be just pliable enough to allow the pins to shift into place as they mate with the connector port.
I used the breadboard transmitter circuit to test the receiver above. Once it was working, time to get a real controller assembled! Pictures above are first the board with solder paste and components attached. Note that I manually wiped off a bit of the solder paste around the microcontroller, in an attempt to avoid having it bridge the pins like before. It helped a bit, but not enough. In the process of heating the thing to melt the solder, one of the tiny surface mount resistors wasn't quite positioned properly and required manual attention. I had a devil of a time re-attaching it by hand later. You can see tiny bits of solder spread out around it as I repeatedly tried to attach it down with the iron. But I did (barely) get it lined up and soldered down. It happens to be the resistor which controls the current that the charging IC (right next to it) will apply to the battery, affecting charging time.
And with mention of the battery: I've been doing a battery test for days now! I've had the controller on, and been watching it, for nearly all my waking hours since Thursday. It took until last night (Saturday) to finally run through the whole battery. So it's got at least 24 hours of operating life on the battery, which is much better than I even hoped for. Right now I'm leaving it switched on, with a "dead" battery, to observe exactly how it behaves there. It can be unsafe to attempt to re-charge a Lithium Ion battery after discharging it too far. So I've got a chip in there to make sure that I won't over discharge it. So far signs are very good!
Here's one final note worth making. I was quite careful with everything I did here, to try to avoid waste. I didn't want to design the board, pay to have it fabricated, and only then discover a critical problem. I was almost completely successful in this regard. I missed just one physical layout issue. An earlier post showed the plastic laser cut prototype that I used to avoid this. What I failed to do was ever insert the shoulder buttons. They pivot through one of the plastic standoffs which, whoops, I blocked with my PCB. The PCB had no traces or parts there, so I could dremel it out without issue. But one of them was also blocked by the RF daughter board! By extreme luck, only a tiny bit of the corner next to, rather than part of, the antenna was actually located there. In these pictures you can see the bits that I had to chop out. Good thing I didn't need to pay another $50 to re-spin another board!
So what I've got now is one each transmitter and receiver circuit, working and tested end to end. Wonderful! What remains is to actually complete the original target of the project and hook this up to a Nintendo, not a Super Nintendo. Early in my research I discovered that they're nearly identical. So I can, if I choose, build a receiver only for the Nintendo and use the Super Nintendo controller with it. That's next. I got a cheap NES Satellite receiver only via eBay. It works via infrared, but is a nice pretty container to hold a replacement radio based unit, and I certainly won't run into any connector modification issues like before!
Finally, here's a picture of the final modified controller! Overall it still looks very pretty. There's a bit of a gap around the indicator/power button. The cable hole is replaced with a connector for recharging the battery. Hopefully my second controller will look even better without the gaps! I've pushed all the source to GitHub today. The hardware was designed with KiCad and the software through the Arduino IDE, with the RF24 library.
2015-01-26 22:09 - Making
This weekend I made myself a footstool. I started from these plans I found online, though I couldn't find any attribution for them. I especially like that it looks nice enough, but leaves the feet right out by the outer edge, making it quite sturdy. Then I customized based on the material available. There was a nice wide board in my Mom's scrap pile, but it was covered in some old blotchy white paint. More on that later.
I started by marking out the three pieces. The top was just a rectangle, and the two legs each were trapezoids. With them marked out correctly they were both cut on the table saw. One of them had a bit of a flaw, but that area was soon to come out. I marked the round cutout with a bucket, and then cut it out with a jigsaw.
The next step was a lot of sanding to strip the paint off. It didn't all come off: the knots grabbed the paint tight, and some low spots had extra paint that sanding couldn't remove. Close enough, and much better, though. I don't plan for it to be very visible under my desk. The corners of the top were rounded off with the jigsaw, a handy can on the workbench was a nice size to trace. With that done they all got a pass on the router for a round over of the outer edges.
Then I had to cut the joining slots in the legs. At just the right angle. After some sketching and practice aligning scrap pieces, I realized that the cuts had to be complementary parallelograms. And if I crossed the opposite corners of those, I get the center point, which should line up with the center point of the leg pieces. Easy peasy! I had to cut those slots by hand so they came out just a tad rough, but worked just great after a little filing to clean up the edges.
With the legs lined up they were laid out to be even on the top, upside down. Then I used glue, no nails, no screws, and clamped it overnight. Voila! Some spots of paint remain, but it's going to live under my desk so that's not a big deal. It turned out almost exactly as I planned, but a bit too tall perhaps. I basically just used the board available as it was, but I probably should have cut it down by an inch or so. Either way it serves its purpose well enough!
2015-01-17 17:51 - Making
Tada! It works. Almost the only thing left to do is manufacture the PCBs, then assemble!
2015-01-14 19:51 - Making
Today the second, and hopefully last, batch of components arrived from DigiKey. I combined some of those with the SMD breakout boards I ordered earlier. I'm pointing at one of them there, mostly for scale. You can clearly see the board that I'm pointing at. You'll have to squint, and probably open the full size image, to see the chip on that board. On the left there is the 2.5 volt regulator, and the other on the right is the battery charging chip.
It was medium-good experience soldering them on there, which I did completely by hand. And not perfectly, but I already learned a bit that will make handling the final board better. Now that I've got the exact chips I plan to use set up here, I can test that they really do what I want them to. And now that I'm set up this far, I realize I didn't leave any room on the board to arrange the buttons! I need those to do the next test! If it's not one thing it's another, but the light at the end of the tunnel is definitely coming into view.
2015-01-08 21:31 - Making
Today I made a simple prototype for the physical layout of the PCBs for my nesRF project. Just plastic, laser cut. Here's a picture of the one that goes in the controller, with a couple components also resting in their place. This was a great exercise. The receiver board was just fine, but this one had a few adjustments to make to it which were so much more obvious when in place like this. The button needs to move a bit to avoid the mounting post just next to it (in the other side of the case). And a cut-out of the PCB where the button cap goes will make it more likely to operate smoothly. A couple of the mounting holes were very tight, so they've been expanded. And I was able to check again that all the buttons line up with their openings.
2015-01-03 12:36 - Making
I took a break over the holidays, traveling to my Mom's place without any of my nesRF project work with me. This weekend I'm back home, and working on it again. The first step was breaking out the controller pins so I could hook up to them. I had an existing sacrificial SNES controller. It arrived pretty damaged already when I bought it, used. It's been open for some time to do measurements, and now its connector is also proving useful. I attached breadboard-suitable wires to each and prepared to hook it up.
And here it is, hooked up. The good news is that it's basically working. Interrupts completely drive the output data pin from the input latch and clock pins. And I can successfully send button presses to the console. Right now, I am using the Arduino's serial port to send the data in, rather than the wireless input which will finally be used. I've got a confusing off-by-one error to solve(when I try to send a Down I get an Up, and so on) but the concept has been proven to generally be sound!
2014-12-07 19:46 - Making
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.
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.
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!
2014-11-29 18:59 - Linux
All of my ZFS-using Linux machines have recently started spewing ZFS status errors:
$ sudo zpool status
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.
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
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.