Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: aimtrak recoil problems  (Read 4986 times)

0 Members and 1 Guest are viewing this topic.

mitsurugi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 49
  • Last login:May 04, 2025, 02:47:52 pm
  • I want to build my own arcade controls!
aimtrak recoil problems
« on: April 17, 2013, 04:47:48 am »
Hello. I have installed aimtrak in a ps2 gun case:  p99 LIGHT gun Logic3

and it works (the motor turns when i shoot to the screen), but the problem is: the engine wheel don't turn enough for move the gun slide. I have try to set in the options coil to the right, but is not enought. Could be modded the program or the firmware for send more than 40ms of pulse? It could be really interesting for person who uses gun case of ps2 with electric motor instead of solenoid.
Thanks.

mitsurugi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 49
  • Last login:May 04, 2025, 02:47:52 pm
  • I want to build my own arcade controls!
Re: aimtrak recoil problems
« Reply #1 on: April 20, 2013, 01:47:42 pm »
Nobody? I have sent a mail to andy, but no reply yet...
Thanks.

stigzler

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 983
  • Last login:March 21, 2025, 06:36:05 am
  • It seemed like a good idea at the time....
    • Mago Arcade
Re: aimtrak recoil problems
« Reply #2 on: May 19, 2013, 06:22:14 am »
Hey Mitsurugi,

Am just at the start of this hack. Have my two aimtrak modules and my two (cheap :) ) Logic 3's. The gun has so much in - shame to waste the vibration module! How did you wire everything up, especially the recoil function?

Thanks

Steve

epicfatigue

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 360
  • Last login:May 15, 2016, 08:16:08 pm
    • http://www.retromods.com.au
Re: aimtrak recoil problems
« Reply #3 on: May 19, 2013, 06:33:44 am »
the aimtrack has a set pulse, i believe the program changed the recoil voltage for aimtracks solidnoid.

What you want to do it change how large the pulse is, i believe Andy does not modify his firmwares which is rightfully so, but you could look at programming a small pic chip to that could handle it for you or even a small circuit with a capastior

food_bag

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 2
  • Last login:October 23, 2013, 06:01:56 am
  • I want to build my own arcade controls!
Re: aimtrak recoil problems
« Reply #4 on: July 09, 2013, 07:32:40 pm »
I have been looking into this problem and have come up with a circuit that does exactly is needed for P99G2. Essentially, the aimtrak puts out a 5v pulse when the gun is fired at the screen, and the recoil slider bar in the configuration options sets the pulse duration (up to 40ms). However, you need an approximately 200ms pulse driving a motor driver ic at about 7.65V to get gun to recoil properly. In order to get the recoil to work and still have adjustability, I wrote some Arduino code for an ATTiny that measures the aimtrak recoil pulse and adds a static timing offset to the measured pulse duration. This lets you get a pulse that is in adjustment range of 180 to 220ms, and is adjustable through the aimtrak software. I have tried it on a P99G2, and it works pretty good (I also added some code to let the recoil be disabled by the switch on the bottom of the gun). If anyone is interested in the schematics and code I used, let me know.

epicfatigue

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 360
  • Last login:May 15, 2016, 08:16:08 pm
    • http://www.retromods.com.au
Re: aimtrak recoil problems
« Reply #5 on: July 09, 2013, 08:48:37 pm »
post a video of it in action, so others can see.
Good work,

syntax_x

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 42
  • Last login:October 27, 2019, 09:32:44 pm
Re: aimtrak recoil problems
« Reply #6 on: July 10, 2013, 07:09:07 am »
Here you go, this will do what you need for around $4 in parts


syntax_x

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 42
  • Last login:October 27, 2019, 09:32:44 pm
Re: aimtrak recoil problems
« Reply #7 on: July 10, 2013, 07:19:44 am »
I also fail to see why you couldnt use the original board that came with the ps2 gun to drive the motor, i mean, its made to do that.

No reason you cant hook that up still, every time the trigger on it is grounded it'll recoil the gun.  Other wise build the circuit.

should go from 0.0001 second pulse to over 400ms with the 500k pot.

food_bag

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 2
  • Last login:October 23, 2013, 06:01:56 am
  • I want to build my own arcade controls!
Re: aimtrak recoil problems
« Reply #8 on: July 11, 2013, 07:03:10 pm »
You are correct. The original electronics could be used to drive the motor. The part of the original electronics that drive the are pretty simple. The controller on that board just sends out a long enough pulse to a transistor to drive the motor at ~7.6V (the playstation controller plug has a dedicated 7.6V line for driving rumble motors). However, the pulse length sent out is not very well optimized for the design (the motor spins too long which results in a weird 1 and a half recoils per pulse) and is not adjustable. How well the recoil works is very sensitive to the pulse duration since you are essentially trying to spin a DC motor around exactly once. I also had to cut off part of the board in order to fit the aimtrak board properly, so I am not sure if the board still works.

Your 555 timer circuit definitely looks like it would work (I assume you would add a transistor or h-bridge to drive the motor). The upside is that you don't have to program a micro controller to do it. The downside is that the recoil is only adjustable when you have the case open (or if you put something to adjust the pot from the outside), whereas the micro controller method lets you adjust the recoil length from the aimtrak software. The cost difference for the circuits is pretty minimal. An ATTiny85 is trivially more expensive than a 555, and requires less total components. Using a L293d as an motor driver, the cost is about 5-6 bucks (with 4 bucks being the L293d). Personally, I think the gun is a pain to take apart and I had the parts on hand, so I opted for using a microprocessor. Overall, the more choices, the better.

Here is the code for the uC for anyone who wants it. It can be loaded to an ATTINY85 through the arduino IDE with the "arduino-tiny" add-on.

Code: [Select]
/*
P99RecoilLAPW (L293d Attiny PulseWidth)
 
 This program receives a 5v pulse on the int pin on the uC and activates the motor pin on a L293d to spin
 the recoil motor on a P99 light gun for a fixed amount of time. This version uses an ATTiny85 instead of
 an arduino. Also, this version measures the width of the pulse coming in and adds that to a static wait
 time so that the motor run time can be adjusted slightly adjusted directly through the Aimtrak software
 (adjustment time should be between 1 - 40 ms. Even with 8MHz processor speed, the smallest pulse duration
 of 1ms should be captured by the uC). Works fine with an ATTiny running at 8MHz.
 
 Pinout (ATTiny85)
                                  _____
                      (N/C) PB5 -|1   8|- VCC (5v)
                      (N/C) PB3 -|2   7|- PB2 (Aimtrak recoil signal input)
 (P99 Recoil Enable Switch) PB4 -|3   6|- PB1 (L293d enable pin)
                            GND -|4___5|- PB0 (L293d input 2)
 
 This code is in the public domain.
 
 Foodbag
 July 6, 2013
 */

#define in2Pin 0 // Drives the motor driver
#define recoilPin 2 // Reads recoil pin from Aimtrak
#define recoilPinInt 0 // Pin 2 Interrupt
#define recoilEnbSwitch 4 // Reads the enable recoil switch
#define enablePin 1 // Sets the enable pin on the L293d

unsigned long staticWaitTime = 130000; // How long the static wait time for the firing is (in microseconds)
unsigned long maximumMotorTime = 230000; // Disable motor after this long

volatile boolean readyToFire = true;
volatile boolean fireMotor = false;
volatile boolean lastEdgeRising = false; // Seems to help with to falling edges doubling motor run time
volatile unsigned long firingTime = 0; // When the rising signal from the Aimtrak Recoil pin is captured
volatile unsigned long recoilSigLen = 0; // How long the pulse is from the Aimtrak Recoil pin

void setup()
{
  pinMode(enablePin, OUTPUT); // Sets the driver enable pin to output
  digitalWrite(enablePin, LOW); // Sets the driver enable pin low to start (it gets enabled with one loop of program)
  pinMode(in2Pin, OUTPUT); // Sets the driver pin 2 to output
  digitalWrite(in2Pin, HIGH); // Sets the driver pin 2 to 5v (which is the motor break)
  pinMode(recoilEnbSwitch, INPUT); // Sets the recoil enable switch pin to input
  digitalWrite(recoilEnbSwitch, HIGH); // Sets the internal interrupt for the recoil enable pin
  pinMode(recoilPin, INPUT); // Sets the recoil sensor pin to an input (we need to read the pin the interrupt
  attachInterrupt(recoilPinInt, captureFiringSignal, CHANGE); // Sets up the interrupt for the recoil pin
}

void captureFiringSignal()
{
  if (readyToFire == true)
  {
    if (digitalRead(recoilPin) == HIGH) // If this is the rising edge of the pulse, record pulse start time and let the motor be fired
    {
      firingTime = micros();
      fireMotor = true;
      lastEdgeRising = true;
    }
    else if (lastEdgeRising == true) // If this is the first falling edge, calculate pulse width. Otherwise ignore
    {
      recoilSigLen = (micros() - firingTime);
      readyToFire = false;
      fireMotor = true;
      lastEdgeRising = false;
    }
  }
}

void loop()
{
  if(fireMotor == true)
  {
    digitalWrite(in2Pin, LOW); // Start motor
    unsigned long firingStart = micros();
    while (micros() - firingStart <= staticWaitTime + recoilSigLen && micros() - firingStart <= maximumMotorTime) {} //Wait for motor to spin long enough
    digitalWrite(in2Pin, HIGH); // Stop motor
    fireMotor = false; // Don't let motor run till next pulse received
    readyToFire = true; // Look for new pulse
  }
  else if (digitalRead(recoilEnbSwitch) == LOW) // If switch is turned to recoil, enable L293d to spin motor (ie enable recoil)
  {
    digitalWrite(enablePin, HIGH);
  }
  else // Otherwise, disable L293d so motor can't spin (ie disable recoil)
  {
    digitalWrite(enablePin, LOW);
  }
}

I've attached the schematic for my circuit.

mitsurugi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 49
  • Last login:May 04, 2025, 02:47:52 pm
  • I want to build my own arcade controls!
Re: aimtrak recoil problems
« Reply #9 on: October 06, 2013, 03:55:24 pm »
Wow! today i have see it. I was talking with andy and  trying to convince for mod the aimtrack utility for more lenght pulse...
I have not enough knowledge for made it...