Arduino Portal Gun

by DigiWiz23 in Circuits > Arduino

1393 Views, 10 Favorites, 0 Comments

Arduino Portal Gun

20230308_000156.jpg
For all you Portal nerds out there, boy have I got something for you! With the power of 3D printing and electronics, you too can have your very own portal gun.

Without further ado, let's just jump into it!

Supplies

Materials needed:


  • Male to female jumper wires
  • Soldering iron
  • 3D Printer
  • 968g black PLA filament
  • 512g white PLA filament
  • Superglue (preferably something that works well on plastic)
  • x2 M3 x 10mm screws
  • x6 M3 x 20mm screws
  • Plastic bottle
  • x3 20cm black cable
  • x8 M3 nuts

Electronics list:

  • x2 Neopixel stick
  • Neopixel Jewel
  • Neopixel Ring
  • Arduino UNO
  • DFPlayer Mini
  • 8 ohm speaker
  • x2 buttons of your choice
  • Power bank
  • Micro-USB cable

3D Printing

portal gun.PNG
CE3_PG-Finger_Pt3_20221015105733.00_00_01_21.Still001.png

To get the ball rollin', lets' start with da 3D printing. Go here to get the files for the original portal gun made by EAVRATE. Print all the stuff from there except the Generator Hatch.

Go here to my remix of the original portal gun to get the files I made specifically for this and that includes a modified version of the Generator Hatch. It has cutouts for the two buttons and a cutout for the usb cable to go so the power bank can be charged easily. It has the tube for the core which must be printed in white for the light to diffuse properly. The last piece in my remix is a circular bracket for the Neopixel Ring which sits inside the nozzle of the portal gun. It centres the Ring so the light doesn't look crap.


The Front_Cover, Cover and core_tube are to be printed in white PLA and everything else is to be printed in black PLA and that's pretty much the 3D printing part done!

Wiring the Portal Gun: Part 1

Schematic_PortalGun1_2023-02-12 (1) (1).png

I wired up two buttons to two digital pins and respective ground pins. I wired the 5V of the neopixel stick, ground pin to ground and digital in to another digital pin. The buttons I soldered and tested to make sure they worked but could not integrate them into the circuit yet because at that point, I had run out of pins because I needed another set of ground pins for the led's inside the buttons.

The whole portal gun is powered from a small power bank, kind of like the ones used to charge your phone. This can keep the gun powered for about 5 hours on low brightness but if you have the lights on full blast, the power bank only lasts for 2 hours before needing to be charged. This is of course if you use the portal gun continuously. I included a "sleep" feature of some sort that turns off the led's after about 5 minutes so the battery doesn't get drained.

Wiring the Portal Gun: Part 2

20221022_171808.jpg
20220923_172110.00_00_00_00.Still001.png

To control the speaker and sound of the portal gun, I used a module called a DFPlayer Mini which is what the positive and negative terminals of the speaker connect to. This is the point where the issue of pin availability needs to be addressed. There's 3 GND pins, and 2 5V pins. The led's need two 5v pins and 3 ground pins. The dfplayer module needs another ground pin and a 5v pin as well. So the solution: daisychain together the needed wires. The led's get a ground pin, so do the buttons and dfplayer mini. Same goes for the 5v pins as well.

Programming

portal gun code.PNG

The code for the gun is quite simple, really. What it does is check the state of either of the two buttons. If blue button is pressed, make the LED's light up blue and play the accompanying sound. Vice versa with the orange button. If the buttons have not been pressed for 5 minutes or longer, shut the portal gun off until a button is pressed again (saves battery). I was thinking of adding an idle animation but decided against it for simplicity sake.

Audio files are located below for the firing sounds. Rename them from 1 upwards so arduino can actually recognize the files.

Physical Assembly

20221008_122209.jpg
20230304_193214.jpg
20230304_163149.jpg
20230301_141358.jpg
20230306_142100.jpg

For actually assembling the physical parts of the portal gun, it is fairly straight forward stuff, just gluing stuff together but here are a couple of notes to help you along the way:


  1. The plastic bottle that is needed has to have the bottom and top cut off of it. The ends have to measure no more and no less than 13cm long. This is the casing for the portal gun core
  2. Keep the portal gun nozzle elevated properly above the pegs for the front cover to ensure there is enough pressure for the glue to work. Same goes for the other parts that gotta be glued.
  3. When gluing the cables, tape them down while they're being glued, otherwise they will most definitely come loose when the glue is setting.

DONE!!

rn_image_picker_lib_temp_407c08e1-589c-4456-9f45-4a5ee10a3d87.jpg
20230307_235729.jpg
20230307_235737.jpg

Congratulations! You are now in possession of an Aperture Science Handheld Portal Device. (Sticker on the side is optional btw, I just wanted to give my portal gun an extra something).

Hope you enjoyed the journey.

This guide was made by DigiWiz