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

Poll

02/19 I will add RGB led support soon, I need for that to use 3 arduino PWM pins, which are currently being used by Pedal, Start & Right. I will do 2 firmwares, one with 11 buttons, and one with 8 button+led. How should they behave?

Leave the button pins as it is now, and disable the pedal, start and dpad right buttons when the RGB led is active
0 (0%)
Swap the pedal and start pins with some of the DPad ones, and disable only the DPAD when the RGB led is active
2 (50%)
Other (post a message to tell me what you think).
2 (50%)

Total Members Voted: 4

  

Author Topic: JayBee DIY 4 IR Led Lightgun System (no calibration needed)  (Read 57710 times)

1 Member and 1 Guest are viewing this topic.

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 8006
  • Last login:Yesterday at 10:36:16 pm
  • Designated spam hunter
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #120 on: January 13, 2020, 03:24:56 pm »
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.
Cheap is good, but an ItsyBitsy 32u4 might be a better choice for JayBee's firmware than a Pro Micro due to the number of 32u4 ports not connected.

  ItsyBitsy doesn't have connections for two ports (pins) -- B0 (8 ) and D5 (22).  Schematic here.


  Pro Micro doesn't have connections for seven ports (pins) -- B0 (8 ), D5 (22), B7 (12), C7 (32), D6 (26), F1 (40), and F0 (41).


the ItsyBitsy boards miss some functionalities needed for this system to work flawlessly
Does your firmware use any of the unconnected ports (pins) mentioned above, JayBee, or are the "functionalities" you mentioned something else?   :dunno


Scott

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 #121 on: January 13, 2020, 05:04:25 pm »
Cheap is good, but an ItsyBitsy 32u4 might be a better choice for JayBee's firmware than a Pro Micro due to the number of 32u4 ports not connected.

  ItsyBitsy doesn't have connections for two ports (pins) -- B0 (8 ) and D5 (22).  Schematic here.

  Pro Micro doesn't have connections for seven ports (pins) -- B0 (8 ), D5 (22), B7 (12), C7 (32), D6 (26), F1 (40), and F0 (41).

Does your firmware use any of the unconnected ports (pins) mentioned above, JayBee, or are the "functionalities" you mentioned something else?   :dunno


Scott

I just went through all the pins specified in the original post, they are all found on the pro micro.

The ones you mention that the pro micro is missing are used for the following (taken from the atmega32u4 spec sheet)
http://ww1.microchip.com/downloads/en/devicedoc/atmel-7766-8-bit-avr-atmega16u4-32u4_datasheet.pdf

PB0 Used for the RX led on the board.
PB7 Digital GPIO pin, found on arduino leonardo, skipped on pro micro due to the board being scaled down (no special functionality)
PC7 Digital GPIO pin, found on arduino leonardo, skipped on pro micro due to the board being scaled down has some Timer and high-speed PWM functionality (which is most likely not needed)
PD5 is used for the TX led on the board.
PD6 This is ADC9, it has some timer input functionality, but its probably not of much use. it is found on arduino leonardo, so again skipped.
PF0 This is ADC0, not a gpio pin, can only be used for reading analog voltages.
PF1 This is ADC1, not a gpio pin, can only be used for reading analog voltages.

Another thing is, this setup with one pin per button is an unneeded luxury.
I could easily design a breakoutboard for the cheap pro micros, which could be labeled for all the buttons and have up to 8 buttons per analog pin.

I also think its a slippery slope, not keeping it open-source, since guys like samco, did make his project open on github, which is neat, cause we'd then be able to develop it much further, should JayBee set aside the project at some point.

Look im all for having a pre-compiled image, that people can just flash on specific boards and follow a simple guide, but those of us whom are tinkerers, should be able to customize it to their needs, which in turn could become features on newer versions.

Heck i'd even be willing to send you some of the boards when i get around to ordering them (pay for shipping ofc).


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 #122 on: January 13, 2020, 06:07:35 pm »
So I decided that I had nothing better to do than rewire the gun and can confirm that tracking works at at least 3 meters (that's how long a cable I have) that's with the 3 led spots I made. No interference from other lights like the buttons on my arcade.

But as you might remember I didn't use the df robot camera but the wiimote one instead.
So it does not have a housing that I can just rotate, mine is locked in with glue.
the problem is that the entire coordinate system is mirrored which is the same as being rotated 180 deg.
  :dizzy:

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 8006
  • Last login:Yesterday at 10:36:16 pm
  • Designated spam hunter
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #123 on: January 13, 2020, 08:11:58 pm »
I just went through all the pins specified in the original post, they are all found on the pro micro.
Sounds good.   ;D

The question still stands:  What are the missing "functionalities" that JayBee referenced that would prevent using his firmware on a different 32u4 board?   :dunno

I also think its a slippery slope, not keeping it open-source, since guys like samco, did make his project open on github, which is neat, cause we'd then be able to develop it much further, should JayBee set aside the project at some point.

Look im all for having a pre-compiled image, that people can just flash on specific boards and follow a simple guide, but those of us whom are tinkerers, should be able to customize it to their needs, which in turn could become features on newer versions.
I agree that open-sourcing the project would be great.

If open-source is not an option, having the pre-compiled firmware use port connections that are available on all of the commonly-available 32u4 boards (like this firmware appears to do) increases usability.   :cheers:

Here's a handy chart to translate Arduino markings into 32u4 pins and ports.   ;D
- You may want to do something similar, JayBee, since some of the "Pin number" markings (A6-A9, A10) in the OP don't appear on these common 32u4 Arduino boards.


Scott
« Last Edit: January 13, 2020, 08:57:43 pm by PL1 »

JayBee

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 330
  • Last login:Yesterday at 10:45:33 pm
  • If I can't buy it, I build it.
    • Github
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #124 on: January 13, 2020, 09:03:07 pm »
So to answer to your questions:
The main compatibility problem is that most model of itsybitsy don't have NAND storage, which is needed to store important calibrations data. (Not sure about all model tho)
Beside that for optimization purpose most of the library I use are especially written to work on the Atmega32u4, and won't work on other ones (the joystick mode for instance).
Although I never tried on the ItsyBitsy 32u4 specifically, which seems to be a clone to the itsybitsy 32u4? If it's a clone it should work as is.
The main reasons I choose the Atmega32u4 is that it's dirt cheap, has more than enough power and pins for this use, and has way more resources available than any other models.

Now the reason why I decided to not share the code;
I was indeed thinking about sharing it too like Samco did.
I did it for my 2 points sketch that added many more functions than his.
But you have to know that my sketch is massively different, way bigger and more complex. It took me hundred of hours to pull off the complex math needed to accurately and smoothly triangulate the aim position no matter the number of points (1~4), while taking care of other functions like rumble or recoil, all without any added lag or slowdowns.
With all the numerous functionalities I added and am still adding, this solution is pretty much the most advanced in the market, sinden included, thanks to the auto calibration, the ultra low latency (5~7ms), and the plug and play aspect (no need to have a video processing device a special tool/driver or anything else).
But I've worked as a dev long enough to know that if I release the sketch in the wild, there will always be people using that code to improve their own product or sell new ones. I definitely don't want people to make money on it.
So unless you know a way for me to protect my code, I won't share it  :embarassed:

But if you guys want I can still make other firmwares compatible with different device or pinout.

So I decided that I had nothing better to do than rewire the gun and can confirm that tracking works at at least 3 meters (that's how long a cable I have) that's with the 3 led spots I made. No interference from other lights like the buttons on my arcade.

But as you might remember I didn't use the df robot camera but the wiimote one instead.
So it does not have a housing that I can just rotate, mine is locked in with glue.
the problem is that the entire coordinate system is mirrored which is the same as being rotated 180 deg.
  :dizzy:
You mean mirrored with my sketch? Or just as is? Did you test with samco's test sketch?
The DF Robot cams have a big tilts issue, they aren't correctly oriented.
But if you tell me how the axises are reversed I can make another firmware without the df robot inversion.

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 8006
  • Last login:Yesterday at 10:36:16 pm
  • Designated spam hunter
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #125 on: January 13, 2020, 10:41:37 pm »
The main reasons I choose the Atmega32u4 is that it's dirt cheap, has more than enough power and pins for this use, and has way more resources available than any other models.
It certainly is a great little processor.   ;D

Now the reason why I decided to not share the code;
Your code, your choice.  Thanks for sharing the compiled firmware.   :cheers:

But if you guys want I can still make other firmwares compatible with different device or pinout.
Just wanted to check that:

1.) You had considered which ports your firmware used so the maximum number of 32u4 boards are compatible.

Mysli0210 mentioned above that it should work with the limited number of ports available on a Pro Micro, but I'm not able to positively confirm which ports/pins correspond to "A6" thru "A10" in the OP.

2.) You clarified the documentation so anyone using your firmware knows exactly which wire connects to which pin.

For example, according to the OP, "B button" connects to "A6".  Which pin on a Leonardo, Micro, or Pro Micro would that be?  None of the pins on those boards are labeled "A6".   :dizzy:


Scott

JayBee

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 330
  • Last login:Yesterday at 10:45:33 pm
  • If I can't buy it, I build it.
    • Github
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #126 on: January 13, 2020, 11:02:20 pm »
The pins are pretty much the ones written on the basic Atmega32u4 board, but you can find the corresponding pin numbers in the image attached ;)

Also, I considered using the analog inputs to increase the number of buttons, but it's not really needed, make it more complex, and most importantly if you use both rumble and recoil function, there is no more space to add another circuit inside most gun shells :lol

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 8006
  • Last login:Yesterday at 10:36:16 pm
  • Designated spam hunter
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #127 on: January 13, 2020, 11:43:54 pm »
That image is the Rosetta Stone for your OP.   :applaud:
- Shows which "pin numbers" go to which pin. (some don't match the marks on the PCB)
- Shows that you're using a Pro Micro. (the specific Arduino you are using is not mentioned in the OP)

Please consider adding that image to the OP so it isn't overlooked here on page 4.


Scott

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 #128 on: January 14, 2020, 12:22:04 am »
You mean mirrored with my sketch? Or just as is? Did you test with samco's test sketch?
The DF Robot cams have a big tilts issue, they aren't correctly oriented.
But if you tell me how the axises are reversed I can make another firmware without the df robot inversion.

I did try with his sketch way back when I built the gun.
Well both x and y axes, are inverse. Up is down, left is right.
that would be great if you could! As I plan to bring my arcade to the hackerspace today  ;D

JayBee

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 330
  • Last login:Yesterday at 10:45:33 pm
  • If I can't buy it, I build it.
    • Github
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #129 on: January 14, 2020, 01:01:21 am »
That image is the Rosetta Stone for your OP.   :applaud:
- Shows which "pin numbers" go to which pin. (some don't match the marks on the PCB)
- Shows that you're using a Pro Micro. (the specific Arduino you are using is not mentioned in the OP)

Please consider adding that image to the OP so it isn't overlooked here on page 4.


Scott
Yeah I should have joined it.
The model is actually written in the needed hardware list, "Atmega32u4 5V/16MHz".
This is indeed the pro micro, but there are different variations of it. Most clone of this specific one, no matter the name, will have the same pinout and specs.

Edit: ah I see, some specific boards have a different pinout.
Well I guess it's better to stick to the most common model.
« Last Edit: January 14, 2020, 01:05:27 am by JayBee »

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 8006
  • Last login:Yesterday at 10:36:16 pm
  • Designated spam hunter
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #130 on: January 14, 2020, 02:35:47 am »
The model is actually written in the needed hardware list, "Atmega32u4 5V/16MHz".
Yeah . . . that's not enough to identify which specific PCB you're using/recommending.   ::)

All of the AVRs in the chart above use that same processor/voltage/frequency combination -- with 5 different pinouts, markings, and board sizes.

Necessary info about the PCB, pinout, and markings is currently not in the OP.

"Arduino Pro Micro Atmega32u4 5V/16MHz" and adding the Rosetta Stone pic would convey that info.


Scott

kill_one

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 133
  • Last login:October 23, 2020, 06:18:53 pm
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #131 on: January 14, 2020, 03:42:43 am »
The model is actually written in the needed hardware list, "Atmega32u4 5V/16MHz".
Yeah . . . that's not enough to identify which specific PCB you're using/recommending.   ::)

All of the AVRs in the chart above use that same processor/voltage/frequency combination -- with 5 different pinouts, markings, and board sizes.

Necessary info about the PCB, pinout, and markings is currently not in the OP.

"Arduino Pro Micro Atmega32u4 5V/16MHz" and adding the Rosetta Stone pic would convey that info.


Scott

@PL1 therefore Pro Micro  and Itsy Bitsy 32u4 is the same board but with only different pinouts?
thanks

kill_one

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 133
  • Last login:October 23, 2020, 06:18:53 pm
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #132 on: January 14, 2020, 07:18:38 am »
- 8* SID1K10CM led or similar specs (they have an angle of only 30 but are very powerful)

SID1K10CM
I can not find them

the specs of led ir is: 5MM 940NM 200mw/sr 1.3-1.5v 30  quite right?

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 #133 on: January 14, 2020, 08:17:26 am »
I do believe you won't need anything specific, except for the wavelength, as mentioned earlier.
I run mine at the lowest voltage that is specified and works at 3 meters distance.
I bet I could go even lower  ;D

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 8006
  • Last login:Yesterday at 10:36:16 pm
  • Designated spam hunter
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #134 on: January 14, 2020, 12:39:50 pm »
@PL1 therefore Pro Micro  and Itsy Bitsy 32u4 is the same board but with only different pinouts?
The boards are very similar because a 32u4 processor only needs a few supporting components, and none of those change the way that firmware code is handled.

If you look at the ItsyBitsy or Pro Micro schematics, the two main components are an ATMega32u4 processor and a 16 MHz crystal oscillator, both running on 5v.
- The supporting components are a few capacitors, resistors, LEDs, a USB connector, a reset switch (ItsyBitsy), a fuse (Pro Micro), a Zener diode, and a power regulation chip.

The other possible difference between boards is the bootloader.
- It determines which program (AVRDude, FLIP, etc.) you can use to load the firmware into the 32u4, but it won't matter once the firmware is running.

The various 32u4 boards aren't exactly the same, but the firmware can't tell the difference.
- As long as the board fits into your gun shell and you connect the various inputs/outputs correctly, it should work.   ;D


Scott

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 #135 on: January 14, 2020, 01:56:20 pm »
Did a little testing tonight (rotated my camera 180)
I find that the accuracy is not sufficient to play with.
it seems smooth, but I find that the leds being offset outside the frame of the screen, makes it so that its not scaled 1:1

JayBee, you asked how you could prevent people from earning money off of it.
Well, you can release the project under creative commons CC BY-NC-SA  license

JayBee

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 330
  • Last login:Yesterday at 10:45:33 pm
  • If I can't buy it, I build it.
    • Github
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #136 on: January 15, 2020, 12:39:28 am »
Did a little testing tonight (rotated my camera 180)
I find that the accuracy is not sufficient to play with.
it seems smooth, but I find that the leds being offset outside the frame of the screen, makes it so that its not scaled 1:1

JayBee, you asked how you could prevent people from earning money off of it.
Well, you can release the project under creative commons CC BY-NC-SA  license
Did you put the LEDs right in the border of the screen or on the outside border? For me it's extremely accurate, more than any solution I tested even real light guns on CRT  ;)
But I had to get LEDs good enough to avoid any flickering (and so loss of position).
Creative commons won't prevent anybody to use my code, since there is no way to check if they are using it unless they share it too  :lol
« Last Edit: January 15, 2020, 03:13:40 am by JayBee »

kill_one

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 133
  • Last login:October 23, 2020, 06:18:53 pm
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #137 on: January 15, 2020, 05:30:54 am »
I do believe you won't need anything specific, except for the wavelength, as mentioned earlier.
I run mine at the lowest voltage that is specified and works at 3 meters distance.
I bet I could go even lower  ;D

i found these OSRAM SFH 4546  : High Power Infrared Emitters 5mm 940nm 130 mW/sr 1.5 V 100mA  40 deg 12ns
will they work?
and what resistance should i use for these?
always 56 ohms 1/4w?

Thanks a lot guys for support :)

kill_one

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 133
  • Last login:October 23, 2020, 06:18:53 pm
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #138 on: January 15, 2020, 05:48:59 am »
Did you put the LEDs right in the border of the screen or on the outside border? For me it's extremely accurate, more than any solution I tested even real light guns on CRT  ;)
But I had to get LEDs good enough to avoid any flickering (and so loss of position).

@JayBee on my cab i will have to put the leds on the sides of the crt monitor behind the bezel glass or in front of the sides of the glass? my cabinet is classic arcade cab with crt monitor 15khz hantarex polo slightly inclined, this inclination or
reflections of the glass they can create problems to precision of the gun?

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 #139 on: January 15, 2020, 09:06:55 am »
Did a little testing tonight (rotated my camera 180)
I find that the accuracy is not sufficient to play with.
it seems smooth, but I find that the leds being offset outside the frame of the screen, makes it so that its not scaled 1:1

JayBee, you asked how you could prevent people from earning money off of it.
Well, you can release the project under creative commons CC BY-NC-SA  license
Did you put the LEDs right in the border of the screen or on the outside border? For me it's extremely accurate, more than any solution I tested even real light guns on CRT  ;)
But I had to get LEDs good enough to avoid any flickering (and so loss of position).
Creative commons won't prevent anybody to use my code, since there is no way to check if they are using it unless they share it too  :lol
Well I placed them as you see in the pictures I posted, they are around 10 mm off the border of the screen.
As for the leds I do think these are perfect for the purpose, as it tracks them fine, but as I said, the scale is just wrong
No you can't, but if you have it licensed you can prove ownership. If you do see the code.

I do have an idea as to how to compensate for the offset.
if you initialize serial, which will respond to numbers which could be percentage of screen width.
With this offset you could just inset the mouse coordinates.

I do know its not easy to program something like this. And still think your work is awesome, even though I can't hit a damned thing  ;D

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 #140 on: January 15, 2020, 09:32:18 am »
I do believe you won't need anything specific, except for the wavelength, as mentioned earlier.
I run mine at the lowest voltage that is specified and works at 3 meters distance.
I bet I could go even lower  ;D

i found these OSRAM SFH 4546  : High Power Infrared Emitters 5mm 940nm 130 mW/sr 1.5 V 100mA  40 deg 12ns
will they work?
and what resistance should i use for these?
always 56 ohms 1/4w?

Thanks a lot guys for support :)

The resistance needed is a result of the input voltage and the current being drawn.
so if you got 3 leds of 1.5v each, in series. you can supply the chain with 4.5V raw
(consult the spec sheet of the led to find the right voltage and current)
with many multimeters you can measure what voltage the led starts to conduct current.

Now what the resistor is doing is just drop the voltage by passing current.
You can use calculators like this one
http://led.linear1.org/1led.wiz
However there's a difference between having a single led, having them in series and in parallel

janderclander14

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 5
  • Last login:October 24, 2020, 07:42:58 pm
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #141 on: January 15, 2020, 01:35:08 pm »
    The 4 IR LEDs system is finally here!

    Instead of using the usual 2+ LEDs sensor bar, this system uses one LED in the middle of each side, which allows a far better aiming system overall.
    I also added tons of features, and will keep it updated whenever needed.

    Thanks a lot, JayBee. I was looking for something like this since I tested Hifi's code on a Wiimote.
    May I ask you some questions?
    - I understand the builds you refer are those you describe here: http://forum.arcadecontrols.com/index.php/topic,161192.0.html, which use a Namco Guncon 1. But, do you have any experience with a Namco Guncon 2? Do you think the whole build (including the solenoid) could fit in a Guncon 2 considering also the additional buttons it has? I'm particularly interested in using the button under the handle instead of a separate pedal.
    - How do you feed the rumble motors? Do you use the VCC output of the Arduino? or the 5V line of the USB cable? Or do you use a similar driver as the solenoid and an external power supply?
    - Regarding leds, I saw at different places that the optimal led for the Wiimote camera is the Vishay tsal6400. It's a 100mA 25 angle led with UV coating. Since the DF Robot camera seems to be very similar to that of the Wiimote, they may also be adequate.

    Thanks![/list]

    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 #142 on: January 15, 2020, 03:32:30 pm »
    Did you put the LEDs right in the border of the screen or on the outside border? For me it's extremely accurate, more than any solution I tested even real light guns on CRT  ;)
    But I had to get LEDs good enough to avoid any flickering (and so loss of position).

    @JayBee on my cab i will have to put the leds on the sides of the crt monitor behind the bezel glass or in front of the sides of the glass? my cabinet is classic arcade cab with crt monitor 15khz hantarex polo slightly inclined, this inclination or
    reflections of the glass they can create problems to precision of the gun?

    thanks! :)
    Well reflections could make some interference. but remember, IR light does not pass through all glasstypes equally.
    my cab, also has a slight incline, which didnt seem to matter at all.

    JayBee

    • Trade Count: (0)
    • Full Member
    • ***
    • Offline Offline
    • Posts: 330
    • Last login:Yesterday at 10:45:33 pm
    • If I can't buy it, I build it.
      • Github
    Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
    « Reply #143 on: January 15, 2020, 08:14:26 pm »
      Well I placed them as you see in the pictures I posted, they are around 10 mm off the border of the screen.
      As for the leds I do think these are perfect for the purpose, as it tracks them fine, but as I said, the scale is just wrong
      No you can't, but if you have it licensed you can prove ownership. If you do see the code.

      I do have an idea as to how to compensate for the offset.
      if you initialize serial, which will respond to numbers which could be percentage of screen width.
      With this offset you could just inset the mouse coordinates.

      I do know its not easy to program something like this. And still think your work is awesome, even though I can't hit a damned thing  ;D
      Are your TV and games 16/9 or 4/3?
      If it's 16/9 TV with 4/3 content, you have to switch the screen ratio mode by briefly pressing the calibration button once.
      If it's a 4/3 TV, press the button one more time.
      It should magically correct the ratio, no need to manually calibrate or anything ;)
      It's all written in the first post, but I understand that it's confusing.
      For the screen mode you can actually change them automatically  with mamehooker through serial commands, but I haven't finished the tutorial for that.

      For the border even if the led isn't directly on border of the screen, it should still work fine, minus a slight offset on borders that isn't really a problem for old games. And only 10mm should definitely not matter.

      Tell me if it fixes the issue, I will help you until we manage to make it work properly.


      Thanks a lot, JayBee. I was looking for something like this since I tested Hifi's code on a Wiimote.
      May I ask you some questions?
      - I understand the builds you refer are those you describe here: http://forum.arcadecontrols.com/index.php/topic,161192.0.html, which use a Namco Guncon 1. But, do you have any experience with a Namco Guncon 2? Do you think the whole build (including the solenoid) could fit in a Guncon 2 considering also the additional buttons it has? I'm particularly interested in using the button under the handle instead of a separate pedal.
      - How do you feed the rumble motors? Do you use the VCC output of the Arduino? or the 5V line of the USB cable? Or do you use a similar driver as the solenoid and an external power supply?
      - Regarding leds, I saw at different places that the optimal led for the Wiimote camera is the Vishay tsal6400. It's a 100mA 25 angle led with UV coating. Since the DF Robot camera seems to be very similar to that of the Wiimote, they may also be adequate.

      Thanks![/list]
      To answer to your questions:
      - one is the guncon 1, the other one is the saturn virtua gun. Of those two I actually prefer the saturn one, since it has far more space for a bigger stronger recoil, and for an Xbox controller rumble motor in the handle. But I am indeed also working on a guncon 2 right now, because like you said the handle button is so convenient. I managed to fit most of the main stuff inside, and all buttons work nicely (even the dpad), but right now I'm struggling to fit a mini solenoid in, which isn't easy to say the least  :banghead:
      - So far I only finished the Virtua Gun rumble, which uses an Xbox rumble motor, and it works amazingly well! It vibrates when reloading or when shooting out of the screen, but I also want to use it for many other feedbacks. I'm using a simple circuit (transistor, kickback diode, resistors...) to feed it with the VCC but control it with another pin. The VCC pin and the UCB VCC are virtually the same beside the VCC pin being limited in current. Reason why I use the Xbox rumble motor specifically since it doesn't take so much of it. Right now I'm still experimenting with it, in the end I want to be able to do different rumble effects. For the smaller shells like the GC1&2, I'm planning to use small wiimote rumble motors that I will stick inside the handle, but it's still too early to say how well it will work.
      - yeah it will probably work too  ;D The one I'm using is mainly because I'm standing a bit far from my TV and most less powerful leds were flickering so much on cam.

      In general the best way to test leds is using dfrobot or Samco's test app to see if the cam is picking up the led smoothly from where you are standing.
      « Last Edit: January 15, 2020, 08:49:24 pm by JayBee »

      janderclander14

      • Trade Count: (0)
      • Jr. Member
      • **
      • Offline Offline
      • Posts: 5
      • Last login:October 24, 2020, 07:42:58 pm
      • I want to build my own arcade controls!
      Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
      « Reply #144 on: January 16, 2020, 05:33:00 am »
      But I am indeed also working on a guncon 2 right now, because like you said the handle button is so convenient. I managed to fit most of the main stuff inside, and all buttons work nicely (even the dpad), but right now I'm struggling to fit a mini solenoid in, which isn't easy to say the least  :banghead:

      Thanks for the details!
      Regarding the mini solenoid, I have used this very tiny solenoid for another project: https://www.aliexpress.com/item/32987722435.html?spm=a2g0s.9042311.0.0.dc534c4doWaC1d
      It has the convenient feature of working well with a 5V 2amp power supply, so it can be feed with a powered USB line.
      For the controller board, I've used this cheap pre-made one: https://www.aliexpress.com/item/33038728761.html?spm=a2g0s.9042311.0.0.dc534c4doWaC1d
      It completely decouples the power and control lines, as you can se here: https://bogza.ro/index.php/FR120N_Isolated_MOSFET_MOS_Tube_FET_Relay_Module

      And, regarding the rumble motor, smaller alternatives to the xbox rumble motor could be the rumble modules of the xbox one controller triggers or of the ps3 move. On the contrary to the Wii motor, those have a mini unbalanced weigth and may produce a better effect. These can be found in ebay:

      https://www.ebay.es/itm/Vibration-Rumble-Motor-M10-Replacement-For-Microsoft-Xbox-One-Controller/132845524127?hash=item1eee35d49f:g:IesAAOSwoDlb4EZj
      https://www.ebay.es/itm/2-Units-Handle-Vibration-Rumble-Motor-Motors-Replacement-For-PS3-Move-Controller/122490167409?hash=item1c84fba071:g:d68AAOSwcB5ZFDxl

      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 #145 on: January 16, 2020, 06:35:48 am »
        Well I placed them as you see in the pictures I posted, they are around 10 mm off the border of the screen.
        As for the leds I do think these are perfect for the purpose, as it tracks them fine, but as I said, the scale is just wrong
        No you can't, but if you have it licensed you can prove ownership. If you do see the code.

        I do have an idea as to how to compensate for the offset.
        if you initialize serial, which will respond to numbers which could be percentage of screen width.
        With this offset you could just inset the mouse coordinates.

        I do know its not easy to program something like this. And still think your work is awesome, even though I can't hit a damned thing  ;D
        Are your TV and games 16/9 or 4/3?
        If it's 16/9 TV with 4/3 content, you have to switch the screen ratio mode by briefly pressing the calibration button once.
        If it's a 4/3 TV, press the button one more time.
        It should magically correct the ratio, no need to manually calibrate or anything ;)
        It's all written in the first post, but I understand that it's confusing.
        For the screen mode you can actually change them automatically  with mamehooker through serial commands, but I haven't finished the tutorial for that.

        For the border even if the led isn't directly on border of the screen, it should still work fine, minus a slight offset on borders that isn't really a problem for old games. And only 10mm should definitely not matter.

        Tell me if it fixes the issue, I will help you until we manage to make it work properly.

        Well its not a tv, which you would have known if you looked at the pics I uploaded earlier in the thread.
        the screen is actually 5:4 but that's pretty close to 4:3
        It definitely doesn't seem like the aspect ratio is the problem, but rather that 10mm offset.
        On the center of the screen the offset is not felt, but it feels like a gradiently increasing offset the further you get to either edge. Which to me seems logical.

        However I do understand why you'd think 10mm shouldn't matter that much, cause on a large tv, it's a small percentage of the screen size.
        But my screen is only 19"
        Which in 5:4 format is 38cm wide, with an offset of 10cm on either side, this becomes 40cm
        40/38 is 1.05 so therefor there is a 5 percent error on the edges of the screen. In this particular case. [/list]

        EDIT:
        As for mamehooker, i dont use mame at all, i find it running very poorly in retropie, and super confusing to set up properly due to some versions running some games better than others.
        « Last Edit: January 16, 2020, 07:17:31 am by Mysli0210 »

        JayBee

        • Trade Count: (0)
        • Full Member
        • ***
        • Offline Offline
        • Posts: 330
        • Last login:Yesterday at 10:45:33 pm
        • If I can't buy it, I build it.
          • Github
        Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        « Reply #146 on: January 16, 2020, 11:02:32 am »
        But I am indeed also working on a guncon 2 right now, because like you said the handle button is so convenient. I managed to fit most of the main stuff inside, and all buttons work nicely (even the dpad), but right now I'm struggling to fit a mini solenoid in, which isn't easy to say the least  :banghead:

        Thanks for the details!
        Regarding the mini solenoid, I have used this very tiny solenoid for another project: https://www.aliexpress.com/item/32987722435.html?spm=a2g0s.9042311.0.0.dc534c4doWaC1d
        It has the convenient feature of working well with a 5V 2amp power supply, so it can be feed with a powered USB line.
        For the controller board, I've used this cheap pre-made one: https://www.aliexpress.com/item/33038728761.html?spm=a2g0s.9042311.0.0.dc534c4doWaC1d
        It completely decouples the power and control lines, as you can se here: https://bogza.ro/index.php/FR120N_Isolated_MOSFET_MOS_Tube_FET_Relay_Module

        And, regarding the rumble motor, smaller alternatives to the xbox rumble motor could be the rumble modules of the xbox one controller triggers or of the ps3 move. On the contrary to the Wii motor, those have a mini unbalanced weigth and may produce a better effect. These can be found in ebay:

        https://www.ebay.es/itm/Vibration-Rumble-Motor-M10-Replacement-For-Microsoft-Xbox-One-Controller/132845524127?hash=item1eee35d49f:g:IesAAOSwoDlb4EZj
        https://www.ebay.es/itm/2-Units-Handle-Vibration-Rumble-Motor-Motors-Replacement-For-PS3-Move-Controller/122490167409?hash=item1c84fba071:g:d68AAOSwcB5ZFDxl
        Very nice, you've been doing some good research too on the subject  ;D
        Yes my home made control circuit is very similar, however I've been using a n-channel mosfet (IRL540) because I've heard they work better for solenoids with the low current and voltage output of the Arduino. I also use stronger kickback diodes and additional resistors to protect everything.
        I'm not sure it would make a difference with this small low powered solenoid tho, my knowledge in electronic is far more limited than in programming.

        I would say it's worth trying your solution, with the cheap cost of those components.

        Using those small motors is a good idea, I might look into that too! Did you find the specs somewhere?
        I did a quick search but couldn't find any (Size, voltage, current)

        I attached a pic of the motherboard of the GCon2, after being stripped of all unsused components and with the Arduino wires soldered. I lost my paper where I wrote down which point is what, but pretty much the connector on the right contains the gun handle buttons (trigger, reload, d pad) and the common ground, while the other buttons can be taken from other points on the motherboard.
        « Last Edit: January 16, 2020, 11:43:40 am by JayBee »

        JayBee

        • Trade Count: (0)
        • Full Member
        • ***
        • Offline Offline
        • Posts: 330
        • Last login:Yesterday at 10:45:33 pm
        • If I can't buy it, I build it.
          • Github
        Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        « Reply #147 on: January 16, 2020, 11:42:58 am »
          Well I placed them as you see in the pictures I posted, they are around 10 mm off the border of the screen.
          As for the leds I do think these are perfect for the purpose, as it tracks them fine, but as I said, the scale is just wrong
          No you can't, but if you have it licensed you can prove ownership. If you do see the code.

          I do have an idea as to how to compensate for the offset.
          if you initialize serial, which will respond to numbers which could be percentage of screen width.
          With this offset you could just inset the mouse coordinates.

          I do know its not easy to program something like this. And still think your work is awesome, even though I can't hit a damned thing  ;D
          Are your TV and games 16/9 or 4/3?
          If it's 16/9 TV with 4/3 content, you have to switch the screen ratio mode by briefly pressing the calibration button once.
          If it's a 4/3 TV, press the button one more time.
          It should magically correct the ratio, no need to manually calibrate or anything ;)
          It's all written in the first post, but I understand that it's confusing.
          For the screen mode you can actually change them automatically  with mamehooker through serial commands, but I haven't finished the tutorial for that.

          For the border even if the led isn't directly on border of the screen, it should still work fine, minus a slight offset on borders that isn't really a problem for old games. And only 10mm should definitely not matter.

          Tell me if it fixes the issue, I will help you until we manage to make it work properly.

          Well its not a tv, which you would have known if you looked at the pics I uploaded earlier in the thread.
          the screen is actually 5:4 but that's pretty close to 4:3
          It definitely doesn't seem like the aspect ratio is the problem, but rather that 10mm offset.
          On the center of the screen the offset is not felt, but it feels like a gradiently increasing offset the further you get to either edge. Which to me seems logical.

          However I do understand why you'd think 10mm shouldn't matter that much, cause on a large tv, it's a small percentage of the screen size.
          But my screen is only 19"
          Which in 5:4 format is 38cm wide, with an offset of 10cm on either side, this becomes 40cm
          40/38 is 1.05 so therefor there is a 5 percent error on the edges of the screen. In this particular case. [/list]

          EDIT:
          As for mamehooker, i dont use mame at all, i find it running very poorly in retropie, and super confusing to set up properly due to some versions running some games better than others.
          Dude I did check your photo already, but 1. We can barely see anything in them, and 2. I used TV as a generic term, TV or simple screen doesn't matter on this system.

          What matters is the aspect ratio of the content vs the aspect ratio the screen.
          Since the mouse absolute position (or joystick axises in joystick mode) is relative to the content aspect ratio/resolution, but the aiming detection is relative to the aspect ratio detected with the 4 LEDs.
          So if your content isn't stretched fullscreen, my sketch won't be able to match aiming and cursor position.
          And the center is always in the center of the 4 LEDs no matter the screen or content.

          That's why I added a quick aspect ratio correction switch (with one calibration button push) to prevent this issue and still have accurate aiming without calibration, mainly for 4:3 contents displayed in 16:9 screens.

          Have you tried stretching your games fullscreen for test purpose?
          Send me pics or video of how it behaves in full screen mode.

          I've tested it with a 17" 4:3 screen with ~2cm border, and I had minimal offset on the sides.

          Mamehooker is a Windows app that works independently from Mame. But yes it won't work with retropie. And I agree libretro mame cores are bad, outdated, not optimized and have awful latency.

          I consider adding a forced calibration mode for anybody who has unusual screen ratio or larger borders. It might make it easier to fit any setup, but might also make it easier to mess things up if the calibration isn't done correctly.
          « Last Edit: January 16, 2020, 11:49:12 am by JayBee »

          janderclander14

          • Trade Count: (0)
          • Jr. Member
          • **
          • Offline Offline
          • Posts: 5
          • Last login:October 24, 2020, 07:42:58 pm
          • I want to build my own arcade controls!
          Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
          « Reply #148 on: January 16, 2020, 01:27:54 pm »
          Using those small motors is a good idea, I might look into that too! Did you find the specs somewhere?
          I did a quick search but couldn't find any (Size, voltage, current)

          I attached a pic of the motherboard of the GCon2, after being stripped of all unsused components and with the Arduino wires soldered. I lost my paper where I wrote down which point is what, but pretty much the connector on the right contains the gun handle buttons (trigger, reload, d pad) and the common ground, while the other buttons can be taken from other points on the motherboard.

          The specs of the xbox triggers rumble motors can be found here:

          https://www.ebay.es/itm/2pcs-Microsoft-gamepad-Vibration-motor-Large-vibration-DC3V-5V-N10-motor-DIY/323696171526?hash=item4b5dcb9a06:g:yJ4AAOSwMoZcZt9o

          For the PS3 move, I'm not completely sure, but it should be similar to this:

          https://es.aliexpress.com/item/4000220703114.html?spm=a2g0o.productlist.0.0.4bfd4029g7X6tW&algo_pvid=100564c0-dd1c-493b-8f1c-717f4b18bc93&algo_expid=100564c0-dd1c-493b-8f1c-717f4b18bc93-24&btsid=eaeca679-c85d-46de-b2c7-4bade2229f95&ws_ab_test=searchweb0_0,searchweb201602_9,searchweb201603_53

          In any case, knowing the maximum volume that can be fitted in the handle, it could be possible to find a suitable motor of the many third party ones available in ebay.

          And thanks for the photo of the guncon2! This saves a lot of work finding the pins to solder!
          « Last Edit: January 16, 2020, 01:29:25 pm by janderclander14 »

          JayBee

          • Trade Count: (0)
          • Full Member
          • ***
          • Offline Offline
          • Posts: 330
          • Last login:Yesterday at 10:45:33 pm
          • If I can't buy it, I build it.
            • Github
          Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
          « Reply #149 on: January 16, 2020, 10:12:45 pm »
          Using those small motors is a good idea, I might look into that too! Did you find the specs somewhere?
          I did a quick search but couldn't find any (Size, voltage, current)

          I attached a pic of the motherboard of the GCon2, after being stripped of all unsused components and with the Arduino wires soldered. I lost my paper where I wrote down which point is what, but pretty much the connector on the right contains the gun handle buttons (trigger, reload, d pad) and the common ground, while the other buttons can be taken from other points on the motherboard.

          The specs of the xbox triggers rumble motors can be found here:

          https://www.ebay.es/itm/2pcs-Microsoft-gamepad-Vibration-motor-Large-vibration-DC3V-5V-N10-motor-DIY/323696171526?hash=item4b5dcb9a06:g:yJ4AAOSwMoZcZt9o

          For the PS3 move, I'm not completely sure, but it should be similar to this:

          https://es.aliexpress.com/item/4000220703114.html?spm=a2g0o.productlist.0.0.4bfd4029g7X6tW&algo_pvid=100564c0-dd1c-493b-8f1c-717f4b18bc93&algo_expid=100564c0-dd1c-493b-8f1c-717f4b18bc93-24&btsid=eaeca679-c85d-46de-b2c7-4bade2229f95&ws_ab_test=searchweb0_0,searchweb201602_9,searchweb201603_53

          In any case, knowing the maximum volume that can be fitted in the handle, it could be possible to find a suitable motor of the many third party ones available in ebay.

          And thanks for the photo of the guncon2! This saves a lot of work finding the pins to solder!
          The main issue I had with non controller vibration motor is that even if they take only 3~5v, they aren't power efficient enough to work with the Arduino and require an extra power supply to even start (bought few different to test out).
          The available space range from "very few" on the GCon1 to "almost non existent" on the GCon2 :lol
          Joke aside I will try measuring that soon and tell you.
          And yeah I will definitely buy some of those controller motors to test them out and see if they fit inside  ;D

          kill_one

          • Trade Count: (0)
          • Full Member
          • ***
          • Offline Offline
          • Posts: 133
          • Last login:October 23, 2020, 06:18:53 pm
          • I want to build my own arcade controls!
          Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
          « Reply #150 on: January 17, 2020, 03:54:05 am »
          for led 940nm better 25 or 40 degrees?

          kill_one

          • Trade Count: (0)
          • Full Member
          • ***
          • Offline Offline
          • Posts: 133
          • Last login:October 23, 2020, 06:18:53 pm
          • I want to build my own arcade controls!
          Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
          « Reply #151 on: January 17, 2020, 04:25:27 am »
          Yes my home made control circuit is very similar, however I've been using a n-channel mosfet (IRL540) because I've heard they work better for solenoids with the low current and voltage output of the Arduino. I also use stronger kickback diodes and additional resistors to protect everything.


          @JayBee pending your tutorial on how to build it, you can make a list of the rest of the components needed to create your homemade circuit?
          thanks a lot :)

          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 #152 on: January 17, 2020, 11:49:27 am »
          Dude I did check your photo already, but 1. We can barely see anything in them, and 2. I used TV as a generic term, TV or simple screen doesn't matter on this system.

          What matters is the aspect ratio of the content vs the aspect ratio the screen.
          Since the mouse absolute position (or joystick axises in joystick mode) is relative to the content aspect ratio/resolution, but the aiming detection is relative to the aspect ratio detected with the 4 LEDs.
          So if your content isn't stretched fullscreen, my sketch won't be able to match aiming and cursor position.
          And the center is always in the center of the 4 LEDs no matter the screen or content.

          That's why I added a quick aspect ratio correction switch (with one calibration button push) to prevent this issue and still have accurate aiming without calibration, mainly for 4:3 contents displayed in 16:9 screens.

          Have you tried stretching your games fullscreen for test purpose?

          EDIT: As for forced calibration, the one from the 2 point sketch seemed to work perfectly fine, the only real problem i had with the 2 point sketch was that you'd have to be further away from the screen to aim at the opposite side of the screen, from the leds that is.
          Send me pics or video of how it behaves in full screen mode.

          I've tested it with a 17" 4:3 screen with ~2cm border, and I had minimal offset on the sides.

          Mamehooker is a Windows app that works independently from Mame. But yes it won't work with retropie. And I agree libretro mame cores are bad, outdated, not optimized and have awful latency.

          I consider adding a forced calibration mode for anybody who has unusual screen ratio or larger borders. It might make it easier to fit any setup, but might also make it easier to mess things up if the calibration isn't done correctly.

          Well sorry, it must have been misinterpreted, didnt mean any offense.
          As for the content, i tried with rescueshot for psx rendered in 1280x1024 ie. 5:4 in fullscreen.
          but to debug it i just tested it on the desktop of the machine so i could accurately tell what was wrong.
          I get that the mouse coordinates are defined in as absolute coordinates and that the center of the leds are always center of the coordinate system(therefor the individual axis is scaled according to the led position), except for the calibration offset, right?

          I'll get some pics/video taken shortly :D

          EDIT: I dont think forced calibration is a bad thing to have, i mean, what can it fook up?
          on the 2 point sketch, it worked perfectly, IMO the only thing that the 2 point did poorly was track beyond the cameras limits... durrh :D

          On these 4 pics i aim exacly at the border of the screen, as accurately as the ironsights on the gun allows for.


          « Last Edit: January 17, 2020, 01:10:24 pm by Mysli0210 »

          JayBee

          • Trade Count: (0)
          • Full Member
          • ***
          • Offline Offline
          • Posts: 330
          • Last login:Yesterday at 10:45:33 pm
          • If I can't buy it, I build it.
            • Github
          Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
          « Reply #153 on: January 17, 2020, 09:11:02 pm »
          Well sorry, it must have been misinterpreted, didnt mean any offense.
          As for the content, i tried with rescueshot for psx rendered in 1280x1024 ie. 5:4 in fullscreen.
          but to debug it i just tested it on the desktop of the machine so i could accurately tell what was wrong.
          I get that the mouse coordinates are defined in as absolute coordinates and that the center of the leds are always center of the coordinate system(therefor the individual axis is scaled according to the led position), except for the calibration offset, right?

          I'll get some pics/video taken shortly :D

          EDIT: I dont think forced calibration is a bad thing to have, i mean, what can it fook up?
          on the 2 point sketch, it worked perfectly, IMO the only thing that the 2 point did poorly was track beyond the cameras limits... durrh :D

          On these 4 pics i aim exacly at the border of the screen, as accurately as the ironsights on the gun allows for.
          Thanks for the pics! And very nice cab by the way  :applaud:
          There is indeed a weird offset between the led and the border, which clearly shouldn't be that high. Do you get to the borders when you aim for the LEDs instead?  :P

          Anyway, I will take some time today to try adding a calibration system.
          But I have one question;
          There are two ways of keeping the calibration data;
          Just save it in the RAM, meaning you have to calibrate every time you plug the gun, like with samco system, or save it in the ROM, meaning it will auto reload every time you plug the gun, the same way as the sensor calibration does. It also means that if you mess up the calibration it will be unusable until you redo it correctly.

          I was thinking of making the screen calibration optional, just after the sensor calibration. And resetting it to zero when you start the calibration then cancel it. What do you think?

          Edit: I updated the firmware with a new screen calibration option that might be useful for you, check the op ;)
          I also updated the post itself to make it cleaner.
          More to come soon.
          « Last Edit: January 18, 2020, 04:36:28 am by JayBee »

          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 #154 on: January 18, 2020, 10:39:46 am »
          Thanks, it has a few super neat secrets within, which you'll get pics of later  :)
          Yeah i get to border of the screen when I aim for the leds.

          Saving calibration to ROM don't seem like a bad idea, the only negative I can think of is ROM cell wear around 100-200K writes per byte. However I think you could justify getting another pro micro by then... Or we could make it use an external EEPROM via the i2c that the camera already uses and potentially the nunchuck.

          I'll check the new firmware out tonight  :D

          JayBee

          • Trade Count: (0)
          • Full Member
          • ***
          • Offline Offline
          • Posts: 330
          • Last login:Yesterday at 10:45:33 pm
          • If I can't buy it, I build it.
            • Github
          Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
          « Reply #155 on: January 18, 2020, 11:05:31 am »
          Thanks, it has a few super neat secrets within, which you'll get pics of later  :)
          Yeah i get to border of the screen when I aim for the leds.

          Saving calibration to ROM don't seem like a bad idea, the only negative I can think of is ROM cell wear around 100-200K writes per byte. However I think you could justify getting another pro micro by then... Or we could make it use an external EEPROM via the i2c that the camera already uses and potentially the nunchuck.

          I'll check the new firmware out tonight  :D
          Yeah the eeprom wearing out was one of my concerns for this sketch.
          But I reduced the writing on it only when you successfully do a calibration. I doubt you would do 100k calibrations with your guns  :laugh2:
          That's also why I made a function that allows to switch between 16:9 and 4:3 in 16:9 (with pillarboxes) with one button press, and doesn't write anything in the eeprom.
          Tell me if you need a firmware that is able to work with 4:3 content on 5:3 screen, it's super easy for me to do (just one value to change).
          « Last Edit: January 18, 2020, 11:07:59 am by JayBee »

          Foxhole

          • Trade Count: (0)
          • Full Member
          • ***
          • Offline Offline
          • Posts: 262
          • Last login:Yesterday at 05:38:39 pm
          • I want to build my own arcade controls!
          Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
          « Reply #156 on: January 18, 2020, 01:21:26 pm »
          This looks like a really awesome project, I'm definitely gonna build one.
          how close can you get to a 55 inch without sacrificing accuracy?
          « Last Edit: January 18, 2020, 05:43:11 pm by Foxhole »

          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 #157 on: January 18, 2020, 04:00:39 pm »
          Thanks, it has a few super neat secrets within, which you'll get pics of later  :)
          Yeah i get to border of the screen when I aim for the leds.

          Saving calibration to ROM don't seem like a bad idea, the only negative I can think of is ROM cell wear around 100-200K writes per byte. However I think you could justify getting another pro micro by then... Or we could make it use an external EEPROM via the i2c that the camera already uses and potentially the nunchuck.

          I'll check the new firmware out tonight  :D
          Yeah the eeprom wearing out was one of my concerns for this sketch.
          But I reduced the writing on it only when you successfully do a calibration. I doubt you would do 100k calibrations with your guns  :laugh2:
          That's also why I made a function that allows to switch between 16:9 and 4:3 in 16:9 (with pillarboxes) with one button press, and doesn't write anything in the eeprom.
          Tell me if you need a firmware that is able to work with 4:3 content on 5:3 screen, it's super easy for me to do (just one value to change).

          What you did just works!
          however i do have one annoyance :( the fact that it enumerates as a joystick fooks up my retroarch setup.
          Would it be too much trouble to make a version that only enumerates as a mouse?

          JayBee

          • Trade Count: (0)
          • Full Member
          • ***
          • Offline Offline
          • Posts: 330
          • Last login:Yesterday at 10:45:33 pm
          • If I can't buy it, I build it.
            • Github
          Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
          « Reply #158 on: January 18, 2020, 10:07:25 pm »
          What you did just works!
          however i do have one annoyance :( the fact that it enumerates as a joystick fooks up my retroarch setup.
          Would it be too much trouble to make a version that only enumerates as a mouse?
          Glad it worked! ;D
          I see, it makes sense since I have to initialize it even if not using it.
          Can you switch to joystick mode to test if it works better? Joystick mode has the same functionalities as mouse mode, but might be more compatible.
          It seems a bit difficult to delay the initialization of the joystick, so I will either have to do a special version with mouse only or find another way  :P
          « Last Edit: January 19, 2020, 12:24:38 am by JayBee »

          JayBee

          • Trade Count: (0)
          • Full Member
          • ***
          • Offline Offline
          • Posts: 330
          • Last login:Yesterday at 10:45:33 pm
          • If I can't buy it, I build it.
            • Github
          Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
          « Reply #159 on: January 18, 2020, 10:20:08 pm »
          This looks like a really awesome project, I'm definitely gonna build one.
          how close can you get to a 55 inch without sacrificing accuracy?
          That's a good question, I definitely have to take some time measuring it  ;D
          The only distance limit for the sketch right now is being able to capture the 4 leds on cam once when pointing the middle of the screen, because it needs to see the 4 leds at least once to auto calibrate it.
          Once calibrated, it can track the aiming down to 1 led (very less accuracy of course, but still works).
          It might change in the future, I am searching a way to implement a rougher calibration with 2 or 3 leds when impossible to see the 4 leds at once.