Portal Turret Build Guide

Table Of Contents

  1. Introduction
  2. About this guide
  3. Items Needed
  4. Tools Needed
  5. Schematic
  6. Source Code
  7. 3D Print Files
  8. Audio
  9. Painting
  10. Assembly Guide
  11. How to use

Introduction

Ever since the release of Portal in 2007, the turrets featured in the game Portal are a true hit. The odd shaped white units lure you in with cute voicelines, but completely shoot you to pieces with one wrong move.

The reason I started this project was because now that I owned a 3D printer, I really wanted to create something cool that moved with servos and challenge myself in what I could achieve with Fusion 360.

I had a few goals I wanted to achieve:

I managed to hit a lot of these goals. There were some sacrifices here and there, but concidering the physical size of the turret, this was something to be expected.

About this guide

This guide was written after the full assembly of the turret. Since there were quite some requests about releasing the print files, I decided to write down the steps to build one yourself. A lot of the problems I encountered during the design process are fixed, so the build should be rather straightforward. The most challenging part will probably be the wiring, and routing of these wires. Cut your wires long enough, you can always shorten them. Take your time to study the schematics and maybe even take a look at the source code before doing a full assembly. Doing it step by step will certainly help getting your turret up and running.

Putting together the design for this turret was quite a challenge. Writing this guide even more so. But I also believe other people should be able to enjoy building cool things like this. That's why I'm releasing all the files and guide for free. If you feel like this is a fun project and want to support me somehow, you can use the button below to buy me a coffee or something.

Items needed

Tools needed

Schematic

This schematics of the turret are relatively simple. All of the components run on the 5V lines. The ADXL345 and the PCA9685 both run on the I2C protocol. The YX5200 uses Serial communication. Then there's the PIR sensor and the LED ring both using just one pin for communication.

Some important notes:

These are just some of the things I bumped into when building the turret. Please read the technical specification of your chosen chips and boards before hooking them up!

Source Code

The Wemos D1 Mini is the brain of the turret. This powerful little board has onboard WiFi and can be programmed like an Arduino. You'll need the Arduino IDE to install some libraries and program the board.

You can use this page to get started with programming the Wemos.

This page provides information about how to use the Filesystem of the Wemos to run the webpage. Make sure you use the LittleFS Data Upload tool mentioned lower on the page!

The full source code of the turret can be found here.

Keep in mind that most of this software was written to just get the turret to work, so it's not quite optimized for readability. All functionality is split over differnt files to keep it maintainable to some degree.

The code runs on some briliant libraries. Make sure to install:

3D Print files

The turret consists of many parts. The combined parts can be found below. I suggest using a program like Slic3r or Prusa Slicer to split them into individual parts. Most parts can be printed with no or minimal support. Prusa Slicer provides tools to paint support where needed. Settings like temperature and the use of brims is really up to your printer and the used filament. The most difficult parts to print will probably be the wings. I used quite a bit of support material and a big brim to make sure it could print upright and keep it in one piece. To get the glossy finish, make sure to use something like 0.10mm as a layer height for the outer shells. The internal parts can be printed with slightly bigger layer height, but this will ofcourse show more visible layer lines.

Please note: The gun is only added once. You need to mirror it for the other side!

Internals

Download Internals

Download Wemos Mount

Externals

Download Externals

Legs

Download Legs

Audio

The turret plays a lot of voicelines from the game. Download this archive and put the contents on the SD card used in the YX5200.

Painting

I wish there was some sort of shortcut I could provide when it comes to painting the turret. But to get the shiny finish there's pretty much only one way to go about it:

This part will require a lot of patience. Take your time, don't spray too much paint at once. The smoother the surface before painting, the better the result will be in the end. The time spent will be worth it.

Assembly

Now that all the parts are printed and painted, it's time for the assembly. All these steps assume you know how the electronics should be hooked up.

Center

To help with print orientation, the base of the mechanics is done in 3 prints. Use 6 smalls crews to attach the parts together.

The 3 gears should slide right in. I've used an old allen key for the center axel. It should go in relatively easy, but the gear should get stuck on there. If it's too loose, the axel might slide out. The other two axels are 4mm rods cut to length. Make sure the gears are oriented the right way!

Use 4 small screws to attach the rear plate to secure the gears in place.

Install the continuous servo and the microswitch. This switch helps the controller to detect if the wings are open or closed.

Insert the rack gears. Make sure they line up on both ends. They should go in both all the way.

Now you can install the large gear. This one also needs to have a snug fit to ensure not falling off. A drop of super glue surely will help.

Attach the top part with 3 small screws. This should complete the inner mechanics. The screws should not stick out of the top, as this will hinder movement of the part.

Eye

The center piece is printed flat to make sure it's easy to print and doesn't show any layer lines. However, the shape should be slightly indented. A tiny "mold" is added to the models to help with this. After printing, place the eye in some hot water. PLA gets soft at these temperatures, so you can push it on the mold to get the desired shape.

The LED ring should exactly fit in the holder. Same for the red LED. The white part is a 'diffuser' to make the red light more even across the eye. Looks way better than directly looking into the LEDs of the ring.

All the parts should fit together front to back and should slide over the extruded edges of the main body. The red LED should help keep everything in place.

Wemos Mount

There is a small mount to print used for the Wemos. Please note that at the time of writing, the Wemos V4 has launched with the mounting holes in a different position. Either try to get a V3, or do a small redesign of the mount. Use one small screw to keep the Wemos in place. Having it attached with just one screw makes it easy to access when soldering the components together.

Main Body

Cut two pieces of M3 threaded rod to length and glue them in one side of the main body. Make sure the wires on your speaker are long enough, because it won't be easy to access it after this step.

Using some more glue, slide the second half of the shell in place.

The whole eye assembly should slide in place. Use superglue to attach the Wemos mount. This should also help with keeping the two shells alligned.

Top

The bottom piece is part of the hinge that makes the wings turn. It also houses both the PCA9685 and the YX5200. Since there are no mounting holes on the YX5200, I decided to glue it to a custom small piece. The top layer of this piece is the same size as de Micro-SD card, providing a nice surface for the glue to do its work.

To save space, I'd recommend to remove the pin headers of the YX5200 by desoldering them. Use some clippers to cut the black plastic bits and use a soldering iron to remove the metal pins. Do them one by one, don't overheat the chip.

The PCA9685 is mounted with 4 smalls crews.

Once the YX5200 is glued to the 3D printed part, you can attach it with two small screws.

Slide the piece in the main body and secure it with 4 scews. This should greatly help stability of the whole build.

Bottom

There are multiple ways to power the turret. You can use a USB breakout board, or simply route the power wires directly in the build. Both options should fit underneath the little clamp that gets attached with two small screws.

The acceleromter goes in next. There are two standoffs provided to secure it in place.

6 screws are used to attach this plate to the bottom. The PIR motion sensor can be clamped in the front and should just fit above the accelerometer. There's not much room, but with some tight cable management it should be possible.

The orientation of the ADXL345 is important. When mounted upside down the turret will constantly think it's tipped over and starts to panic and turn off. For me, this meant all the chips are on the top side of the board, facing the printed part.

Screw the small gear on the servo and attach it to the bottom plate.

Cut 2 4mm rods to length and run them through the bottom plate. They should stick out a few milimeters on each side.

Use a small piece of 4mm rod to create the hinge between the top and bottom part.

Most of the internal mechanics are now complete.

Slide the center mechanics in the hinge at the top. Slightly spread the outer shells at the bottom to slide them over the metal rods. If the shell doesn't keep the rods in place, concider some glue. However, this would fix things in place permanently, so only do this when you're sure everything works.

Wings

First up are the two guns. Insert the white LEDs in the metal holders. Insert a holder with LED in all of the muzzles. The LED holders should stay in place by itself.

The back of the guns provides a small path for wires. Use some hot glue to keep the LEDs and wires in place. Make sure the wires are long enough to reach the PCA9685. It's easier to cut some off than to resolder new wires later.

Cut some 4mm rods to length. I recommend smoothing them by inserting them into a drill and spin them in a piece of rough sandpaper. The smoother the better, but also keep in mind that they should fit as closely as possible to prevent the wings from wobbling too much. Roughen the outer tip a bit and use super glue to attach the rods to the wing. I suggest you insert the wings into the center mechanism to keep the rods in place while the glue dries. Make sure the wings don't touch the center mechanism though, as they could get stuck. Ask me how I know...

Attach the gun with 2 to 6 screws.

Cut some M3 threaded rod and use super glue to fix them in place in the wing. This will be the pin the rackgears will snap around so make sure they're tight.

When all the parts are glued and secure, you can slide in the wings and click the rack gears on the metal pins.

Legs

All legs consist of a piece of 4mm steel rod, 2 printed pieces and a small peg that can be cut from the M3 threaded rod. Use superglue to glue everything together. The peg should help with some strength.

Getting the metal parts in the correct shape can be quite tricky. Bending 4mm steel can be difficult. I suggest using something round of the approximate size to help with getting the right shape.

Completion!

Now it's time to glue in the antenna and the 3 legs. And that concludes the assembly.

How to use

After assembly, the turret should be pretty much ready to go. When starting up, the Wemos will look for a WiFi network. If it can't find it, it will start a HotSpot to connect to. Use the provided portal to set up your WiFi credentials. After that, the turret should connect to your network and start its program.

You can look up the IP Address of the turret by accessing your router, or try http://portal.local on a device connected to the same network. This should give you the Portal themed webpage of the turret to go into manual mode and look at some of the sensors of the turret.