Rick & Morty Portal Gun (Arduino & 3D Printer Project)




Introduction: Rick & Morty Portal Gun (Arduino & 3D Printer Project)

About: Currently a Systems Engineer at Sagentia, with 3+ years of experience in consumer audio electronics. I Graduated from The University of Kent with a MEng in Electronic & Communications Engineering.

Welcome to my first big 3D print project!

Sneak Peak of end result!

This Instructables will explain all the steps you will need to flow to build yourself a working portal gun like Ricks! for roughly £35!

Hope you enjoy & lets begin!

Step 1: Project Proposal

As a massive Rick and Morty fan I really want a Portal Gun of my own, having looked about the current existing projects I thought I could add some extra features!

Key Goals

Have a Working (Visually anyway, still a ways of a real portal gun) Ricks Portal Gun this will include,

  1. Working 4 Digit Seven Segment Display in Red
  2. The display must be able to cycle through infinite dimensions and the key ones from the show!
  3. Must be able to fire the portal gun causing front panel to light up indicating portal generation!
  4. Portal Tube must be lit
  5. Needs a self destruct button hidden in the handle!
  6. Some way of charging the gun without disabling the device
  7. Must look like the portal gun!

I've planned out a simple system flow diagram for how I think the device should work

Step 2: BOM

Lets discuss the the electronics and materials required for this project, to achieve the proposed system flow diagram the following components will be required.

The estimated cost of this projects components would be £35.17 to buy all the parts out right,

The cost of all the components used in one of these projects would be approximately £24.77

*Note that this does not include the cost of the 3D printer material used!


Arduino Nano V3 - £3.60

4 Bits TM1637 Digital Tube LED Display Module - £0.99

Rotary Encoder Module KY-040 - £1.56

Momentary Tactile Push Button - £1.25

PCB Slide Switch DPDT On-Off-On - £8.14 **** (This part is not only option any Vertical Slide On - Off Switch could be used)

TP4056 Lithium Battery Charging Module - £2.40

180Ω & 1kΩ Resistors (Just buy a set of resistors) - £5.66

Green 10mm Diffused LEDs - £1.69

3.7V 1600mAh Lipo Li-polymer Rechargeable Battery - £7.50

M3 8mm Countersunk Screws - £1.39

3D Parts

If you don't want to paint your parts you will want to get some White & Black PLA to print all the required model parts.

For this project I used,

Flashforge® PLA 3D Printing Filament 1.75mm 1KG White - £17.00

AMZ3D 1.75mm Black PLA 3D Printer Filament - 1kg Spool - £16.99

of course the other option is to print the parts in any materials you currently have and then post process the parts

Step 3: 3D Printed Parts

The 3D print models can all be found on Thingiverse here - https://www.thingiverse.com/thing:2935246

To design this model I used Fusion 360, I tried to find as many screen shots of the gun from the show as possible and tried to recreate the gun with consideration for all of the electronics.

The parts have all been designed with a 0.4mm tolerance to compensate for any 3D print inaccuracies (This is based on my experience with my printer)

Note* You may still want to file back some of the joins e.g the LED cutouts.

The parts are named with the colour they need to be printed in,

  • 'B_' = Black Part
  • 'W_' = White Part

The only 2 parts that require supports are the

  1. W_HiddenDoor_v4.stl
  2. W_Handle2 SinglePartSecretDoor.stl

All other parts do not require supports or rafts.

For the portal gun tube I have used a Bubble Sword toy which had a diameter of roughly 27mm this is what the current 3D model has been designed for. If you have issues finding a similar part I can modify the .stl if you let me know what you need it changed to!

Step 4: Electronics

Now time to put together the circuit diagram!

I've used Fritzing to plan the circuit diagram which is a really awesome free bit of software for these types of project.

The setup shown in the attached image will allow for the Arduino to control the TM1637 Display and update it when the user inputs on either the Rotary Encoder Module or the Momentary Tactile Push Button.

The battery is connected through the TP4056 which allows for Micro USB charging, this then connects to the MT3608 which stets up the 3v7 to 5v for the Arduino Nano Vin. The Latching slide switch is connected through this 5v connection to use as an On/Off switch. While in this configuration the battery can still be charged while the device is powered down.

The 2 LEDs for the tube are always powered up & the 3 LEDs for the front panel are connected to a Do pin of the Arduino so they can be triggered when the Rotary Encoder is pressed.

Step 5: Code

The code for this project was pretty simple,

For this code to work you will need the attached library 'TM1637-1.1.0.zip'

This is far from an optimal code but it seems to work for me!

(Code shown below but it would be better to download the .ino rather than copy and paste)

Step 6: Assembly

Once I assembled and tested the electronics it was time to put together the entire gun!

I used a small pin to hold the secret hinge door, a header / small bit of wire / paper clip should work as well.

Once assembled its time to test it out!

Final Test

Step 7: Conclusion

I'm really happy with how this project came out and hope you guys enjoyed,

If you get around to making your own please send me photos, I would love to see how it worked out for everyone!

If you have any questions or issues please comment and I will try to help as best I can

Future Work

  1. I plan to add audio to the device soon using a ISD1820 chip and a small speaker, this will play the audio bite and I may also find a self destruct noise
  2. Maybe an Evil Rick Portal Gun Variant?!

Be the First to Share


    • Pocket-Sized Speed Challenge

      Pocket-Sized Speed Challenge
    • Audio Challenge 2020

      Audio Challenge 2020
    • Maps Challenge

      Maps Challenge

    21 Discussions


    7 months ago

    Hey i really like this idea but the problem is i dont have a 3D printer but i am planning to buy it. do you think i could make this out of cardboard en popsticle sticks?


    Reply 5 months ago

    Hey Kyan, don't see why not! Be sure to upload photos if you manage it :)


    8 months ago

    I got the programming figured out.. lots of issues there to start... now the diagram for the Arduino board has lines goes to holes that are counted for... some of the lines are just jumbled around and connect to several different things maybe? Can you clear up how to wire everything? Perhaps using the NAMES ON THE BOARD example GND for ground (which on the v3 nano there are two of btw) or D3/D4/D5, those are some of the names of the pin locations on the board itself. If you just say pin 3... well there isnt a pin 3 labeled on the board. There is D3 AND A3 on this board. I mean great work overall, really love the design and thought that went into this but the follow-through for "Instructables" is failing.


    Reply 8 months ago

    I give up. None of the wires on the diagram are accurate enough to understand. Pro Tip, MS Paint is not the way to set up your wiring display. Wasted $100 on this. Decent print but horrible design notes. Crazy part is, I rewired Apache Attack Helicopters in the Army for 6 years... that's how bad this example provided is.


    Reply 8 months ago

    Hi, not totally sure what
    your issue is, if you could detail your circuit setup and HW config maybe we
    can debug the issue.

    Can you confirm you are using the same display module (TM1637)?

    The Pin map is poor but I did not spend much time on that as
    its redundant after you look at the pin definitions in the code I provided.

    Below I've detailed the
    display pins, once these are connected you just need to provide the TM1637 with
    PWR & GND. The diagram is redundant again as there are many different
    variants of this display module with different ordered pin outs. If the pins
    below are not appropriate for you setup, you can just redefine them.

    const byte PIN_CLK
    = 8; // define CLK pin (any digital pin) ** Pin D8

    const byte PIN_DIO
    = 7; // define DIO pin (any digital pin) ** Pin D7

    I'm not sure what level of electronic knowledge you have but
    if you are capable of reading a part DS & solder I would assume you could
    resolve this issue quite easily (Especially if you have worked on military
    grade systems...)

    I would recommend validating
    that the display works using the examples in the provided library before
    attempting the full system code.

    Unless you provide more detailed explanations for the issues
    you are having I cannot help further.

    Also the software used to make the circuit diagram is called Fritzing( http://fritzing.org/download/). This is a common bit of software used on this site due to its focus on hobbiest electronics and the facts it free. I could have used LTSpice or Altium to model this but that would have been a tad over kill :)


    Reply 7 months ago

    I went with a different board, got the program uploaded to the Trinket Pro. Guessed at how to alter the code, you're much better at it than I am. Changed the pins code around to match the Trinket, rotary encoder when rotated just fires and turns on the lights. Working on the code again to find out why when I turn the knob (to change the led) it just says FIRE over and over again like the SW button is being pushed. Once I have everything figured out and running would you mind if I added images of how I wired everything to the Pro Trinket?

    NEVERMIND! Its cause I'm stupid. Didn't have the + hooked up on the encoder! Gonna put it all together now and finally get some screws in on this bad boy. Took 2 weeks but hey... worth


    1 year ago

    Greetings from Los Alamos, New Mexico, USA. I made 2 of these as a demo for our makerspace! The first one was completely constructed, but the second one was deconstructed and had parts everywhere. I added a couple of UV leds under the green tube, and made a plasma ball with some hot glue! The glue lights up pretty good with the UV bulbs.

    Thanks Jack, for this projcet!!! This was the first thing I soldered in my life, I might have never learned with out this project!

    What ever you do with this portal gun, stay out of the Citadel.



    Reply 1 year ago

    Hi Jonathan, Awesome job and great idea with the UV lights they look great, I've ordered some to try out myself and some UV Reactive Green PLA samples for the plasma ball in the tube! Thanks for sharing your build and I'm glad you enjoyed it!



    Question 2 years ago on Introduction

    I got a 7 segment display which has 8 pins. How do I wire that to the arduino?


    Answer 2 years ago

    Hi, is it a 4 bit 7 segment display? you will need to follow another guide of how to configure it like this one to get there working https://create.arduino.cc/projecthub/SAnwandter1/programming-4-digit-7-segment-led-display-2d33f8

    The issue with doing this is that my code will not work, you would need to rewrite the display sections.

    I would advice either buying a cheap TM1637 IC and find a guide on setting that up or the better option would be to buy a TM1637 4 bit 7 segment display module like I used otherwise the wiring can get messy!


    Reply 2 years ago

    The TM1637 is ac IC that handles the 4 digit 7 segment display connctions, so that TM1637 chip connects to the 8 pins on the display itself. The chip drives the LEDs in the display based on simple I2C commands it recieves from the Arduino.

    This means that the Arduino only need to use 2 pins Rx and Tx instead of the 8 pins that the LCD Display needs. Also now that we are just sending standard I2C signals it makes it much easier to programme everything.

    Using modules like this is always easier especially when using a small microcontroller like an Arduino Nano, as it has very limited I/O.


    2 years ago

    Wonder if a persistance of vision display could be used to create a portal effect infront of it...


    Reply 2 years ago

    Hey, that is a possible solution I think although I don't know how bright this method would be. I'm quite interested in how the Funko Toy Ricks Portal Gun does it (seen here https://youtu.be/9eXw0bzWeRw?t=123). I think its just a High power LED behind a lens with the portal image on it which would be nice and simple. I'd be tempted to buy one to see how they did it if they were on sale.


    Question 2 years ago

    Will this work even if I am not a rick ?


    Answer 2 years ago

    Lets hope so.


    Answer 2 years ago

    Can confirm that yes it does work if you are not Rick!

    Unfortunately the real portals only work for Rick :)


    Question 2 years ago

    What's the green tube from? I see it as a toy of sorts in one of the images, but do not recognize it.


    2 years ago

    awesome I love it! it would be super cool if you could put an electrical discharge (like a plasma lamp) effect in the green tube.