ES-PS3-2 Controlled Pan Tilt Turret

by mars91 in Circuits > Robots

154 Views, 1 Favorites, 0 Comments

ES-PS3-2 Controlled Pan Tilt Turret

with motion cv2
img1.png
complete_img1.png

Some 3D printed parts, screws, a bearing, a slip ring (lets wires spin without tangling), two motors - and you’ve got a turret! I also added a LiDAR sensor (measures distance with lasers) and a normal laser pointer. The the two lasers on this build don’t interact, but they do show how this electrical turret can support a bunch of different modules controlled from a ground circuit.

I’m using an ESP32 chip since it can talk wirelessly to a PS3 controller. Open-source code gives the ESP32 full access to a PS3 controller via Bluetooth. Left joy stick, right joy stick, square, X, circle, everything. My example uses the PS3 controller to control the motors and turn on/off the laser pointer.

The 3D-printed parts mostly came from an open source turret design. My main addition is the slip ring. That part is important because it lets the wires spin and easily allows complicated turret modules (sensors, blasters, whatever you want) to spin around freely. The slip ring doubles as a bearing and the axis of rotation for the pan movement.

Supplies

Screen Shot 2025-08-31 at 4.35.22 PM.png
61CCc3RslAL.jpg
raggio-lasr-articolo-1024x294.jpg

Basic Turret Parts


  1. 2x Adafruit TMC2209 Stepper Motor Drivers (other drives would work as well)
  2. M3 Screws
  3. 6002-2RS15x32x9mm bearing
  4. 2x nema 17 stepper motors
  5. Slip Ring with Flange - 22mm
  6. 2x motor belts 200-6
  7. 2x 20 teeth 5mm pulley
  8. 3D parts - files below


Power

I think the turret motors can run off 5V USB power, but I use a dedicated 12V supply. Higher voltage (within their rated limits) generally means better performance for stepper motors and drivers.

power supply


PS3 Wireless Controller Setup


ESP32

You need an ESP32 that supports classic Bluetooth (not BLE). Here’s the one I use: ESP32-WROOM. I learned this because I first tried an ESP32-S3, but it wouldn’t connect to my controller.

ESP32-WROOM


PS3 controler

You’ll need a real PS3 controller. Some knockoffs claim to be PS3 controllers but don’t actually use classic Bluetooth, so they won’t work with the ESP32-WROOM. You can usually find used ones online - including Amazon.


A windows computer or virtual machine

You’ll need Windows for this step. I used Sixaxis Pair Tool (Windows only) to set the MAC address on my PS3 controller. You have to write your ESP32’s factory-set Bluetooth MAC into the controller so it knows who to pair with.


Other parts I used


  1. tft screen
  2. garmin lidar (recommends a 680 µF capacitor)
  3. laser pointer
  4. small breadboard (the sticky bottom works great for attaching it to the turret base)
  5. 5v buck with GPIO enable pin

3D Build

Screen Shot 2025-08-31 at 2.41.14 PM.png
breadboard.png
img3.png
img2.png

Pan tilt turret


Everything snaps into place and is pretty straightforward. It’s also very dependent on your 3D printer. Luckily, I’ve got a public library about 10 minutes away that does quality prints. Most things fit tightly, but I did use some folded paper in a few spots to make things snugger.

For the screws, I used a handheld power drill, very slowly. The cheap screws can strip easily. I ended up using a variation of the M3 screw lengths. The belts and pulleys sometimes need a little muscle to snap into place. The pulleys come with their own allen wrench to tighten them down.

For the final pan tilt turret, you’ll need the slip ring, two motors, two belts, two pulleys, and a few screws.


Slip Ring Wires

This slip ring has 12 wires! That’s pretty nice, especially when most sensors only need 4 wires for I²C communication or just one GPIO pin for a toggle. You could also get creative and build your own minicircuits on the pan 3D printed base. The small Chanzon breadboard has a peelable sticky bottom and is the perfect size to connect your modules to the slip ring connections.

If you want the tilt action, you need to connect the stepper’s four wires to four wires on the slip ring with the breadboard.

Circuit

circuit.png
pan.png

The TMC2209 drivers are easy to use. They also allow for much higher precision, but I’m using the simplest method: two pins, DIR and STEP. As the names suggest, the DIR pin sets the direction, and the STEP pin makes the motor step.

Adafruit has a good tutorial on these drivers.

The four wires on the stepper motor control direction and stepping. I believe NEMA 17 motors don’t have a standardized color scheme. If you wire the four wires into the screw terminal and the motors don’t move, it’s probably wired wrong. There is also this neat trick to finding the correct pairing with a multimeter:

  1. Set multimeter to continuity mode.
  2. Pick any two wires and touch the probes to them.
  3. If the meter shows low resistance (for me it was 30 ohms), those two wires belong to the same coil.
  4. If it shows open / no continuity, they’re from different coils - try a different pair.
  5. Once you find the two pairs, one pair goes to 1A / 1B on the driver, and the other goes to 2A / 2B.

These drivers also have a small screw potentiometer for current limiting. If you turn it all the way counterclockwise, the drivers stop because the current is basically set to ~0A. More current = more torque and power (but more heat). I’m not moving anything heavy, I kept the current pretty low.

My motor wiring ended up being:

2B → Red, 2A → Yellow, 1A → Gray, 1B → Green.

That’s all you need to get the turret motors running. My build, tho, has more.


Final Laser LiDAR Build


I’ve got two modules connected:

  1. An I²C professional LiDAR module (four wires connected to the slip ring)
  2. A 5V laser pointer (two wires connected to the slip ring)

To control the laser on/off, I used a 5V buck module with an enable pin, tied into the 12V motor supply. This lets the ESP32 toggle the laser’s 5V power. The LiDAR module also needs 5V, so I powered it from the ESP32’s onboard USB 5V pin. I also added an SPI TFT screen.


A Few Notes About the TFT Screen

ESP32 chips are awesome with tft displays and this library: https://github.com/Bodmer/TFT_eSPI

I used a 240x135 TFT, which means 32,400 RGB pixels to control. Since each pixel needs an RGB value, that’s 97,200 RGB data points constantly updating.

Once I hooked everything up, tho, I noticed my motors weren’t running as smoothly anymore... Turns out, the processing and speed required to render the smooth, custom animations caused small delays in motor control. But i'll give this $5 chip a break - it’s simultaneously:

  1. Writing 97,200 RGB values at a high frame rate
  2. Talking to a PS3 controller over Bluetooth
  3. Pulling LiDAR data over I²C
  4. And controlling two stepper motors

When I removed the fancy TFT graphics (or massively simplified them by avoiding large buffers and sprites), the motors went back to running very smooth.

Eventually, I got a version working using the AccelStepper library, which is smooth enough for me… but I spent way too many hours writing these graphics to not stubbornly keep them in :)


I’m using this ESP32 to control two stepper motors (four pins), toggle a laser (one pin), talk to the LiDAR (two pins), and drive a TFT screen (five pins). Here’s the full pin breakdown:

ESP32 Pin Mapping & Connections

  1. GPIO 27 → DIR input on Pan driver → Controls Pan motor direction
  2. GPIO 33 → STEP input on Pan driver → Steps Pan motor
  3. GPIO 13 → DIR input on Tilt driver → Controls Tilt motor direction → Uses slip ring
  4. GPIO 12 → STEP input on Tilt driver → Steps Tilt motor → Uses slip ring
  5. GPIO 4 → Laser enable / LED → Toggles laser module ON/OFF (Controlled by PS3 Cross button)
  6. GPIO 18 → TFT MOSI → SPI data for TFT display
  7. GPIO 5 → TFT SCLK → SPI clock for TFT display
  8. GPIO 17 → TFT CS → Chip select for TFT
  9. GPIO 21 → TFT DC → Data/Command pin for TFT
  10. GPIO 16 → TFT RST → Hardware reset for TFT
  11. I²C SDA (default GPIO 21) → LiDAR SDA → Uses slip ring
  12. I²C SCL (default GPIO 22) → LiDAR SCL → Uses slip ring


Power Setup & Breakdown

This build has a few different power sources to handle the motors, LiDAR, TFT, and laser. I tied all grounds together. Here’s how the power is set up:

Main Power (12V Supply)

  1. Powers the stepper drivers directly through their Vin screw terminals.
  2. Also feeds a 5V buck converter that powers the laser module.

5V Buck Converter (Laser Power)

  1. Takes 12V input and outputs a regulated 5V for the laser module.
  2. The laser’s enable pin is tied to GPIO 4 on the ESP32 so it can be turned ON/OFF via code.
  3. Connected to the small bread board with the slip ring

ESP32 USB 5V

  1. The LiDAR module (so it stays powered all the time)
  2. Connected to the small bread board with the slip ring

ESP32 On Board 3V

  1. TFT Vin
  2. VDD on the stepper motors (this is the voltage for the STEP and DIR logic). Should match your boards

Common Ground

  1. all share a common ground.

PS3 Controller

My Movie 22
unnamed (7).jpg
Screen Shot 2025-08-31 at 4.22.10 PM.png

I pretty much followed this amazing blog step by step.

First download the Ps3Controller.h library from the Arduino library manager.

One thing that was a little different for me was that I had to set my PS3 controller MAC address to my ESP32’s hardcoded Bluetooth MAC address. You can find the ESP32’s MAC using this script:

#include "esp_bt_device.h"
#include "esp_bt_main.h"
#include "esp_gap_bt_api.h"

void setup() {
Serial.begin(115200);

if (!btStart()) {Serial.println("Failed to init");return;}
if (esp_bluedroid_init() != ESP_OK) {Serial.println("Failed to init bluedroid (whatever that is)");return;}
if (esp_bluedroid_enable() != ESP_OK) {Serial.println("Failed to enable");return;}

const uint8_t* mac = esp_bt_dev_get_address();
Serial.printf("esp32 mac: %02X:%02X:%02X:%02X:%02X:%02X\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
}

void loop() {
const uint8_t* mac = esp_bt_dev_get_address();
Serial.printf("esp32 mac: %02X:%02X:%02X:%02X:%02X:%02X\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
delay(20000);
}


After that, I used six axis pair-tool on a Windows computer. It’s an easy download. Just plug your PS3 controller into the PC via USB, and the tool will recognize it. Then, you can set its MAC address. Type in the exact ESP32 MAC address you got from the script above. Then update it.


Also change the MAC address in the Ps3Controller.h examples in the set up function. Successfully run the PS3 Demo and youre done!

Final Code

jake-walker-MPKQiDpMyqU-unsplash (1).jpg

The final code pulls everything together. The PS3 controller toggles the laser pointer, the TFT screen updates with LiDAR I2C values, and it also logs the pan and tilt angles. The code connects the ESP32 to the controller and lets them work together over Bluetooth.


I have also included the necessary setup files I used for the TFT_eSPI library.

The End

no music with tft

thanks for checking out this instructables!