Saturday, April 23, 2011

Wireless NES Controller Doorbell (2008)

When we moved into our condo, we found a wireless doorbell module; the electronics still worked fine, but the case of the doorbell itself was broken beyond repair.  My uncle had recently scored a number of NES and accessories a a flea market, so I thought it would be neat to turn one of the controllers into a doorbell.

This is a pretty simple hack, since all I really did was replace the button from the original doorbell with the buttons from the NES controller.  Nevertheless, a short video about the doorbell on youtube has since garnered tens of thousands of views:
It's cropped up on random websites (even Gizmodo), and I am frequently asked for more details about the build, so here goes.

Just replacing the button would have been pretty simple, but I also wanted to add feedback to the user to tell them something was going on, since it's not immediately evident that the controller serves as a doorbell.  (After many years of use, however, I've only had one person knock because they were unsure what to do.)  I figured an LED that lights up when the user pushes a button should do the trick.

In order to figure out what the best way to wire all that up was, I wanted to trace out the doorbell emitter circuit  - the circuit behind the button you push to make the chime ring.  To do this, I took pictures of both sides of the circuit:
Top side of the circuit, with the components.

Underside of the circuit, with the button, a diode, a resistor, and a Circuit-On-Board (COB).

I loaded up those pictures as two layers in a Paint.NET document.  With a bit of reorienting/resizing, I was able to align the pictures so that they lined up with each other, and I could see either side of the board by toggling layer visibility.  (Note that one of the layers has to be flipped for this to work; you can tell from the pictures above that the word "ALKALINE" reads backwards.)  It helps to make the top layer partially transparent when doing this:
Both layers lined up.  You can tell that the components from the top side align with the solder pads on the underside.

Then, I used a small Wacom tablet to paint over the backside traces and components in a new layer:

Backside with hand-drawn traces.
Then, keeping the painted traces visible, I hid the circuit backside and showed the frontside:
Frontside with hand-drawn backside traces and components.
This is where you can tell that the job is made a bit more difficult because of the perspective foreshortening, since the red traces don't exactly line up with the component legs.  To mitigate this, I could have used a flatbed scanner to take the pictures (by putting the electronics on the bed), or perhaps taken the picture from a bit further back (at the expense of resolution).

Nevertheless, by twiddling the transparency of the front layer back and forth, I was able to trace the front-side components with the Wacom as well:
Traced frontside components.
And then, hiding everything but the hand-drawn stuff, I wound up with the following:
Final traced circuit.  (Image flipped horizontally from previous shots for legibility.)
From this point, I was able to transpose the circuit by hand onto paper:
Hand-drawn circuits.  The top circuit is the first jot.  The bottom one is the same circuit, but laid out differently to increase legibility.  The components I added are highlighted in red.
On the bottom circuit, you can somewhat delineate the stages of the circuit.  The battery is at the far left, supplying voltage to the the input stage (R3, S1, C1) and the COB.  S1 is read by the COB, and when a press is detected, the COB drives the transmitter stage on the far right.

To see how to merge the NES controller with this circuit, one needs to know a bit about how NES controllers are made.  It turns out to be quite simple: all the buttons are wired as independent inputs to a shift register.  Since the doorbell circuit has only one input, all I needed to do was to wire up all the controller buttons in parallel to S1, so that pressing any one button would close the circuit and ring the bell.

Additionally, to light up an LED when the button is pushed, I needed to wire up the LED (and a current-limiting resistor) in such a way that a voltage differential would exist across the LED when a button was pushed.  By analyzing the circuit above, it is possible to see that the input to the COB is active low - when S1 is closed, it brings the line read by the COB to ground.  (R3 acts as a pull-up resistor when S1 is open.)  Thus, an LED between the positive end of the battery (the net labelled N8 in the diagram above) and the input line read by the COB (net N9) will light up when a button is pressed.

Both these modifications are shown in the above diagram, in the red rectangle.

However, just adding the LED and the NES buttons in parallel caused a problem to occur: the doorbell wouldn't ring anymore!  This is because the buttons in the NES controller are made of little graphite pads that have a definite non-zero resistance, unlike a regular pushbutton.  (I seem to recall testing buttons up to a few kilohm.)  In effect, the NES controller buttons are creating voltage dividers with R3; if the resistance from the pushbuttons is too large, the voltage read by the COB does not drop low enough for it to detect a button press.

The first fix I made for this was to desolder R3 and replace it with a bigger resistor, to "recalibrate" the voltage divider to account for the higher resistance of the NES controller pushbuttons.  This required careful tuning, because the COB also requires a minimal amount of current to flow in for a button push to be detected; making R3 too large chokes off the current flow, once again preventing the doorbell from ringing.  Add to this the fact that the LED steals even more current from the COB and you have a tricky trial-and-error process to find values for R3 and the current-limiting resistor - values which allow the bell to ring, while allowing the LED to light up "sufficiently".

Once I had the electronics working, it was a matter of fitting everything into the controller casing.  Here are a few steps from the process:
The discombobulated controller.

Getting ready to make some space inside the case.

Part-way through cleaning up the case.

Testing the fit.

Another angle on fit testing.

Soldering up the buttons with the fire-starter I had at the time.

Buttons soldered up in parallel.

Testing the cutout for the chime circuit.

Final look, with the LED in the top-right.

Part-way through assembly.

Putting in the LED.

Mounted on the door using "temporary fixtures" which are still there three years later.

This worked great!  For six months.

When winter came, the bell stopped ringing - the resistance from the graphite pads inside the controller had risen, and the COB no longer detected button presses.  Tarnation!  The definitive fix was to use a time-proven trick to revitalize dead NES controllers, which is to use double-sided tape to affix little aluminum pads to the rubber behind the buttons, effectively replacing the graphite.  This dropped the NES button resistance by three orders of magnitude, and everything has worked since then.

Finally, I should mention that this was an afternoon hack that performed because I saw an opportunity to make something amusing.  People often point out that the buttons could make different sounds; that is quite true, and it would have made it even cooler!  Sadly, with the parts I had on hand, this would have taken quite a bit more effort.  But worry not!  Somebody has in fact built such a device, and you can see a video here.

Lessons Learned:

  • The internet is an awesome place - I never would have thought so many people would see the video.
  • The doorbell makes for a great conversation starter with delivery people.
  • Reverse-engineering circuit layouts can actually be a good time.

4 comments:

  1. you need to make a bunch of these and sell 'em on eBay for $100 each - you could be a millionaire!

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. This is my first time visit here. From the tons of comments on your articles,I guess I am not only one having all the enjoyment right here! doorbell camera reviews

    ReplyDelete