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 --- Bug Reports --- 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 60750 times)

0 Members and 1 Guest are viewing this topic.

Owillingham

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 3
  • Last login:July 06, 2021, 09:59:29 am
  • I want to build my own arcade controls!
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #120 on: June 20, 2021, 09:13:40 am »
Any schematics for including recoil on the Samco lightgun?  have parts on order to build the Samco gun, but would be nice to include recoil at the same time of building.

samco

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 42
  • Last login:April 21, 2022, 11:36:04 pm
  • SAMCO Light Gun Creater
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #121 on: June 21, 2021, 12:20:17 am »
Hi, think I already answered this on facebook. But yeah, have schematics available on my GitHub (for ItsyBitsy but should be easy enough to adapt to other boards and can already change Pin assignments in code if you need to). Recoil is still a work in progress so no documentation yet.

Dam0

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 5
  • Last login:October 19, 2021, 07:41:03 pm
  • I want to build my own arcade controls!
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #122 on: August 04, 2021, 03:51:06 am »
SAMCO, after many months of leaving your 1.0 arduino kit on the shelf, i finally re-plugged the gun in and it works flawlessly....

so thanks for all your hard work, now to gather the light-gun games i got into a single frontend.

i "think" my issue in the end was i was standing too close buy about a good metre maybe more. so all up, for a 24" screen i recon id be 5-6 foot away from the screen for the cursor to operate properly.

i kinda thought on it a bit in hindsight, that after reading about some ppl using lenses on their gun4ir setups to reduce the focal length makes some sense .

anyhow, thanks for your hard work . very happy i waited this time, before i cracked a poopy pants

Prow

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:Today at 09:25:08 am
  • I'm here for Light Guns
    • github.com/Prow7/ir-light-gun
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #123 on: August 07, 2021, 01:06:48 pm »
I made an enhanced version of the SAMCO project. The enhancements are:
  • Increased precision for maths and mouse pointer position
  • Glitch-free DFRobot positioning (DFRobotIRPositionEx library)
  • IR camera sensitivity adjustment (DFRobotIRPositionEx library)
  • Optional averaging modes can be enabled to slightly reduce mouse position jitter
  • Enhanced button debouncing and handling (LightgunButtons library)
  • Modified AbsMouse to be a 5 button device (AbsMouse5 library)
  • Multiple calibration profiles
  • Save settings and calibration profiles to flash memory (SAMD) or EEPROM (ATmega32U4)
  • Built in Processing mode for use with the SAMCO Processing sketch

Much of the code was re-worked but the positioning math calculation is all from SAMCO. It is fantastic how well this works!

One big change is with the button handling code that allows button combinations. For example, you can assign a button combination to enter pause mode that you will never press while playing a game so the reload button can be assigned a mouse button or key press.

The other big enhancement is the calibration profiles. I found myself sometimes wanting to play on my big screen TV and other times on my monitor. Combine that with 4:3 aspect ratio games requiring different calibration data, adding multiple profiles is an obvious solution. While the calibration procedure is simple, it's even faster to just press a button to select a profile.

Support for the ATmega32U4 boards was a bit of a last minute addition and not as well tested, but it should work (though I haven't tested saving to EEPROM).

The buttons in the sketch are configured for a SAMCO 2.0 GunCon 2 build. If your gun has different button pin assignments then you will have to modify the sketch.

You can get the source code from: https://github.com/Prow7/ir-light-gun
See the readme files on GitHub for more details.

Big thanks to Samco for this project. Your custom PCB made it super easy to mod a GunCon 2! Also thanks to Gustavo for his Apexel lens adapter models. A fantastic solution to the less than ideal narrow FOV that the camera has.

samco

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 42
  • Last login:April 21, 2022, 11:36:04 pm
  • SAMCO Light Gun Creater
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #124 on: August 08, 2021, 08:48:13 pm »
Wow, this is awesome Prow! I was hoping that a gun coder would get their hands on my code at some stage.

Haven't got a spare SAMD board to try it out yet but just looking through your code, I'm super impressed. Can't wait to try it out!

Cheers Sam(co)

ThatOneSeong

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 13
  • Last login:April 13, 2022, 07:30:21 pm
  • Just your average Seong.
    • Twitter
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #125 on: September 11, 2021, 07:00:01 pm »
Hiya!New face peeking in to say thanks, because this project's given me the perfect inspiration to get and mod a GCon 2 for myself. Would be the first good lightgun solution I've found that isn't in some desolate theater arcade.

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

Prow

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:Today at 09:25:08 am
  • I'm here for Light Guns
    • github.com/Prow7/ir-light-gun
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #126 on: September 16, 2021, 10:01:10 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)

ThatOneSeong

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 13
  • Last login:April 13, 2022, 07:30:21 pm
  • Just your average Seong.
    • Twitter
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #127 on: September 17, 2021, 12:53:38 pm »
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)
+1 for open source!
I was considering getting the M0 based on your recommendation on the repo, and for futureproofing anyways. But is there any user facing difference going for the RP2040 instead? I mean, I guess saving $2 on raw parts has its plus!I'm certainly patient, since I'd have to wait about a month on the camera alone anyways.

On the note of console support, apparently there's another SAMCO fork that allows it to work on actual PS2 hardware as a Gcon2 - or at least, that's the claim, as I obviously don't have a working setup to know for sure. It's only in the last two days I realized the post on this board. Now, it's obviously a stretch to suggest that these changes could be implemented retroactively in your project, but even just the possibility of having that compatibility is enough to make me genuinely more excited than I perhaps reasonably should be. :P
Anyways, glad to hear. I'll be waiting to see what updates comes to your code. It really has reinvigorated my interest in light gun games again. (^^

Prow

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:Today at 09:25:08 am
  • I'm here for Light Guns
    • github.com/Prow7/ir-light-gun
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #128 on: September 18, 2021, 06:09:05 pm »
+1 for open source!
I was considering getting the M0 based on your recommendation on the repo, and for futureproofing anyways. But is there any user facing difference going for the RP2040 instead? I mean, I guess saving $2 on raw parts has its plus!I'm certainly patient, since I'd have to wait about a month on the camera alone anyways.
It looks like it should be a drop in alternate to the M0 or M4, at least for the SAMCO project from what I can see. I think even all of the Arduino pin numbers for the buttons match up for the GunCon 2 SAMCO PCB, so the button configuration in the sketch doesn't even need to change.

Quote
On the note of console support, apparently there's another SAMCO fork that allows it to work on actual PS2 hardware as a Gcon2 - or at least, that's the claim, as I obviously don't have a working setup to know for sure. It's only in the last two days I realized the post on this board. Now, it's obviously a stretch to suggest that these changes could be implemented retroactively in your project, but even just the possibility of having that compatibility is enough to make me genuinely more excited than I perhaps reasonably should be. :P
Anyways, glad to hear. I'll be waiting to see what updates comes to your code. It really has reinvigorated my interest in light gun games again. (^^
I don't have a PS2 so I can't test out that code. It would be cool to have that working though.

ThatOneSeong

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 13
  • Last login:April 13, 2022, 07:30:21 pm
  • Just your average Seong.
    • Twitter
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #129 on: September 20, 2021, 09:13:22 am »
It looks like it should be a drop in alternate to the M0 or M4, at least for the SAMCO project from what I can see. I think even all of the Arduino pin numbers for the buttons match up for the GunCon 2 SAMCO PCB, so the button configuration in the sketch doesn't even need to change.
That looks to be the case.And since the M0 is out of stock, I guess I'm going RP2040.Just ordered all the parts for myself. It'll be a bit belated, but I think it'll be a good enough gift for myself. :p

samco

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 42
  • Last login:April 21, 2022, 11:36:04 pm
  • SAMCO Light Gun Creater
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #130 on: September 22, 2021, 01:47:24 am »
Hi ThatOneSong, yeah from what I can tell the ItsyBitsy RP2040 should work fine with the M0 sketch. But if you have any problems just let us know either here or on my facebook. https://www.facebook.com/groups/2456595207897603 :)


ThatOneSeong

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 13
  • Last login:April 13, 2022, 07:30:21 pm
  • Just your average Seong.
    • Twitter
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #131 on: September 22, 2021, 10:49:25 am »
Hi ThatOneSong, yeah from what I can tell the ItsyBitsy RP2040 should work fine with the M0 sketch. But if you have any problems just let us know either here or on my facebook. https://www.facebook.com/groups/2456595207897603 :)
I'm looking forward to it! By which I mean, a while for the board and other parts to arrive. Unfortunately I wasn't quick enough on the trigger for the camera so it's on backorder for the moment, but everything--aside from the ItsyBitsy RP and a 3m cable--is being imported anyways. (^^;

Prow

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:Today at 09:25:08 am
  • I'm here for Light Guns
    • github.com/Prow7/ir-light-gun
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #132 on: September 22, 2021, 12:34:20 pm »
Hi ThatOneSong, yeah from what I can tell the ItsyBitsy RP2040 should work fine with the M0 sketch. But if you have any problems just let us know either here or on my facebook. https://www.facebook.com/groups/2456595207897603 :)
One thing to note is that the ItsyBitsy RP2040 currently will not work with your sketch. The RP2040 does not support the Arduino USB stack and the AbsMouse library only supports the Arduino USB stack.

My modified AbsMouse5 library is working with the Adafruit TinyUSB stack now, which is an option for the RP2040. This update is not yet on my GitHub project, but hopefully soon I'll get back to working on it.

ThatOneSeong

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 13
  • Last login:April 13, 2022, 07:30:21 pm
  • Just your average Seong.
    • Twitter
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #133 on: September 30, 2021, 10:52:58 am »
Just came in to say I've just received both IB-RP2040 and Samco boards - extra props to samco of course for the quick turnaround. The GCon2 itself is still on its way, but unfortunately the camera has been sitting on Backordered for a bit now. Not sure how long it takes DFrobot to fulfill orders; I didn't anticipate them being in such high demand.
Regardless, I'll be waiting eagerly on the 2040 sketch update.  :applaud:

Prow

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:Today at 09:25:08 am
  • I'm here for Light Guns
    • github.com/Prow7/ir-light-gun
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #134 on: October 01, 2021, 10:48:36 pm »
The update for the ItsyBitsy RP2040 is now available.

One thing to note is the button pin values in the sketch must be modified if you use the ItsyBitsy RP2040. The sketch uses the Arduino pin numbering as printed on the top of the PCB but these values don't work for the RP2040. The button pin values must be the physical GPIO pin numbers printed on the bottom of the PCB (or see the Adafruit pinouts page). More details on this in the readme. It was a bit odd to me since the A0 through A3 pins are defined, but the digital pins aren't translated... for example D7 is defined as 7, which doesn't translate Arduino to GPIO. \_(ツ)_/


samco

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 42
  • Last login:April 21, 2022, 11:36:04 pm
  • SAMCO Light Gun Creater
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #135 on: October 05, 2021, 08:22:39 pm »
Nice one Prow! Thanks for the heads up on the AbsMouse Library too. I don't have too much time to tinker at the moment so I'll be keeping an eye on this thread to see how this goes and what you guys think of the RP2040.

ThatOneSeong

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 13
  • Last login:April 13, 2022, 07:30:21 pm
  • Just your average Seong.
    • Twitter
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #136 on: October 06, 2021, 07:57:30 pm »
So I will say the process of getting here was a bit of an experience for me...
First off, without even having gun in hand, following the procedures in advance setting the board up had me for a loop.Firstly, even getting an RP2040 recognized in Arduino software--which Adafruit's store page and documentation contradict one-another atm (one says there is no support, another generic Raspberry Pico page was updated saying there is...)--was difficult since it's a third-party repository that needed a bit of searching to find. Would be nice to add this in the SamcoEnhanced readme for 2040-ers.Sidenote, this might just be my PC, but the board wasn't being assigned a serial driver like it's supposed to, but was stubbornly hanging as an unknown device with no known drivers. I had to force the 'RP2 USB' device to use a Microsoft-brand USB Serial Device. But at least afterwards, I can assign the port number and it was able to be flashed just fine.
One thing that was unclear as a first-timer was the note in the Enhanced repo;
Quote
If you are using an ItsyBitsy M0 or M4 then I recommend you set the Optimize option to -O3 (or faster). If you are using an ItsyBitsy RP2040 then I recommend the -O3 Optimize option.
I was looking and couldn't find any such Optimize flag options; neither in the Preferences, or the Sketch/Tools dropdowns that Ada's documentation suggested should be there. Nada.And results when searching for "Arduino optimization flags" kept bringing up coding habits, but not the GCC flags. There was only one I could find after going through multiple pages that pointed to C:\Program Files (x86)\Arduino\hardware\arduino\avr\platform.txt where I could change the references of -Os to -O3. If there is something I'm overlooking here, feel free to say, but maybe a note should be appended on what exactly this step means on the latest Arduino IDE.
Anyways, from there, code runs, that's all I could get at the time. Fast forward to today and my GCon 2 arrives. Time to get to work.Disassembly and all that wasn't hard at all, thanks to Samco's own video documentation on the process. This was my first substantial soldering work in quite some time, so I was proud to see good joints coming out of it.My main difficulty came when I was adding in a microswitch mod where I had to rip out the original trigger tact switch (what a frick that was), and plant in a microswitch alongside a replacement arm attached to the trigger. While that worked out, it made cable routing feel kind of precarious - of which I also had a bit of trouble, since I tried attaching my microUSB to the board after attaching the B button board, which wouldn't work. I had to take out the button standoff and put the cable in before reattaching, but it felt quite tight. Thankfully, it all ended up coming together in the end.
Prow is all too right about the GPIO mapping. But I figured it out with just a bit of cross-referencing Samco's documents;
Code: [Select]
Trigger = 6
D-Up = 9
D-Left = 8
D-Down = 7
D-Right = 10
C = 11
A/B/Start/Select/Pedal stays the same.
While I'm unfortunately still not able to use the gun due to the camera still being backordered, I can at least confirm all the inputs work (after changing the sketch mappings) as well as the calibration toggle. It will unfortunately be another lengthy wait I imagine before this is really finished, but the process so far has been fun and leaving me with great anticipation for what it's like when it's really working.
A lot of rambling for a lot of nothing seems to be my only contributions here, but I'm kind of okay with that. (^^;

ThatOneSeong

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 13
  • Last login:April 13, 2022, 07:30:21 pm
  • Just your average Seong.
    • Twitter
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #137 on: October 11, 2021, 07:46:50 pm »
Self-bumping update: I got the camera, and aside from the TOP label being off by 90 degrees clockwise, it all seems to be working. I'm glad I got one more sensor bar than I needed because the sole one I've had on my monitor for a few years for my Wiimote has such a narrow FOV compared to the new ones I'd just ordered, it's crazy.
I did manage to play through Time Crisis on MAME without any issue, it tracks surprisingly really well and no latency--especially when coming from a wireless EMS.
But after I decided to play T2 Arcade, a few minutes in, the trigger started acting a bit funny and some of the depressed shots were only firing off for a frame or something. It didn't seem to be consistent, but weird how it crops up so late into it.
From what I can tell, I think on some inputs, it's double-clicking instead of firing once and holding like I want it to? Because it's not just the trigger - the start button also on rare occasions can spurt out 1111 which was odd (esp. since it's one of the buttons directly embedded to the Samco2 board).
I was going to say it worked better some time later, but when playing a Naomi shooter through the Flycast core on RetroArch, again halfway through, all my on-screen shots just... stop registering? And when I alt-tabbed, this very messagebox I'm typing this in was being spammed with 1111's.
It's stuff like that which makes it hard for me to believe it's just the trigger microswitch that's bad... it's literally brand new and I even triple-checked my solder points; no joints touching one-another or anything. After writing this part I played Point Blank with lr-Duckstation with no issues, just like with Time Crisis (though I did note two small instances of double-clicking). Maybe it's just brandist against anything non-Namco.

@Prow, any idea what's up here?

EDIT:L Update to the update. Of course, the next morning I try to confirm the trigger issue and it's working perfectly again. But the D-pad (and kinda start button) is still sticky sometimes.

But I've noticed on two separate instances that after some time (pretty much *only* happens after putting the gun down for a bit then up again), the calibrated aim is offset a quarter-screen to the right, despite not having moved at all since. But it's fixed with a re-calibration, so... I don't have a clue really.
« Last Edit: October 12, 2021, 11:08:33 am by ThatOneSeong »

Prow

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:Today at 09:25:08 am
  • I'm here for Light Guns
    • github.com/Prow7/ir-light-gun
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #138 on: October 13, 2021, 01:08:52 am »

From what I can tell, I think on some inputs, it's double-clicking instead of firing once and holding like I want it to? Because it's not just the trigger - the start button also on rare occasions can spurt out 1111 which was odd (esp. since it's one of the buttons directly embedded to the Samco2 board).
I was going to say it worked better some time later, but when playing a Naomi shooter through the Flycast core on RetroArch, again halfway through, all my on-screen shots just... stop registering? And when I alt-tabbed, this very messagebox I'm typing this in was being spammed with 1111's.
Adjusting the debounce time will hopefully fix this. I'm not sure why I set the debounce times lower than they need to be. I'll make a note to fix the sketch. With that said, I don't have any issue with my gun and the buttons.

Quote
But I've noticed on two separate instances that after some time (pretty much *only* happens after putting the gun down for a bit then up again), the calibrated aim is offset a quarter-screen to the right, despite not having moved at all since. But it's fixed with a re-calibration, so... I don't have a clue really.
Interesting you report this as I had this happen once recently. In my case, I reconnected the USB cable and it was fine since I have the calibration stored in NVRAM. Just as you say, I recall I set the gun down for a bit and then when I picked it up the aim was way off. If you can reproduce this it would be interesting to know if the calibration values somehow change. You can view them in the serial monitor (or any serial terminal program). I was unable to reproduce it, but only tried a few times.

Quote
I was looking and couldn't find any such Optimize flag options; neither in the Preferences, or the Sketch/Tools dropdowns
I jumped the gun on this one... I submitted a Pull Request to the Arduino Pico project and expected an update to be released before anyone would actually use an RP2040 build. It actually may not matter all that much, but might as well optimize for speed. I'll update the wording to describe it as an optional setting if it's available.

ThatOneSeong

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 13
  • Last login:April 13, 2022, 07:30:21 pm
  • Just your average Seong.
    • Twitter
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #139 on: October 17, 2021, 10:33:35 pm »
Heeey, sorry for the wait. Been pulled away for some time on some PC upgrades and switching to Linux. Fun.
Interesting you report this as I had this happen once recently. In my case, I reconnected the USB cable and it was fine since I have the calibration stored in NVRAM. Just as you say, I recall I set the gun down for a bit and then when I picked it up the aim was way off. If you can reproduce this it would be interesting to know if the calibration values somehow change. You can view them in the serial monitor (or any serial terminal program). I was unable to reproduce it, but only tried a few times.
Seems like we've both only had this happen once without any way to reproduce. But this hasn't happened often. And I appreciate the honesty - easily forgiven, though no less confusing for a first-timer. I think it's safe to say the debounce--or lack thereof--only affects my membrane buttons, but definitely not an issue with the trigger (the unresponsiveness might've just needed some time to get worn in. shrug).
As of now, I'm just trying to work out how to get this working in X11. Not the most straightforward thing to say the least. :laugh:

DeKay

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 1
  • Last login:April 11, 2022, 08:12:37 pm
  • I want to build my own arcade controls!
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #140 on: October 25, 2021, 07:03:59 pm »
Hey Prow.  You and Samco are doing great work here!  I sent you a few minor fixes for things I tripped over getting my ItsyBitsy M4 set up this weekend in a github pull request.  I really have to learn to use git properly one of these days   :)

woordmand

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 21
  • Last login:January 27, 2022, 01:34:09 pm
  • I want to build my own arcade controls!
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #141 on: January 07, 2022, 12:03:20 am »
I made an enhanced version of the SAMCO project. The enhancements are:
  • Increased precision for maths and mouse pointer position
  • Glitch-free DFRobot positioning (DFRobotIRPositionEx library)
  • IR camera sensitivity adjustment (DFRobotIRPositionEx library)
  • Optional averaging modes can be enabled to slightly reduce mouse position jitter
  • Enhanced button debouncing and handling (LightgunButtons library)
  • Modified AbsMouse to be a 5 button device (AbsMouse5 library)
  • Multiple calibration profiles
  • Save settings and calibration profiles to flash memory (SAMD) or EEPROM (ATmega32U4)
  • Built in Processing mode for use with the SAMCO Processing sketch

Much of the code was re-worked but the positioning math calculation is all from SAMCO. It is fantastic how well this works!

One big change is with the button handling code that allows button combinations. For example, you can assign a button combination to enter pause mode that you will never press while playing a game so the reload button can be assigned a mouse button or key press.

The other big enhancement is the calibration profiles. I found myself sometimes wanting to play on my big screen TV and other times on my monitor. Combine that with 4:3 aspect ratio games requiring different calibration data, adding multiple profiles is an obvious solution. While the calibration procedure is simple, it's even faster to just press a button to select a profile.

Support for the ATmega32U4 boards was a bit of a last minute addition and not as well tested, but it should work (though I haven't tested saving to EEPROM).

The buttons in the sketch are configured for a SAMCO 2.0 GunCon 2 build. If your gun has different button pin assignments then you will have to modify the sketch.

You can get the source code from: https://github.com/Prow7/ir-light-gun
See the readme files on GitHub for more details.

Big thanks to Samco for this project. Your custom PCB made it super easy to mod a GunCon 2! Also thanks to Gustavo for his Apexel lens adapter models. A fantastic solution to the less than ideal narrow FOV that the camera has.
I used your improved version of sanco firmware on 32U4, it is really good.  But compared to gun4ir, it lacks support for electromagnets.  Calibration is not very friendly either.  Hope to see the updated version of the firmware.

sparehead1

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 5
  • Last login:May 14, 2022, 09:34:12 pm
  • I want to build my own arcade controls!
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #142 on: January 07, 2022, 05:49:23 am »
Hi there! I've ordered some Samco boards, guncon 2's, cameras, and itsy-bitsy M4's. I want to use them on a projector screen so I was wondering if there are guides for the distance from the screen in relation to screen size? Can I use fish eye or wide-angle lenses? Should I still use Wii sensor bars or can I use 4 IR LED's spaced out a little more? Thanks in advance! I'm looking forward to building them!

Prow

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:Today at 09:25:08 am
  • I'm here for Light Guns
    • github.com/Prow7/ir-light-gun
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #143 on: January 07, 2022, 12:24:50 pm »
Hi there! I've ordered some Samco boards, guncon 2's, cameras, and itsy-bitsy M4's. I want to use them on a projector screen so I was wondering if there are guides for the distance from the screen in relation to screen size? Can I use fish eye or wide-angle lenses? Should I still use Wii sensor bars or can I use 4 IR LED's spaced out a little more? Thanks in advance! I'm looking forward to building them!
From my experience you will want to use at least a wide angle lens.

If you already have 2 Wii sensor bars then might as well just try it out with them first.

For a bit of reference, I use sensor bars from an original EMS LCD TopGun which have the IR emitters approximately 33cm apart. I have a super wide angle lens on my gun (the FOV is less than a fish eye lens) and I can be positioned around 2M away from my 65" TV.

sparehead1

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 5
  • Last login:May 14, 2022, 09:34:12 pm
  • I want to build my own arcade controls!
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #144 on: January 07, 2022, 10:46:52 pm »
Thanks Prow :)

I dont have sensor bars yet so I think I'll make some IR LED arrays. Any recommendations for super wide or fish eye lens's? I want to use it on my 110" screen.

Prow

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:Today at 09:25:08 am
  • I'm here for Light Guns
    • github.com/Prow7/ir-light-gun
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #145 on: January 08, 2022, 03:49:09 pm »
I dont have sensor bars yet so I think I'll make some IR LED arrays. Any recommendations for super wide or fish eye lens's? I want to use it on my 110" screen.
Good idea to make your own IR emitters. I can only guess maybe Wii sensor bars may not be spaced out enough for a screen that large.

For the lenses, I bought an Apexel lens kit. However, I have noticed many people in the Gun4IR Discord buy a cheap 3 in 1 mobile phone lens kit which includes a wide angle and fish eye lens. I don't know if some accuracy aiming at the corners will be lost when using a fish eye lens due to the distortion, I haven't tried it. :dunno I saw that mentioned which is why I initially used the wide angle lens but then swapped in the super wide angle lens.

rbarr110

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 296
  • Last login:May 01, 2022, 02:59:22 am
  • I already built my own arcade controls!
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #146 on: January 09, 2022, 03:00:14 pm »
I am so glad I found this thread.  I wanted light guns soooo bad 10-15 years ago when I was more active here.  My current machine I built is too big for my wife, thanks CRT monitors.  So I have been toying with a new cabinet design off and on for years and finally got to a point that I think I can make what I want.

Had the GunCon 2's for a while and the SAMCO solution looks soo easy that I had to do it.  Everything is ordered, only thing that may hold this back is the damn backordered DF robot cameras. 

sparehead1

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 5
  • Last login:May 14, 2022, 09:34:12 pm
  • I want to build my own arcade controls!
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #147 on: January 10, 2022, 05:14:34 am »
For the super wide lens this the one that's recommended?

Prow

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:Today at 09:25:08 am
  • I'm here for Light Guns
    • github.com/Prow7/ir-light-gun
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #148 on: January 10, 2022, 12:16:40 pm »
For the super wide lens this the one that's recommended?
I have the APL-DG7 lens kit (7 in 1). So that kit does look similar and gives you the 3 useful lenses to try out.

ThatOneSeong

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 13
  • Last login:April 13, 2022, 07:30:21 pm
  • Just your average Seong.
    • Twitter
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #149 on: January 18, 2022, 01:37:10 pm »
However, I have noticed many people in the Gun4IR Discord buy a cheap 3 in 1 mobile phone lens kit which includes a wide angle and fish eye lens. I don't know if some accuracy aiming at the corners will be lost when using a fish eye lens due to the distortion, I haven't tried it. :dunno
I can speak to being one of those "many people." It's okay I suppose. The fisheye causes too much distortion for the dual light-strip array, presumably whacking out the rectangular field that the sketch expects. Using the wide angle combination seems to work better, about as fine as vanilla, though I had to bump up the sensitivity by one level to make it work consistently (dunno how much of that is just having more sunlight than usual).
If only I'd known this earlier; the super wide lens seems the best option for Samco in general. But that'll have to wait until after I've moved house. Another two months long wait for shipping from China.  :badmood:

sparehead1

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 5
  • Last login:May 14, 2022, 09:34:12 pm
  • I want to build my own arcade controls!
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #150 on: January 18, 2022, 07:04:59 pm »
I went with the super wide which is now on a slow boat. I thought I'd snagged the last 2 cameras from element14 but now my order says they are on back order and not expected to ship until June  :(

sparehead1

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 5
  • Last login:May 14, 2022, 09:34:12 pm
  • I want to build my own arcade controls!
Re: SAMCO DIY Arduino Powered IR Light Gun
« Reply #151 on: May 14, 2022, 08:13:08 pm »
My camera's turned up :D

now I need to find a way to attach the wide-angle lens's :/