Shoot the Lights With a NES Zapper (RF 433MHz)
by robertvanstraten in Circuits > Remote Control
8797 Views, 147 Favorites, 0 Comments
Shoot the Lights With a NES Zapper (RF 433MHz)
![2017-12-05 16.56.11.jpg](/proxy/?url=https://content.instructables.com/FBT/ZZ47/JASJR47M/FBTZZ47JASJR47M.jpg&filename=2017-12-05 16.56.11.jpg)
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!
Gather the Components
![2017-12-05 16.32.03.jpg](/proxy/?url=https://content.instructables.com/F6X/SL5U/JASJR46J/F6XSL5UJASJR46J.jpg&filename=2017-12-05 16.32.03.jpg)
![2017-12-05 16.32.45.jpg](/proxy/?url=https://content.instructables.com/FMY/G3F4/JASJR46N/FMYG3F4JASJR46N.jpg&filename=2017-12-05 16.32.45.jpg)
![2017-12-05 16.52.28 - 3.jpg](/proxy/?url=https://content.instructables.com/FG5/ULL0/JASJR474/FG5ULL0JASJR474.jpg&filename=2017-12-05 16.52.28 - 3.jpg)
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.
Learn the Transmitted Codes
![2017-12-03 13.50.37.jpg](/proxy/?url=https://content.instructables.com/F9D/BTJW/JASJR44T/F9DBTJWJASJR44T.jpg&filename=2017-12-03 13.50.37.jpg)
![433MHz pinout.jpg](/proxy/?url=https://content.instructables.com/F4L/Z1XF/JASJR42O/F4LZ1XFJASJR42O.jpg&filename=433MHz pinout.jpg)
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!
Prepare the NES Zapper
![2017-12-03 13.40.28.jpg](/proxy/?url=https://content.instructables.com/FCM/L5PM/JASJR44B/FCML5PMJASJR44B.jpg&filename=2017-12-03 13.40.28.jpg)
![2017-12-03 13.40.47.jpg](/proxy/?url=https://content.instructables.com/FHL/FYIS/JASJR44S/FHLFYISJASJR44S.jpg&filename=2017-12-03 13.40.47.jpg)
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.
Connect and Program the ATtiny
![2017-12-03 15.39.03.jpg](/proxy/?url=https://content.instructables.com/FTI/LAHU/JASJR45G/FTILAHUJASJR45G.jpg&filename=2017-12-03 15.39.03.jpg)
![2017-12-03 15.38.23.jpg](/proxy/?url=https://content.instructables.com/FMJ/LWRL/JASJR45C/FMJLWRLJASJR45C.jpg&filename=2017-12-03 15.38.23.jpg)
![schema.jpg](/proxy/?url=https://content.instructables.com/F8R/F8GV/JASJR47Q/F8RF8GVJASJR47Q.jpg&filename=schema.jpg)
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
Put It All Together
![2017-12-03 16.16.08.jpg](/proxy/?url=https://content.instructables.com/FKP/TSG9/JASJR45I/FKPTSG9JASJR45I.jpg&filename=2017-12-03 16.16.08.jpg)
![2017-12-03 16.16.30.jpg](/proxy/?url=https://content.instructables.com/FW9/FNCG/JASJR45L/FW9FNCGJASJR45L.jpg&filename=2017-12-03 16.16.30.jpg)
![2017-12-03 16.16.35.jpg](/proxy/?url=https://content.instructables.com/FGS/22GO/JASJR461/FGS22GOJASJR461.jpg&filename=2017-12-03 16.16.35.jpg)
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!
Conclusion and Improvements
![Shoot the lights with a NES Zapper (Instructables)](/proxy/?url=https://content.instructables.com/FI3/P42Y/JASJR6WD/FI3P42YJASJR6WD.jpg&filename=Shoot the lights with a NES Zapper (Instructables))
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!