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: SAMCO DIY Arduino Powered IR Light Gun  (Read 86188 times)

0 Members and 1 Guest are viewing this topic.

samco

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 52
  • Last login:April 12, 2024, 08:30:25 am
  • SAMCO Light Gun Creater
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #160 on: December 12, 2022, 06:21:30 pm »
@scratcher no problem mate. The easiest way is to just reallocate those pins. So find the bit in the code that looks like this and swap the values around like this...

int _tiggerPin = 7;               // Label Pin to buttons
int _upPin = 11;               
int _downPin = 13;             
int _leftPin = 10;             
int _rightPin = 12;               
int _APin = A1;               
int _BPin = A0;             
int _startPin = A2;
int _selectPin = A3;               
int _reloadPin = 9;
int _pedalPin = 5;   

That will swap those function around. i.e down is now calibration and the old calibration button is now down.

ThatOneSeong

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 66
  • Last login:April 21, 2024, 11:57:42 pm
  • Just your average Seong.
    • Twitter
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #161 on: April 02, 2023, 02:21:48 pm »
Long time no see, everyone!
Weird to think this has been going for two/three years, but I'm still maining Prow's fork with no issues* on Linux. FWIW, I've made a small modification to allow setting the gun to pause mode with a key combination so I can use C as Mouse Thumb 1/Mouse4, what with the recent merging of PCSX2 GunCon2 support for all platforms.
In case anyone's interested in following along, to change Pause mode to a combination of C + Select, change line 178/179 to:
Code: [Select]
// button combo to enter pause mode
constexpr uint32_t EnterPauseModeBtnMask = BtnMask_Reload | BtnMask_Select;
I'd make a pull request but I wasn't sure how many people would want to change this behavior.

*Actually there is a problem, but not from the gun or the software itself. I'm starting to realize that the cheap sensor bars I've been buying have a bad habit of dimming over time. Because of this, I've been tempted to buy RPEG's high-power black LEDs used for GUN4IR, and just arranging them in the same orientation as a top/bottom Wii lightbar, but maybe this is a bit extreme? I've tried looking into other Wii USB lightbars, but they all look exactly the same; having three leds on either side instead of five, and a tendency to dim over a period of time. I've also looked into the wireless options like the Power A Ultrabar, but not only would I be wasting batteries but getting a pair would be about as expensive as buying the kit from RPEG. And buying bulk lots of the cheap bars seems even more wasteful (not to mention a hassle of switching them out every so often). I could perhaps take some legit OEM Wii sensor bars and mangle them to work off USB/another non-Wii centric power source, but that seems messy. Are some knockoff Wii sensor bar brands better than others, maybe?
I'm just not sure. Has anyone else ran into this issue? Mayhaps some of the Lichtknarre 2LED users can chime in here? I'm just trying to figure the best way of doing this, as I do plan on making potential videos about PC Light Guns and will probably highlight Samco in the process (mayhaps alongside Gun4IR? Not sure), so I'd like to know what exactly to recommend/what the common consensus is for my own research.

famichiki

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 1
  • Last login:June 09, 2023, 10:27:13 pm
  • I want to build my own arcade controls!
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #162 on: June 06, 2023, 09:55:48 pm »
I've bought Sam's PCB and am trying to figure out which board to go with out of the ItsyBitsy 32u4, M0 or M4.

Disregarding the ability to save the calibration and putting cost aside, why not choose the M0 or M4? The price isn't much more and they appear substantially faster on paper. Is there anything to be aware of with the ARM processors?

Do both the 3v and 5v 32u4 comfortably run with additional processor headroom for custom tweaks to the code, such as adding recoil solenoids etc? Or are they already maxxed out handling the tracking? I have a few ideas I want to incorporate.

Also, is there any more overhead for running the 4IR code vs the 2IR?

samco

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 52
  • Last login:April 12, 2024, 08:30:25 am
  • SAMCO Light Gun Creater
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #163 on: June 12, 2023, 08:20:53 pm »
Hi Mate, I've found the 32u4 3V can seem to run a tiny bit slightly slower than than the 5V but no noticeable difference to M0 or M4 (I assume because it can only run as fast as the camera can update the points but haven't done any testing on this). There is still a bit of flash space (about 7kb) on the 32u4 using the 4IR sketch (which is heaver) to to add to sketch if you wanted to. I prefer using the 324 5V because I like how it saves to eeprom. Like I said haven't done any actual tests so if anyone has I be interested in the results?

dabone

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 898
  • Last login:October 31, 2023, 12:03:37 pm
  • Time to work...
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #164 on: August 25, 2023, 03:47:45 pm »
I ordered and built to samco gc2 boards using the ItsyBitsy 32u4-5V, and I've tried both firmwares, but here's a easy question.

Where should the LEDs be mounted?

The gun IR wants them placed on the middle of the top/bottom and sides.

Where should the LEDS be placed for the samco firmwares? I'm running the 4 led config, using 3 SFH 4547 LEDs per led position.

Thanks.

samco

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 52
  • Last login:April 12, 2024, 08:30:25 am
  • SAMCO Light Gun Creater
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #165 on: August 27, 2023, 06:23:08 pm »
Hi dabone, it's made to work with with 2 wii sensor bars like in this picture but you can also use your own leds by placing then in the same spots. Marked up in red on the picture.

Cheers Sam(co)


ThatOneSeong

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 66
  • Last login:April 21, 2024, 11:57:42 pm
  • Just your average Seong.
    • Twitter
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #166 on: August 31, 2023, 02:59:24 am »
I ordered and built to samco gc2 boards using the ItsyBitsy 32u4-5V, and I've tried both firmwares, but here's a easy question.

Where should the LEDs be mounted?

The gun IR wants them placed on the middle of the top/bottom and sides.

Where should the LEDS be placed for the samco firmwares? I'm running the 4 led config, using 3 SFH 4547 LEDs per led position.

Thanks.
How convenient, as I had just ordered a full set of those LEDs [and other parts] to make a custom light set for SAMCO. I was  done dealing with the shoddy knockoff IR bars, and now that I'd paid the cost of parts I think RPEG's premade sets are way overpriced imo. It's not exactly going to be the prettiest thing, but should hopefully work better and last longer.
But, yeah, basically the idea is just place pairs of LEDs roundabout the same distance as the space between the two arrays of LEDs in the Wii lightbars (about ~3 inches apart) at the top and bottom to form a rectangle around the center of the display. Probably doesn't have to be that exact distance depending on the display size, i.e. big TV or small monitor, etc, but enough to form the basic shape for tracking.

retroman2022

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 6
  • Last login:September 01, 2023, 02:25:50 pm
  • I want to build my own arcade controls!
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #167 on: September 01, 2023, 01:55:06 pm »
Hi Samco!!

Amazing your job!

Questions: do you will contonue with this project? Ex:add recoil, rumble, etc?

Thanks

retroman2022

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 6
  • Last login:September 01, 2023, 02:25:50 pm
  • I want to build my own arcade controls!
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #168 on: September 01, 2023, 02:11:24 pm »
Had a few asks, though:
  • How accurate is the SAMCO compared to other solutions? And for anyone who's used it, how is the performance any different with @Prow's enhanced fork? I feel like that may as well be the version I use whenever I get around to building this.
  • From what I can tell, the Gun4IR seems to be scarily similar to SAMCO, down to using the same board and camera, but I'm curious what the differences are between the two. For example, the SAMCO uses Wii-styled lightbars which I already have plenty of from using my Wii remote on PC, so it seems awfully more convenient than the specific IR light pods that the G4IR uses. Is there an appreciable difference in accuracy between these two?
  • Sort of an appendix to the last question, but from what I can tell it looks like the G4IR will be getting some form of PS1/2 support as an emulatable Guncon 1. Since both of these projects are more or less running the same handful of Arduino-compatible boards at the core and use the same camera as one another, with just different sketches/software/calibration being the most apparent differences, is it possible the SAMCO will also see similar support? Admittedly, it's one of the reasons I got an EMS TopGun a couple years ago, to use with original hardware because PS2 specifically is a PITA for configuring with lightguns - not to mention the latest 1.7.x builds of PCSX2 removing plugin support, and subsequently killing the nuvee plugin this would rely on.
I know all of that might be a mouthful, but I'm admittedly only just now discovering lightgun mods so these are things I'm considering before diving in head-first for parts. AFAIC, SAMCO sounds cooler and more convenient for my setup, but I want to be sure is all!  ;D

I can't compare the performance to other solutions but the SAMCO 4IR Beta code, which is what I used, has perfect accuracy for a single player directly in front of the screen. I'm currently using light sensor bars from an original EMS LCD TopGun. The only thing I have to do is block the middle IR LEDs on the one sensor bar that has 3 spots. This was one consideration for why I tried out the SAMCO build; it was very easy for me to make a little foam mount for one of the sensor bars to sit on top of my big screen TV.

I guess the main differences with Gun4IR are: different IR emitter layout, a configuration GUI, closed source project, and I think you must use a Pro Micro board (though check the project to confirm the supported boards).

Even though my code will build for the Pro Micro and the 32u4 ItsyBitsy boards, I recommend using an M0 or M4 SAMD board instead. Or, if you wait a bit, then hopefully soon I'll add support for the RP2040 ItsyBitsy and it will be another good option, at least for my code. I actually have it prototyped and working, just need to clean up the code a bit. :)

Interesting you mention PS1/2 support... I tried to find information on the original Xbox light guns, but couldn't find any information, so that was as close as I got to any console support.

Yes, it's a cool project and the custom SAMCO PCB is awesome! makes modding a GunCon super easy. 8)

Hi,

I can use two guns at Time?

Thanks.

ThatOneSeong

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 66
  • Last login:April 21, 2024, 11:57:42 pm
  • Just your average Seong.
    • Twitter
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #169 on: September 05, 2023, 11:43:23 am »
Hi,
I can use two guns at Time?

Thanks.
Should be possible, if it's anything like the Gun4IR.I don't know how many others have more than one SAMCO modded gun controller (except maybe sam himself lol), but it should be fine? Only thing that might be a problem is having two devices with the same vendor/product ID pair.

Coincidentally, I am planning on a second gun mod, so guess I'll know by then?

ThatOneSeong

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 66
  • Last login:April 21, 2024, 11:57:42 pm
  • Just your average Seong.
    • Twitter
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #170 on: September 05, 2023, 12:07:15 pm »
Do both the 3v and 5v 32u4 comfortably run with additional processor headroom for custom tweaks to the code, such as adding recoil solenoids etc? Or are they already maxxed out handling the tracking? I have a few ideas I want to incorporate.
Late to this I know, but if you're still working on this, I would be highly interested in the results. I plan to have a solenoid option on my second gun, so it would be nice to have recoil support in SAMCO (and further close the gap between it and Gun4IR).Perhaps it could be contributed to Prow7's fork, since it's more performant and supports some of the more powerful/bigger code space boards compared to the 32u4.

samco

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 52
  • Last login:April 12, 2024, 08:30:25 am
  • SAMCO Light Gun Creater
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #171 on: September 06, 2023, 10:06:54 pm »
Hi Guys, from my experience most of the emulators I use (PCSX2, pretty much everything in Recalbox) 2 guns at the same time isn't a problem with a bit of configuration. However I have heard of people having trouble in Teknoparot which does want an individual VID for each gun. If you need to you can do it by updated the board.txt file in Arduino for each gun. Found a tutorial here, if ya need it...

https://www.shellhacks.com/arduino-change-devices-vid-pid-name/

I have been doing a bit of coding lately working with a few other guys so hopefully some of those features that everyone been after for so long are too far off.

ThatOneSeong

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 66
  • Last login:April 21, 2024, 11:57:42 pm
  • Just your average Seong.
    • Twitter
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #172 on: September 10, 2023, 06:31:20 pm »
Hi Guys, from my experience most of the emulators I use (PCSX2, pretty much everything in Recalbox) 2 guns at the same time isn't a problem with a bit of configuration. However I have heard of people having trouble in Teknoparot which does want an individual VID for each gun. If you need to you can do it by updated the board.txt file in Arduino for each gun. Found a tutorial here, if ya need it...

https://www.shellhacks.com/arduino-change-devices-vid-pid-name/

I have been doing a bit of coding lately working with a few other guys so hopefully some of those features that everyone been after for so long are too far off.
You tease!  ;D Ah, but I look forward to it. I should be getting my second gun in tomorrow to do a custom mod, which should be fun.
On a sidenote, I did finally get around to upgrading my IR lights setup: borrowing from the GUN4IR spec, I tied together some high power black LED emitters, triplets of three tied to 5.6 ohm resistors each on a split power config, all run through one USB port on my TV. In lieu of proper mounting equipment I didn't have, to keep them steady I gutted the boards from the knockoff Wii sensor bars and put in the new boards - just needing some cable management and a bit of patience. Hacky, but eff it if it works. Pics here. I guess the plus side of this is I could also try GUN4IR at some point now?
But yeah, been super fun getting back to playing these games (again, again). Always happy to hear more's happening on this front, love to see good open source projects blossom.

dabone

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 898
  • Last login:October 31, 2023, 12:03:37 pm
  • Time to work...
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #173 on: October 24, 2023, 10:01:34 am »
Ok, another quick question.

Is it possible to do chorded key combos?
Like the ipac? i.e. press and hold select, and then press start = esc, but select and start having different values.


ThatOneSeong

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 66
  • Last login:April 21, 2024, 11:57:42 pm
  • Just your average Seong.
    • Twitter
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #174 on: October 24, 2023, 07:58:42 pm »
Ok, another quick question.

Is it possible to do chorded key combos?
Like the ipac? i.e. press and hold select, and then press start = esc, but select and start having different values.
Prow's fork uses button masks, which does exactly that (combinations of buttons access different functions). They're all hooked into different subroutines atm, but I imagine you could probably add one that sends an escape keypress. I myself have yet to try this.
UPDATE: if you're so interested in adding this (again, specific to the aforementioned Prow's fork), in the early section declaring the button combo masks, add:
Code: [Select]
// button combo to send an escape keypress
constexpr uint32_t EscapeKeyBtnMask = BtnMask_Reload | BtnMask_Start;
(Note: This is just an example for my Guncon 2-compatible gun, you could change the combination to whatever you like. Works best if the EnterPauseModeBtnMask is a different key combo, like BtnMask_Reload | BtnMask_Select

And then in the ExecRunMode function (the main code), preferably before the EnterPauseModeButtonMask, add:
Code: [Select]
        if(buttons.pressedReleased == EscapeKeyBtnMask) {
            Keyboard.releaseAll();                                  // Clear out keyboard keys (since Seong's default is pressing start, which is num1)
            delay(1);                                               // Wait a bit. Required for the escape keypress to actually register.
            Keyboard.press(KEY_ESC);                                // PUSH THE BUTTON.
            delay(100);                                             // Wait another bit. Required for the escape keypress to actually register, and mitigate sticking.
            Keyboard.release(KEY_ESC);                              // Aaaaand release.
        }
It should work. Granted, I've noticed the button combos need a few tries to register sometimes, but it'll activate after the last button in the sequence is pressed.

As an aside, I have been working on adding rumble motor and solenoid activation support to the fork myself. So far I have the former working for feedback when shooting off-screen (needs tuning just fixed it in fact!); with the latter coded up and ready in theory, but I'm still missing parts for the solenoid breakout board itself. Things keep getting lost in transit. :< But ideally, it should close the gap in functionality with GUN4IR.
« Last Edit: October 24, 2023, 11:35:45 pm by ThatOneSeong »

ThatOneSeong

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 66
  • Last login:April 21, 2024, 11:57:42 pm
  • Just your average Seong.
    • Twitter
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #175 on: October 30, 2023, 01:14:10 am »
In case anyone happens to be looking, I did make a little something and wanted to share that with everyone here.
I brought force feedback to SAMCO. (Based on Prow's work, just with my own additions and slight tweaks)


Currently, the gun being demo'd is having some EMI interference/disconnection issues so I couldn't demo as much as I'd like, but I'm redoing the wiring on my setup since it's using very low quality cables so it should be more stable on bigger gun builds. I just wanted to make something to close the gap on GUN4IR, and partially for my own enjoyment because of how much I loved the system made. I hope y'all won't mind?

RandyT

  • Trade Count: (+14)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 6888
  • Last login:Yesterday at 08:34:00 am
  • Friends don't let friends hack keyboards.
    • GroovyGameGear.com
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #176 on: October 30, 2023, 04:19:11 pm »
Nice work on both the software updates and the gun build!

« Last Edit: October 30, 2023, 04:23:43 pm by RandyT »

samco

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 52
  • Last login:April 12, 2024, 08:30:25 am
  • SAMCO Light Gun Creater
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #177 on: October 30, 2023, 11:21:52 pm »
Very nice!!! Keep up the good work man :)

ThatOneSeong

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 66
  • Last login:April 21, 2024, 11:57:42 pm
  • Just your average Seong.
    • Twitter
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #178 on: October 31, 2023, 12:47:21 am »
Nice work on both the software updates and the gun build!
Thanks! Though it's definitely a build that looks better on the outside than in, and is kind of disgusting when you see the rats nest of cables...

You'd be surprised how tight everything was in this particular shell--and I had to design the mounts (and a fisheye adapter) from scratch, too! Just a whole lot of work - but when I got it working in the end, both the build and the mods, it was soooo satisfying.
Very nice!!! Keep up the good work man :)
Feel like I should be the one giving you the props! But thank you, truly.

EDIT [2023/11/01]: Updated the fork again, this time actually enabling EEPROM saving on the RP2040! Have tested and it works now on both my builds. Also fixed double feedback by reading the debounced trigger and not the pin state directly.
Still have to figure out the start/select buttons sticking on occasion, but it's at a very good state now at least...
« Last Edit: November 01, 2023, 03:53:01 pm by ThatOneSeong »

ThatOneSeong

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 66
  • Last login:April 21, 2024, 11:57:42 pm
  • Just your average Seong.
    • Twitter
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #179 on: November 02, 2023, 04:36:51 pm »
Posting again here! Since the last update, I've released v1.3 of the enhanced fork. This adds the option to send a different mouse button event when aiming off the screen, as well as ability to toggle the extra functionalities (rumble and solenoid) on and off from pause mode with button combinations. It also fixes the button responsiveness problems of the keyboard presses that were present in Prow's fork.
Granted, both that and the offscreen button option were done via hacky workarounds, since the LightgunButtons library that fork uses seems to have a hard time with the keyboard presses, but I've tested and it seems to be much better. As far as I know, that's most of the features now implemented in an open source project (and with less reflashing the board to change settings)!
« Last Edit: November 02, 2023, 11:35:48 pm by ThatOneSeong »