Arduino Laser Turret With Joystick & Sweep Mode
by danielg80316 in Circuits > Arduino
21 Views, 0 Favorites, 0 Comments
Arduino Laser Turret With Joystick & Sweep Mode
Build a pan/tilt laser turret controlled by a joystick! This project uses two servo motors to aim a laser pointer in any direction using a joystick. A second mode — sweep mode — automatically scans the laser back and forth. A second external laser can be toggled on and off with the joystick button.
Great for cat toys, laser show effects, or learning about servo control with Arduino.
Difficulty: Beginner–Intermediate Time: 1–2 hours
Below are the videos of the working project
Supplies
- Arduino Uno (or compatible board)
- 2x servo motors (SG90 or similar)
- Joystick module (with X, Y analog outputs and push button)
- Store-bought laser pointer
- Push button
- Jumper wires
- Breadboard
- USB cable + power supply
- 3D printed base or store-bought pan/tilt mount
3D Print
The base for this turret was originally designed for a different project — an earlier version of the build that used a different mounting approach. When the design direction changed, we scrapped that idea but kept the base since it still worked perfectly for holding the pan/tilt assembly stable.
Base dimensions:
- Width: ~182.9 mm
- Depth: ~96.5 mm
- Height: ~29.2 mm
Print settings (recommended):
- Material: PLA or PETG
- Layer height: 0.2 mm
- Infill: 20–30%
- Supports: Check your slicer — depending on orientation, you may need supports for any internal features
- Print orientation: Flat side down
To print:
- Download the STL file attached to this step.
- Import it into your slicer (Cura, PrusaSlicer, Bambu Studio, etc.).
- Orient it flat side down on the build plate.
- Slice and print.
Note: This base was originally designed with a different mounting concept in mind. Some features on it may not be relevant to this build — that's intentional. We reused it because the footprint, weight, and overall stability were exactly what we needed for the servo mount.
Once printed, mount your pan servo bracket to one of the slots on the base using tape or hot glue, depending on your preference for permanence.
Downloads
Wiring
Connect everything to your Arduino as follows:
Servos:
- Pan servo signal → Pin 9
- Tilt servo signal → Pin 10
- Both servo power → 5V and GND
Joystick module:
- VRX (X axis) → A0
- VRY (Y axis) → A1
- SW (button) → A5
- VCC → 5V, GND → GND
Lasers:
- External laser → Pin 6 and GND
Sweep mode button:
- One leg → Pin 7
- Other leg → GND (Pin 7 uses INPUT_PULLUP — no resistor needed)
Tip: Make sure your laser modules are rated for 5V, or add an appropriate resistor.
Setup Arduion IDE
If you haven't used Arduino before, here's how to get set up.
- Go to arduino.cc/en/software and download the latest Arduino IDE for your operating system.
- Install it and open it up. You'll see a blank sketch window.
- Connect your Arduino Uno to your computer with the USB cable.
- Go to Tools → Board → Arduino AVR Boards → Arduino Uno.
- Go to Tools → Port and select the COM port that appeared when you plugged in the Arduino. On Windows it'll look like COM3 or similar; on Mac it'll look like /dev/cu.usbmodem...
- The Servo library is already built in — no extra installation needed.
Uploading Code
Copy the code below into the Arduino IDE and upload it to your board.
Downloads
Power on and Test
Connect your Arduino via USB or an external 5V supply.
The laser (Pin 3) turns on automatically at startup.
Move the joystick to pan and tilt the laser. Movement is intentionally slow for smooth control.
Press the joystick button to toggle the external laser on/off.
Press the sweep button (Pin 7) to enter sweep mode — the tilt locks at 60° and the pan sweeps automatically from 45° to 135° and back.
Press the sweep button again at any time to exit sweep mode and return to joystick control.
Customizing
Here are some easy modifications to try:
- Change sweep speed: Adjust the delay(15) inside the sweep for-loops. Lower = faster.
- Change sweep range: Edit the 45 and 135 values in the for-loops.
- Change tilt angle in sweep mode: Edit tiltServo.write(60) to your preferred angle.
- Joystick sensitivity: Lower the 400/600 thresholds to make the joystick more sensitive, raise them to make it less sensitive.
- Add more lasers: Any digital output pin can drive an additional laser module.