กลับไปหน้ารวมไฟล์
samco-arduino-powered-ir-light-gunmouse-54cd84-en.md

The SAMCO is a Namco light gun with the insides replaced with an Arduino micro controller and DF Robot IR positioning camera and works as HID mouse on LCD (flat screen) TV/monitors.

Build Guide
Introduction & Mame in RetroPie setup
Accuracy & Tilt Correction Demo
PlayStation 1 & SEGA Saturn (RetroArch) Setup
PlayStation 2 (PCSX2) Setup
Test your Light Gun setup before uploading the final code

Technical Deep-Dive

The "SAMCO Precision IR Resolver" is a high-fidelity hardware modification that upgrades vintage arcade peripherals for the modern digital era. By gutting an original PS1 Namco Light Gun and installing an Arduino Micro (ATMega32U4) paired with a DF Robot IR Positioning Camera, the project creates a native USB-HID Mouse that works on modern LCD and LED flat screens—a feat impossible for original cathode-ray tube (CRT) light guns. It is a masterclass in Computer Vision (CV) tracking, HID descriptor emulation, and Trigonometric Coordinate Mapping.

  • IR Positioning & Computer Vision:
    • The Tracking Logic: Unlike original light guns that relied on the scanning electron beam of a CRT, the SAMCO uses an infrared positioning camera localized in the gun’s barrel. This camera tracks up to four distinct IR points emitted from a stationary LED bar placed atop the monitor.
    • Geometric Translation: The Arduino firmware calculates the center of gravity between the tracked IR points. By applying Bilinear Interpolation or simple trigonometric scaling, it translates the camera's raw 1024x768 sensor coordinates into standard screen mouse coordinates ($X, Y$).
  • USB-HID Emulation (ATMega32U4):
    • Native USB Stack: The Arduino Micro is chosen for its 32U4 processor, which has built-in USB communication. This allows the gun to identify itself to Windows, Linux, or RetroPie as a standard generic mouse.
    • Zero-Lag Polling: Because the gun acts as a native HID device, there is no "v-sync" lag or software interpretation overhead. The gun reports its position at the maximum USB polling rate, providing the snappy, "one-to-one" tracking feel required for competitive arcade titles like Time Crisis or Point Blank.
  • Tilt & Parallax Correction:
    • Advanced Algorithms: Re-housing the electronics in a gun shell introduces parallax errors if the user stands at an angle. The "SAMCO Core" code includes a Tilt Correction Module that uses the relative distance between IR points to compensate for the gun’s orientation, ensuring the cursor stays "on-target" even when shooting from the hip.
  • PCB Design & Signal Routing:
    • Custom SAMCO PCB: To ensure high reliability and a clean build, the project utilizes a custom-designed PCB that manages the power distribution to the IR camera and captures the physical trigger/button inputs from the original Namco shell. This eliminates the "Rat's Nest" of wires common in DIY light gun modifications.

Engineering & Operation

  • IR Emission Engineering: The project uses specific 15° narrow-angle IR emitters. This narrow beam ensures high intensity at long distances, allowing the gun to be used from across a living room. The 100-ohm resistors ensure the LEDs are driven at their peak efficiency without exceeding their thermal limits.
  • Software Setup (RetroArch/MAME): The documentation provides deep integration guides for RetroPie and PCSX2. It explains how to map the "Light Gun" input within the emulator’s core settings, transforming the Arduino’s mouse clicks into specific gaming-console signal pulses.
  • Dynamic Range Optimization: A specialized "4-LED Sketch" is available for larger screens or smaller rooms. By increasing the number of reference points, the Arduino can more accurately triangulate its position when the user is standing very close to the display, preventing the "dead zones" common in 2-LED setups.
  • Professional Build Quality: From the precision-drilled camera mounting in the barrel to the application of Solder Flux for high-integrity joints, the SAMCO project emphasizes a non-destructive aesthetic that preserves the tactile feel of the original 1990s hardware while delivering 21st-century performance.

Further Development: Adding a 4 LED sketch sketch to reduce working distance.

Explanation of 4 LED sketch
New Code Update!

Build Guide for GunCon2

NEW RANGE OF PCB's AVAILABLE


Revive the arcade legend: Bridging 90s nostalgia with cutting-edge optical positioning.

ข้อมูล Frontmatter ดั้งเดิม

apps:
  - "1x Arduino IDE"
  - "Mouse.h (HID Library)"
author: "samco"
category: "Gaming & Leisure"
components:
  - "2x Resistor 100 ohm"
  - "1x NEW SAMCO PCB's"
  - "1x Soldering iron (generic)"
  - "1x Adafruit ItsyBitsy M0"
  - "2x Infrared Emitter, 15 °"
  - "1x Gravity: IR Positioning Camera For Arduino"
  - "1x Arduino Micro"
  - "1x Drill / Driver, Cordless"
  - "1x Solder Flux, Soldering"
description: "Replace the inside of a PS1 Namco light gun with a microcontroller with HID support and turn into a light gun/mouse."
difficulty: "Intermediate"
documentationLinks: []
downloadableFiles:
  - "https://github.com/samuelballantyne/IR-Light-Gun"
  - "https://github.com/samuelballantyne/IR-Light-Gun"
encryptedPayload: "U2FsdGVkX1/EX5N6KU5WhAAdl4VUi8OAaeLArfIqcU1BuBT+I5FG0QHISSiA+xhGhj3cAkIMZqZtM7VLVbZmg8hVWAj3dRDm/hSg8Jk0+NQ="
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/samco-arduino-powered-ir-light-gunmouse-54cd84_cover.jpg"
lang: "en"
likes: 5
passwordHash: "dafa1c2862ec4773c63a321b58e22749cbc2af54573f4503f88f9b5b09adf04f"
price: 1499
seoDescription: "Build a custom light gun/mouse using Arduino and a PS1 Namco light gun with HID support."
tags:
  - "retro-gaming"
  - "hid-device"
  - "ir-positioning"
  - "emulator-hardware"
  - "mame"
title: "SAMCO Arduino Powered IR Light Gun/Mouse"
tools:
  - "Soldering Iron"
  - "Cordless Drill"
  - "Solder Flux"
videoLinks:
  - "https://www.youtube.com/embed/cwhUe22ZhzE"
  - "https://www.youtube.com/embed/ygBHzShNIPg"
  - "https://www.youtube.com/embed/1g8y9xYrDiE"
  - "https://www.youtube.com/embed/UqWgm9CAP7U"
  - "https://www.youtube.com/embed/FDNjJug52EA"
  - "https://www.youtube.com/embed/Mzek1c2WMb0"
  - "https://www.youtube.com/embed/JJPcwmTc5X0"
  - "https://www.youtube.com/embed/xPWTQeqoiII"
  - "https://www.youtube.com/embed/k_JsqBy0rr4"
  - "https://www.youtube.com/embed/LizXdsRqRpE"
views: 15653