Smart Holographic Gun Sight With Arduino

by jpminstructables in Outside > Launchers

6201 Views, 18 Favorites, 0 Comments

Smart Holographic Gun Sight With Arduino

CoverPic2.jpg
20181124_105543.jpg
20181123_190451.jpg
20181123_182347.jpg
Gun Sight

Nerf, airsoft, laser tag, and paintball have always been popular forms of recreation in my house. Sometimes, beating my three younger brothers in a skirmish can be quite tiring. As a caring older brother, I of course can't let my younger siblings win because that would mean anarchy. They would tear each other apart as they scrambled to fill in the void left in the top of the food chain. In an effort to preserve order (and by extension my dominance in shooting games) I have opted to create a "smart" gun sight to give me the edge in battle.

I have designed a gun sight that can attach to a 20mm gun rail. However the bottom of the sight can be swapped to accommodate different sizes. The sight features LEDs and laser sight for low light shootouts. The sight projects a crosshairs onto a piece of plastic via an OLED display. The sight displays the amount of rounds left remaining using a peppers ghost illusion (see step 2 for a more in depth explanation). In addition, it displays weather the laser sight or LEDs are active. When the clip is empty or the clip is removed, an LCD light filter will darken the sight and the OLED will display "reload". I used a hall effect sensors to keep track of when the magazine is removed/replaced and when the trigger is pulled. One round is subtracted from the remaining shots every time the trigger is pulled. When the clip is removed and replaced, the total is reset.

How It Works

Sight optics diagram sized.jpg
20181122_163320.jpg

Above is a diagram of the inner workings of the sight. An OLED will be placed on the bottom of the sight. This OLED will display a crosshairs that can be adjusted via two variable resistors (one controls the x-axis the other will control the y-axis). A piece of clear acrylic or plastic will be placed at a 45 degree angle above the OLED. The plastic will have a dot marked on it. The OLED will project the information onto the clear plastic. In order to aim the sight, you'll need to line up the crosshairs, the point marked on the plastic, and your target. Lastly, I have added an LCD light filter to the front of the sight. This will limit the light entering the front of the sight to ensure that the crosshairs is always reflected clearly on the plastic. In addition, the LCD will be adjusted according to feedback from the photoresistor light sensor.

Parts Needed

20181122_163752.jpg

Before starting, here is a list of all the parts I used:

Hardware:

  • #4-40 machine screws and nuts
  • #0-80 machine screws
  • 20 AWG solid core wire

Supplies:

  • Epoxy
  • Electrical tape
  • PLA 3D printer filament
  • Solder
  • 9V battery
  • Rare Earth Magnets
  • Proto-board

Equipment:

  • 3D printer
  • Soldering iron
  • A computer with Arduino IDE
  • Breadboard

Electronics:

  • Arduino Nano
  • Male and Female header pins
  • 3mm white LEDs x4
  • Laser diode
  • Screw Terminal Block x5
  • SPDT switch x3
  • BJT NPN Transistor x2
  • OLED Display SD1306 (with IIC communication interface)
  • 10k ohm potentiometer x3
  • 3.3k ohm resistor x4
  • 220 ohm resistor x4
  • 47 ohm resistor
  • D Flip-Flop TI SN74AC74N
  • Photoresistor
  • Hall Effect Sensor 3144
  • 9V Battery connector

3D Print Parts

AutoCAD pic.JPG
20181117_105349.jpg
20181122_164159.jpg

I have attached all the STL files needed to print off another sight. I would recommend using PLA filament to prevent warping while printing. Some of the parts are designed so that a #0-80 machine screw will be attached. I would print these parts at a higher resolution as the hole needed to accommodate screws of that size are quite small.

Code

CodePic2.JPG

Next, you'll need to upload the attached code to the arduino nano. To accomplish this you'll need to download the arduino IDE if you haven't already done so.Simply attach a USB type B to the Arduino and press the upload button. The "ammo" variable will need to be adjusted to accommodate the size of your magazine.

Downloads

Electronics

Schematic1.JPG
Schematic3.JPG
Schematic4.JPG
20181111_203213.jpg
20181111_203153.jpg

Next, lets knock out the electronics. I would recommend building everything on a breadboard so that you can ensure all the components are working correctly. I have attached all the schematics in a PDF document. Be sure to load the attached code in the previous step onto the arduino nano. This will allow you to check that the components are working properly with the software.

Solder Electronics to Proto Board

20181122_164005.jpg
20181122_164019.jpg
20181122_164706.jpg

Next, transfer all the components onto your proto-board. When soldering components make sure that the switches and potentiometers will fit correctly in the outer cover 3d-printed part. It is important that these can be easily accessed by the user. In addition, I used female and male header pins to attach the arduino nano to the rest of the circuit. That way, if the nano breaks, it can be easily replaced. To save space I soldered the clip circuit and the lower trigger circuit (the two diagrams with a hall effect sensor) on separate pieces of Proto-board. These circuits are used to monitor the trigger and clip. Be sure to add extra length to the power wires, eventually a 9V connection will be soldered to these wires.

Assembly

20181122_163314.jpg
20181122_163552.jpg
20181123_182345.jpg

Assembly is the most difficult process of the build (I have added notes to the attached photos and labeled the parts files to help clear things up). First, use #0-80 machine screws to attach the OLED display to the optics bracket and the protoboard to the outer sight cover. The photo resistor will need to be solder to an additional length of wire and attached to the optics bracket. Solder wire leads to the OLED display. Next, use the #4 machine screws to attach the tactical rail bracket to the bottom of the the optics bracket. Place the LCD light filter in the optics bracket and route the wires through the inner sight cover. Use epoxy to attach the battery bracket, LED holders, and laser housing to the outside of the outer sight cover. Finally,L place the outer sight cover over the inner sight cover and tighten everything down with #4 machine screws. Solder the LEDs together, and solder a 9V battery connector to the power wires. Lastly, solder a female header pin connection on the photoresistor and OLED wire leads.

Finishing Up and Upgrade Ideas

20181123_190420.jpg
20181124_105545.jpg
20181123_190121.jpg

Lastly, You'll need to place the sensors on the clip and trigger. Sight the gun using the potentiometers on the top of the gun. You can adjust the laser sight with #0-80 machine screws. I would recommend using electrical tape to wrap the strands of wire together so it is less messy.

I hope to create a revision 2 at some point, but if I never get around to it, here are some features you could add to make the sight even better. I am hoping to add a rechargeable battery. These usually have a slim profile, so I would also be able to reduce the overall size of the sight. In addition, there are several LIDAR sensors available on Amazon with 100' + range. These could be used to display the distance of targets. If used with an airsoft gun it could let you know if targets are out of range.

Your gun sight is complete. Have fun dominating the battlefield at your next airsoft, paintball, or nerf war.