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

Poll

-- deleted poll --

-- deleted poll --
0 (0%)
-- deleted poll --
0 (0%)

Total Members Voted: 0

  

Author Topic: GUN4IR - The Ultimate 4 Points Lightgun System  (Read 390986 times)

0 Members and 2 Guests are viewing this topic.

Zebra

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • Last login:August 19, 2021, 01:12:24 pm
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #80 on: November 15, 2019, 05:32:30 pm »
This kind of fixed gun tech has nothing to do with the IR cam tech we are using here, it would require a totally different firmware.

That's not 100% accurate. Most arcade IR gun I/O boards output as regular analog joysticks. In most cases you can use a positional gun instead of an IR gun with the same arcade PCB. The I/O boards just translate the positional data to the same 0-5v signal you would have got from a pot for the X and Y axis. The is a video on Youtube of some guy using a Taito positional gun in place of the IR gun on that Rambo arcade game.
I'm not saying that's impossible, I'm just saying my setup isn't compatible with it nor will be, that's not the purpose of it at all.
It would require to do a special version that pretty much remove 90% or my code (IR detection and all), and change the rest significantly. So a brand new sketch...
And before you ask, no it's not possible to add it to this sketch, because 1. All the analog pins are already in use for something else and 2. The sketch is already taking more than 80% of the Arduino flash, and I want to add more functions in the future. ;)

Edit: By the way don't mix input and output. My sketch always had a joystick output, since the very first version  :lol
But it doesn't support joystick input that bypass the IR detection.
However anyone who want to have a special version for that is free to use my 2 IR points sketch, which should work fine after removing the IR detection code.

I'm not sure I understand what you're saying on input VS output. All the PC light guns and IR guns I have seen output as either a mouse or an analog joystick (or both) in Windows. Most arcade guns from PC-based arcades output as an analog joystick (including both real light guns and IR guns). It makes the most sense for arcade gun set-ups as the 10-12 led boards define the screen perimeter while each coordinate is expressed as voltage from 0 to 5v. I.e. 0v at one side, 5v at the other edge and 2.5v for the center of each axis (or something like that). It's simple and universally compatible.

What does this four sensor IR gun set-up output as? If it's seen as a mouse, how is it finding the coordinates of where you are aiming? My understanding of how a mouse works in Windows is limited but I assumed the mouse just tracks movement and not coordinates. Can Windows be fed coordinates to position a mouse cursor?

I have high hopes for the 4 sensor set-up as, in theory, one at each corner should be able to define the screen perimeter almost as well as arcade IR guns. I think the main weakness of the Aimtrak set-up is that nothing defines the screen edge so when you aim at the out edge of the screen, the crosshairs no longer lines up with your iron sights.

 I just spent a fortune on Sega arcade IR gun parts so I can play House of the Dead 4 and Rambo with the original arcade gun in Teknoparrot. It would be nice to sell it an get some money back once there is a viable cheaper alternative....

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19399
  • Last login:Today at 05:29:33 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #81 on: November 15, 2019, 09:16:07 pm »
I'll throw some cents in here:

Mice in windows can be setup two ways.  Either as a relative position device, which works as you think it does (x number of ticks in a given direction) or absolute position... which I believe gives the x/y position in a 0 to 1024 value in both x and y.  Imho neither of these should be used as output to make a modern light gun.   Why?  Well windows handles mouse input surprisingly poorly.  One mouse read in relative position does just fine but absolute position or multiple mice aren't universally supported in games.  As a matter of fact, the reason troubleshooter, troubleshooter 2 and demulshooter exist is due to the poor mice support in the typical gun game released on the pc... even some emulators.  This is due to the fact that the various apis used to interface with multiple mice are outdated and/or cumbersome. 

On the other hand if your gun shows up as a joystick you are golden.  Most modern games can handle two gamepads just fine and as a quick kludge to support older games, it's pretty easy to use middle ware to move the mouse cursor with a joystick.   Multiple mice aren't officially supported in any commercially available games due to the api issues, so going forward, any gun games released on the pc are probably going to have gamepad support, with developers assuming you'll actually use a gamepad since true pc guns are dead atm.  That's just fine if you make a new light gun show up as a joystick, but it means more hacking if you have it show up as a mouse. 

Zebra

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • Last login:August 19, 2021, 01:12:24 pm
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #82 on: November 16, 2019, 11:25:50 am »
That explains why arcade developers almost always choose to have the gun I/O board output as an analog joystick, regardless of the gun tech. Modern arcades are PC's under the hood so they probably have to deal with all the same challenges

Also, if the plan is to make a gun work with older consoles on HD flat screens, most light gun games already have analog joystick support. A few of the PS2 rail shooters I have tried even offer a choice of relative or absolute positioning (they call it "regular" and "pro" mode). I am relying on this to add light gun support to the few PS2 rail shooters with no gun support once my Sega arcade IR gun is set up.

House of the Dead 4 on the PS3 even offers calibration and an option to turn off visible crosshairs when played with an analog joystick. I have high hopes for using my HOD4 arcade gun with it (with the I/O wired to a PS3 six axis pad).

Do you have any insight on which mouse mode the Aimtrak uses when set to work as a mouse? It kinds seems like it works in relative mode as it doesn't seem to have the capability of recording accurate coordinates.


Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19399
  • Last login:Today at 05:29:33 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #83 on: November 17, 2019, 12:27:53 am »
I don't have one but it's probably relative to maximize compatibility.

JayBee

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 498
  • Last login:Yesterday at 10:09:30 am
  • Creator of the GUN4IR
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #84 on: November 17, 2019, 04:52:25 am »
Well i cant really see whats going on behind that hot-snot glue (which you can remove with rubbing alcohol, if need be ;))
But the microswitch (the one you call arcade) is super easy to solder several wires onto, as it has got a hole in the lead which you can hook the end of the wire around before soldering... heck even after if you heat the solder up before.
BTW they are easily obtained, they go by the name 1c25, there are other types such as DB1, DB2 & DB3 but they have a different size, just if need be :D
and the pcb with the red button(s)? should be pretty easy to wire up with a common ground wire aswell.

Here's a couple of pics of my gun, which surely could use some tidying up.
https://drive.google.com/open?id=1-2D4oAQEHhFUM4F9ROmfW6oOpiYpz_iA
Though there are 2 wires connected on one pin of the trigger pcb, the rest are daisychained from there. Just as it was from the factory.

Also should you need spare pcb's, provide me with a drawing with measurements and holesizes.
and i'll design a new one for ya ;)
I could even make one that extends rearward which can hold the arduino, mosfet and all the supporting components.

You wouldnt happen to have a scanner and a ruler would you?
Cause if you lay the gun, or even guns on their (in)side next to the ruler and send me the picture i'll design it to work for that gun.
You'd ofcourse have to make sure that it is clean against the glass, so that there's no warping or out of focus places.
and i'll make it so you have several through-holes where you can attach the ground wires :D


EDIT:
@JayBee, if you wanted to have me take a look at your code, make a user on github and make a private repository for it and share it with me :D

EDIT2:
I dont think you should have the camera board act as the ground for the  solenoid as that could actually deprive the camera of power on activation (read. inrush current)
what you'd ought to have is a beefy capacitor, maybe even a super capacitor to conserve space right next to the mosfet.
Yeah despite what many people say, hot glue is so convenient when you don't have 3D printer or anything like that. Easy to put, easy to remove, and hold things very well.
There is simply a push button for calibration and other functions behind it.

Yeah I guess I could have soldered everything on the switch, but again it would have been a pain everytime I want to modify/add anything, and the placement in the gun is not the best to pull all grounds to it (not enough space).
This is not the original switch by the way (those kind of gun don't have microswitches), I added them along with a 3D printed supports I bought online  :laugh:
Nice to know the ref if I need to replace them, thanks ;)

Your gun is so tidy compared to mine, good idea to reuse the thick cable to bring all your wires to the board. I guess having a solenoid doesn't help  :lol
For the common ground with the cam don't worry, the solenoid circuit prevent any of those issues.

Sorry I don't have access to my computer lately, couldn't do the schematics or clean my code before sharing it with you yet, it might have to wait 2 more weeks for that  :-\
I will send you a PM as soon as it's ready ;)

I'll throw some cents in here:

Mice in windows can be setup two ways.  Either as a relative position device, which works as you think it does (x number of ticks in a given direction) or absolute position... which I believe gives the x/y position in a 0 to 1024 value in both x and y.  Imho neither of these should be used as output to make a modern light gun.   Why?  Well windows handles mouse input surprisingly poorly.  One mouse read in relative position does just fine but absolute position or multiple mice aren't universally supported in games.  As a matter of fact, the reason troubleshooter, troubleshooter 2 and demulshooter exist is due to the poor mice support in the typical gun game released on the pc... even some emulators.  This is due to the fact that the various apis used to interface with multiple mice are outdated and/or cumbersome. 

On the other hand if your gun shows up as a joystick you are golden.  Most modern games can handle two gamepads just fine and as a quick kludge to support older games, it's pretty easy to use middle ware to move the mouse cursor with a joystick.   Multiple mice aren't officially supported in any commercially available games due to the api issues, so going forward, any gun games released on the pc are probably going to have gamepad support, with developers assuming you'll actually use a gamepad since true pc guns are dead atm.  That's just fine if you make a new light gun show up as a joystick, but it means more hacking if you have it show up as a mouse. 

Thanks, you summed up things quite well.

2 mouses support is indeed a pain to work with, but at the same time there are also many games that don't support absolute coordinate joystick, only relative joystick.
When using only one gun, mouse mode it's a lot more simple, and you can use it natively in windows or with any devices that use a mouse. That's mainly why I left the mouse mode as default.
During my test, I felt like the joystick mode was also slightly less precise and had more input latency than the mouse, but that might depends on the app, and the library I am using.

That explains why arcade developers almost always choose to have the gun I/O board output as an analog joystick, regardless of the gun tech. Modern arcades are PC's under the hood so they probably have to deal with all the same challenges

Also, if the plan is to make a gun work with older consoles on HD flat screens, most light gun games already have analog joystick support. A few of the PS2 rail shooters I have tried even offer a choice of relative or absolute positioning (they call it "regular" and "pro" mode). I am relying on this to add light gun support to the few PS2 rail shooters with no gun support once my Sega arcade IR gun is set up.

House of the Dead 4 on the PS3 even offers calibration and an option to turn off visible crosshairs when played with an analog joystick. I have high hopes for using my HOD4 arcade gun with it (with the I/O wired to a PS3 six axis pad).

Do you have any insight on which mouse mode the Aimtrak uses when set to work as a mouse? It kinds seems like it works in relative mode as it doesn't seem to have the capability of recording accurate coordinates.

Why do people seems to think my firmware only work in mouse mode? Is my first post not clear?
It works as a mouse/keyboard, a joystick, or hybrid (mouse motion and joy buttons, useful for the MiSTer FPGA). All using absolute coordinates of course.
You can change the mode on the fly at any time with a button combo (see my first post).

For the input/output subject, I was speaking about it from the arduino board point of view.
So the input here are the IR cam and gun buttons, and the output are the USB port, solenoid & rumble motor.

The USB output can be change in any way I want, in this case it simulates a mouse, a keyboard and a joystick, all at the same time.

On the IR cam side, as you can imagine it doesn't provide any screen coordinates, but instead gives me up to 4 IR led 2D coordinate (which are placed in the middle of each TV side, which is way better than putting them in the corners).
So with those I have to do a lot of calculation (mostly trigonometry) to do the aspect ratio/angle correction and get the aiming coordinates, while keeping everything fast enough to not add input latency.
It was the main challenge and what took me countless hours, since keeping those calculation accurate in any situation with the limited arduino power is far from easy.

What hyo2012 was asking was to plug a real analog gun as input instead of the cam.
Doing that would require to completely bypass all the IR cam calculation, which is pretty much the core of my firmware.
It's doable of course, but then I would have to reserve 2 analog input (which I can't because of all the input the GCon 2 needs) for it and deeply modify my code. It would be faster to do a whole new firmware instead.

By the way, I received the lightgun I ordered from ebay (the one from the link you sent me), and it's actually using a motor instead of a solenoid to trigger to recoil.
It's awesome for auto mode, but not that great for one shot. Due to the way the motor has to turn to trigger it, it's slower to react and the impact backward is weaker than forward.
But overall it's a great gun to use with my CRT and PSX/Saturn, I think I will just use it like that instead of modding it :lol
« Last Edit: November 17, 2019, 04:55:06 am by JayBee »

Zebra

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • Last login:August 19, 2021, 01:12:24 pm
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #85 on: November 18, 2019, 10:24:13 pm »
We weren't talking about your firmware (I've never seen it). I was asking about how Aimtraks work in mouse mode.

On the light gun, maybe you could add a small solenoid inside the grip for semi auto recoil (like Happ recoil guns) and then just use the motor for full auto. Unlike full auto, you can use any solenoid for semi.

I actually prefer motors over solenoids for full auto only games but, it depends on the mechanism. With a decent motor and a brass knocker mechanism you can get a much better full auto effect. The recoil mechanism in the Konami Teraburst rifles is the best I have seen:




If you are handy and creative, adding a brass knocker and maybe a motor upgrade is not too difficult. It's the noise of metal hitting metal that really sells it.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19399
  • Last login:Today at 05:29:33 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #86 on: November 19, 2019, 12:59:33 am »
Well how I'm going to build mine  (assuming I ever get around to it)  is to put all the electronics in a square tube with all the I/o connecting up vid a d-sub on the tube.  For handgun games I'll build a hand gun shell with a solenoid and for full auto I'll have a machine gun shell with a motor.  I think the wiimote method of different shells would help a lot in regards of trying to get one system to do it all.  That or build a second set of guns. 

JayBee

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 498
  • Last login:Yesterday at 10:09:30 am
  • Creator of the GUN4IR
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #87 on: November 20, 2019, 12:06:17 am »
JayBee, Can you add analog input feature on firmware? 2 axis are ok.

I have fixed analog arcade gun. I use it playing Let's go island, Terminator 2 arcade... etc.



It has two potentiometer, x-axis and y-axis. No pcb inside.

If analog inputs are supported, I can play both rail-shooter game which support analog gun and only support mouse input.

And that gun has built in solenoid, your firmware has solenoid  automatic recoil output, that make easy to setup. How great.
This kind of fixed gun tech has nothing to do with the IR cam tech we are using here, it would require a totally different firmware.

That's not 100% accurate. Most arcade IR gun I/O boards output as regular analog joysticks. In most cases you can use a positional gun instead of an IR gun with the same arcade PCB. The I/O boards just translate the positional data to the same 0-5v signal you would have got from a pot for the X and Y axis. The is a video on Youtube of some guy using a Taito positional gun in place of the IR gun on that Rambo arcade game.

We weren't talking about your firmware (I've never seen it). I was asking about how Aimtraks work in mouse mode.

On the light gun, maybe you could add a small solenoid inside the grip for semi auto recoil (like Happ recoil guns) and then just use the motor for full auto. Unlike full auto, you can use any solenoid for semi.

I actually prefer motors over solenoids for full auto only games but, it depends on the mechanism. With a decent motor and a brass knocker mechanism you can get a much better full auto effect. The recoil mechanism in the Konami Teraburst rifles is the best I have seen:




If you are handy and creative, adding a brass knocker and maybe a motor upgrade is not too difficult. It's the noise of metal hitting metal that really sells it.
Yes we were. Where did we speak about the aimtrak?

No space on the motor driven lightgun to put anything else sadly, everything is so tightly packed I can't even add a cable in it. Will take pics of it if I have time. I think I will keep this one as it is to play on my CRT.
My other guns already have solenoid/rumble motors double feedback for semi auto and auto. It's not the same of course, but still feels quite good  ;D
The rifle looks very cool. But also way too big.

Well how I'm going to build mine  (assuming I ever get around to it)  is to put all the electronics in a square tube with all the I/o connecting up vid a d-sub on the tube.  For handgun games I'll build a hand gun shell with a solenoid and for full auto I'll have a machine gun shell with a motor.  I think the wiimote method of different shells would help a lot in regards of trying to get one system to do it all.  That or build a second set of guns. 
Sounds good, would love to see what you build.
You could sacrifice one or two digital inputs of the Arduino to automatically detect whatever shell is used.

Zebra

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • Last login:August 19, 2021, 01:12:24 pm
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #88 on: November 20, 2019, 01:56:20 pm »
Well how I'm going to build mine  (assuming I ever get around to it)  is to put all the electronics in a square tube with all the I/o connecting up vid a d-sub on the tube.  For handgun games I'll build a hand gun shell with a solenoid and for full auto I'll have a machine gun shell with a motor.  I think the wiimote method of different shells would help a lot in regards of trying to get one system to do it all.  That or build a second set of guns.


I kind of do that with my light guns so I can use one recoil gun with multiple gun types and multiple gun shells with one I/O board. For example, Time Crisis arcade guns just have a sensor, trigger and solenoid inside. Instead of wiring them directly to a Guncon 2 pcb, I put a DB9 breakout board so I can hook the gun up to a Guncon 1 and Komami gun pcb too. I've learnt that all light gun sensors are universally compatible and it's just the I/O pcb that differs. Eventually I'll be able go use the TC gun with my Act Labs board and Dreamcast gun too.

You could do the same with your gun (use one pcb for multiple guns) if you don't mount the camera on the pcb. Most arcade recoil guns I have seen don't have much room inside to spare once you add a solenoid. Putting just the camera inside will give you more flexibility in terms of gun choice.

Personally, I wouldn't want removable cameras in a recoil gun. The solenoid or motor tends to shake things around so they are best if hot glued in place (somewhere they won't get hit with a solenoid plunger).

Depending on your budget, a Time Crisis 4 gun shell might suit this IR gun camera best as it's probably similar in size to the one Namco uses.

Mysli0210

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 34
  • Last login:June 11, 2020, 06:08:21 pm
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #89 on: November 28, 2019, 10:24:04 pm »
@Jaybee, wont quote that long a post  :dunno

But its fine, ---steaming pile of meadow muffin--- happens :D
Meanwhile i did some work on a wii nunchuk breakout board, and i will likely order it soon!
probably together with the wiicam boards.

As for reselling the boards, i actually think it'd be cheaper to order them yourself. jlcpcb has a pretty good offer for your first order.
So i'll doublecheck everything and list the files you need for the order, and maybe even design pcb's for the solenoid :)

Sorry if i missed something, it has been a while since i wrote the last post.

But if you get the chance to put both the shells in a scanner with a ruler along the side. preferrably 1 shell per image.
I can design a pcb that just fits the gun.

That goes for any gun, so lets get some scans :D I'll do one for my 2nd hyper blaster.
Im in no rush however, as the ir leds have yet to arrive :(

lightgungamer

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 57
  • Last login:September 24, 2020, 02:43:28 am
  • I love playing Light Gun Games
    • LightgunGame.com
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #90 on: December 17, 2019, 06:22:13 am »
I’ve been looking for some good leds for this project. It’s hard to find wide angle ones in the uk.

Does anyone know if these would be good?
They aren’t the same wavelength as recommended but I think the camera supports it.

https://rover.ebay.com/rover/0/0/0?mpre=https%3A%2F%2Fwww.ebay.co.uk%2Fulk%2Fitm%2F264301195521
https://LightGunGamer.com - every Lightgun game and how to play them
Dolphin Emulator

JayBee

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 498
  • Last login:Yesterday at 10:09:30 am
  • Creator of the GUN4IR
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #91 on: December 24, 2019, 01:47:33 am »
I’ve been looking for some good leds for this project. It’s hard to find wide angle ones in the uk.

Does anyone know if these would be good?
They aren’t the same wavelength as recommended but I think the camera supports it.

https://rover.ebay.com/rover/0/0/0?mpre=https%3A%2F%2Fwww.ebay.co.uk%2Fulk%2Fitm%2F264301195521

I guess those leds should be seen by the camera as well?
That's actually one the issues that slow down the development of my firmware, finding good working leds that work correctly from any angle. Since my system supports better angle/precision/distances than any 2 leds system, I need to find leds that work well enough for it from any place and distance. I tested many, with various success.
If this one works for you, please tell me  ;)

Zebra

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • Last login:August 19, 2021, 01:12:24 pm
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #92 on: December 24, 2019, 03:32:15 pm »
Not sure if this helps but, on the Sega Type 2 /Namco arcade IR guns, the led boards are designed to allow users to bend individual LEDs to face the desired direction to deal with any issues related detection angles. You often see Led boards from games with larger screens with the corner LEDs bent to face inwards.

The Guncon 3 also has LEDs facing different directions so maybe this is a better way of dealing with detection angle issues than trying to source "wide angle LEDs".

The Extreme IR bar sold by ArcadeGuns claims to have wider angle LEDs  that let users play at more extreme angles or closer to the screen. One of the guys on this forum bought one and reported that it made no difference. Perhaps "wide angle LEDs" is just marketing bullsh*t....

Most people play light gun games in front of the screen anyway. It's probably best to just use any LEDs that work to get it up and running. Nobody is going to be able to tell you which LEDs work best for this as it's all new.

JayBee

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 498
  • Last login:Yesterday at 10:09:30 am
  • Creator of the GUN4IR
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #93 on: December 29, 2019, 08:54:53 am »
Not sure if this helps but, on the Sega Type 2 /Namco arcade IR guns, the led boards are designed to allow users to bend individual LEDs to face the desired direction to deal with any issues related detection angles. You often see Led boards from games with larger screens with the corner LEDs bent to face inwards.

The Guncon 3 also has LEDs facing different directions so maybe this is a better way of dealing with detection angle issues than trying to source "wide angle LEDs".

The Extreme IR bar sold by ArcadeGuns claims to have wider angle LEDs  that let users play at more extreme angles or closer to the screen. One of the guys on this forum bought one and reported that it made no difference. Perhaps "wide angle LEDs" is just marketing bullsh*t....

Most people play light gun games in front of the screen anyway. It's probably best to just use any LEDs that work to get it up and running. Nobody is going to be able to tell you which LEDs work best for this as it's all new.

You're right, turning the leds in a better angle does helps a bit.
The issue comes when we are doing 2 players games, if one is too much on the side, the IR cam starts to have problem picking up the leds.
For the leds, I found quite powerful one but with bad angles, and ones with good angles but pretty terrible distance.
In a way, wide angle leds isn't just marketing, different leds do have different angles (you can actually test them with a digital cam), but more angle means less concentrated light, so less power.
I tried to combine few high power leds with various angles in one spot, and they kind of work but tend to produce a lot of heat (and takes a lot of current as well).
Still, will continue to look into the combined led solution, as it seems one single wide angle led doesn't do the trick.

thet0ast3r

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 77
  • Last login:October 26, 2020, 02:10:37 pm
  • Chihiro ftw
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #94 on: December 29, 2019, 09:17:52 am »
Have you tried with putting something infront of the led that makes it more wide-angle? like maybe just a thin sheet of paper or similar?

the wii remote sensor bar and my ems topgun sensor bars seem to have pretty uniform brightness, mostly independent of viewing angle.
thet0ast3r

JayBee

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 498
  • Last login:Yesterday at 10:09:30 am
  • Creator of the GUN4IR
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #95 on: December 29, 2019, 10:33:16 am »
Have you tried with putting something infront of the led that makes it more wide-angle? like maybe just a thin sheet of paper or similar?

the wii remote sensor bar and my ems topgun sensor bars seem to have pretty uniform brightness, mostly independent of viewing angle.
That's a good suggestion, I might try to see how it will react with a kind of half sphere filter.

Zebra

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • Last login:August 19, 2021, 01:12:24 pm
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #96 on: December 29, 2019, 01:42:59 pm »
Have you tried with putting something infront of the led that makes it more wide-angle? like maybe just a thin sheet of paper or similar?

the wii remote sensor bar and my ems topgun sensor bars seem to have pretty uniform brightness, mostly independent of viewing angle.
That's a good suggestion, I might try to see how it will react with a kind of half sphere filter.

That probably won't help (although it's worth trying). It's not possible to spread out a beam of light without reducing it's brightness. Diffusers waste a lot of light by sending it in all directions. The problem is somewhat solved in the projector screen business with dual micro-lens layers. A fresnel lens focuses light while a lenticular lens sends it left and right but not up or down (as nobody sits on the ceiling). Luckily, there are simpler solutions for IR guns...

When you bend LEDs to face the camera better, you don't have to bend all of them. You can place two or three in each position and face them in different directions (like on the Guncon 3). Then a slightly smokey plexiglass shield would stop the camera seeing three different LEDs (without over-diffusing).

Another option would be to place the LEDs closer together. The Guncon 3 seems to work just as well on my 77" TV where the LED cable isn't long enough to position them at the screen edge.

Or some kind of wide angle lens on the camera itself.

Personally, I think this issue is best solved by replacing the camera with an IR sensor like the Sega and Namco arcade guns. Having used their gun set-up at home for a few weeks now, I can see that it would make a far easier diy project than a camera solution. It's incredibly simple and effective. The LEDs mark the screen edge and the sensor measures proximity from that edge. Then it outputs 5v when facing one edge and goes down to 0v at the opposite edge. It may even be possible to hack a pair of 5 channel IR line follower sensors.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19399
  • Last login:Today at 05:29:33 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #97 on: December 29, 2019, 08:44:56 pm »
I don't think an ir-sensor based solution is out of the question... the problem seems to be that nobody can find the sensors other than just buying the arcade guns.  If a robust avr, say a teensy, was used to build the kit it should be fairly trivial to blink some leds in sequence and read the values as they are turned on.  The thing is.. what kind of equation are they using to get the x/y?  I'm sure it's some kind of triangulation, but could any of us code something good enough to get a similar result?

JayBee

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 498
  • Last login:Yesterday at 10:09:30 am
  • Creator of the GUN4IR
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #98 on: December 30, 2019, 04:10:26 am »
I don't think an ir-sensor based solution is out of the question... the problem seems to be that nobody can find the sensors other than just buying the arcade guns.  If a robust avr, say a teensy, was used to build the kit it should be fairly trivial to blink some leds in sequence and read the values as they are turned on.  The thing is.. what kind of equation are they using to get the x/y?  I'm sure it's some kind of triangulation, but could any of us code something good enough to get a similar result?
I surely could code that, with the triangulation calculations I made for the 4 led system, adapting the logic to an IR sensor shouldn't be that hard.
But like what you said, I have no idea where to get those for cheap, neither how to interface them with a teensy.

Zebra

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • Last login:August 19, 2021, 01:12:24 pm
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #99 on: December 30, 2019, 01:03:07 pm »
I don't think an ir-sensor based solution is out of the question... the problem seems to be that nobody can find the sensors other than just buying the arcade guns.  If a robust avr, say a teensy, was used to build the kit it should be fairly trivial to blink some leds in sequence and read the values as they are turned on.  The thing is.. what kind of equation are they using to get the x/y?  I'm sure it's some kind of triangulation, but could any of us code something good enough to get a similar result?

I'm fairly confident I understand how the Sega type 2 guns work now. The most important thing is that the BD gun sense board does not calculate coordinates or employ any sort of complex algorithm that is beyond our capabilities. Aside from the digital buttons, the only output is a variable voltage (0-5v).

If you connected the X or Y and ground output to a small light bulb, moving the gun's aim from the left to right of the screen would act like a dimmer switch. Matching that voltage to a screen position is all done in Windows (or the arcade PCB) and accuracy is dependent on how well you (manually) calibrate. All the work required to translate voltage to screen coordinates has already been done for us. Our challenge is how to make a device output 0v when you aim at one screen edge and gradually rise to 5v as you move your aim to the opposite edge.

The next part is understanding how the Sega and Namco gun sensor (AKA light receiving unit) works. You can see the original design and description on their website (use Google translation):

http://www.ohmic.co.jp/cat/zahyou-01.html

Note how the original design used just 4 IR led boards. Not sure why it became 12 and then 10.

If you remove the IR shield from the Sega and Namco guns you see this type of sensor:



I've been trying to identify what sensors like this actually do and as far as I can tell, they reflect the IR light from the LEDs and measure how long it takes for it to return so they can calculate distance, speed or proximity. Similar tech used by police to catch you speeding.

I can't pretend to understand how IR proximity or distance sensors work. I can just see that, with Sega and Namco guns, the X Y voltage reads 0v, 0v, when I aim towards LED board 5 (top left corner). When I move the gun's aim across to board 9 (top right), the needle on my analog volt meter rises to 5v. If I stop at board 7 or 2 (the center), it reads 2.5v.

I think a good place to start for research is the 5 channel IR Arduino line-followers with analog and digital output options (so they can work as an analog joystick or an optical mouse). Check out this video and imagine hacking that device to space the IR channels evenly across the screen and possibly having a second 5 channel array for the Y axis.



« Last Edit: December 30, 2019, 01:12:03 pm by Zebra »

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19399
  • Last login:Today at 05:29:33 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #100 on: December 30, 2019, 01:55:47 pm »
I'm pretty sure the logic board is taking the 12 readings it gets from each led and processing with via calculations those readings into the analog signals you mentioned, so no, the calculations ARE necessary unless you know something I don't.  It actually says so in the first sentence of the page you linked to.  The reason that it does this is so that the gun operation is completely separate from the game pcb, so the gun tech can be swapped out as the years roll on and still be used as a replacement for older games.  The calculations might be rather complex considering they have a dedicated cpu just to do them.... then again those boards are pretty old and a beefy avr might be just as powerful.  I would think that in the gun would have four ir sensors so that the difference between both x (left and right sensors) and y (top and bottom sensors).  The thing is it looks like there are only two.  I'm lost on that one as I can't figure out how the vertical position could be detected that way.  The multiple led boards might have to do with the resolution.  It could be that the horizontal resolution of the sensor is rather poor, so it has to be checked a section of the screen at a time.  That would explain the 20ms response time and the leds turning on in sequence. 

We might be able to dumb it down... buy four light sensors, throw them in a gun and put four leds around a screen.  We really need someone that knows about these types of sensors. 

Zebra

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • Last login:August 19, 2021, 01:12:24 pm
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #101 on: December 30, 2019, 02:57:12 pm »
It's true that the system is stand-alone but what it outputs is no more complicated than an analog joystick. You can actually use an analog stick to control Sega type 2 gun games. All the work to translate voltage to coordinates is done on the other side. You need to physically tell windows which voltages = the screen edge.

It also relies heavily on the screen out feature (digital button 3 on my UHID) to know when to stop tracking. It loses all accuracy when I disconnect the screen-out cable.

The gun sense boards are big but most of the space is taken up with voltage regulators, pots and ports. The actual IC chip is fairly small and I am sure you are right that a modern AVR or Arduino could do the same and then some.

I'm wondering if the IC chip from the gun sense boards has already been dumped for one of the emulators. If it has, would someone with your programming knowledge be able to see how it works?

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19399
  • Last login:Today at 05:29:33 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #102 on: December 30, 2019, 03:22:02 pm »
It's true that the system is stand-alone but what it outputs is no more complicated than an analog joystick. You can actually use an analog stick to control Sega type 2 gun games. All the work to translate voltage to coordinates is done on the other side. You need to physically tell windows which voltages = the screen edge.

It also relies heavily on the screen out feature (digital button 3 on my UHID) to know when to stop tracking. It loses all accuracy when I disconnect the screen-out cable.

The gun sense boards are big but most of the space is taken up with voltage regulators, pots and ports. The actual IC chip is fairly small and I am sure you are right that a modern AVR or Arduino could do the same and then some.

I'm wondering if the IC chip from the gun sense boards has already been dumped for one of the emulators. If it has, would someone with your programming knowledge be able to see how it works?

Unfortunately I don't think the chip has been dumped.  Mame just reads the x/y values from the proper address and I always wondered how exactly they got x/y from a light gun game but now I know.  I need to check one of these nerdy sites that do Arduino projects and see if someone has fooled with light sensors to detect ir leds.  If doing it from scratch finding an appropriate sensor would be the first step. 

thet0ast3r

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 77
  • Last login:October 26, 2020, 02:10:37 pm
  • Chihiro ftw
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #103 on: December 30, 2019, 03:35:19 pm »
Ok, Zebra. Here we go again.

You removed the IR Shield from the 4 sensors on the tiny pcb that is in the nozzle of the gun. What you also removed, is a rectangular ( maybe/probably square ) iris ( some plastic cap with a square hole in it).
This plastic cap has its opening in the middle of these 4 sensors which are just 4 flat photodiodes. If you shine a light on these photodiodes with the cap on, depending on which angle you shine, the amount of light that hits each individual sensor varies. if you happen to point the light straight at it, all 4 sensors get the same amount of light. The sega ir II system uses this difference in measured brightness to calculate the ANGLE of ONE* light source. This is why the IR diodes mounted on the screen are connected to the pcb, and not just to some power source. The ic`s of the gun system are synced, so that the gun can read all angles of the ir lights ONE after another. With this information ( all angles of all light sources) (and the position of the light sources which is obviously known since they are fixed) the system calculates its 6 degrees of freedom in relation to the screen, and converts the screen coordinates to 2 analog outputs for x and y. It also knows (just like ems topguns) when it is pointed offscreen, and returns that aswell.

I am 99% confident this is the way the ir II system works.

* I do not know how exactly they deal with outside light sources. Maybe they just read the photodiodes while no light is active, and subtract the intensities.
thet0ast3r

Zebra

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • Last login:August 19, 2021, 01:12:24 pm
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #104 on: December 30, 2019, 05:22:10 pm »
It's true that the system is stand-alone but what it outputs is no more complicated than an analog joystick. You can actually use an analog stick to control Sega type 2 gun games. All the work to translate voltage to coordinates is done on the other side. You need to physically tell windows which voltages = the screen edge.

It also relies heavily on the screen out feature (digital button 3 on my UHID) to know when to stop tracking. It loses all accuracy when I disconnect the screen-out cable.

The gun sense boards are big but most of the space is taken up with voltage regulators, pots and ports. The actual IC chip is fairly small and I am sure you are right that a modern AVR or Arduino could do the same and then some.

I'm wondering if the IC chip from the gun sense boards has already been dumped for one of the emulators. If it has, would someone with your programming knowledge be able to see how it works?

Unfortunately I don't think the chip has been dumped.  Mame just reads the x/y values from the proper address and I always wondered how exactly they got x/y from a light gun game but now I know.  I need to check one of these nerdy sites that do Arduino projects and see if someone has fooled with light sensors to detect ir leds.  If doing it from scratch finding an appropriate sensor would be the first step.

That's a shame although I guess it's not a surprise as one of the key points of emulators is that they allow you to use regular PC controllers for old games.

I'll ask the guys on the Arcade Projects forum. A lot of them have type 2 gun cabs and the means to dump chips. It's possible someone dumped them to make replacements.

Zebra

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • Last login:August 19, 2021, 01:12:24 pm
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #105 on: December 30, 2019, 05:43:20 pm »
Ok, Zebra. Here we go again.

You removed the IR Shield from the 4 sensors on the tiny pcb that is in the nozzle of the gun. What you also removed, is a rectangular ( maybe/probably square ) iris ( some plastic cap with a square hole in it).
This plastic cap has its opening in the middle of these 4 sensors which are just 4 flat photodiodes. If you shine a light on these photodiodes with the cap on, depending on which angle you shine, the amount of light that hits each individual sensor varies. if you happen to point the light straight at it, all 4 sensors get the same amount of light. The sega ir II system uses this difference in measured brightness to calculate the ANGLE of ONE* light source. This is why the IR diodes mounted on the screen are connected to the pcb, and not just to some power source. The ic`s of the gun system are synced, so that the gun can read all angles of the ir lights ONE after another. With this information ( all angles of all light sources) (and the position of the light sources which is obviously known since they are fixed) the system calculates its 6 degrees of freedom in relation to the screen, and converts the screen coordinates to 2 analog outputs for x and y. It also knows (just like ems topguns) when it is pointed offscreen, and returns that aswell.

I am 99% confident this is the way the ir II system works.

* I do not know how exactly they deal with outside light sources. Maybe they just read the photodiodes while no light is active, and subtract the intensities.

Again? Nobody has done this before or we wouldn't be having this discussion.

The pic wasn't mine. I've never taken off my IR shields (the part you call "a plastic cap"). They're Twisted Symphony's pics:

http://solid-orange.com/1643

The exact workings of the system is what we're trying to establish but I'm 99.9% sure it doesn't work how you said. The LED angles are irrelevant to the set-up and the board has no idea of coordinates (or that a screen exists). It doesn't transmit any data at all. It's only output is 0-5v for X and 0-5v for Y. Just like an analog joystick pot. It does this even if it's not connected to a computer. It relies on the user to establish where 0v and 5v is on the screen.

The IR LEDs are used to mark the screen edge for the screen-out feature and as a reference point to track motion inside the perimeter (of LED boards).That is all.



Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19399
  • Last login:Today at 05:29:33 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #106 on: December 30, 2019, 07:38:00 pm »
I'll try one more time, you've had two separate people explain this to you.  The end output is created after processing.  What do you think the cpu on that board is for?  Yes it results in two analog values for x and y but that is just for ease of interface, it has nothing to do with how the sensors work.  If there are indeed 4 photodiodes/transistors on the gun pcb, then it's working as I described before.... it turns on a led (or group of leds), reads all four values to guestimate it's position based upon the differences between those values, then moves to the next led/group of leds.  Then all of the readings are compared and processed via some formula to give the screen position, then that position is converted back to an analog value so it can be interfaced out to the game pcb. Again, back to my original post, the trick is determining what formula they used and what combination of sensors and leds work similar enough for the rig to be replicated.  Someone good at trig (i.e.  not me) could probably put together a formula solution.

JayBee

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 498
  • Last login:Yesterday at 10:09:30 am
  • Creator of the GUN4IR
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #107 on: December 31, 2019, 05:56:20 am »
I'll try one more time, you've had two separate people explain this to you.  The end output is created after processing.  What do you think the cpu on that board is for?  Yes it results in two analog values for x and y but that is just for ease of interface, it has nothing to do with how the sensors work.  If there are indeed 4 photodiodes/transistors on the gun pcb, then it's working as I described before.... it turns on a led (or group of leds), reads all four values to guestimate it's position based upon the differences between those values, then moves to the next led/group of leds.  Then all of the readings are compared and processed via some formula to give the screen position, then that position is converted back to an analog value so it can be interfaced out to the game pcb. Again, back to my original post, the trick is determining what formula they used and what combination of sensors and leds work similar enough for the rig to be replicated.  Someone good at trig (i.e.  not me) could probably put together a formula solution.
If I understand correctly what has been explained here about this tech, the sensor is only measuring the distance with each led (light one by one in sync), and then calculates the aim with a trig calculation?
It's actually very similar to what I am doing in my arduino sketch, so I guess if someone can find a cheap way to get those sensor, we could maybe make it work?
But to be honest, my IR cam and 4 led system is already on the way to become very reliable and stable, so I'm not sure it's worth the trouble.

thet0ast3r

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 77
  • Last login:October 26, 2020, 02:10:37 pm
  • Chihiro ftw
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #108 on: December 31, 2019, 06:20:35 am »
If I understand correctly what has been explained here about this tech, the sensor is only measuring the distance with each led (light one by one in sync), and then calculates the aim with a trig calculation?
It's actually very similar to what I am doing in my arduino sketch, so I guess if someone can find a cheap way to get those sensor, we could maybe make it work?
But to be honest, my IR cam and 4 led system is already on the way to become very reliable and stable, so I'm not sure it's worth the trouble.

Almost.
The gun does NOT calculate the distance to each single point. It actually calculates the angle/direction of each light relative to the gun, just like the ir camera does in your script. (every pixel of any camera represents just the intensity of light at that specific angle). So after the ir II got the angles (which are the coordinates in your script) it solves the Perspective-n-Point problem, just like the ems topgun and your script does.

I think no lightgun measures any distances to anything. Even if it did, the distance alone wouldn`t give any valuable information. if you only know the distances to 3 fixed points, you can only calculate where the gun is, not where the gun is pointing at, and we want the latter. Think about that, @Zebra.

Happy New year, till 2020 guys :)

thet0ast3r

JayBee

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 498
  • Last login:Yesterday at 10:09:30 am
  • Creator of the GUN4IR
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #109 on: December 31, 2019, 06:57:29 am »
If I understand correctly what has been explained here about this tech, the sensor is only measuring the distance with each led (light one by one in sync), and then calculates the aim with a trig calculation?
It's actually very similar to what I am doing in my arduino sketch, so I guess if someone can find a cheap way to get those sensor, we could maybe make it work?
But to be honest, my IR cam and 4 led system is already on the way to become very reliable and stable, so I'm not sure it's worth the trouble.

Almost.
The gun does NOT calculate the distance to each single point. It actually calculates the angle/direction of each light relative to the gun, just like the ir camera does in your script. (every pixel of any camera represents just the intensity of light at that specific angle). So after the ir II got the angles (which are the coordinates in your script) it solves the Perspective-n-Point problem, just like the ems topgun and your script does.

I think no lightgun measures any distances to anything. Even if it did, the distance alone wouldn`t give any valuable information. if you only know the distances to 3 fixed points, you can only calculate where the gun is, not where the gun is pointing at, and we want the latter. Think about that, @Zebra.

Happy New year, till 2020 guys :)


Thanks for the info, makes more sense now!
Actually you can calculate an estimation of the aim with only 3 LEDs, but only if you already detected which one is which, but yeah it's not very precise.

Right now what I am solving is the gun tilting that don't work well for more than 30° tilt on my system (because of the lack of tilt sensor). I found a trick for that, so with this update this system should work in any situation, any angle, any tilt, and a very reduced distance from the screen. All that without needing any calibration of course  :lol

Happy New Year guys, hope this year will be as full as interesting dev as the last one  :cheers:

kill_one

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 138
  • Last login:March 07, 2023, 01:16:21 pm
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #110 on: January 07, 2020, 07:10:51 am »
could someone post a tutorial with photos and links of the precise components to buy? In particular
4 powerful 940nm IR LEDs with angle wide enough (at least 30 °) and
resistors, are they the same as samco project? 4x 100 ohm Resistors ? 4x Super-bright 5mm IR LED - 940nm  20 or 30 degree beam width ?

thanks a lot guys :)

Mysli0210

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 34
  • Last login:June 11, 2020, 06:08:21 pm
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #111 on: January 12, 2020, 05:10:27 am »
Finally recieved my 5mm 940nm leds :D
And can confirm that they do work fine from at least 1 meter.
However this was with the old 2 point sketch, so i have yet to test the 4 point version.

I found by experimenting, that 3 leds in series, with a switching step-down regulator set at 3.8V works fine, even though their max rated voltage is 1.4v per led.
I 3D printed a small part to house the leds (first with 4 leds spaced too far from each other) which i will share on my github, which will be updated today with the model (stl and fusion360) along with my pcb designs.
https://github.com/Mysli0210/Liightgun


@Jaybee sent you a PM :)

kill_one

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 138
  • Last login:March 07, 2023, 01:16:21 pm
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #112 on: January 13, 2020, 07:06:20 am »
Finally recieved my 5mm 940nm leds :D
And can confirm that they do work fine from at least 1 meter.

@Mysli0210  can you post a link for buy your led ?
thanks :)

JayBee

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 498
  • Last login:Yesterday at 10:09:30 am
  • Creator of the GUN4IR
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #113 on: January 13, 2020, 08:44:21 am »
Finally recieved my 5mm 940nm leds :D
And can confirm that they do work fine from at least 1 meter.
However this was with the old 2 point sketch, so i have yet to test the 4 point version.

I found by experimenting, that 3 leds in series, with a switching step-down regulator set at 3.8V works fine, even though their max rated voltage is 1.4v per led.
I 3D printed a small part to house the leds (first with 4 leds spaced too far from each other) which i will share on my github, which will be updated today with the model (stl and fusion360) along with my pcb designs.
https://github.com/Mysli0210/Liightgun


@Jaybee sent you a PM :)
Finally recieved my 5mm 940nm leds :D
And can confirm that they do work fine from at least 1 meter.

@Mysli0210  can you post a link for buy your led ?
thanks :)
could someone post a tutorial with photos and links of the precise components to buy? In particular
4 powerful 940nm IR LEDs with angle wide enough (at least 30 °) and
resistors, are they the same as samco project? 4x 100 ohm Resistors ? 4x Super-bright 5mm IR LED - 940nm  20 or 30 degree beam width ?

thanks a lot guys :)
Actually it's on the work right now, I've finally found a pretty good solution that works well in any situation.
I will post it soon, but here what you will need for a good setup:
- 8* SID1K10CM led or similar specs (they have an angle of only 30° but are very powerful)
- 4* 56ohms 1/4watts resistor
- 4* very small soldering boards or something similar
- 1* USB plug
- enough wire to connect each IR point to the next one

Basically the idea is that instead of getting a wide range angle led but having a pretty bad useful distance, I combine two led for each point, very slightly angled vertically to greatly improve angle.
If the LEDs are close enough from each other, the cam will see only one point, even from close distance without filter.
So each point consists in two LEDs and one resistor in series, which are then connected directly to the 5V USB power.
The total consumption of the whole 4 point system is around 200mA, so any USB power should work.

Mysli0210

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 34
  • Last login:June 11, 2020, 06:08:21 pm
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #114 on: January 13, 2020, 10:30:38 am »
All of the above
I got these, actually nothing special.
https://www.aliexpress.com/item/32755919314.html
EDIT: i dont recommend this seller, due to more than 2 months delivery time (did receive several packages ordered after leds, before they arrived)

The most important things I can think of are as follows:
Correct wave lenght, being 940nm. (think of how far your tv remote reaches! )
ViewAngle ofcourse.
Correct ir pass through filter (probably the one on the df-robot cam is, the filter on the wiimote does a huge difference, without it it even tracks my lamps with 2 spots)
and last but not least the spotsize!

This is why I used 3 leds aimed slightly towards each other (it theoretically has a spread of 45 deg to either side)
I shared the fusion 360 file for my led mount on github.

As far as electronics goes, if you want low power consumption, ditch the resistors and finely adjust the voltage to be within spec of the led.
For example this:
https://aliexpress.com/item/32899665271.html
The reason being that the resistors just burn off the excess voltage to the point where the led won't pull too much current.

Took 2 pics of these after mounting them, will take more when I have printed some more of these led mounts (might add them to the telly)

JayBee if you could send me the sketch so I can change the pins to fit my gun as is, I'll test it thoroughly today  ;D
« Last Edit: January 13, 2020, 10:35:28 am by Mysli0210 »

kill_one

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 138
  • Last login:March 07, 2023, 01:16:21 pm
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #115 on: January 13, 2020, 11:30:44 am »
Actually it's on the work right now, I've finally found a pretty good solution that works well in any situation.
I will post it soon, but here what you will need for a good setup:
- 8* SID1K10CM led or similar specs (they have an angle of only 30° but are very powerful)
- 4* 56ohms 1/4watts resistor
- 4* very small soldering boards or something similar
- 1* USB plug
- enough wire to connect each IR point to the next one

Basically the idea is that instead of getting a wide range angle led but having a pretty bad useful distance, I combine two led for each point, very slightly angled vertically to greatly improve angle.
If the LEDs are close enough from each other, the cam will see only one point, even from close distance without filter.
So each point consists in two LEDs and one resistor in series, which are then connected directly to the 5V USB power.
The total consumption of the whole 4 point system is around 200mA, so any USB power should work.

@JayBee thanks a lot, Great!
in the tutorial you will also put the diagram and components for the recoil circuit?
I will wait for it to start ;)

I forgot ... this card is ok for your project?

https://www.adafruit.com/product/3677

JayBee

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 498
  • Last login:Yesterday at 10:09:30 am
  • Creator of the GUN4IR
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #116 on: January 13, 2020, 12:13:46 pm »
JayBee if you could send me the sketch so I can change the pins to fit my gun as is, I'll test it thoroughly today  ;D
For different reasons I decided I won't share the sketch, just the firmware for the Atmega32u4 5V/16MHz (the ItsyBitsy boards miss some functionalities needed for this system to work flawlessly).
@JayBee thanks a lot, Great!
in the tutorial you will also put the diagram and components for the recoil circuit?
I will wait for it to start ;)

I forgot ... this card is ok for your project?

https://www.adafruit.com/product/3677
I will share the diagrams later when I finally find the time to do them.
Only the Atmega32u4 5V/16MHz work with my firmware, the other boards miss some functionalities.

kill_one

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 138
  • Last login:March 07, 2023, 01:16:21 pm
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #117 on: January 13, 2020, 12:35:31 pm »
Only the Atmega32u4 5V/16MHz work with my firmware, the other boards miss some functionalities.

yes, of course, this board is: The ItsyBitsy 32u4 5V 16MHz and this specifications is the same?

ATmega32u4 onboad chip in QFN package
5V power and logic, 16MHz clock rate, 2KB RAM and 28K FLASH
USB bootloader with a nice LED indicator, AVR109 compatible (same as Flora, Feather 32u4, Leonardo, etc)
Micro-USB jack for power, USB uploading and debugging, you can put it in a box or tape it up and use any Micro USB cable for when you want to reprogram.
Can act as a USB HID Keyboard, Mouse, MIDI or plain USB 'CDC' serial device (default)
On-board 5.0V power regulator with 150mA output capability and ultra-low dropout. Up to 16V input, reverse-polarity protection, thermal and current-limit protection.
Low current 3.3V regulator output from chip, for small sensors
Power with either USB or external output (such as a battery) into VBAT pin - it'll automatically switch over
On-board red pin #13 LED
23 GPIO total - 6 analog in, 1x SPI port, 1x I2C port, 1x Hardware Serial port and 10 more GPIO, 4 of which have PWM
Can drive NeoPixels, connect to sensors, servos, etc.
Reset button for entering the bootloader or restarting the program.

thanks :)

Mysli0210

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 34
  • Last login:June 11, 2020, 06:08:21 pm
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #118 on: January 13, 2020, 01:18:37 pm »
JayBee if you could send me the sketch so I can change the pins to fit my gun as is, I'll test it thoroughly today  ;D
For different reasons I decided I won't share the sketch, just the firmware for the Atmega32u4 5V/16MHz (the ItsyBitsy boards miss some functionalities needed for this system to work flawlessly).
Well, i was kind of waiting for you to share it with me, not the general public. As you told me you would earlier.
and I know about the itsy not being the same, I get that.
But I do have the atmega32u4 5v @16 MHz. And as we talked about I could help optimize the code and add functionality to it. Like having the option to add a nunchuck for the extra buttons. Even designed the pcb's for this exact purpose.

But I guess I'll have to rewire my entire gun due to this then  :banghead:

Mysli0210

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 34
  • Last login:June 11, 2020, 06:08:21 pm
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #119 on: January 13, 2020, 01:44:21 pm »
Only the Atmega32u4 5V/16MHz work with my firmware, the other boards miss some functionalities.

yes, of course, this board is: The ItsyBitsy 32u4 5V 16MHz and this specifications is the same?

ATmega32u4 onboad chip in QFN package
5V power and logic, 16MHz clock rate, 2KB RAM and 28K FLASH
USB bootloader with a nice LED indicator, AVR109 compatible (same as Flora, Feather 32u4, Leonardo, etc)
Micro-USB jack for power, USB uploading and debugging, you can put it in a box or tape it up and use any Micro USB cable for when you want to reprogram.
Can act as a USB HID Keyboard, Mouse, MIDI or plain USB 'CDC' serial device (default)
On-board 5.0V power regulator with 150mA output capability and ultra-low dropout. Up to 16V input, reverse-polarity protection, thermal and current-limit protection.
Low current 3.3V regulator output from chip, for small sensors
Power with either USB or external output (such as a battery) into VBAT pin - it'll automatically switch over
On-board red pin #13 LED
23 GPIO total - 6 analog in, 1x SPI port, 1x I2C port, 1x Hardware Serial port and 10 more GPIO, 4 of which have PWM
Can drive NeoPixels, connect to sensors, servos, etc.
Reset button for entering the bootloader or restarting the program.

thanks :)

Well it's the same chip, so no magic difference there.
the only 2 things that might differ, but not matter is the bootloader might be different, though entirely not needed if you flash via an external programmer, as with any avr chip. And the physical location of the pins may differ on a different board.
But I reckon most people would get the pro micro clones as they're super cheap.
However i do believe that it would be entirely possible to use an stm32 at half the price , or even a esp32 when they release libraries to make it a Bluetooth hid joypad/mouse (keyboard is already possible)