Introduction: Shoot the Lights With a NES Zapper (RF 433MHz)

About: Creative and analytic thinker who loves solving complex technical problems and build awesome things! Programming, electronics, microcontrollers, making music, retro gaming, giving old devices a new life, learn…

Why turn off the lights using a switch if you can shoot them with your NES Zapper! I already built a laser light in an old broken NES Zapper when this idea popped into my head. It liked it better so I replaced the laser light with this. An ideal project for a Sunday afternoon!

The lights in my study room are already controlled using remote switches, so all I needed to do was learn what codes are being sent and mimic them. And then build it into my NES Zapper. See the video at the end of this instructable!

Step 1: Gather the Components

You will need:

  • NES Zapper, preferably a broken one. You can also use any other electronic toy gun.
  • ‘ClickOnClickOff’ type remote switches working at 433MHz.
  • 433MHZ transmitter and receiver. Only the transmitter will be built into the Zapper, the receiver is needed to learn the codes beint sent.
  • ATtiny microcontroller, this will be built into the Zapper. I’m using a low-power ATtiny85V-10PU. And you will need a programmer for it.
  • Arduino UNO, or any other kind which can display data in the serial monitor. This is used for learning and testing sending the codes.
  • 3V button cell with soldering tabs or pins.
  • Soldering iron and wires.

Step 2: Learn the Transmitted Codes

Connect the transmitter and receiver to your Arduino UNO. The pinout is shown in the picture, most pins connect to 5V or GND. We don't need an antenna since we are not using it over a long range. We also don't need the lineair output on the receiver. Data output on the receiver connects to pin D2 and data input on the transmitter connects to pin D11.

Of course I’m not the first to try and control these switches, so there are several libraries already out there. Many thanks to Randy Simons for his RemoteSwitch library, which saved me a lot of work! Download the library and copy it to your ‘libraries’ folder, then restart the Arduino IDE. If the following sketches don’t work for your switch you can try his NewRemoteSwitch library.

The ’ShowReceivedCode’ example sketch will listen for sent switch messages and display them in your serial monitor. Press the buttons on your remote switch and the codes should appear with the signal time in microseconds, something like “Code: 456789, period duration: 320us.”. Write these numbers down.

To test the transmitter you can use the ‘Retransmitter’ example sketch. This will resend the first received code, with a 5 second delay. So turn the lights on and then quickly turn them off again. After a few seconds they will turn on again!

Step 3: Prepare the NES Zapper

Open the Zapper with a screwdriver and remove everything you don’t need. All we need is the trigger mechanism with the microswitch. Also we will leave the weights in the barrel and handle, this makes it feel less cheap.

I had already modified my Zapper so I'm not sure if the wires connected to the microswitch are long enough in the original or if I replaced them. If they are not long enough you can extend them by soldering wires to them or solder new wires to the microswitch tabs.

Step 4: Connect and Program the ATtiny

At first I wanted to put the ATtiny in sleep mode and let it wake up with a pin change interrupt when the trigger is pulled. I already created a test setup which worked. Then I realised that sending the switch command only takes a quarter of a second, so I could just use the trigger to connect the battery to the ATtiny and transmitter. This way no power is used at all when it is not used!

Connect the transmitter to your ATtiny, data input on the transmitter connects to D0 (pin 5) on your chip. Connect the button cell to both the ATtiny and the transmitter, but have it interrupted by the Zapper trigger microswitch. See the picture for more details.

The coding is very simple. All it does it send the switch message and then it waits until the ATtiny is turned off. Use the details from the ’ShowReceivedCode’ example sketch as arguments in the sendCode function.

#include <RemoteTransmitter.h>
void setup() {
RemoteTransmitter::sendCode(0, 456789, 320, 3);
}
void loop() {
// wait until ATtiny is turned off
}

The arguments in the sendCode function are:

  • Output pin
  • Message code
  • Period duration in microseconds
  • Number of retries

Step 5: Put It All Together

I have chosen the quick and dirty approach this time; the (prepared) wires are all the same color and they are soldered directly to the ATtiny pins. I normally use chip headers and colored wires since it makes reprogramming and problem solving easier, but it shouldn't be a problem for this small project. Everything is attached to the Zapper using hot glue, it sticks well enough and can be removed without damaging the Zapper.

Test it before you close the Zapper again. Then show everyone your shooting skills!

Step 6: Conclusion and Improvements

It works perfectly! The trigger only needs to be pressed for a short time and the delay is very small. The battery can last for years, even with everyday use. Even when the voltage drops below 3V it will work since both the ATtiny and the transmitter can operate even below 2V.

Some possible improvements:

  • A way to reprogram the ATtiny, for example:
    • Put the ATtiny on a header so it can be removed. This header can be placed in the nozzle so it can be reached without opening the Zapper.
    • Add wires to the ATtiny which can be connected to your programmer. These wires can be connected to a header which can be placed in the opening of the handle where the cable used to be.
  • Add a light or laser at the end of the barrel! This will of course drain the battery way faster.
  • Add a sound effect! This will also drain power but is a very nice addition!

Let me know if you have any other ideas to improve this. Now I just need some cool way to turn the lights on… maybe with a lighter? (I feel a new project coming up)

I hope you liked my first instructable, more will follow!

Wireless Contest

Participated in the
Wireless Contest