The NEW Build Your Own Arcade Controls

Main => Lightguns => Topic started by: JayBee on September 30, 2019, 01:25:12 pm

Title: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on September 30, 2019, 01:25:12 pm
Ultimate 4 IR points lightgun system
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.
It also has many other features, making it the most advanced IR light gun consumer solution.

If you like my projects and want to support me and help me maintain it, or just pay me a beer, you can find my Paypal and Patreon below :cheers:
(https://www.paypalobjects.com/en_US/FR/i/btn/btn_donateCC_LG.gif) (https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YMRLTJ6WBGX8G&source=url)
My patreon (https://www.patreon.com/bePatron?u=5316139)

First, a small obligatory disclaimer: like with any DIY project, I am not responsible of any damage you might do to your hardware/yourself. Be sure to read everything careful before using my firmware. I am not a professional in electronic. I am giving all the schematics and pics as example, use them at your own risks.
And of course, this firmware cannot be sold alone nor in a package/hardware, it is completely free. If some people sold it to you, they are scam.


Features:

Building the hardware:
- to avoid any issue, I would recommend to flash the arduino firmware first (see software installation guide), test the camera, and then if everything work, build the rest of the hardware.

Needed components for the gun:
(optional) Hardware for the solenoid recoil:
(optional) Hardware for the rumble feedback:
(optional) Hardware for RGB LED:
(optional) Extra hardware:
Here is the pins listing and their functions in the next table. (the schematics will come next)
Note that you don't have to connect everything, just connect whatever you have available for your gun.
IMPORTANT: The DFRobot IR Cam often have the sensor tilted, so you might have to tilt the camera on left or right to make it work properly. I would recommend you to install the camera first and test the aiming with the tool before doing anything else.

Connected device DPAD Firmware pin RGB LED Firmware pin Functionality Mouse/Keyboard button Gamepad button
Calibration button 19 (A1) 19 (A1) calibration and modes switching - -
Trigger button 20 (A2) 20 (A2) gun trigger Left mouse button Button 0
A button 21 (A3) 21 (A3) reload/cover Right mouse button button 1
B button 4 (A6) 4 (A6) extra button Middle mouse button button 2
Pedal button 6 (A7) 15 Pedal/GCon2 handle Right mouse button button 1
Select button 8 (A8) 8 (A8) GCon2 Select Keyboard 5 key button 3
Start button 9 (A9) 14 GCon2 Start Keyboard 1 key button 4
Down button 14 (MISO) not used GCon2 Down Keyboard Down arrow dpad Down
Up button 15 (SCLK) not used GCon2 Up Keyboard Up arrow dpad Up
Left button 16 (MOSI) not used GCon2 Left Keyboard Left arrow dpad Left
Right button 10 (A10) not used GCon2 Right Keyboard Right arrow dpad Right
RGB LED Red not used 6 (A7) RGB LED red pin - -
RGB LED Green not used 9 (A9) RGB LED green pin - -
RGB LED Blue not used 10 (A10) RGB LED red pin - -
Recoil solenoid output 7 7 Recoil trigger output pin - -
Rumble motor output 5 5 Rumble trigger output pin - -

The corresponding pins on the Pro Micro as reference:
(https://i.imgur.com/3wVcKiy.jpg)

Notes:

Here is a diagram of the feedback circuits I am using for the rumble and solenoid, as sample;
(https://i.imgur.com/bnRMMTe.jpg)
You can of course make your own or adapt it the way you want, as long as the Arduino rumble and solenoid pins are correctly connected.

Hardware for the led system:
If you're using something bigger than a computer screen, I recommend using 2 or 3 leds by point, with a slight angle between them, for a better angle without reducing the maximum distance.
I personally use 8 SID1K10CM (5MM 940NM 200mw/sr 1.3-1.5v 30°), because they are very powerful, but any led with similar specs will work. Just avoid the wide angle leds since they are not powerful enough to play from a distance more than 1.5m.

You can calculate the resistor needed and the power supply here:
http://led.linear1.org/led.wiz (http://led.linear1.org/led.wiz)
or here:
http://ledcalc.com/#calc (http://ledcalc.com/#calc)

As an example, here is the schematics and data of my circuits:
Those data are only good with the specific leds I am using, for different leds use the website above!
The +5V and GND are connect to a the VCC and GND of a USB plug.

(https://i.imgur.com/qk8G8QN.png)

And here how it looks once done:
(https://i.imgur.com/Dk7EzAw.jpg)(https://i.imgur.com/1FzINDC.jpg)

Place the LEDs at the exact center of each side (up, down, left, right), as close as the screen as possible, to have a good accuracy, like that:
(https://i.imgur.com/xTuZqDV.jpg)
It's a temporary installation with tape, I would recommend a better more stable one  :lol

Software Needed:
Installation:

Software installation process:

Firmware flashing process:

Warning: Very important, DO NOT flash any other arduino than the Atmega32u4 5v/16MHz with this firmware, or you might brick it. I repeat, DO NOT flash it on other arduino devices.
Read the following instructions carefully and make sure you understand everything before starting.
It is better to do the firmware flashing before closing your lightgun, just in case you need to access the "reset" pin.
You are warned ;)



MameHooker usage:
To use Mamehooker with this system, first follow those steps:
- In your Mame.ini file (in Mame folder), change "output" option to "windows";
Code: [Select]

#
# OSD OUTPUT OPTIONS
#
output                    windows

- Change the COM port of your gun 1 and 2 to be respectively COM1 and COM2 (you can do that in devices manager).
- Make sure Mamehooker is correctly configured for your system and detects the emulators you want to use (follow the instructions on its website).
- I will provide a zip file of my Mamehooker config files once I finished them, but meanwhile here is the command list:
 Each of those command have to be sent by serial to the arduino (Com write)
Commands that must be sent at game/mame start or stop:
 Start serial mode: S
 End serial mode: E
 Screen aspect ratio:   16/9: A0     4/3   in 16/9: A1    4/3: A2
 Joystick mode:    Mouse/KB: J0     Joystick: J1     Hybrid: J2
Ingame feedback trigger commands:
 Solenoid trigger:     on: s1    off: s0
 Rumble trigger:     on: r1    off: r0

Usage:
- Aiming: after plugging in your lightgun, simply aim the screen (anywhere on the screen, as long as the IR cam see the 4 LEDs at the same time at least once), you should see your cursor starting to follow your motion right away (if nothing happens, there might be something wrong with your LEDs, check them with your phone digital cam if you can see them bright enough from where you are aiming).
- IR cam calibration: On the first use, your aim might be off centered. It is normal, each camera sensor has a slight offset. To correct this offset, hold the calibration button until the cursor jumps to the center of the screen, release it, carefully aim for the cursor, and press the trigger, then press the calibration button briefly to quit the calibration mode. Your sensor should now be calibrated, and since it's saved to the Arduino EEPROM, you won't have to do it ever again, even when changing your screen setup.
- Manual screen calibration there is now a way to force the screen calibration (if your leds are not right next to the screen, or if your screen or contents are not the standard 16/9 or 4/3). Instead of pressing the calibration button after the sensor calibration, aim the upper left screen corner, press the trigger once, aim the lower right screen corner, press the trigger once more. It should now automatically exit calibration mode. The calibration data is saved to the arduino, and will stay at each reboot. To reset the calibration to default just reenter the calibration mode and quit the mode right away.
- Aim tracking: once your lightgun is working, it should now follow your aim as long as it sees at least one LED on camera (or 2 LEDs if you aimed out of the LEDs range, to get "back on track"). It means you have a huge range of motion offscreen, the cursor will follow your aiming in the borders of the screen.
- Offscreen shooting: if you shoot offscreen, it will trigger the A button (Right mouse click) instead of the trigger, useful for games that need offscreen shoot to reload.
- Button combo mode changing: there are different modes you can change with buttons combo, you must first hold one of the following buttons and press the calibration button briefly for some to switch mode. If you have a rumble motor, it will rumble briefly to tell you which mode it activated.
IR camera testing tool:
You can get this tool in the attached file.

The install and use process is simple:
Inside the gray screen, the detected IR leds should be displayed, with this color code:
Unrecognized IR point = Black
Left IR point = Red
Top IR point = Green
Bottom IR point = Blue
Right IR point = Purple
Calculated center point = White
The duplicated and slightly grayish points are the same but with the tilt correction, they are showed to check if everything is working correctly.

It's very convenient to see when the points are misdetected, you will have wrong point colors, wrong corrected points, or an incorrect center point.

Troubleshooting:

Problem: The aim is not working at all, even on windows desktop.
Solution: Is something happening when pushing the buttons? If yes, it means the camera can't see your LEDs correctly. You might want to check them. If not, it means you are either in the wrong mouse/joystick mode, or there is a connection problem with your Arduino.

Problem: The aim is suddenly messed up (still moving but not in the right way).
Solution: It means either the gun is tilted too much or the camera has trouble seeing the LEDs. When it happens, check if your gun is not tilted, aim outside of the LEDs range and aim back at the screen. It should go back to normal.
If it doesn't come back to normal, or happens too often, you might want to check your LEDs, your camera orientation, and check if you are not in the wrong screen aspect mode.

Problem: The aim is working in the center of the screen, but on the sides it's not aiming properly.
Solution: You are not in the right screen aspect mode.

Updates history:

* 2020/02/28 - 1.85 major update, please read the changelog carefully before updating!

- rewrote the whole flashing and config tool, now a lot more user friendly!
- made a double timing test to be able to flash any arduino. No need to modify the bat file anymore.
- various optimizations
- IR points detection bug corrected, it should be a bit more stable now
- reworked the buttons management
- merged normal and test firmware, now the test tool should trigger the test mode (replug the arduino once to reboot in normal mode)

- added RGB LED support for the 7 button + LED firmware! If your gun uses more than 7 buttons or if you don't want LED support please use the 11 buttons firmware
- added temperature sensor support! connect a tmp36 sensor to pin A0
- added rumble and LED feedbacks when changing modes
- added various LED feedbacks
- added EEPROM save and load gun data

- updated the game screen ratio modes for better usage and compatibility, now there are only 2; fullscreen and 4:3. Obviously changing this option will have no effect if you have a 4:3 screen.
- updated the test tool, now the one pde tool supports both normal and full screen, and has more options (don't use the old tools)

* 2020/02/18 - 1.76
- reworked the buttons management again and fixed the remaining issues (with the calibration for instance)
- fixed the bug with the feedback when offscreen reload is disabled, now it should trigger the solenoid (the way it works remain unchanged when offscreen reload is enabled)
- modified the flashing batch file to be more compatible (detects bootloader whatever the model, and waits for 6 seconds now)
- rewrote part of the guide, added installation instructions

* 2020/02/16 - 1.75
- fixed the combo buttons functions (joystick mode, offscreen shot...)
- reworked the buttons management to decrease risks of bugs and future-proof it
- did a lot of small optimization to increase the execution speed.
- changed the zip file, firmware name and flash bat again, now you can know which firmware you have, and choose between normal and test firmware. Please don't mix with the previous files.

* 2020/02/15 - 1.70
- restored the cursor accuracy without increasing the load, it should eliminate most wobbles
- put everything in only one zip and renamed the batches file for more clarity.
- added diagrams for the gun feedbacks

* 2020/02/13
- added the fullscreen IR testing tool

* 2020/02/12 - 1.68
- Improved the 2 points detection and optimized the other functions
- updated the .pde sketch for IR testing, now it can be edited easily to fit any setup/resolution/com port

* 2020/02/12 - 1.66
- fixed some bugs and re implemented the 2 points detection

* 2020/02/11 - IR cam testing tool
- I uploaded the Processing sketch for testing the IR points, and the firmware that works with it.

* 2020/02/09 - 1.55 beta
- Rewrote a big part of the aiming calculation, it should be far more stable.
- Added a better tilt/twist detection, now the gun should still work fine when tilting it, it increases the maximum tilt to 89 degrees on each side.
- Added a function to disable the press of secondary button when shooting offscreen.
  + You can disable it by holding trigger button and pressing the calibration button briefly.
  + Enable it back the same way.
  + For now this parameter isn't saved in the EEPROM, it will reset on power cycle.

* 2020/01/19 - 1.35
- slightly improved the led detection code and the calculation, now the twist is a bit better.

* 2020/01/18 - 1.3
- cleaned some code and added the option for screen calibration.

* 2019/10/26 - 1.2
- first public version



Special credits:
Samuel Ballantyne (SAMCO), who started the idea of doing a DIY arduino lightgun with the DFRobots camera (https://github.com/samuelballantyne (https://github.com/samuelballantyne))
DFRobot, for their camera and libraries (https://github.com/DFRobot/DFRobotIRPosition (https://github.com/DFRobot/DFRobotIRPosition))
Jonathan Edgecome, for his absmouse library (https://github.com/jonathanedgecombe/absmouse (https://github.com/jonathanedgecombe/absmouse))
Matthew Heironimus, for his Joystick library (https://github.com/MHeironimus/ArduinoJoystickLibrary (https://github.com/MHeironimus/ArduinoJoystickLibrary))
Toni Spets, for his great ideas on 4 leds detection system (https://github.com/hifi (https://github.com/hifi))
Howard Casto, for his Mamerhooker program and his help on making it work with this system (http://dragonking.arcadecontrols.com (http://dragonking.arcadecontrols.com))
PL1 for his Pro Micro diagram
Foxhole for his support and careful testing
And everyone else in the forum for supporting this project and keeping the arcade love alive  :cheers:
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Ginsonic on October 01, 2019, 03:16:32 am
Great work JayBee, looking forward to more details  :applaud:
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: ryoken on October 01, 2019, 03:41:38 am
Very impresive... nice for sharing
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Titchgamer on October 01, 2019, 04:36:52 am
Cool :)
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: samco on October 02, 2019, 05:57:54 am
Nice work JayBee, can't wait to check out your code.

I was wondering is the reason you mentioned you have to stand in front of the screen to fie because of the tight angle of the leds? Just because I've looked around and found some wide angle leds on AliExpress https://www.aliexpress.com/item/32491780864.html?spm=a2g0s.9042311.0.0.41bf4c4dNxe3jj they don't have UV coating on them so wouldn't suggest for everyday unless you want to mount them behind a UV filter (or even better eventually find some that already have it like the Adafruit ones). But these increase the viewing angle massively.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on October 02, 2019, 06:55:22 am
Nice work JayBee, can't wait to check out your code.

I was wondering is the reason you mentioned you have to stand in front of the screen to fie because of the tight angle of the leds? Just because I've looked around and found some wide angle leds on AliExpress https://www.aliexpress.com/item/32491780864.html?spm=a2g0s.9042311.0.0.41bf4c4dNxe3jj they don't have UV coating on them so wouldn't suggest for everyday unless you want to mount them behind a UV filter (or even better eventually find some that already have it like the Adafruit ones). But these increase the viewing angle massively.
Actually this time I'm not sure I will share the source code yet, for ease of use, update and prevent any problem.
Instead I was thinking of providing two things: a sketch that will write to the Arduino EEPROM all your custom settings you need, like pin numbers, screen res and all, and bin files, one for each Arduino type. Like this you just need save your settings once, no need to modify the sketch again every time I update it  :)

Yes, I mentioned at the same time for led angle, and because the system doesn't work that well if you are too much up or down (works fine from left and right).
I actually bought 200mW/Sr LEDs with 30degrees angle, they work quite nicely so far, but don't have UV filter or coating. What's the risks without UV filter? I have a limited knowledge on the matter.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: samco on October 02, 2019, 08:44:53 am
Sweet, sounds good man.

Unfortunately I don't know too much about UV filters either apart from a few Google searches. Mainly just didn't want to suggest a solution that was potentially unsafe which seems to be the general consensus from the little research I've done.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on October 03, 2019, 01:31:52 pm
Quick news, now the code is fully functional and very stable for full use. More infos, videos and code coming soon, stay tuned  ;)
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: SammyWI on October 03, 2019, 03:03:04 pm
Very cool.  Great to see more options coming out.  :applaud:
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: lllll44 on October 12, 2019, 04:38:22 pm
cant wait to hear more! amazing.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on October 14, 2019, 01:49:26 pm
Good news, thanks to Howard_Casto and his Mamehooker software, I was able implement mame output with my lightgun. I can send recoil, rumble and led control and parameters directly to the guns for each game independently.
For the games/emulators that support output, the solenoid, rumble motor or led that you have installed in your gun will react like in the real arcade machine.
It will also be very easy to customize.
And since it's switching the games automatically, for games that don't support output, the recoil, rumble and led will go back to be controlled by the Arduino.

This is very close to complete!
Next, I will add a way of checking the solenoid temperature with a small chipset, to modify its speed of actuation if getting too hot, and avoid frying it.
It could also allow you to continue to fire in full auto but with reduced speed as long as the solenoid is hot.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Ginsonic on October 15, 2019, 04:34:16 am
Good news, thanks to Howard_Casto and his Mamehooker software, I was able implement mame output with my lightgun. I can send recoil, rumble and led control and parameters directly to the guns for each game independently.
For the games/emulators that support output, the solenoid, rumble motor or led that you have installed in your gun will react like in the real arcade machine.
It will also be very easy to customize.
And since it's switching the games automatically, for games that don't support output, the recoil, rumble and led will go back to be controlled by the Arduino.

This is very close to complete!
Next, I will add a way of checking the solenoid temperature with a small chipset, to modify its speed of actuation if getting too hot, and avoid frying it.
It could also allow you to continue to fire in full auto but with reduced speed as long as the solenoid is hot.
:applaud: :applaud: :applaud:
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Howard_Casto on October 15, 2019, 01:59:44 pm
You got it done before I even had a chance to sit down and work on it.   :afro:

What type of interface did you use?

One thing I would suggest would be to add a pulse mode to your code.....  99% of the mame and model 2 library pulse the output for you with games like terminator 2, ect., but If I remember correctly Operation Wolf just has a steady on when the gun is firing.  It has to do with the mechanical operation of the guns... (op wolf and a couple others use a motor spinning a piston instead of a solenoid).  I have the outputs mapped for the model 2 emulator and some of the pc/techno parrot stuff as well, but I haven't released an updated troubleshooter 2 yet. 
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on October 16, 2019, 02:11:07 am
You got it done before I even had a chance to sit down and work on it.   :afro:

What type of interface did you use?

One thing I would suggest would be to add a pulse mode to your code.....  99% of the mame and model 2 library pulse the output for you with games like terminator 2, ect., but If I remember correctly Operation Wolf just has a steady on when the gun is firing.  It has to do with the mechanical operation of the guns... (op wolf and a couple others use a motor spinning a piston instead of a solenoid).  I have the outputs mapped for the model 2 emulator and some of the pc/techno parrot stuff as well, but I haven't released an updated troubleshooter 2 yet.
It wasn't so hard, your tool makes things so much more simple :cheers:

I'm using your serial write command to send combinations of characters and numbers, and read the serial buffer in the arduino. I'm really happy with the way it works, reading the serial buffer is very fast and doesn't add much latency to the overall execution.
Plus I am also sending special commands to completely control the behavior of the gun, meaning I won't have to change any settings manually anymore.

For the pulse mode, I already have one (king of) in my arduino code, it automatically starts full auto mode when holding the trigger button. I can also trigger it with a serial command, so it should be easy :D

The only issue I have is with games that have a variable speed pulsed command like terminator 2.
In my arduino code, I read the serial buffer every 3~5ms, and I also rely on specific timing for the solenoid holding and the minimum pause between each trigger (to avoid it to overheat). So the code detects the pulse command within 3~5ms, and then triggers the solenoid only if it's ready to be triggered. It means the game pulse and the solenoid pulse are getting totally out of sync.
Still scratching my head trying to find an elegant solution for that  ???

Yeah I didn't test the m2emulator outputs yet, but I will sure do it, would love some good Virtua Cop with accurate recoil!
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Howard_Casto on October 16, 2019, 07:57:13 pm
Honestly getting m2emulator ready to run with mamehooker is a giant pain in the butt, mostly because I'm getting it to do something it isn't supposed to do.  I'm working on it though. 

Yeah getting the pulse synced up is an issue.  Wait commands can be used to hold the solenoid open a bit longer so things can be slowed down somewhat, but that's about it.  I guess finding a solenoid that fires at the same rate as some of the positional guns would be the ideal solution, but I don't know how hard that would be. 
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra on October 18, 2019, 11:06:48 am
I can send you the Arcade Guns Aimforce dongle software to look at if it would be helpful?

It looks like they borrowed some of your work with mame hooker and added their own front end with some additional options. It essentially allows you to set up recoil for each game individually including the type of recoil (auto or semi) and the speed of recoil. It works with any gun game including Model 2 and 3. Plus, it also has a hooker option to take instructions from the game like mame hooker, and space to add your own code.

Changing the speed of a solenoid should just be a case of changing the frequency. I do it manually with a pot on my ne555 board. I use the 0-50hz jumper and then turn the pot until I get roughly 6-10 activations per second. I assume this would be possible to set any solenoid to the right speed for the game in software with the right know how.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on October 18, 2019, 11:17:59 am
Honestly getting m2emulator ready to run with mamehooker is a giant pain in the butt, mostly because I'm getting it to do something it isn't supposed to do.  I'm working on it though. 

Yeah getting the pulse synced up is an issue.  Wait commands can be used to hold the solenoid open a bit longer so things can be slowed down somewhat, but that's about it.  I guess finding a solenoid that fires at the same rate as some of the positional guns would be the ideal solution, but I don't know how hard that would be.
Yeah I guess it has to be very hacky to get support in m2, like memory read and stuff? looks like a huge headache to make that work  :-\

By the way, in Mamehooker if I use the mamestart in a game ini file, it's overwriting the default ini mamestart, right?
Is it possible, in some way, to no overwrite it but execute both in order? (default mamestart => game mamestart => playing game => game mamestop => default mamestop)
With my setup pretty much all lightgun games will need to open/close the serial connection, and send the default parameters commonly used by mame (used screen aspect ratio for instance), then some games have specific parameters I need to send (recoil/rumble mode).
I can of course copy paste the commands one by one for each games, but I wanted to ask you in case you have a better way of doing it.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on October 18, 2019, 11:35:23 am
I can send you the Arcade Guns Aimforce dongle software to look at if it would be helpful?

It looks like they borrowed some of your work with mame hooker and added their own front end with some additional options. It essentially allows you to set up recoil for each game individually including the type of recoil (auto or semi) and the speed of recoil. It works with any gun game including Model 2 and 3. Plus, it also has a hooker option to take instructions from the game like mame hooker, and space to add your own code.

Changing the speed of a solenoid should just be a case of changing the frequency. I do it manually with a pot on my ne555 board. I use the 0-50hz jumper and then turn the pot until I get roughly 6-10 activations per second. I assume this would be possible to set any solenoid to the right speed for the game in software with the right know how.
It is technically possible to activate the solenoid at the right frequency with Mamehooker and my arduino code, with a 3-5ms precision, but unless we have the matching solenoid for each game, the activation/hold/release/pause timings will not match my solenoid, and won't work or make it overheat. It's not really an issue with games without variable speed full auto, where speed of solenoid activation doesn't matter so much.
For instance games like terminator 2 have a recoil working clearly way faster than any of our solenoids can handle, so it gets out of sync when its speed is changing (gun overload and all).
Right now, I am actually building a rumble system beside the solenoid that I want to use instead of recoil in those games, it won't feel the same but will sure work better and more in sync.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra on October 18, 2019, 01:27:01 pm
I think there's two different issues. One is obviously choosing a solenoid that is rated for continuous duty and that can handle full auto recoil. That has to be done no matter what. I have rescued and repurposed a lot of arcade guns and any that used full auto recoil via a solenoid in the original coin-op will generally work fine with other games, even if other games had faster recoil.

The second issue is setting the recoil speed for each game. Now, it's true that there are differences between solenoids because the length of piston and range of travel varies. As does the force of the return spring. Also, a lot of full auto only arcade guns use a recoil motor instead of a solenoid. This doesn't mean you can't use one solenoid for multiple games. It just means you can't switch solenoids without redoing the speed settings.

With software that allows you to adjust recoil speed for each game (like the Aimforce software), you can simply find one gun with a decent full auto solenoid and set each game to your liking. Or, with mame hooker, you can use the original games frequency. But...Unless you had direct knowledge of the original recoil speed for each game, I doubt you'd get it exact. But, it wouldn't be far off as most of my arcade solenoids have around 10mm of travel. For games that used a solenoid, I doubt most people could perceive a difference between 10 activations per second and 12.

It's also worth noting that one T2 cab (for example) would vary in recoil speed to another, just based on the age of the solenoid and how recently they oiled the piston. The difference is huge immediately after you add a little oil. So the original speed we remember may not be exact either. Most Time Crisis guns I have used in the wild have really slow and anemic recoil due to poor maintenance. My TC arcade gun recoil is a beast.

Personally, I think it's more trouble than it's worth to worry about making the recoil speed exact. The amount of enjoyment it adds is minimal compared to the headache. I think it's more important to make the full auto recoil speed feel convincing to me than it is to make match an original speed.

I set mine up to recoil once when I pull the trigger and full auto when I hold it down. This works well for 99% of the gun games I ever played. The only one it doesn't work so well on (so far) is Alien 3 the gun, as I get full auto recoil even when I have the flame thrower...

https://www.youtube.com/watch?v=DatfpMFmIcc

Perhaps the bigger issue for me is that I prefer to use the PS2 for light gun games, so none of the current software solutions are compatible. The Arcade Guns guys said they were working on a recoil box that would offer Aimforce-like recoil control for any console, computer or PCB. I haven't seen it yet though. I might invest in something like that as the PS2 is unmatched for this genre. Kickstarter anyone?
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Howard_Casto on October 18, 2019, 01:36:38 pm
Well the main reason for recoil is to make the player aware of the gun's status, as gun games and be frantic and an excitable player might not notice that they are out of ammo, or the gun has over heated, ect.  So long as "firing", "overheat", "empty" and possibly "special" are distinguishable from each other, it should be close enough. 
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra on October 18, 2019, 06:00:11 pm
It's definitely nice if a gun behaves just like the coin-op but, for me, recoil makes it feel more realistic and fun. It's still worth it even if it doesn't stop recoiling when you run out of ammo. The gun just feels dead without it.

Not that many games let you run out of ammo. It's technically possible in games like Op Thunderbolt and Op Wolf but only if you don't shoot the falling ammo. The ones that make you reload by shooting off-screen usually shout "reload, reload" at you, and I usually reload before that out of habit. I always notice. Most people play these games at home with no recoil at all so keeping an eye on your ammo is just part of the game. The potential for overheating is a real issue though. I've seen it happen.

Some solenoids can get hot enough to melt the gun plastic. It's one of the reasons why I prefer to use guns with a recoil motor for full auto only games. Games like Crisis Zone on the PS2 require long periods of continuous full auto fire to dispense end of level bosses. It's more relaxing if I'm not worried about the solenoid.

I could never get the over heating warning working right in the Aimforce software. These guns don't have heat sensors so you can never rely on it anyway, so I gave up on it. It kinda seemed like it needed setting up for each game and I lacked any meaningful data to do it right. One thing I would say though, my full auto arcade guns rarely over-heat if set up right. The one I had issues with was my Aimtrak solenoid. It's really not suitable for full auto.


Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on October 18, 2019, 10:45:48 pm
Actually the temperature sensors I ordered for my lightguns are on the way, it will be very easy to add solenoid speed variation depending on the temp. It should make it a lot safer to use.
For the speed variation and timing, I can already change them for each games, have auto full auto and things like that, that's not an issue.
Not matching the game speed is not an issue either.

As I was saying, the only issue is with games that have solenoid speed variation.
In T2, the game recoil full auto is supposed to start at full speed, then the longer you will hold it the more it will slow down.
But since my solenoid is out of sync, the faster speed is kind of slow, then suddenly become faster at lower speed, when the game recoil speed gets around the same speed as my solenoid. So far it's pretty much the only game where I had this issue.
That's why I want to use rumble motors, that don't have this timing issue.
The second solution I was thinking about is sending a special command to my Arduino to tell it to measure the timing between each activation/deactivation, and change the solenoid full auto speed accordingly.
It's not that hard to do, I just need some time, and it should cover every game that behaves like that.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra on October 19, 2019, 01:44:03 pm
OK I understand the issue now. T2 doesn't just change recoil speed for heat control though. It changes for different guns you pick up along the way too. A number of arcade games do this. I noticed it on the Jurassic Park (Raw Thrills version) too. It would be awesome to be able to replicate that feature. Recoil should pick up the pace if you grab a gatling gun in-game.... Have you managed to make this work?

I haven't seen any arcade guns that have a heat sensor inside. I'd be interested to hear how you'd make the game change recoil speed based on the output from the heat sensor. I'm not sure how much difference it will make in practice though.

My experience has been that full auto arcade recoil gun solenoids don't dangerously overheat, even after a long play session. That is, assuming they are set up right. They are made to take a hammering all day every day so typical home play doesn't really tax them. I spent over two hours playing Time Crisis 3 and Crisis Zone yesterday and my Time Crisis arcade gun solenoid was barely warm. It's the same with my Op Thunderbolt and Gen X guns (if I keep the pistons oiled).

If a solenoid is getting dangerously hot during regular play then I'd assume it was either the wrong type of solenoid or it was set up wrong (too much power or a duty cycle that's too high). Either way, I'd want to stop using it all together and let it cool down properly instead of reducing the frequency. When I tested my Aimtrak solenoid with full auto, after three minutes of play, it got hot enough to burn my fingers and melt the surrounding wires. This was using the same 555 circuit (with the same frequency) as I use for my arcade gun solenoids. It taught me an expensive lesson.

It's important to know if you have a momentary or continuous duty solenoid. Momentary solenoids (like the one in the Aimtrak) usually pack more force but require cool down time between activations and shouldn't stay activated for more than a second or two. Continuous duty solenoids are designed to say activated for longer periods of time (without burning up the coil). They usually pack less force but they generate less heat and are more suitable for full auto.

Have you experienced over-heating issues with full auto arcade gun solenoids? If so, I'd be interested to hear which guns had issues and what frequency you used?

Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on October 19, 2019, 03:05:16 pm
OK I understand the issue now. T2 doesn't just change recoil speed for heat control though. It changes for different guns you pick up along the way too. A number of arcade games do this. I noticed it on the Jurassic Park (Raw Thrills version) too. It would be awesome to be able to replicate that feature. Recoil should pick up the pace if you grab a gatling gun in-game.... Have you managed to make this work?

I haven't seen any arcade guns that have a heat sensor inside. I'd be interested to hear how you'd make the game change recoil speed based on the output from the heat sensor. I'm not sure how much difference it will make in practice though.

My experience has been that full auto arcade recoil gun solenoids don't dangerously overheat, even after a long play session. That is, assuming they are set up right. They are made to take a hammering all day every day so typical home play doesn't really tax them. I spent over two hours playing Time Crisis 3 and Crisis Zone yesterday and my Time Crisis arcade gun solenoid was barely warm. It's the same with my Op Thunderbolt and Gen X guns (if I keep the pistons oiled).

If a solenoid is getting dangerously hot during regular play then I'd assume it was either the wrong type of solenoid or it was set up wrong (too much power or a duty cycle that's too high). Either way, I'd want to stop using it all together and let it cool down properly instead of reducing the frequency. When I tested my Aimtrak solenoid with full auto, after three minutes of play, it got hot enough to burn my fingers and melt the surrounding wires. This was using the same 555 circuit (with the same frequency) as I use for my arcade gun solenoids. It taught me an expensive lesson.

It's important to know if you have a momentary or continuous duty solenoid. Momentary solenoids (like the one in the Aimtrak) usually pack more force but require cool down time between activations and shouldn't stay activated for more than a second or two. Continuous duty solenoids are designed to say activated for longer periods of time (without burning up the coil). They usually pack less force but they generate less heat and are more suitable for full auto.

Have you experienced over-heating issues with full auto arcade gun solenoids? If so, I'd be interested to hear which guns had issues and what frequency you used?
I'm not using arcade fun solenoids, just the cheap one with enough strength that fits in the gun. I know what you are going to say, but I'm very happy with those  ;)
They overheat only after something like non stop 15-20 minutes of full auto, and one (the bigger one) is heating way more than the other.
I couldn't find any affordable not quality continuous duty solenoid. But if you know places where I can get some, it would be very usefull.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra on October 19, 2019, 10:30:02 pm
The only affordable quality recoil solenoid I know of is the one for Terminator Salvation arcade guns. There aren't many arcade companies left these days but Raw Thrills parts are generally far more reasonable than Namco and Sega parts. They can be found for a little over $30. If a person can't afford $30, my suggestion would be to not spend anything on gaming peripherals at all until they can.

The other cheap option, and probably the one I would recommend for a project, is a used PS1 jolt gun. They have a decent full auto solenoid and you benefit from also getting a shell designed to fit it. It saves a lot of time and wasted cash.

The issue with cheap solenoids over-heating isn't just that they get hot. If you can feel a noticeable amount of heat building up in a properly lubed solenoid, it's because you are burning up the coil. In other words, it won't last long. I destroyed a bunch of "cheap" solenoids before I realized that it was cheaper to just buy one that was suitable for the job. Ultimately, you want to be able to play without worrying about this stuff, or it's not fun.

I spent a good amount of time searching for decent continuous duty pull solenoids on ebay a while ago. They can be found but the saving over the Raw Thrills solenoids is usually too small to matter.

I can't honestly criticize what you are trying to do with the cheap eBay solenoids as I tried to do the same and for the same reasons. I'm almost 100% sure that you'll eventually come to the same conclusion though.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on October 20, 2019, 05:48:52 am
The only affordable quality recoil solenoid I know of is the one for Terminator Salvation arcade guns. There aren't many arcade companies left these days but Raw Thrills parts are generally far more reasonable than Namco and Sega parts. They can be found for a little over $30. If a person can't afford $30, my suggestion would be to not spend anything on gaming peripherals at all until they can.

The other cheap option, and probably the one I would recommend for a project, is a used PS1 jolt gun. They have a decent full auto solenoid and you benefit from also getting a shell designed to fit it. It saves a lot of time and wasted cash.

The issue with cheap solenoids over-heating isn't just that they get hot. If you can feel a noticeable amount of heat building up in a properly lubed solenoid, it's because you are burning up the coil. In other words, it won't last long. I destroyed a bunch of "cheap" solenoids before I realized that it was cheaper to just buy one that was suitable for the job. Ultimately, you want to be able to play without worrying about this stuff, or it's not fun.

I spent a good amount of time searching for decent continuous duty pull solenoids on ebay a while ago. They can be found but the saving over the Raw Thrills solenoids is usually too small to matter.

I can't honestly criticize what you are trying to do with the cheap eBay solenoids as I tried to do the same and for the same reasons. I'm almost 100% sure that you'll eventually come to the same conclusion though.
As I already told you, none of the options you suggest are available here in Japan where I live.
Plus, a good gun solenoid will also require a proper gun shell, so it will increase the price way more no matter what.
I calculated the price I would have to pay to make a proper gun with a proper recoil, it would cost me at least 200$~400$, everything included.
My guns cost me a bit more than 60$ each in total, and they are only for casual use.

Your comparison is like saying to someone who only use his car once a month for short travel "you should buy this very expensive sport car, it will be more comfortable". Of course it would be more comfortable, but that's not the point.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra on October 20, 2019, 04:31:44 pm
It's more like saying "regardless if you plan to use the car once per month or every day, you should get one with brakes that work". And, "if you can't afford a car with working brakes, it's better to get nothing at all".

I don't live in Japan or know the market there but I don't believe that it's not possible to buy a continuous duty solenoid. Especially as some of the solenoid brands I've seen are Japanese companies. Plus, there is a bunch of low cost arcade parts sellers that are based in Asia and ship internationally. And, there are plenty of ebay sellers who ship internationally. I order stuff from Japanese sellers all the time. I'm sure that if you kept an eye on ebay, you'll find a jolt gun from a seller who'll ship to Japan.

Also, Namco, a Japanese company, sell new Time Crisis 4 gun shells and recoil solenoids for $120 in America. I'm sure they will have a parts distributor for their home market and that it wouldn't be significantly more expensive which means, if you know where to look, there will be used parts selling for less.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on October 20, 2019, 05:46:10 pm
It's more like saying "regardless if you plan to use the car once per month or every day, you should get one with brakes that work". And, "if you can't afford a car with working brakes, it's better to get nothing at all".

I don't live in Japan or know the market there but I don't believe that it's not possible to buy a continuous duty solenoid. Especially as some of the solenoid brands I've seen are Japanese companies. Plus, there is a bunch of low cost arcade parts sellers that are based in Asia and ship internationally. And, there are plenty of ebay sellers who ship internationally. I order stuff from Japanese sellers all the time. I'm sure that if you kept an eye on ebay, you'll find a jolt gun from a seller who'll ship to Japan.

Also, Namco, a Japanese company, sell new Time Crisis 4 gun shells and recoil solenoids for $120 in America. I'm sure they will have a parts distributor for their home market and that it wouldn't be significantly more expensive which means, if you know where to look, there will be used parts selling for less.
The jolt gun I found + sending fees was more than 100$ in total.
Arcade parts here are actually more expensive and hard to come by than outside of Japan, thanks to the high demand of arcade centers that are everywhere here, that would pay any price to get their parts.
Plus none of those gun part shop is open to the public, only people with an arcade company can order. They are protective of their market and tech.
So getting official part would be very expensive for me AND extremely troublesome.
But if you can show me some model of continius duty solenoid you think are good and than can fit in my guns, I will gladly take a look at it.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on October 26, 2019, 10:07:08 am
* 2019/10/26 - 1.2
- first public version

It's here guys!
Feel free to test it and give me your feedbacks ;)
A lot of schematics and pictures are still missing, I will add them later.
Title: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: lightgungamer on October 26, 2019, 12:51:16 pm
This looks great. Can’t wait to get it built and try it out.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on October 26, 2019, 01:35:37 pm
This looks great. Can’t wait to get it built and try it out.
Yeah, I should be adding schematics and pictures of everything tomorrow ;)
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Mysli0210 on October 28, 2019, 06:36:31 pm
Thanks, @JayBee @Samco @Hifi and all others involved, you're awesome!
After retrofitting my old trusty sluh-00017 Konami Justifier with the JayBee 2 point software, i stumbled upon Hifi's software and actually started to make the same.
but now i found this, so i guess its not needed anymore.
Though i tried to implement the ir led offset from the screen, to make it 100% accurate.

If this is needed i do not know, as im currently waiting for a package of 100 940nm leds from china.
For those interested in the link:
https://www.aliexpress.com/item/32755919314.html?spm=a2g0s.9042311.0.0.21694c4dLn44LN (https://www.aliexpress.com/item/32755919314.html?spm=a2g0s.9042311.0.0.21694c4dLn44LN)

As for the gun itself, i didnt use the DFRobot IR positioning camera.
But rather the IR camera from a wiimote, which i found out you can actually take out of the metal/plastic housing, so you dont even need to desolder it from the wiimote, just pry it out of the holder, and you have 8 solderpads on the rear.
(I will provide pics for the next gun, i'm planning to build)
The reason for taking that route is that i thought that the DFRobot camera was pretty pricey, and i actually had a wiimote at my disposal.
The rest of the components was/is accessible free of charge at the local hackerspace in which i'm a member. (except for a 3.3v switchmode regulator that cost about 0.43$ incl. shipping)

If anyone is interested in going that route i could whip up a pcb in kicad and the components as a kit for a modest price (most certainly not the reason for making this post!)

I guess most of you have seen the old wiimote arduino guides?
Well they do level conversion of the i2c signal which is overly complicated and completely unnecessary!
I just powered the camera through the previously mentioned 3.3v regulator, pulled the SDA and SCL lines to that 3.3v through 2.7k resistors.
The 5V atmega32u4 reads those 3.3v i2c signals just fine.
Other than that its just a 20MHz crystal, 2 capacitors and a 33k (or lower) resistor to hold the reset pin on the camera HIGH.

@JayBee, i know it seems like a good idea to only release the hex file, though if you'd be willing to i'd very much like to have the sketch provided, i will ofcourse contribute if i come up with something good :D
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra on October 28, 2019, 07:56:59 pm
It's more like saying "regardless if you plan to use the car once per month or every day, you should get one with brakes that work". And, "if you can't afford a car with working brakes, it's better to get nothing at all".

I don't live in Japan or know the market there but I don't believe that it's not possible to buy a continuous duty solenoid. Especially as some of the solenoid brands I've seen are Japanese companies. Plus, there is a bunch of low cost arcade parts sellers that are based in Asia and ship internationally. And, there are plenty of ebay sellers who ship internationally. I order stuff from Japanese sellers all the time. I'm sure that if you kept an eye on ebay, you'll find a jolt gun from a seller who'll ship to Japan.

Also, Namco, a Japanese company, sell new Time Crisis 4 gun shells and recoil solenoids for $120 in America. I'm sure they will have a parts distributor for their home market and that it wouldn't be significantly more expensive which means, if you know where to look, there will be used parts selling for less.
The jolt gun I found + sending fees was more than 100$ in total.
Arcade parts here are actually more expensive and hard to come by than outside of Japan, thanks to the high demand of arcade centers that are everywhere here, that would pay any price to get their parts.
Plus none of those gun part shop is open to the public, only people with an arcade company can order. They are protective of their market and tech.
So getting official part would be very expensive for me AND extremely troublesome.
But if you can show me some model of continius duty solenoid you think are good and than can fit in my guns, I will gladly take a look at it.


It sucks to be in Japan (for light gun fans)....

You should be able to find one cheaper than that though. I can order a jolt gun right now off ebay for $35 delivered. For you, it's probably best to search for UK sellers. These guys will send me this PS1 recoil gun from the UK for less than $30 delivered:

https://www.ebay.com/itm/Playstation-2-SATURN-SILVER-AVENGER-PRO-LIGHT-GUN-CONTROLLER-PS2/333345578110?hash=item4d9cf1dc7e:g:120AAOSwnD1dkejz

There is usually a lot of jolt guns there. If you put an offer in for ones like this, I'm sure they'll take it:

https://www.ebay.com/itm/Pistola-Gun-per-Playstation-1-PS1-e-Sega-Saturn-con-pedale-Funzionante/303335038088?hash=item46a02d5c88:g:MKcAAOSw~KpcduNN

In terms of solenoid models, just add the word "continuous" to an ebay search for pull solenoid, or check the specs for Duty cycle: Continuous.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on October 28, 2019, 09:12:54 pm
It's more like saying "regardless if you plan to use the car once per month or every day, you should get one with brakes that work". And, "if you can't afford a car with working brakes, it's better to get nothing at all".

I don't live in Japan or know the market there but I don't believe that it's not possible to buy a continuous duty solenoid. Especially as some of the solenoid brands I've seen are Japanese companies. Plus, there is a bunch of low cost arcade parts sellers that are based in Asia and ship internationally. And, there are plenty of ebay sellers who ship internationally. I order stuff from Japanese sellers all the time. I'm sure that if you kept an eye on ebay, you'll find a jolt gun from a seller who'll ship to Japan.

Also, Namco, a Japanese company, sell new Time Crisis 4 gun shells and recoil solenoids for $120 in America. I'm sure they will have a parts distributor for their home market and that it wouldn't be significantly more expensive which means, if you know where to look, there will be used parts selling for less.
The jolt gun I found + sending fees was more than 100$ in total.
Arcade parts here are actually more expensive and hard to come by than outside of Japan, thanks to the high demand of arcade centers that are everywhere here, that would pay any price to get their parts.
Plus none of those gun part shop is open to the public, only people with an arcade company can order. They are protective of their market and tech.
So getting official part would be very expensive for me AND extremely troublesome.
But if you can show me some model of continius duty solenoid you think are good and than can fit in my guns, I will gladly take a look at it.


It sucks to be in Japan (for light gun fans)....

You should be able to find one cheaper than that though. I can order a jolt gun right now off ebay for $35 delivered. For you, it's probably best to search for UK sellers. These guys will send me this PS1 recoil gun from the UK for less than $30 delivered:

https://www.ebay.com/itm/Playstation-2-SATURN-SILVER-AVENGER-PRO-LIGHT-GUN-CONTROLLER-PS2/333345578110?hash=item4d9cf1dc7e:g:120AAOSwnD1dkejz

There is usually a lot of jolt guns there. If you put an offer in for ones like this, I'm sure they'll take it:

https://www.ebay.com/itm/Pistola-Gun-per-Playstation-1-PS1-e-Sega-Saturn-con-pedale-Funzionante/303335038088?hash=item46a02d5c88:g:MKcAAOSw~KpcduNN

In terms of solenoid models, just add the word "continuous" to an ebay search for pull solenoid, or check the specs for Duty cycle: Continuous.
I think I already told you, jolt gun delivery fees to Japan are >50$, and for the last time, I am not interested in buying those, I am very happy with my current guns, thanks.
Can you show me any push-pull solenoid that is actually continuous duty? I don't believe that even exists, for a simple technical reason; solenoid ALWAYS heat when staying activated, no matter the power/type/size.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on October 28, 2019, 09:21:13 pm
Thanks, @JayBee @Samco @Hifi and all others involved, you're awesome!
After retrofitting my old trusty sluh-00017 Konami Justifier with the JayBee 2 point software, i stumbled upon Hifi's software and actually started to make the same.
but now i found this, so i guess its not needed anymore.
Though i tried to implement the ir led offset from the screen, to make it 100% accurate.

If this is needed i do not know, as im currently waiting for a package of 100 940nm leds from china.
For those interested in the link:
https://www.aliexpress.com/item/32755919314.html?spm=a2g0s.9042311.0.0.21694c4dLn44LN (https://www.aliexpress.com/item/32755919314.html?spm=a2g0s.9042311.0.0.21694c4dLn44LN)

As for the gun itself, i didnt use the DFRobot IR positioning camera.
But rather the IR camera from a wiimote, which i found out you can actually take out of the metal/plastic housing, so you dont even need to desolder it from the wiimote, just pry it out of the holder, and you have 8 solderpads on the rear.
(I will provide pics for the next gun, i'm planning to build)
The reason for taking that route is that i thought that the DFRobot camera was pretty pricey, and i actually had a wiimote at my disposal.
The rest of the components was/is accessible free of charge at the local hackerspace in which i'm a member. (except for a 3.3v switchmode regulator that cost about 0.43$ incl. shipping)

If anyone is interested in going that route i could whip up a pcb in kicad and the components as a kit for a modest price (most certainly not the reason for making this post!)

I guess most of you have seen the old wiimote arduino guides?
Well they do level conversion of the i2c signal which is overly complicated and completely unnecessary!
I just powered the camera through the previously mentioned 3.3v regulator, pulled the SDA and SCL lines to that 3.3v through 2.7k resistors.
The 5V atmega32u4 reads those 3.3v i2c signals just fine.
Other than that its just a 20MHz crystal, 2 capacitors and a 33k (or lower) resistor to hold the reset pin on the camera HIGH.

@JayBee, i know it seems like a good idea to only release the hex file, though if you'd be willing to i'd very much like to have the sketch provided, i will ofcourse contribute if i come up with something good :D
I didn't know you could use the wiimote IR cam, that's really cool! Yeah if you can show us more about that, I would gladly test it too.
For the sketch, I should make it open source at some point in the future, but right now I have many reasons not to.
I know it's not so convenient, and I'm sorry for that, if there was a way to make it better I would  ;)
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Mysli0210 on October 28, 2019, 09:45:53 pm
I will most certainly do that! i would take pictures of what i have made, but it wouldnt be much use as i have hot-snotted everything together.
yeah, the DFRobot camera, is as far as im aware the exact same camera, but with the supporting components attached in a neat shell.

I totally get it! and im looking forward to testing it... but alas i have to either source the ir leds locally or wait that month or so for the ones from china.
but its okay, as i will then have time to get hands on another gun... or maybe make one from scratch in lasercut wood.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Ginsonic on October 29, 2019, 05:43:03 am
Congratulations JayBee, great work  :applaud:

Will you update the source code at GitHub later on, or is the project closed source now?
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on October 29, 2019, 06:21:43 am
I will most certainly do that! i would take pictures of what i have made, but it wouldnt be much use as i have hot-snotted everything together.
yeah, the DFRobot camera, is as far as im aware the exact same camera, but with the supporting components attached in a neat shell.

I totally get it! and im looking forward to testing it... but alas i have to either source the ir leds locally or wait that month or so for the ones from china.
but its okay, as i will then have time to get hands on another gun... or maybe make one from scratch in lasercut wood.
Ah yes, finding good IR LEDs for this kind of project is really a pain. Currently working with powerful LEDs but that have terrible viewing angle, and still waiting for the 120° LEDs I ordered from China 2 weeks ago, to see how they will perform (will post them in the first post if they work well.

Congratulations JayBee, great work  :applaud:

Will you update the source code at GitHub later on, or is the project closed source now?

Thanks :)
Yes it's closed source right now, but I will probably make it open source later.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: hyo2012 on October 29, 2019, 08:27:46 am
I just ordered IR camera and LED.

You did a good job :)

I can't wait how it works.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra on October 29, 2019, 01:11:41 pm
It's more like saying "regardless if you plan to use the car once per month or every day, you should get one with brakes that work". And, "if you can't afford a car with working brakes, it's better to get nothing at all".

I don't live in Japan or know the market there but I don't believe that it's not possible to buy a continuous duty solenoid. Especially as some of the solenoid brands I've seen are Japanese companies. Plus, there is a bunch of low cost arcade parts sellers that are based in Asia and ship internationally. And, there are plenty of ebay sellers who ship internationally. I order stuff from Japanese sellers all the time. I'm sure that if you kept an eye on ebay, you'll find a jolt gun from a seller who'll ship to Japan.

Also, Namco, a Japanese company, sell new Time Crisis 4 gun shells and recoil solenoids for $120 in America. I'm sure they will have a parts distributor for their home market and that it wouldn't be significantly more expensive which means, if you know where to look, there will be used parts selling for less.
The jolt gun I found + sending fees was more than 100$ in total.
Arcade parts here are actually more expensive and hard to come by than outside of Japan, thanks to the high demand of arcade centers that are everywhere here, that would pay any price to get their parts.
Plus none of those gun part shop is open to the public, only people with an arcade company can order. They are protective of their market and tech.
So getting official part would be very expensive for me AND extremely troublesome.
But if you can show me some model of continius duty solenoid you think are good and than can fit in my guns, I will gladly take a look at it.


It sucks to be in Japan (for light gun fans)....

You should be able to find one cheaper than that though. I can order a jolt gun right now off ebay for $35 delivered. For you, it's probably best to search for UK sellers. These guys will send me this PS1 recoil gun from the UK for less than $30 delivered:

https://www.ebay.com/itm/Playstation-2-SATURN-SILVER-AVENGER-PRO-LIGHT-GUN-CONTROLLER-PS2/333345578110?hash=item4d9cf1dc7e:g:120AAOSwnD1dkejz

There is usually a lot of jolt guns there. If you put an offer in for ones like this, I'm sure they'll take it:

https://www.ebay.com/itm/Pistola-Gun-per-Playstation-1-PS1-e-Sega-Saturn-con-pedale-Funzionante/303335038088?hash=item46a02d5c88:g:MKcAAOSw~KpcduNN

In terms of solenoid models, just add the word "continuous" to an ebay search for pull solenoid, or check the specs for Duty cycle: Continuous.
I think I already told you, jolt gun delivery fees to Japan are >50$, and for the last time, I am not interested in buying those, I am very happy with my current guns, thanks.
Can you show me any push-pull solenoid that is actually continuous duty? I don't believe that even exists, for a simple technical reason; solenoid ALWAYS heat when staying activated, no matter the power/type/size.

That's why I gave you a link to someone selling one with cheap international shipping. Just because you looked once and found one that was expensive, it doesn't mean they all are. But I get it, you can't afford one. No matter what the price.

On the continuous duty solenoid, as I said, search eBay for "pull solenoid continuous" and you'll see there are lots of options:

https://www.ebay.com/sch/i.html?_from=R40&_trksid=m570.l1313&_nkw=Pull+solenoid+continuous&_sacat=0&LH_TitleDesc=0&_osacat=0&_odkw=Guncon

Or don't. Whatever.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Howard_Casto on October 29, 2019, 01:55:25 pm
I don't have a dog in this fight, but I'm with Zebra on this one.... you can find cheap parts anywhere... in some areas of the globe it might take a lot of effort to do so, but Japan.... nah. 
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on October 29, 2019, 09:52:14 pm

That's why I gave you a link to someone selling one with cheap international shipping. Just because you looked once and found one that was expensive, it doesn't mean they all are. But I get it, you can't afford one. No matter what the price.

On the continuous duty solenoid, as I said, search eBay for "pull solenoid continuous" and you'll see there are lots of options:

https://www.ebay.com/sch/i.html?_from=R40&_trksid=m570.l1313&_nkw=Pull+solenoid+continuous&_sacat=0&LH_TitleDesc=0&_osacat=0&_odkw=Guncon

Or don't. Whatever.
Oh I see! My bad, I guess I didn't search well enough  ::)
I will check that then and see what I can get.
Just in case, do you know what are those gun solenoids specs (voltage, current...)?

I don't have a dog in this fight, but I'm with Zebra on this one.... you can find cheap parts anywhere... in some areas of the globe it might take a lot of effort to do so, but Japan.... nah. 
If you know any shop (local or online) that sell this kind of part in Japan, I am very curious to know  ;)

Here are the info I could get after all the search I did in Japan, including asking to so many retro shops in Akihabara or other places, and asking the arcade centers themselves:
There were no consumer lightgun with recoil, or too rare to be found at a correct price.
For the real arcade stuff, there are no consumer shop selling lightgun parts (they only sell arcade sticks and machines).
From what the guys in the arcade centers told me, those guns are bought and maintained directly by the brand making them, and are not available to consumers.
But of course, again, it's possible that I missed something, if that's the case please correct me ;)
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra on October 30, 2019, 12:51:26 pm
I'm sure there are large arcades with machines that are owned by the brand but that won't be the case with a lot of smaller arcades running older games that Namco and Sega etc no longer support.

These old arcade cabs are getting thrown in dumpsters in Japan, just like they are here in the States and in Europe. Seeing stuff like this breaks my heart:

https://www.youtube.com/watch?v=SS9-T-KgmmM&t=1s

https://www.youtube.com/watch?v=Gmhc0i9co-s

They don't even attempt to find a home for all those candy cabs that we sell our kidneys to get here. The solenoids in those gun survivor 2 guns they were throwing away are excellent BTW.

They used to maintain a list of Japanese arcade PCB stores over on the shmups forum which shows there are plenty of places for consumers to buy old arcade parts there. My ability to search them was always limited by my lack of Japanese language skills though.

As a general point, all those 3rd party ps1 and PS2 recoil guns were made in Asia. A lot of the ones here were originally ordered online from stores in Hong Kong like Play Asia. I am positive that the same stores we buy from in HK and mainland China would also have shipped to Japan. I wouldn't assume there are none to be found locally.

People travel to Japan from all over the world to buy video games and peripherals. We think of it as a video game Mecca. You guys have lots of stuff we've never even seen (like the original Famicom recoil machine gun). I'd keep an eye on local video game stores who sell older used consoles.

Also, Suzo Happ, one of the two large arcade parts suppliers here, have a store in Hong Kong to support customers across Asia. There is also another store in HK called Happ that sells arcade parts but they have nothing to do with each other.

These guys (also in HK) can often get used arcade parts. Ask them if they can track you down a cheap Time Crisis solenoid replacement. The Chinese knock-off Time Crisis guns are usually a lot cheaper and have a stronger solenoid.

https://www.arcadespareparts.com/arcade_parts/shooting_parts.html


Solenoid specs like voltage and amps won't help. Most arcade solenoids use 12v or 24v PSUs but so do a bunch of momentary solenoids that are not suitable for continuous duty. I would use the largest continuous duty tubular solenoid you can fit in your shell. The power supply only matters in terms of matching it to the specific solenoids ratings.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on October 30, 2019, 02:25:23 pm
I'm sure there are large arcades with machines that are owned by the brand but that won't be the case with a lot of smaller arcades running older games that Namco and Sega etc no longer support.

These old arcade cabs are getting thrown in dumpsters in Japan, just like they are here in the States and in Europe. Seeing stuff like this breaks my heart:

https://www.youtube.com/watch?v=SS9-T-KgmmM&t=1s

https://www.youtube.com/watch?v=Gmhc0i9co-s

They don't even attempt to find a home for all those candy cabs that we sell our kidneys to get here. The solenoids in those gun survivor 2 guns they were throwing away are excellent BTW.

They used to maintain a list of Japanese arcade PCB stores over on the shmups forum which shows there are plenty of places for consumers to buy old arcade parts there. My ability to search them was always limited by my lack of Japanese language skills though.

As a general point, all those 3rd party ps1 and PS2 recoil guns were made in Asia. A lot of the ones here were originally ordered online from stores in Hong Kong like Play Asia. I am positive that the same stores we buy from in HK and mainland China would also have shipped to Japan. I wouldn't assume there are none to be found locally.

People travel to Japan from all over the world to buy video games and peripherals. We think of it as a video game Mecca. You guys have lots of stuff we've never even seen (like the original Famicom recoil machine gun). I'd keep an eye on local video game stores who sell older used consoles.

Also, Suzo Happ, one of the two large arcade parts suppliers here, have a store in Hong Kong to support customers across Asia. There is also another store in HK called Happ that sells arcade parts but they have nothing to do with each other.

These guys (also in HK) can often get used arcade parts. Ask them if they can track you down a cheap Time Crisis solenoid replacement. The Chinese knock-off Time Crisis guns are usually a lot cheaper and have a stronger solenoid.

https://www.arcadespareparts.com/arcade_parts/shooting_parts.html


Solenoid specs like voltage and amps won't help. Most arcade solenoids use 12v or 24v PSUs but so do a bunch of momentary solenoids that are not suitable for continuous duty. I would use the largest continuous duty tubular solenoid you can fit in your shell. The power supply only matters in terms of matching it to the specific solenoids ratings.
That's a lot of info, thanks! :D
Actually the problem in japan is that companies are overly protective of their own brand and products, even 20years old products, and don't allow other companies to sell part for their products. They still continue to support them, it's still a real business here. For arcade boards it's a little different because they use some standard like jamma supposed to make them compatible with everything, and so be used/bought and installed by anyone. Which is not the case for lightgun cabinet that are fully patented by the brand.
I'm working for big game companies, it always shock me to see how overprotective they are with their products and the way they make money with them.

That's why you have more chance to find stuff in China, were the laws on copyright and all are pretty much absent.

For the lightgun search, I spent two weeks searching in so many locals or more specialised shop everywhere, in the popular places as well as obscure places, I could only find the usual cheap guncon/Virtua gun. When I asked the seller, they told me to contact the brands directly.

So yeah maybe I will try check the Chinese route.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: pbj on October 30, 2019, 03:18:24 pm
http://www.youtube.com/watch?v=cvK-VGPocQU&t=0m22s (http://www.youtube.com/watch?v=cvK-VGPocQU&t=0m22s)
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra on October 30, 2019, 09:02:16 pm
There is no copyright laws protecting light guns or solenoids. A lot of arcade light gun cabs have the guns replaced with Happ or Betson light guns as the tech is generic. Any decent arcade owner would be capable of switching out the light guns to replace old expensive oem guns with new generic ones.

I am no expert on Japanese law but I would be very surprised if there was any law that prevented arcade owners selling old cabs and parts they no longer use to whoever they like.

There is also no reason why manufacturers would be protective of gun hardware but not their PCBs. I think you've been misinformed. If an arcade owner sells or breaks a pcb, they will part out the rest of the cab and sell parts to whoever. It's always been that way, even when arcades were at their peak in the 80's and 90's.

If I put a search in Google, in English, for "used arcade parts Tokyo Japan", I get multiple results for stores selling used arcade parts....

https://www.google.com/search?q=used%20arcade%20parts%20tokyo%20japan&rlz=1C1SQJL_enUS844US844&oq=used+arcade+parts+tokyo+japan&aqs=chrome..69i57.11966j0j7&sourceid=chrome&ie=UTF-8&safe=off&npsic=0&rflfq=1&rlha=0&rllag=35700934,139771333,185&tbm=lcl&rldimm=1791196374969552662&phdesc=8DEOZzsG28M&ved=2ahUKEwi457fwqMXlAhUFj1kKHR6ZDUIQvS4wAnoECAoQOQ&rldoc=1&tbs=lrf:!2m1!1e2!2m1!1e3!3sIAE,lf:1,lf_ui:10&rlst=f#rlfi=hd:;si:7617596130752392823,y,pC1rO5bV5SY;mv:[[35.713045099999995,139.776682],[35.5164013,139.68927209999998]]
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on October 30, 2019, 10:56:48 pm
There is no copyright laws protecting light guns or solenoids. A lot of arcade light gun cabs have the guns replaced with Happ or Betson light guns as the tech is generic. Any decent arcade owner would be capable of switching out the light guns to replace old expensive oem guns with new generic ones.

I am no expert on Japanese law but I would be very surprised if there was any law that prevented arcade owners selling old cabs and parts they no longer use to whoever they like.

There is also no reason why manufacturers would be protective of gun hardware but not their PCBs. I think you've been misinformed. If an arcade owner sells or breaks a pcb, they will part out the rest of the cab and sell parts to whoever. It's always been that way, even when arcades were at their peak in the 80's and 90's.

If I put a search in Google, in English, for "used arcade parts Tokyo Japan", I get multiple results for stores selling used arcade parts....

https://www.google.com/search?q=used%20arcade%20parts%20tokyo%20japan&rlz=1C1SQJL_enUS844US844&oq=used+arcade+parts+tokyo+japan&aqs=chrome..69i57.11966j0j7&sourceid=chrome&ie=UTF-8&safe=off&npsic=0&rflfq=1&rlha=0&rllag=35700934,139771333,185&tbm=lcl&rldimm=1791196374969552662&phdesc=8DEOZzsG28M&ved=2ahUKEwi457fwqMXlAhUFj1kKHR6ZDUIQvS4wAnoECAoQOQ&rldoc=1&tbs=lrf:!2m1!1e2!2m1!1e3!3sIAE,lf:1,lf_ui:10&rlst=f#rlfi=hd:;si:7617596130752392823,y,pC1rO5bV5SY;mv:[[35.713045099999995,139.776682],[35.5164013,139.68927209999998]]
I know those shops very well, I've been to each of them many times. Out of the shop your search shows, only one (BEEP) actually sells some arcade part (but very few), and of course no lightgun parts. They are all consumer retrogame shops, not arcade part shop (which are two different things).
For info, the 2 biggest arcade parts shop in town (for both consumers and professionals) are:
Mak Japan http://www.mak-jp.com/ (http://www.mak-jp.com/)
Tops https://www.tops-game.jp (https://www.tops-game.jp)
In those you might be able to buy full lightgun cabinets, but no parts.
You can also find most official store of each arcade parts brand in Rakuten online (Sanwa, Seimitsu...).

I've been living here for 10+ years, been to thousands of retrogame/arcade/electronic shops all over Tokyo. I even know the more obscure ones that sell chinese/US parts or cheaper used parts.
Believe me or not it's up to you, just saying in japan as a consumer you can't easily get any proprietary tech like lightgun gun parts. There are compatible tech made by other brands outside of japan. Not here.
The only reason you can get arcade motherboards is because it's not fully proprietary, most use and have to comply to the JAMMA standard. Same for arcade sticks, that use kind of standardized buttons, connectors and sticks.
No matter if it's a law or not, it's the general practice to support your own product as long as it sells and make money, even 20 years later. (just look at nintendo that only recently drop the support of their famicom) And when the support is still active, doing your own support for those products, especially with cheaper alternative, is a big no no. I've never ever seen a lightgun arcade machine with unofficial parts here.
And yes, all that applies only to japan.

But again, you are welcome to prove me wrong, and find a Japanese store that actually sell those parts. I would honestly prefer being wrong than struggling so much to find good parts.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra on October 31, 2019, 01:51:03 pm
The existence of stores just shows that a consumer arcade market exists and that there is somewhere for those stores to buy parts for the cabs they refurbish. I.e. it’s not an impossible quest.

A lot of the old arcade companies aren’t even in business anymore or no longer make arcade games so they won’t be supporting their products, or any other. Owners of retro arcades must have somewhere to buy replacement parts and trade with each other. You are better placed to find it than me. There are plenty of arcades closing down in Japan too. I’d want to find out where all those cabs go to die and maybe make a trip to one of those arcade graveyards. Old Time Crisis cabs don’t evaporate and most are no longer in arcades, so they must be somewhere.

These are old products now from the crt era. I’m not sure I could find a retail store that sells light guns here either. When I want stuff like that, I search the internet, regularly check eBay for a deal and put wanted ads on Craigslist and sites like this. It sometimes takes a while but I usually find what I’m looking for eventually. It’s a global world and a global internet. Most of the resources available to me are available to you too.

Solenoids and light gun shells are small enough to ship at affordable prices from most countries. You’ll find one eventually. Did you look at that avenger pro recoil gun I sent you the link for? I haven’t used that particular model myself so I don’t know if the recoil mechanism uses a motor or solenoid but it looks the part in this video and is cheap enough to take a chance on maybe:

https://www.youtube.com/watch?v=vv_rQOI84Q8
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Mysli0210 on October 31, 2019, 07:27:43 pm
Sooooo.... after doing a tiny bit of research... i found out that the nintendo Switch has got a pretty sweet ir camera.
It apparently outputs an actual image through SPI. and not i2c as the wiimote does.
https://www.techinsights.com/blog/nintendo-switch-teardown (https://www.techinsights.com/blog/nintendo-switch-teardown)
The reason i got entrigued, was the fact that you can buy the camera seperately for about half the price of the DFRobot cam.
https://www.aliexpress.com/item/32933494037.html (https://www.aliexpress.com/item/32933494037.html)

Surely i dont have the skill to program something to actually process the image data,
but i was thinking that you'd probably be able to track the heat of the screen itself.

Another way you could probably make some sweet lightguns would be from the switch joycon itself.
using Joy-con toolkit https://gbatemp.net/threads/tool-joy-con-toolkit.478560/ (https://gbatemp.net/threads/tool-joy-con-toolkit.478560/)
This could make it possible to have them running via bluetooth. I am aware that the wiimote does aswell,
though it certainly is larger.

BTW im not trying to make a point or anything, just sharing what i found interesting.

Also, i just bought another Konami hyper blaster in darkblue, so i have 2 for my homebuilt arcade. which i will design a pcb to mount the wiimote camera, will probably share it on github when im done.
This will be a replacement for the DFRobot camera as mentioned before.

Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on October 31, 2019, 09:34:06 pm
The existence of stores just shows that a consumer arcade market exists and that there is somewhere for those stores to buy parts for the cabs they refurbish. I.e. it’s not an impossible quest.

A lot of the old arcade companies aren’t even in business anymore or no longer make arcade games so they won’t be supporting their products, or any other. Owners of retro arcades must have somewhere to buy replacement parts and trade with each other. You are better placed to find it than me. There are plenty of arcades closing down in Japan too. I’d want to find out where all those cabs go to die and maybe make a trip to one of those arcade graveyards. Old Time Crisis cabs don’t evaporate and most are no longer in arcades, so they must be somewhere.

These are old products now from the crt era. I’m not sure I could find a retail store that sells light guns here either. When I want stuff like that, I search the internet, regularly check eBay for a deal and put wanted ads on Craigslist and sites like this. It sometimes takes a while but I usually find what I’m looking for eventually. It’s a global world and a global internet. Most of the resources available to me are available to you too.

Solenoids and light gun shells are small enough to ship at affordable prices from most countries. You’ll find one eventually. Did you look at that avenger pro recoil gun I sent you the link for? I haven’t used that particular model myself so I don’t know if the recoil mechanism uses a motor or solenoid but it looks the part in this video and is cheap enough to take a chance on maybe:

https://www.youtube.com/watch?v=vv_rQOI84Q8
Not saying this market doesn't exist, far from it. Just saying that for different reasons they don't sell lightguns.
If you need a proof, just compare the result you get in eBay when searching for lightgun, and the results you get when searching (in Japanese) on Yahoo auction (equivalent to eBay here). eBay has waaaayyy more options and models available.
But whatever, let's not fight about that, I am grateful you showed me the eBay stuff and the right solenoids I should try  ;)
I just bought the silver avenger pro from the link you sent me earlier. It seems cool since it has both PSX and Saturn compatibility. I will tell you how it is once I receive it.

Sooooo.... after doing a tiny bit of research... i found out that the nintendo Switch has got a pretty sweet ir camera.
It apparently outputs an actual image through SPI. and not i2c as the wiimote does.
https://www.techinsights.com/blog/nintendo-switch-teardown (https://www.techinsights.com/blog/nintendo-switch-teardown)
The reason i got entrigued, was the fact that you can buy the camera seperately for about half the price of the DFRobot cam.
https://www.aliexpress.com/item/32933494037.html (https://www.aliexpress.com/item/32933494037.html)

Surely i dont have the skill to program something to actually process the image data,
but i was thinking that you'd probably be able to track the heat of the screen itself.

Another way you could probably make some sweet lightguns would be from the switch joycon itself.
using Joy-con toolkit https://gbatemp.net/threads/tool-joy-con-toolkit.478560/ (https://gbatemp.net/threads/tool-joy-con-toolkit.478560/)
This could make it possible to have them running via bluetooth. I am aware that the wiimote does aswell,
though it certainly is larger.

BTW im not trying to make a point or anything, just sharing what i found interesting.

Also, i just bought another Konami hyper blaster in darkblue, so i have 2 for my homebuilt arcade. which i will design a pcb to mount the wiimote camera, will probably share it on github when im done.
This will be a replacement for the DFRobot camera as mentioned before.


Dude that's very interesting research you are doing there  :lol
Do you know how long is the joycon IR cam range is?
I thought that it's only for close range use, but I don't know.
Actually the main reason why I stick with the DFRobot cam is that it's capable to keep track of the 4 points very well, meaning that as long as each of them stay in range, they keep the same position in the buffer.
It makes everything way easier, faster and stable to use, since I have to figure out which point they are only once each time they are detected.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Mysli0210 on October 31, 2019, 10:31:13 pm

Dude that's very interesting research you are doing there  :lol
Do you know how long is the joycon IR cam range is?
I thought that it's only for close range use, but I don't know.
Actually the main reason why I stick with the DFRobot cam is that it's capable to keep track of the 4 points very well, meaning that as long as each of them stay in range, they keep the same position in the buffer.
It makes everything way easier, faster and stable to use, since I have to figure out which point they are only once each time they are detected.
[/quote]
Thanks  :cheers:
I dont have any clue, didnt go that deep into it, but my main idea from it was just track the hot square that is the monitor.
Ofcourse! and there's nothing wrong with that! :D
But if the wiimote cam is indeed the same. why not make it cheaper... for me its necessary as my wallet is pretty much empty atm...
Aaaaand i wanted to learn how to design a PCB as i actually have a crapton of requests for PCB and mechatronics designs.

I did design the board tonight, and will probably release it on github on tuesday, as i have to get my design checked at the hackerspace :D

Stay Tuned!
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Howard_Casto on October 31, 2019, 11:01:57 pm
The IR functionality is nearly identical to the wiimote because they included it for backwards compatibility.  As for some of the IR heat detection functionality they've been using it for, I think that's fairly short range.  Also lcd/led tvs don't put off a great amount of heat so I doubt they'd show up anyway.   
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on November 01, 2019, 02:38:30 am

Thanks  :cheers:
I dont have any clue, didnt go that deep into it, but my main idea from it was just track the hot square that is the monitor.
Ofcourse! and there's nothing wrong with that! :D
But if the wiimote cam is indeed the same. why not make it cheaper... for me its necessary as my wallet is pretty much empty atm...
Aaaaand i wanted to learn how to design a PCB as i actually have a crapton of requests for PCB and mechatronics designs.

I did design the board tonight, and will probably release it on github on tuesday, as i have to get my design checked at the hackerspace :D

Stay Tuned!
Wait, you're telling me the Wiimote sensor can also be used with serial (SDA&SCL), and keeps track of the IR Points? I though it was only the DFRobot cam that had some extra components on their PCB for that :lol
It's interesting for me too since I do have some broken wiimote motherboards around, I could use them to do some extra stuff.
I also wonder how much it would cost to do a custom PCB for the wiimote sensor?

The IR functionality is nearly identical to the wiimote because they included it for backwards compatibility.  As for some of the IR heat detection functionality they've been using it for, I think that's fairly short range.  Also lcd/led tvs don't put off a great amount of heat so I doubt they'd show up anyway.   
Backwards compatibility, on the switch? Did I miss some info on that? ???
The IR sensor also has an IR led to light up objects and reflectors and measure distances (like in nintendo labo), but I didn't see any instance where it was used from long range.
If it works for detecting shapes, we could also put some reflective tape around the screen and add a good powerful IR led under the sensor in the lightgun cannon? Not sure it would work, it's just an idea  :P
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra on November 01, 2019, 01:32:20 pm
It's very hard to judge cameras (of any sort) by the specs alone. Just like with displays, the specs of the most expensive ones can often look similar to the cheapest. One of the most important aspects of cameras in terms of both price and performance is the lens quality and size. It effects how much light can pass, the angles it can see and the level of detail it can capture. All things that really matter with an IR gun camera.

I've never used one these robot motion sense cameras but one of the biggest weaknesses with the Wii camera and sensor bar is the narrow sensing angles. It makes it so you have to stand unreasonably far back, even when using a smaller monitor. It would be interesting to see if that is any different with the robot cams. Being able to stand at arcade-like distances from the screen and aim with iron sights would be a huge step forward.








Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Howard_Casto on November 01, 2019, 02:05:05 pm
You didn't miss anything.  You know where they have been porting a bunch of wii u stuff over to the switch?  The wii u supports wiimotes just like the wii did.  Thus far they haven't ported anything that requires a wiimote ir sensor, but you know Nintendo.... they cram as many sensors in as possible just in case. 
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Mysli0210 on November 01, 2019, 05:24:40 pm
Wait, you're telling me the Wiimote sensor can also be used with serial (SDA&SCL), and keeps track of the IR Points? I though it was only the DFRobot cam that had some extra components on their PCB for that :lol
It's interesting for me too since I do have some broken wiimote motherboards around, I could use them to do some extra stuff.
I also wonder how much it would cost to do a custom PCB for the wiimote sensor?

Thats exactly what I'm telling you 8-)
The only needed components to get the wiimote camera to talk to the arduino is as follows:
A 3.3V regulator for the I2c pullup aswell as the Power.
A 20 to 25 MHz crystal oscillator (resonator wont do) for the camera clock
2 2.7k resistors
A 30 or 33k resistor to pull the camera #reset pin high
2 10nF capacitors for the crystal, which might not even be necessary
a 100uF capacitor for the 3.3v regulator
And a 4 pin connector if you dont fancy wires soldered directly to the pcb.

When my pcb design is confirmed to be correctly made i will order a bunch as you can get 5 50x50mm pcb's for 5$
In china however, they're smaller than that so by panelizing them i might be able to fit 3 or 4 boards within those 50x50mm.
So i will sell the ones i dont need for almost nothing if you're interested.


Also from judging the spec Sheet of the robot cam https://www.robotshop.com/en/ir-tracking-camera.html (https://www.robotshop.com/en/ir-tracking-camera.html)
And what people have found the wiimote camera to be, its pretty darn close.
http://www.robotreviews.com/chat/viewtopic.php?t=8255 (http://www.robotreviews.com/chat/viewtopic.php?t=8255)
keep in mind that some of them measure viewing angle from center to edge, whilst others do it from edge to edge.


Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on November 02, 2019, 02:37:56 pm
You didn't miss anything.  You know where they have been porting a bunch of wii u stuff over to the switch?  The wii u supports wiimotes just like the wii did.  Thus far they haven't ported anything that requires a wiimote ir sensor, but you know Nintendo.... they cram as many sensors in as possible just in case.
Yeah but the architecture of the switch, along with all the hardware, including controllers, is massively different. I've been working on one of the first big N "ports" of the switch for while, and the dev team had to pretty much rewrite all the engine to make it run on it.
I might be wrong on that, but I was pretty sure the IR sensor was just a proximity IR cam along with an IR diode (the same way as the Microsoft Kinect, you can even find a toolkit online to test the cam), and it's on the bottom of the controller, so using it with a sensor bar wouldn't make much sense to me.

Thats exactly what I'm telling you 8-)
The only needed components to get the wiimote camera to talk to the arduino is as follows:
A 3.3V regulator for the I2c pullup aswell as the Power.
A 20 to 25 MHz crystal oscillator (resonator wont do) for the camera clock
2 2.7k resistors
A 30 or 33k resistor to pull the camera #reset pin high
2 10nF capacitors for the crystal, which might not even be necessary
a 100uF capacitor for the 3.3v regulator
And a 4 pin connector if you dont fancy wires soldered directly to the pcb.

When my pcb design is confirmed to be correctly made i will order a bunch as you can get 5 50x50mm pcb's for 5$
In china however, they're smaller than that so by panelizing them i might be able to fit 3 or 4 boards within those 50x50mm.
So i will sell the ones i dont need for almost nothing if you're interested.


Also from judging the spec Sheet of the robot cam https://www.robotshop.com/en/ir-tracking-camera.html (https://www.robotshop.com/en/ir-tracking-camera.html)
And what people have found the wiimote camera to be, its pretty darn close.
http://www.robotreviews.com/chat/viewtopic.php?t=8255 (http://www.robotreviews.com/chat/viewtopic.php?t=8255)
keep in mind that some of them measure viewing angle from center to edge, whilst others do it from edge to edge.
That's really cool dude! Would you have a kind of schematics for that? Would love to test it :D
But you still have to analyse the signal, or it is sending you raw coordinates?
The thing with the DFRobot cam is that it's pretty much sending you the coordinates of the 4 detected IR point through serial, and it follows those points as long as they stay on range.
So for the sketches, it reduces greatly the arduino load and the sketch size, and in result reduces the latency.

For the sensor specs, on DFRobot website they basically link to the wii sensor wiki page, so I wouldn't be surprise if they are using the actual Wiimote sensor in it  :lol

Just in case, would you happen to know a bit about the Playstation 2 USB protocol? Since the sketch is quite stable now, I'm trying to add support to that :P
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra on November 03, 2019, 03:17:26 pm
If the DF robot can really is the exact same part as found in a Wii remote then I wonder why Nintendo chose to only use one sensor bar with just one point of reference. The DF Robot cam states it can track 4.

I guess the obvious answer is that they didn't intend to design it to be a light gun.

Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Mysli0210 on November 03, 2019, 04:23:41 pm

That's really cool dude! Would you have a kind of schematics for that? Would love to test it :D
But you still have to analyse the signal, or it is sending you raw coordinates?
The thing with the DFRobot cam is that it's pretty much sending you the coordinates of the 4 detected IR point through serial, and it follows those points as long as they stay on range.
So for the sketches, it reduces greatly the arduino load and the sketch size, and in result reduces the latency.

For the sensor specs, on DFRobot website they basically link to the wii sensor wiki page, so I wouldn't be surprise if they are using the actual Wiimote sensor in it  :lol

Just in case, would you happen to know a bit about the Playstation 2 USB protocol? Since the sketch is quite stable now, I'm trying to add support to that :P

 :banghead: hit reset after writing a long reply...

But I did make a schematic which I will provide when I get back from my gf in a couple of days.
As for the camera it talks the same language as the robot camera.
I know cause I used your 2 point sketch, with minor changes as I couldn't get axis reverse to work properly, so I changed the for loop to have #ifdef instead of if statements, which should run faster and compile smaller.
I also changed a couple of the constant integers into #define.
But that doesn't interfere with the dfrobot library protocol.

As for the camera being the same didn't really surprise me during research.
The camera is apparently either developed and maybe made by a company called pixart, but it seems to be a pretty secretive company.

About the ps2 usb protocol I haven't got any clue.. But the documentation of the Linux ps2 devkit might be of use.?
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra on November 03, 2019, 04:53:22 pm
Is the PS2 USB protocol the sort of thing you can get from the EMS Topgun 3 drivers with it being another IR gun that works on the PS2 as a Guncon 2?

Also, the guy that wrote the Wingun drivers is a member here. Perhaps he has some insight into how the Guncon 2 hardware works.

One other place to look is the file labeled USB gun on PS2 guncon 2 game discs. I don't understand the code but my assumption is that this is the guncon 2 drivers that the PS2 uses.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on November 04, 2019, 02:05:25 am

 :banghead: hit reset after writing a long reply...

But I did make a schematic which I will provide when I get back from my gf in a couple of days.
As for the camera it talks the same language as the robot camera.
I know cause I used your 2 point sketch, with minor changes as I couldn't get axis reverse to work properly, so I changed the for loop to have #ifdef instead of if statements, which should run faster and compile smaller.
I also changed a couple of the constant integers into #define.
But that doesn't interfere with the dfrobot library protocol.

As for the camera being the same didn't really surprise me during research.
The camera is apparently either developed and maybe made by a company called pixart, but it seems to be a pretty secretive company.

About the ps2 usb protocol I haven't got any clue.. But the documentation of the Linux ps2 devkit might be of use.?
Awesome, can't wait to see your schematic ;)
It's cool we can use old wiimote sensor instead.

Oh and don't throw away the wiimote rumble motors of the wiimote you salvaged parts from, you can actually use it to get rumble feedback with my sketch, for instance when reloading or firing offscreen :D
But I still need to figure out what voltage they are using to not fry them (I guessed 3V, but not sure).

For the sensor inversion, the problem is that DFRobot cam has both axises swapped and one inversed, because of some mistake they did, so I pretty much have to turn them 90° clockwise to make them work.
So it might be a bit different if using real wiimote sensor.

Yeah my 2 point code wasn't so great, it was my very first Arduino sketch  :lol. In the new 4 points one I'm using mostly define and cons, it's winning a lot of memory.
But I'm curious to know how you are using the #ifdef, it would be useful in my new sketch too if it can make it faster.
By the way, if you want to do some modifications to my 2 points sketch, feel free to submit them to my GitHub, I will sure update it and credit you.

If the DF robot can really is the exact same part as found in a Wii remote then I wonder why Nintendo chose to only use one sensor bar with just one point of reference. The DF Robot cam states it can track 4.

I guess the obvious answer is that they didn't intend to design it to be a light gun.

I guess they wanted to keep it simple for everyone to use, even everyone's grandma, while keeping it low cost for them?   :lol

Is the PS2 USB protocol the sort of thing you can get from the EMS Topgun 3 drivers with it being another IR gun that works on the PS2 as a Guncon 2?

Also, the guy that wrote the Wingun drivers is a member here. Perhaps he has some insight into how the Guncon 2 hardware works.

One other place to look is the file labeled USB gun on PS2 guncon 2 game discs. I don't understand the code but my assumption is that this is the guncon 2 drivers that the PS2 uses.
Oh yes I will try contacting the guy who did the wingun driver, he will probably have a good idea on how things work  ;D
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Mysli0210 on November 04, 2019, 05:13:10 am
Not really an answer to all of the above.. (quoting is hard on the phone)
BUT JUST GOT AN AWESOME IDEA!
What if we were to use the nunchuck for extra buttons for those controller which dont have a d-pad and such.
Got the idea from watching metal Jesus play with the gcon 2.
I think it would be possible to use the plug from the wiimote by desoldering it and making a custom pcb with ordinary pimheaders to attach to the pro-Micro... Or stm32 if i can get i2c working on it :-D

Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on November 04, 2019, 06:31:50 am
Not really an answer to all of the above.. (quoting is hard on the phone)
BUT JUST GOT AN AWESOME IDEA!
What if we were to use the nunchuck for extra buttons for those controller which dont have a d-pad and such.
Got the idea from watching metal Jesus play with the gcon 2.
I think it would be possible to use the plug from the wiimote by desoldering it and making a custom pcb with ordinary pimheaders to attach to the pro-Micro... Or stm32 if i can get i2c working on it :-D
Yeah was thinking about that too, but decoding this communication protocol seems to be such a pain :lol
And to be honest there aren't many games that support guns with dpad and all.
The most convenient thing about it is being to scroll games menu with it.
I guess we could also bypass the nunchuck board entirely and connect the buttons directly to the cable, but we would then need a way to read the joystick 2 axises too.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Mysli0210 on November 04, 2019, 07:10:18 am
Well was gonna say that I would take a nunchuck apart. But then i found this https://create.arduino.cc/projecthub/infusion/using-a-wii-nunchuk-with-arduino-597254 (https://create.arduino.cc/projecthub/infusion/using-a-wii-nunchuk-with-arduino-597254)
So it speaks i2c at 3.3v just as the camera, which means that it can actually share the i/o pins as they have different adresses.
Which is probably how the wiimote talks to it.
So it'd be super easy to implement :-D

Edit: btw reading 2 joystick axes (axis in plural ;-)) is super easy, just do 2 analog reads, as they are almost always constructed as potentiometers :-)
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra on November 04, 2019, 10:27:55 am
Not really an answer to all of the above.. (quoting is hard on the phone)
BUT JUST GOT AN AWESOME IDEA!
What if we were to use the nunchuck for extra buttons for those controller which dont have a d-pad and such.
Got the idea from watching metal Jesus play with the gcon 2.
I think it would be possible to use the plug from the wiimote by desoldering it and making a custom pcb with ordinary pimheaders to attach to the pro-Micro... Or stm32 if i can get i2c working on it :-D
Yeah was thinking about that too, but decoding this communication protocol seems to be such a pain :lol
And to be honest there aren't many games that support guns with dpad and all.
The most convenient thing about it is being to scroll games menu with it.
I guess we could also bypass the nunchuck board entirely and connect the buttons directly to the cable, but we would then need a way to read the joystick 2 axises too.

That's what I thought when I made my Time Crisis arcade guns into Guncon 2's but it was a big mistake. It's true that only a few guncon 2 games use the D-pad but a good number use it to navigate through the options menu. It was really annoying to have to keep unplugging the gcon to switch between Virtua Cop 1 and 2 on the Elite edition disc and I couldn't even access the menu system on Guncom 2.

I put all my recoil hardware and the guncon 2 PCB in a wooden box. I ended up adding all the guncon buttons (beside the trigger) to the box and I put a joystick on the other side. My pedal also attached to the box. I suggest you do the same. You need every guncon 2 button and the d-pad unless you only want to play the Time Crisis games.

Also, while you're looking at how to make the gun work on the PS2, there is a good number of rail shooters on the PS2 that currently have no gun support at all. They only allow you to use the analog stick. I am working on hooking up my positional arcade guns but you might be able to add an analog stick mode to your gun to make it work on games like Silent Scope, Combat Queen, Ghost Vibration and Operation Wolf (on the Taito legends disc).
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on November 04, 2019, 11:20:56 am
Well was gonna say that I would take a nunchuck apart. But then i found this https://create.arduino.cc/projecthub/infusion/using-a-wii-nunchuk-with-arduino-597254 (https://create.arduino.cc/projecthub/infusion/using-a-wii-nunchuk-with-arduino-597254)
So it speaks i2c at 3.3v just as the camera, which means that it can actually share the i/o pins as they have different adresses.
Which is probably how the wiimote talks to it.
So it'd be super easy to implement :-D

Edit: btw reading 2 joystick axes (axis in plural ;-)) is super easy, just do 2 analog reads, as they are almost always constructed as potentiometers :-)
Wow that guys already did all the hard work, with that we can actually do it easily. I have an old after market nunchuck somewhere, I will give it a try when I have more time.
You look like you know way more than me in electronic, would you like if I share the 4 leds sketch and schematics with you in private? I would really use some help on making it better, especially on the electronic side of things 😅
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra on November 04, 2019, 12:56:10 pm
This guy seems to have done a lot of the work with guncon protocols.

https://pyroesp.github.io/electronics/reverse%20engineering/playstation/2018/06/14/shooting-bad-guys-2.html

I found it while searching for a Guncon 3 pinout diagram. His project seems to be writing the code to use a wii remote as a guncon or guncon 2.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on November 04, 2019, 07:57:22 pm
Not really an answer to all of the above.. (quoting is hard on the phone)
BUT JUST GOT AN AWESOME IDEA!
What if we were to use the nunchuck for extra buttons for those controller which dont have a d-pad and such.
Got the idea from watching metal Jesus play with the gcon 2.
I think it would be possible to use the plug from the wiimote by desoldering it and making a custom pcb with ordinary pimheaders to attach to the pro-Micro... Or stm32 if i can get i2c working on it :-D
Yeah was thinking about that too, but decoding this communication protocol seems to be such a pain :lol
And to be honest there aren't many games that support guns with dpad and all.
The most convenient thing about it is being to scroll games menu with it.
I guess we could also bypass the nunchuck board entirely and connect the buttons directly to the cable, but we would then need a way to read the joystick 2 axises too.

That's what I thought when I made my Time Crisis arcade guns into Guncon 2's but it was a big mistake. It's true that only a few guncon 2 games use the D-pad but a good number use it to navigate through the options menu. It was really annoying to have to keep unplugging the gcon to switch between Virtua Cop 1 and 2 on the Elite edition disc and I couldn't even access the menu system on Guncom 2.

I put all my recoil hardware and the guncon 2 PCB in a wooden box. I ended up adding all the guncon buttons (beside the trigger) to the box and I put a joystick on the other side. My pedal also attached to the box. I suggest you do the same. You need every guncon 2 button and the d-pad unless you only want to play the Time Crisis games.

Also, while you're looking at how to make the gun work on the PS2, there is a good number of rail shooters on the PS2 that currently have no gun support at all. They only allow you to use the analog stick. I am working on hooking up my positional arcade guns but you might be able to add an analog stick mode to your gun to make it work on games like Silent Scope, Combat Queen, Ghost Vibration and Operation Wolf (on the Taito legends disc).
What I did a while ago was to use an extra atmega Arduino I had (I buy them in pack), and put it inside an old arcade stick, to simulate a bunch of keyboard keys, which work in pretty much any app/emulator.
It's perfect to put on the table in front of me, acting like an arcade panel.
But I'm planning to do something even cooler for that (something with light buttons and mamehooker).

Beside VCop elite edition, which game uses the dpad for menu? You can also use a psx/ps2 gamepad for those tho.

Also, my lightgun firmware already has a joystick mode (hold A button + push calibration button).
But it's not relative motion, it's absolute. It will work only with games that use absolute motion. There is no way around that sadly.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: hyo2012 on November 04, 2019, 10:14:30 pm
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.

(https://ae01.alicdn.com/kf/HTB1uA64dA9WBuNjSspeq6yz5VXaH.jpg)

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.

Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on November 05, 2019, 02:03:48 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.

(https://ae01.alicdn.com/kf/HTB1uA64dA9WBuNjSspeq6yz5VXaH.jpg)

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.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Mysli0210 on November 05, 2019, 01:12:37 pm

That's what I thought when I made my Time Crisis arcade guns into Guncon 2's but it was a big mistake. It's true that only a few guncon 2 games use the D-pad but a good number use it to navigate through the options menu. It was really annoying to have to keep unplugging the gcon to switch between Virtua Cop 1 and 2 on the Elite edition disc and I couldn't even access the menu system on Guncom 2.

I put all my recoil hardware and the guncon 2 PCB in a wooden box. I ended up adding all the guncon buttons (beside the trigger) to the box and I put a joystick on the other side. My pedal also attached to the box. I suggest you do the same. You need every guncon 2 button and the d-pad unless you only want to play the Time Crisis games.

Also, while you're looking at how to make the gun work on the PS2, there is a good number of rail shooters on the PS2 that currently have no gun support at all. They only allow you to use the analog stick. I am working on hooking up my positional arcade guns but you might be able to add an analog stick mode to your gun to make it work on games like Silent Scope, Combat Queen, Ghost Vibration and Operation Wolf (on the Taito legends disc).

Well i think seeing as it would be so easy to implement it and totally omittable during the specific build.
We might aswell add the feature.
Now, you are totally right about the small number of titles supporting it. But the more it supports the better IMHO.

Wow that guys already did all the hard work, with that we can actually do it easily. I have an old after market nunchuck somewhere, I will give it a try when I have more time.
You look like you know way more than me in electronic, would you like if I share the 4 leds sketch and schematics with you in private? I would really use some help on making it better, especially on the electronic side of things 😅
My electronic knowlegde is pretty low... but i do spend a lot of time at the local hacker/makerspace, where i learn a lot from other makers.
However, yes i'd like that.
I put the schematic up on github, so feel free to update it with your ideas. I scaled the pcb as such that it should fit 4 boards within 50x50mm to make them super cheap to order.
There's only 2 things i think it could use is pads for different sized crystal oscillators and 4 more pins to pass the i2c bus for the nunchuck and whatever we may want to add in the future.
https://github.com/Mysli0210/Liightgun (https://github.com/Mysli0210/Liightgun)
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on November 05, 2019, 08:45:09 pm
Well i think seeing as it would be so easy to implement it and totally omittable during the specific build.
We might aswell add the feature.
Now, you are totally right about the small number of titles supporting it. But the more it supports the better IMHO.
If you're talking about the joystick support, it's already fully supported in my firmware (the joystick mode I'm talking about in my post ;) ). But of course it will only work with games that use absolute joystick motion (one stick position = one position on screen), sadly there is no way to get a precise aiming with games that use relative motion (moving the cursor by holding one direction) due to the way they work.

My electronic knowlegde is pretty low... but i do spend a lot of time at the local hacker/makerspace, where i learn a lot from other makers.
However, yes i'd like that.
I put the schematic up on github, so feel free to update it with your ideas. I scaled the pcb as such that it should fit 4 boards within 50x50mm to make them super cheap to order.
There's only 2 things i think it could use is pads for different sized crystal oscillators and 4 more pins to pass the i2c bus for the nunchuck and whatever we may want to add in the future.
https://github.com/Mysli0210/Liightgun (https://github.com/Mysli0210/Liightgun)
Doesn't look that bad to me, but might be because I am terrible at it  :lol
I was wondering if it would be a good idea to merge your pcb with my solenoid/rumble circuit, and add GND soldering points for the buttons (the few GND on the arduino board aren't enough), it would make a great all in one solution :D
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Mysli0210 on November 05, 2019, 09:51:21 pm
If you're talking about the joystick support, it's already fully supported in my firmware (the joystick mode I'm talking about in my post ;) ). But of course it will only work with games that use absolute joystick motion (one stick position = one position on screen), sadly there is no way to get a precise aiming with games that use relative motion (moving the cursor by holding one direction) due to the way they work.
Not talking about the joystick mode, but rather making the joystick on the nunchuck, act as if were a d-pad like on the G-con2.
A few of the titles support it, but watch this instead to see what i mean https://youtu.be/dOSRxiLEVmI?t=226 (https://youtu.be/dOSRxiLEVmI?t=226)

Doesn't look that bad to me, but might be because I am terrible at it  :lol
I was wondering if it would be a good idea to merge your pcb with my solenoid/rumble circuit, and add GND soldering points for the buttons (the few GND on the arduino board aren't enough), it would make a great all in one solution :D
It could be added, but again i tried to keep it very small to make it super cheap to get made. but i could do a pcb for those functions.
I made the schematic for the board to hold the nunchuck connector, which in itself will be pretty small and only have an internal connector (optional), the nunchuck connector, 2 pullup resistors, a regulator and a cap.

Its not that i dislike your idea, but i think its better to have a few small pcb's rather than one big, seeing as it will then be easier to adapt to the specific gun.

Regarding the ground connections, you can scrape off some of the soldermask, both sides are grounded decently.
but a much more sane approach is daisychaining the ground from button to button. my konami gun was even wired that way from the factory.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on November 06, 2019, 01:33:28 am
Not talking about the joystick mode, but rather making the joystick on the nunchuck, act as if were a d-pad like on the G-con2.
A few of the titles support it, but watch this instead to see what i mean https://youtu.be/dOSRxiLEVmI?t=226 (https://youtu.be/dOSRxiLEVmI?t=226)
Ah yes, you're right, it seems fairly easy to connect the nunchuck with the i2c connection. We can even find some arduino libraries online. I will definitely try it when I have a bit more time.

It could be added, but again i tried to keep it very small to make it super cheap to get made. but i could do a pcb for those functions.
I made the schematic for the board to hold the nunchuck connector, which in itself will be pretty small and only have an internal connector (optional), the nunchuck connector, 2 pullup resistors, a regulator and a cap.

Its not that i dislike your idea, but i think its better to have a few small pcb's rather than one big, seeing as it will then be easier to adapt to the specific gun.

Regarding the ground connections, you can scrape off some of the soldermask, both sides are grounded decently.
but a much more sane approach is daisychaining the ground from button to button. my konami gun was even wired that way from the factory.
Having small pcbs instead of one big is actually what I am doing in my guns, but despite being perfectly functional it looks very messy :lol
But I guess there is no way around it if we want to fit it in any gun model.

Daisy chaining is good, but when each point needs to be soldered somewhere (beside the GCon2 I completely replaced the guns original pcb, and they aren't arcade guns, just cheap PS2/Saturn guns), every time I have to add a ground (button or other) it gets complicated. I preferred making a small board where each ground is attached, even if it's a bit dirty.

I will send you the schematics too once I make them clean. What software are you using for your schematics?
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra on November 06, 2019, 01:07:17 pm
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.

(https://ae01.alicdn.com/kf/HTB1uA64dA9WBuNjSspeq6yz5VXaH.jpg)

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.


You can just use an Apac for fixed positional arcade guns. That's what I use. One Apac can hook up two guns (to one USB port) and all the buttons.

I use a relay plus an Ne555 board to hook up the solenoid for full auto recoil. It's the easiest method by far.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra on November 06, 2019, 01:19:22 pm
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.

(https://ae01.alicdn.com/kf/HTB1uA64dA9WBuNjSspeq6yz5VXaH.jpg)

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.

Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Mysli0210 on November 06, 2019, 03:01:38 pm
Ah yes, you're right, it seems fairly easy to connect the nunchuck with the i2c connection. We can even find some arduino libraries online. I will definitely try it when I have a bit more time.

Cool!

Having small pcbs instead of one big is actually what I am doing in my guns, but despite being perfectly functional it looks very messy :lol
But I guess there is no way around it if we want to fit it in any gun model.

Daisy chaining is good, but when each point needs to be soldered somewhere (beside the GCon2 I completely replaced the guns original pcb, and they aren't arcade guns, just cheap PS2/Saturn guns), every time I have to add a ground (button or other) it gets complicated. I preferred making a small board where each ground is attached, even if it's a bit dirty.

I will send you the schematics too once I make them clean. What software are you using for your schematics?

I used KiCad to design the schematics.
yeah they need to be soldered somewhere, but most buttons do have 4 leads that are interconnected in pairs.
I really dont see how having a lot of ground wires going to one pcb and then to the arduino is less messy nor easier to deal with :)
(You should see the wiring of the joycons of my homebuilt arcade  ::))
But if its such a hassle for you, i would suggest using enamel wire (the type where you can melt the insulation) to just use one wire that is soldered to each button.

We could do something entirely else though.
To make a pcb for each guntype, which would be way more expensive, though super easy to install.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on November 06, 2019, 08:44:09 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.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee on November 06, 2019, 09:42:28 pm
I used KiCad to design the schematics.
yeah they need to be soldered somewhere, but most buttons do have 4 leads that are interconnected in pairs.
I really dont see how having a lot of ground wires going to one pcb and then to the arduino is less messy nor easier to deal with :)
(You should see the wiring of the joycons of my homebuilt arcade  ::))
But if its such a hassle for you, i would suggest using enamel wire (the type where you can melt the insulation) to just use one wire that is soldered to each button.

We could do something entirely else though.
To make a pcb for each guntype, which would be way more expensive, though super easy to install.
None of the buttons in my guns have 4 leads, they aren't arcade guns.
My solution is sure not the best recommend one, but I did it to avoid touching the button boards and wires too much (I have no replacement if I damage them) or messing up with the button themselves. If I chain solder them and one point in the chain breaks or do wrong contact, it will be such a pain to troubleshoot.
I also have grounds for other things than buttons, like solenoid and rumble.

You can see pics of the inside of my guns to understand what I mean:
http://forum.arcadecontrols.com/index.php/topic,161192.0.html
They changed a lot since I took those pics, but you get the global idea.

Yeah we could do a different pcb for each, but like you said, it would be expensive, and not sure if it's worth it ;)
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Mysli0210 on November 07, 2019, 07:24:09 pm
None of the buttons in my guns have 4 leads, they aren't arcade guns.
My solution is sure not the best recommend one, but I did it to avoid touching the button boards and wires too much (I have no replacement if I damage them) or messing up with the button themselves. If I chain solder them and one point in the chain breaks or do wrong contact, it will be such a pain to troubleshoot.
I also have grounds for other things than buttons, like solenoid and rumble.

You can see pics of the inside of my guns to understand what I mean:
http://forum.arcadecontrols.com/index.php/topic,161192.0.html
They changed a lot since I took those pics, but you get the global idea.

Yeah we could do a different pcb for each, but like you said, it would be expensive, and not sure if it's worth it ;)

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 (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.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra 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....
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Howard_Casto 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. 
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra 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.

Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Howard_Casto on November 17, 2019, 12:27:53 am
I don't have one but it's probably relative to maximize compatibility.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee 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 (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
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra 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:

(https://i.postimg.cc/3WWDPWYG/IMG-4492.jpg) (https://postimg.cc/3WWDPWYG)


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.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Howard_Casto 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. 
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee 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.

(https://ae01.alicdn.com/kf/HTB1uA64dA9WBuNjSspeq6yz5VXaH.jpg)

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:

(https://i.postimg.cc/3WWDPWYG/IMG-4492.jpg) (https://postimg.cc/3WWDPWYG)


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.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra 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.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Mysli0210 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 :(
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: lightgungamer 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
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee 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  ;)
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra 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.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee 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.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: thet0ast3r 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.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee 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.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra 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.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Howard_Casto 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?
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee 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.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra 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:

(https://i.postimg.cc/R30DhQXs/ir-sensor-2-1.jpg) (https://postimg.cc/R30DhQXs)

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.

https://www.youtube.com/watch?v=KeXoS4568w0

Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Howard_Casto 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. 
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra 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?
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Howard_Casto 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. 
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: thet0ast3r 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.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra 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.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Zebra 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.


Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Howard_Casto 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.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee 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.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: thet0ast3r 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 :)

Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee 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:
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: kill_one 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 :)
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Mysli0210 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 (https://github.com/Mysli0210/Liightgun)


@Jaybee sent you a PM :)
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: kill_one 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 :)
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee 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 (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.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Mysli0210 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 (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 (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
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: kill_one 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
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee 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.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: kill_one 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 :)
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Mysli0210 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:
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Mysli0210 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)
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: PL1 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 (https://cdn-learn.adafruit.com/assets/assets/000/049/818/large1024/development_boards_itsy5v.png?1514957571).
(https://images-na.ssl-images-amazon.com/images/I/51mf50BR-UL.jpg)

  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).
(http://forum.arcadecontrols.com/index.php?action=dlattach;topic=149895.0;attach=360710;image)

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
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Mysli0210 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 (https://cdn-learn.adafruit.com/assets/assets/000/049/818/large1024/development_boards_itsy5v.png?1514957571).

  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 (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).

Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Mysli0210 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:
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: PL1 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
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee 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.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: PL1 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
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee 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
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: PL1 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
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Mysli0210 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
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee 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.
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: PL1 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
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: kill_one 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
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: kill_one 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?
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Mysli0210 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
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: PL1 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 (https://cdn-learn.adafruit.com/assets/assets/000/049/818/large1024/development_boards_itsy5v.png?1514957571) or Pro Micro (https://cdn.sparkfun.com/datasheets/Dev/Arduino/Boards/Pro_Micro_v13b.pdf) 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
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Mysli0210 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
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: JayBee 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
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: kill_one 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 :)
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: kill_one 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! :)
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Mysli0210 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
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: Mysli0210 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 (http://led.linear1.org/1led.wiz)
However there's a difference between having a single led, having them in series and in parallel
Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
Post by: janderclander14 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 (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]
    Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
    Post by: Mysli0210 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.
    Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
    Post by: JayBee 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 (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.
    Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
    Post by: janderclander14 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 (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 (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 (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/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 (https://www.ebay.es/itm/2-Units-Handle-Vibration-Rumble-Motor-Motors-Replacement-For-PS3-Move-Controller/122490167409?hash=item1c84fba071:g:d68AAOSwcB5ZFDxl)
    Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
    Post by: Mysli0210 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.
      Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
      Post by: JayBee 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 (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 (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 (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/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 (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.
      Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
      Post by: JayBee 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.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: janderclander14 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 (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 (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!
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee 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 (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 (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
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on January 17, 2020, 03:54:05 am
        for led 940nm better 25 or 40 degrees?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one 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 :)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Mysli0210 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.


        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee 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.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Mysli0210 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
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee 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).
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole 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?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Mysli0210 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?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee 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
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee 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.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on January 19, 2020, 07:39:02 am
        i'm installed arduino ide but in \AppData\Local\Arduino15\

        dir packages not present, 
        do I have to install anything else?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Mysli0210 on January 19, 2020, 08:04:34 am
        Assuming that the dfrobot cam is the same as the wiimote camera (which I think I proved by building my gun with it)
        your 55" screen is around 121.62 cm wide, so according to https://www.wiimoteproject.com/wiimote-whiteboard/wiimote-camera-angles/ (https://www.wiimoteproject.com/wiimote-whiteboard/wiimote-camera-angles/)
        you'd need to be 167.07 cm away from the screen to see the leds on the sides, not accounting for the vertically placed leds.
        But as the vertical leds are placed at half that distance, you'd be able to divide the 167.07 by 2.
        However you're still limited by how far away you can see the vertical leds as the height of the 55" screen is 65.99cm
        which equals 123.13cm.

        So I'd say 1.2 meters would be around the minimum distance you could use it reliably, I might be wrong though 😊

        @kill_one later today i'll provide an alternative guide for flashing the pro micro with avr-dudess which is fewer steps but requires you to enter bootloader mode by shorting the rst (reset) pin to ground (can be done with any small metal object)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: PL1 on January 19, 2020, 11:00:07 am
        i'm installed arduino ide but in \AppData\Local\Arduino15\

        dir packages not present, 
        do I have to install anything else?

        Here are the avrdude install procedures from the miniArcade 2.0 User Guide. (pg 13)
        - Not sure where Bruno originally found the driver for step 2.
        - If you can't find it elsewhere, it is in the miniArcade 2.0 download files here (http://forum.arcadecontrols.com/index.php/topic,154126.msg1615622.html#msg1615622).
        Quote
        Arduino boards:
        1. Install the avrdude programmer.
        Windows:  Files are located in the "avrdude" folder.
        MAC OS:  The recommended way is to install brew as per single liner available from http://brew.sh/ (http://brew.sh/) then install avrdude with:
        brew install avrdude
        Linux:  sudo apt-get install avrdude
        2. Windows only:  Install the Arduino Leonardo/Mini bootloader driver located in the "avrdude\drivers" folder as per the instructions at https://www.arduino.cc/en/Guide/ArduinoLeonardoMicro#toc2 (https://www.arduino.cc/en/Guide/ArduinoLeonardoMicro#toc2)

        Here are the avrdude programming procedures from the miniArcade 2.0 User Guide. (pg 14)
        - Put a copy of JayBee's .hex file in the avrdude folder.  (used in place of "MINIARCADE2.hex")
        Quote
        6. Find the COM port/device assigned to the Arduino bootloader.
        Windows:  In Control Panel -- Devices and Printers, the bootloader port number is displayed in the device description when the board is put in bootloader mode by pressing the reset button (Micro) or double-click grounding RST 2x as described here (https://learn.sparkfun.com/tutorials/pro-micro--fio-v3-hookup-guide/troubleshooting-and-faq). (Pro Micro)
        MAC:  ls /dev/tty.usbmodem*
        Linux:  Can be found via dmesg after pressing the Arduino reset button
        7. Create a "miniArcade2.txt" file in the avrdude directory and insert the text for your OS.
        Windows:  Change "COMX" to the Arduino bootloader port i.e. "COM7"
        Quote
        avrdude -p atmega32u4 -P COMX -c avr109 -U flash:w:MINIARCADE2.hex -U eeprom:w:EEPROM.eep -C avrdude.conf
        MAC:  Change "tty.usbmodemXXXX" to the bootloader device used by your Arduino i.e. "tty.usbmodem1411"
        Quote
        #!/bin/sh
        avrdude -p atmega32u4 -P /dev/tty.usbmodemXXXX -c avr109 -U flash:w:MINIARCADE2.hex -U eeprom:w:EEPROM.eep -C avrdude.conf
        Linux:  Change "ttyACMX" to the bootloader device used by your Arduino i.e. "ttyACM0"
        Quote
        #!/bin/sh
        avrdude -p atmega32u4 -P /dev/ttyACMX -c avr109 -U flash:w:MINIARCADE2.hex -U eeprom:w:EEPROM.eep -C avrdude.conf
        8. Rename "miniArcade2.txt" to "miniArcade2.bat" (Windows) or "miniArcade2.sh". (MAC or Linux)
        9. MAC or Linux:  "chmod 755 miniArcade2.sh" to set the execution permission bits.
        10. To program the Arduino, launch the .bat/.sh file immediately after pressing the reset button or double-click grounding RST to put the Arduino into programming mode. (the board only stays in programming mode for 8 seconds)

        (https://cdn.sparkfun.com/assets/6/d/3/4/a/523c8e23757b7fbe5f8b4584.png)

        For JayBee's firmware, you don't need to reprogram the EEPROM, so use this for the Windows text in step 7.
        - Change "COMX" to the Arduino bootloader port.
        - Change "MINIARCADE2.hex" to JayBee's .hex file.
        Quote
        avrdude -p atmega32u4 -P COMX -c avr109 -U flash:w:MINIARCADE2.hex -C avrdude.conf


        Scott
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on January 19, 2020, 07:44:39 pm
        Assuming that the dfrobot cam is the same as the wiimote camera (which I think I proved by building my gun with it)
        your 55" screen is around 121.62 cm wide, so according to https://www.wiimoteproject.com/wiimote-whiteboard/wiimote-camera-angles/ (https://www.wiimoteproject.com/wiimote-whiteboard/wiimote-camera-angles/)
        you'd need to be 167.07 cm away from the screen to see the leds on the sides, not accounting for the vertically placed leds.
        But as the vertical leds are placed at half that distance, you'd be able to divide the 167.07 by 2.
        However you're still limited by how far away you can see the vertical leds as the height of the 55" screen is 65.99cm
        which equals 123.13cm.

        So I'd say 1.2 meters would be around the minimum distance you could use it reliably, I might be wrong though 😊

        @kill_one later today i'll provide an alternative guide for flashing the pro micro with avr-dudess which is fewer steps but requires you to enter bootloader mode by shorting the rst (reset) pin to ground (can be done with any small metal object)
        Your calculations look accurate, thanks  :applaud:
        i'm installed arduino ide but in \AppData\Local\Arduino15\

        dir packages not present, 
        do I have to install anything else?

        Here are the avrdude install procedures from the miniArcade 2.0 User Guide. (pg 13)
        - Not sure where Bruno originally found the driver for step 2.
        - If you can't find it elsewhere, it is in the miniArcade 2.0 download files here (http://forum.arcadecontrols.com/index.php/topic,154126.msg1615622.html#msg1615622).
        Quote
        Arduino boards:
        1. Install the avrdude programmer.
        Windows:  Files are located in the "avrdude" folder.
        MAC OS:  The recommended way is to install brew as per single liner available from http://brew.sh/ (http://brew.sh/) then install avrdude with:
        brew install avrdude
        Linux:  sudo apt-get install avrdude
        2. Windows only:  Install the Arduino Leonardo/Mini bootloader driver located in the "avrdude\drivers" folder as per the instructions at https://www.arduino.cc/en/Guide/ArduinoLeonardoMicro#toc2 (https://www.arduino.cc/en/Guide/ArduinoLeonardoMicro#toc2)

        Here are the avrdude programming procedures from the miniArcade 2.0 User Guide. (pg 14)
        - Put a copy of JayBee's .hex file in the avrdude folder.  (used in place of "MINIARCADE2.hex")
        Quote
        6. Find the COM port/device assigned to the Arduino bootloader.
        Windows:  In Control Panel -- Devices and Printers, the bootloader port number is displayed in the device description when the board is put in bootloader mode by pressing the reset button (Micro) or double-click grounding RST 2x as described here (https://learn.sparkfun.com/tutorials/pro-micro--fio-v3-hookup-guide/troubleshooting-and-faq). (Pro Micro)
        MAC:  ls /dev/tty.usbmodem*
        Linux:  Can be found via dmesg after pressing the Arduino reset button
        7. Create a "miniArcade2.txt" file in the avrdude directory and insert the text for your OS.
        Windows:  Change "COMX" to the Arduino bootloader port i.e. "COM7"
        Quote
        avrdude -p atmega32u4 -P COMX -c avr109 -U flash:w:MINIARCADE2.hex -U eeprom:w:EEPROM.eep -C avrdude.conf
        MAC:  Change "tty.usbmodemXXXX" to the bootloader device used by your Arduino i.e. "tty.usbmodem1411"
        Quote
        #!/bin/sh
        avrdude -p atmega32u4 -P /dev/tty.usbmodemXXXX -c avr109 -U flash:w:MINIARCADE2.hex -U eeprom:w:EEPROM.eep -C avrdude.conf
        Linux:  Change "ttyACMX" to the bootloader device used by your Arduino i.e. "ttyACM0"
        Quote
        #!/bin/sh
        avrdude -p atmega32u4 -P /dev/ttyACMX -c avr109 -U flash:w:MINIARCADE2.hex -U eeprom:w:EEPROM.eep -C avrdude.conf
        8. Rename "miniArcade2.txt" to "miniArcade2.bat" (Windows) or "miniArcade2.sh". (MAC or Linux)
        9. MAC or Linux:  "chmod 755 miniArcade2.sh" to set the execution permission bits.
        10. To program the Arduino, launch the .bat/.sh file immediately after pressing the reset button or double-click grounding RST to put the Arduino into programming mode. (the board only stays in programming mode for 8 seconds)

        (https://cdn.sparkfun.com/assets/6/d/3/4/a/523c8e23757b7fbe5f8b4584.png)

        For JayBee's firmware, you don't need to reprogram the EEPROM, so use this for the Windows text in step 7.
        - Change "COMX" to the Arduino bootloader port.
        - Change "MINIARCADE2.hex" to JayBee's .hex file.
        Quote
        avrdude -p atmega32u4 -P COMX -c avr109 -U flash:w:MINIARCADE2.hex -C avrdude.conf


        Scott
        Yeah I have to improve the explanation for that in my post, to make it more clear and convenient.
        Also if you don't want or can't use the reset pin, with any program able to access the Arduino com port just open a connection at 1200baud then close it.
        It will automatically trigger a reboot in bootloader mode, same as the rst pin would.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: PL1 on January 19, 2020, 10:20:04 pm
        Yeah I have to improve the explanation for that in my post, to make it more clear and convenient.
        Feel free to use/remix anything I've posted.   :cheers:

        Also if you don't want or can't use the reset pin, with any program able to access the Arduino com port just open a connection at 1200baud then close it.
        It will automatically trigger a reboot in bootloader mode, same as the rst pin would.
        That might be handy for boards like the Pro Micro that don't have an onboard reset button.   ;D

        Maybe it's possible to write a single .bat file that opens a 1200 baud port, pauses long enough to ensure it is open, closes the port, momentarily pauses again, and runs avrdude to program the board.


        Scott
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on January 20, 2020, 05:01:28 am
        That might be handy for boards like the Pro Micro that don't have an onboard reset button.   ;D

        Maybe it's possible to write a single .bat file that opens a 1200 baud port, pauses long enough to ensure it is open, closes the port, momentarily pauses again, and runs avrdude to program the board.


        Scott
        That's exactly what I was thinking of doing, and include it inside the zip file along with the hex file. Would make it so much more simple, including for me :lol

        Edit3: Ok I managed to do a bat tool to automatically update the arduino!
        Of course it works only if you have just one arduino connected when updating it.
        I will post it right away.

        Edit4: DONE! Now flashing the firmware is as simple as running the bat file  ;D
        That's be great if you guys could test it to see if it works properly for you ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Mysli0210 on January 20, 2020, 01:46:57 pm
        Guess i dont have to create that avr-dudess guide anyways :P

        However, i have a slight problem. and a weird one at that!
        I couldn't use the B button of my pistol in games, as it did the same as the A button. (B set up as start button in retroarch)
        figured it was just the game, but tested in desktop, the startbutton didnt middleclick, it rightclicks.
        the same applies when i try to map the keys in retroarch, it says mouse 2 whatever button i press  :o
        hooked it up to my pc, and fired up an online mousetest, every button is registered as mouse 2.
        which is weird cause when i play rescue shot i can shoot and use the A button for grenade. but cant pause it just selects grenade just as the A button does.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on January 20, 2020, 07:45:24 pm
        Guess i dont have to create that avr-dudess guide anyways :P

        However, i have a slight problem. and a weird one at that!
        I couldn't use the B button of my pistol in games, as it did the same as the A button. (B set up as start button in retroarch)
        figured it was just the game, but tested in desktop, the startbutton didnt middleclick, it rightclicks.
        the same applies when i try to map the keys in retroarch, it says mouse 2 whatever button i press  :o
        hooked it up to my pc, and fired up an online mousetest, every button is registered as mouse 2.
        which is weird cause when i play rescue shot i can shoot and use the A button for grenade. but cant pause it just selects grenade just as the A button does.
        I just tested my gun with the last firmware, it still has the B button as middle click.
        Which pin is connected to the B button on your gun?
        Be careful, the pedal button pin does have the same function as A button for compatibility purpose.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Mysli0210 on January 20, 2020, 07:53:20 pm
        I've connected the buttons according to your diagram.
        I didnt connect the pedal pin to anything.
        just needed left, right and middle mouse button.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on January 20, 2020, 11:48:47 pm
        I've connected the buttons according to your diagram.
        I didnt connect the pedal pin to anything.
        just needed left, right and middle mouse button.
        It's weird, I tested my GCon 1&2 with the same diagram, they both work perfectly with middle button.
        Did you check the pins again just to be sure?
        Be careful, pin A6 is pin 4 and pin A7 is pin 6 (I really have to make it more clear in my first post).
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on January 21, 2020, 04:53:14 am
        Edit4: DONE! Now flashing the firmware is as simple as running the bat file  ;D
        That's be great if you guys could test it to see if it works properly for you ;)

        Thanks!!! Working perfectly :)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Mysli0210 on January 21, 2020, 05:31:36 am
        I've connected the buttons according to your diagram.
        I didnt connect the pedal pin to anything.
        just needed left, right and middle mouse button.
        It's weird, I tested my GCon 1&2 with the same diagram, they both work perfectly with middle button.
        Did you check the pins again just to be sure?
        Be careful, pin A6 is pin 4 and pin A7 is pin 6 (I really have to make it more clear in my first post).

        I'll check just to be sure... Again d'oh

        Edit: that fixed the middle mouse button. but the trigger still right clicks for some reason.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on January 21, 2020, 07:28:26 am
        I've connected the buttons according to your diagram.
        I didnt connect the pedal pin to anything.
        just needed left, right and middle mouse button.
        It's weird, I tested my GCon 1&2 with the same diagram, they both work perfectly with middle button.
        Did you check the pins again just to be sure?
        Be careful, pin A6 is pin 4 and pin A7 is pin 6 (I really have to make it more clear in my first post).

        I'll check just to be sure... Again d'oh

        Edit: that fixed the middle mouse button. but the trigger still right clicks for some reason.
        The trigger is activating the right click when pointing outside of the screen (for games with off screen reload), is that doing the right click on screen too?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Mysli0210 on January 21, 2020, 09:26:31 am
        sure seems like it is, but the trigger works fine ingame, its just registered as mouse 2 in mousetest aswell as in the keybind on retroarch.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on January 21, 2020, 10:10:47 am
        sure seems like it is, but the trigger works fine ingame, its just registered as mouse 2 in mousetest aswell as in the keybind on retroarch.
        If aiming onscreen, it should always register as mouse 1, if offscreen, always as mouse 2. If only some softwares see it another way it's probably a software issue ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on January 21, 2020, 12:24:42 pm
        @jaybee please where can I buy the same LEDs that you used? ;D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on January 21, 2020, 09:23:09 pm
        @jaybee please where can I buy the same LEDs that you used? ;D
        Actually I bough mine in a local shop here in Tokyo, and I think this model is japanese only.
        But any LED with similar or close enough specs will work ;)
        However don't buy them on aliexpress or similar chinese website, the ones they are selling are usually very bad quality and won't work as well.
        If someone can tell us what's the best model they found in US or online...  :cheers:
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on January 22, 2020, 01:58:25 am
        I added a poll to decide the way the input mode should be in this firmware  ;D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on January 22, 2020, 12:43:18 pm
        @jaybee please where can I buy the same LEDs that you used? ;D
        Actually I bough mine in a local shop here in Tokyo, and I think this model is japanese only.
        But any LED with similar or close enough specs will work ;)
        However don't buy them on aliexpress or similar chinese website, the ones they are selling are usually very bad quality and won't work as well.
        If someone can tell us what's the best model they found in US or online...  :cheers:

        i find in local shop in Italy this: http://pdf.icpdf.com/pdf4/LIGITEK/LIR33_datasheet_733433/119516/LIR33_datasheet.pdf

        they should work but which resistance should I use for this?
        thanks a lot JayBee
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on January 22, 2020, 08:39:58 pm
        @jaybee please where can I buy the same LEDs that you used? ;D
        Actually I bough mine in a local shop here in Tokyo, and I think this model is japanese only.
        But any LED with similar or close enough specs will work ;)
        However don't buy them on aliexpress or similar chinese website, the ones they are selling are usually very bad quality and won't work as well.
        If someone can tell us what's the best model they found in US or online...  :cheers:

        i find in local shop in Italy this: http://pdf.icpdf.com/pdf4/LIGITEK/LIR33_datasheet_733433/119516/LIR33_datasheet.pdf

        they should work but which resistance should I use for this?
        thanks a lot JayBee
        Not bad, they look like they'd work nicely!
        Here is the info I can get from the website I mentioned in the OP ;)
        Since the specs are almost the same as mine, 56ohms resistors should also work, but you will get less brightness.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on January 23, 2020, 10:49:08 am
        Not bad, they look like they'd work nicely!
        Here is the info I can get from the website I mentioned in the OP ;)
        Since the specs are almost the same as mine, 56ohms resistors should also work, but you will get less brightness.
        thanks JayBee!!! Can you post other images on how you connected the LEDs to each other and to USB power for beginners like me? : D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on January 23, 2020, 11:06:25 am

        this the gun I'm working on is a Bio Gun for the first XBOX inside there is a rumble motor connected to an on off switch,
         
        (http://killone.myqnapcloud.com/sp/biogun.jpg)

        can i use this by connecting it to the rumble and gnd pin of the pro micro or do i have to change it with one for xbox360?

        (http://killone.myqnapcloud.com/sp/rumble.jpg)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on January 23, 2020, 09:26:12 pm
        Not bad, they look like they'd work nicely!
        Here is the info I can get from the website I mentioned in the OP ;)
        Since the specs are almost the same as mine, 56ohms resistors should also work, but you will get less brightness.
        thanks JayBee!!! Can you post other images on how you connected the LEDs to each other and to USB power for beginners like me? : D
        It might be hard to show anything more than the pics in the OP  :P
        Basically for each IR point, you have one resistor and 2 LEDs in series. Each of those components group are directly connected to the common USB vcc and gnd.
        To make it easier, what I did was to solder each point vcc and gnd to the next point vcc and gnd. It reduces the length of cables.

        this the gun I'm working on is a Bio Gun for the first XBOX inside there is a rumble motor connected to an on off switch,

        can i use this by connecting it to the rumble and gnd pin of the pro micro or do i have to change it with one for xbox360?
        The Arduino digital and analog pins don't provide enough power for rumble, so you will need a transistor or a mosfet to trigger the rumble from the Arduino, and have a separate motor power source.
        I personally power my Xbox 360 rumble motor with the Arduino vcc, because it's 5 volts and doesn't take so much current. but it's not really a recommended solution, especially if you don't have the motor specs (voltage, current, resistance...).
        But in the case your motor is powered only by the Xbox USB power, it should be fine too I guess.
        I will post the list of components you need for the control circuit later when I go home ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on January 24, 2020, 04:51:23 am
        The Arduino digital and analog pins don't provide enough power for rumble, so you will need a transistor or a mosfet to trigger the rumble from the Arduino, and have a separate motor power source.
        I personally power my Xbox 360 rumble motor with the Arduino vcc, because it's 5 volts and doesn't take so much current. but it's not really a recommended solution, especially if you don't have the motor specs (voltage, current, resistance...).
        But in the case your motor is powered only by the Xbox USB power, it should be fine too I guess.
        I will post the list of components you need for the control circuit later when I go home ;)

        so if I understand correctly, I connect solenoid and rumble or just one of the two to your circuit (still to be created) and feed it at 5v better with a second separate usb cable and then from this circuit the Rumble and Recoil pins on the arduino right?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on January 24, 2020, 11:13:43 am
        The Arduino digital and analog pins don't provide enough power for rumble, so you will need a transistor or a mosfet to trigger the rumble from the Arduino, and have a separate motor power source.
        I personally power my Xbox 360 rumble motor with the Arduino vcc, because it's 5 volts and doesn't take so much current. but it's not really a recommended solution, especially if you don't have the motor specs (voltage, current, resistance...).
        But in the case your motor is powered only by the Xbox USB power, it should be fine too I guess.
        I will post the list of components you need for the control circuit later when I go home ;)

        so if I understand correctly, I connect solenoid and rumble or just one of the two to your circuit (still to be created) and feed it at 5v better with a second separate usb cable and then from this circuit the Rumble and Recoil pins on the arduino right?
        Yes you understand correctly, each circuit has its own power and is connected to the corresponding arduino pin.
        And they all have a common ground.
        There are actually 2 kind of control circuits I made, one for the rumble with the simple transistor, and a bigger one for the solenoid with a mosfet, because solenoids circuits need to be stronger than motor circuits usually.
        Which circuit/components you will use will depend of the specs of your rumble and solenoid.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on January 24, 2020, 11:56:50 am
        There are actually 2 kind of control circuits I made, one for the rumble with the simple transistor, and a bigger one for the solenoid with a mosfet, because solenoids circuits need to be stronger than motor circuits usually.
        Which circuit/components you will use will depend of the specs of your rumble and solenoid.

        OK thanks! Then I am waiting for you to place the two circuits and the list of components to create them...as soon as you are ready ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on January 28, 2020, 12:37:03 pm
        Hello JayBee news ?  ;D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on January 28, 2020, 08:45:46 pm
        Hello JayBee news ?  ;D
        I've been quite busy in my personal life lately, and also trying to pull a huge update for my firmware to address the last flaws of this system (minimum distance and maximum tilt), so it might take a while before I can do the schematics and components list  :-\
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on January 29, 2020, 12:31:05 am
        Hello JayBee news ?  ;D
        I've been quite busy in my personal life lately, and also trying to pull a huge update for my firmware to address the last flaws of this system (minimum distance and maximum tilt), so it might take a while before I can do the schematics and components list  :-\
        That's awesome, man. I'm still waiting for the parts.
        Looking forward to building this gun. Any tips about mounting everything in a guncon 1 or guncon 2?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on January 29, 2020, 02:51:48 am
        That's awesome, man. I'm still waiting for the parts.
        Looking forward to building this gun. Any tips about mounting everything in a guncon 1 or guncon 2?
        Well I'm not super good for the hardware side of things, so my way might not be the best nor the cleanest, but if you want to check anyway you can see my other thread, where I show the inside of the first 2 guns I made (saturn gun and guncon 1).
        You can also check the way I soldered everything on the GC2 motherboard at post #146 of this thread.

        A bit more details:
        The Saturn Gun is the largest of all, I was able to fit everything inside with ease. It has a big and loud solenoid. But it also has only 2 buttons.
        In the GC1 I could fit a smaller solenoid, but no rumble (yet).
        For the GC2 I didn't had time to try fitting a mini solenoid nor rumble yet, and it's way harder to fit anything inside due to the slim form factor and all the buttons.

        More details will come with the schematics when I finally have time for it.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on January 29, 2020, 05:09:07 am
        Hello JayBee news ?  ;D
        I've been quite busy in my personal life lately, and also trying to pull a huge update for my firmware to address the last flaws of this system (minimum distance and maximum tilt), so it might take a while before I can do the schematics and components list  :-\

        Of course JayBee the family first of all! : D I look forward to the new release then;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: SpatzST on January 29, 2020, 10:05:10 am
        Does using this system make it track faster/better? Or is it more for 'no calibration'?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on January 29, 2020, 12:35:41 pm
        Does using this system make it track faster/better? Or is it more for 'no calibration'?
        Yeah, beside the no calibration it does work faster and better to some extend; it minimizes input latency, works from a wider angle, tracks a largers area, adds a good off screen tracking, and reduces greatly the minimum distance the player has to be from the screen.
        Beside that it also adds numerous other functionalities, the full list is in the first post  ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on January 31, 2020, 05:24:37 am
        https://photos.app.goo.gl/AcDxtFS8RYcwP36XA

        https://photos.app.goo.gl/gWf5H3t17kysawLd8

        this is my first attempt, with the LEDs that I have taken I can stay at a maximum distance of one meter from the monitor, but considering that it is a 25" is okay! If I tilt the gun too much, the cursor goes crazy and is off-center, but it is a known problem, the trigger does not take the shot every now and then but maybe I have to better check the welded wire, the button B associated with the Middle mouse button if I try to configure it in MAME it does not insert anything and in mame it is seen the gun as GUNXX and the button A me it marks it the same as the trigger, in windows it works as a right mouse button.. apart from that it works great pointing very precisely and there is no flicker of the cursor! You are a great JayBee !!!;)

        I can't do the calibration reset procedure, to overwrite the old calibration with new, how should I proceed?

        now I just have to connect the rumble ... :)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on January 31, 2020, 10:15:34 am
        https://photos.app.goo.gl/AcDxtFS8RYcwP36XA

        https://photos.app.goo.gl/gWf5H3t17kysawLd8

        this is my first attempt, with the LEDs that I have taken I can stay at a maximum distance of one meter from the monitor, but considering that it is a 25" is okay! If I tilt the gun too much, the cursor goes crazy and is off-center, but it is a known problem, the trigger does not take the shot every now and then but maybe I have to better check the welded wire, the button B associated with the Middle mouse button if I try to configure it in MAME it does not insert anything and in mame it is seen the gun as GUNXX and the button A me it marks it the same as the trigger, in windows it works as a right mouse button.. apart from that it works great pointing very precisely and there is no flicker of the cursor! You are a great JayBee !!!;)

        I can't do the calibration reset procedure, to overwrite the old calibration with new, how should I proceed?

        now I just have to connect the rumble ... :)
        Really nice setup, good job!  :applaud:
        You probably know that already, but just in case; your screen is not vertical but the leds have to be facing the gun as much as possible if you want the gun to see them correctly ;)

        Yeah the issue with the tilt is that this system doesn't have gravity sensor to know how it's tilted, so when you turn the gun more than 45 degrees it doesn't know where the up is anymore.
        But that's one of the things I am working on for the big upcoming update I'm busy preparing, so that should be fixed soon if everything goes well ;D

        For the A and B buttons not behaving correctly, can you tell me for each of them how they are behaving in windows? (try them on a basic webpage, convenient to test the right and middle clicks)
        Also, I just realized your gun has A B X Y start buttons and a dpad, that's very unusual, I'm curious to know on which pins you wired them all.
        Looks really annoying to find good soldering points on the motherboard.

        In Mame I'm not sure what's happening, but it looks like the gun axises aren't mapped correctly in the input menu?
        If you can see the mouse cursor behaving correctly in the mame menu (outside of the game), it means it's indeed not mapped correctly.

        For the calibration process it's very simple: hold the calibration button for few seconds (until the cursor goes to the middle of the screen), aim the middle of the screen, shoot, aim the top left corner of the screen, shoot again, aim the bottom right of the screen, shoot one last time. If the calibration process went well it should be calibrated and you shouldn't have to calibrate it ever again ;)

        Tell me how it goes  :cheers:
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 01, 2020, 07:25:47 pm
        Really nice setup, good job!  :applaud:
        You probably know that already, but just in case; your screen is not vertical but the leds have to be facing the gun as much as possible if you want the gun to see them correctly ;)

        yes the screen is tilted and I put the pairs of LEDs exactly on the central sides of the monitor, but I don't know if the second LEDs on the right and left are seen because they are covered by the internal wood of the cab, If I put them vertically could it improve detection?

        Yeah the issue with the tilt is that this system doesn't have gravity sensor to know how it's tilted, so when you turn the gun more than 45 degrees it doesn't know where the up is anymore.
        But that's one of the things I am working on for the big upcoming update I'm busy preparing, so that should be fixed soon if everything goes well ;D

        if you can solve this you have created the perfect solution to use lightguns on Arcade games :)

        For the A and B buttons not behaving correctly, can you tell me for each of them how they are behaving in windows? (try them on a basic webpage, convenient to test the right and middle clicks)
        Also, I just realized your gun has A B X Y start buttons and a dpad, that's very unusual, I'm curious to know on which pins you wired them all.
        Looks really annoying to find good soldering points on the motherboard.

        Yes...i identified the pins of the buttons with the tester and soldered the wires that go from the arduino and I used the following combination of keys:

        DPAD = DPAD Button
        AUTO = CALIBRATION Button
        START = START Button
        BACK = A Button
        X = SELECT Button
        B = B Button

        In Mame I'm not sure what's happening, but it looks like the gun axises aren't mapped correctly in the input menu?
        If you can see the mouse cursor behaving correctly in the mame menu (outside of the game), it means it's indeed not mapped correctly.

        I have reviewed the links and I think I have found and partially solved the problem...A and B Button work perfectly, Trigger button has a problem...

        For the calibration process it's very simple: hold the calibration button for few seconds (until the cursor goes to the middle of the screen), aim the middle of the screen, shoot, aim the top left corner of the screen, shoot again, aim the bottom right of the screen, shoot one last time. If the calibration process went well it should be calibrated and you shouldn't have to calibrate it ever again ;)

        where having used this calibration procedure I was no longer able to have a certain precision, I had to reinstall the firmware and do the automatic calibration

        Tell me how it goes  :cheers:

        I think I found a bug perhaps in the last fw that you released 1.4, in practice it is the problem I had on the mame and on the calibration, in practice after various trigger pressures, the trigger Button becomes A Button...I did various tests, and I can tell you that both in mouse and joypad mode it does the same, Joy Button 1 becomes Joy Button 2 and then returns to normal when he wants...if I connect the trigger button to arduino pin B button it works well, Joy Button 3 always remains for example.

        so I guess it's either a firmware bug or the defective arduino,so seen that at the moment I don't have another arduino to try, if you can verify this anomalous behavior please? :)

        links to photos and videos of the problem:

        https://photos.app.goo.gl/iDWw3YxooWMLZWHS8
         (https://photos.app.goo.gl/iDWw3YxooWMLZWHS8)

        Thanks a lot!
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 02, 2020, 12:40:24 am
        yes the screen is tilted and I put the pairs of LEDs exactly on the central sides of the monitor, but I don't know if the second LEDs on the right and left are seen because they are covered by the internal wood of the cab, If I put them vertically could it improve detection?
        You indeed have to place each leds point at the center of each side of course, but the leds have to be facing the gun camera because their angle is very limited. So if the leds are aligned with your screen they are facing upward and won't work correctly. And of course nothing should block their light. I checked your led specs again, and clearly if it's working at only one meter it's not normal, it should work from afar too if the leds angle is correct.

        where having used this calibration procedure I was no longer able to have a certain precision, I had to reinstall the firmware and do the automatic calibration
        Reinstalling the firmware shouldn't change anything nor erase your calibration. The manual calibration is not overwriting the automatic calibration, but offsetting it to match your screen setup.
        But if something goes wrong with your calibration (for instance if the leds can't be seen correctly when doing it), you can reset it by reentering the calibration mode then leaving it without performing the calibration.
        (more details in the original post)

        I think I found a bug perhaps in the last fw that you released 1.4, in practice it is the problem I had on the mame and on the calibration, in practice after various trigger pressures, the trigger Button becomes A Button...I did various tests, and I can tell you that both in mouse and joypad mode it does the same, Joy Button 1 becomes Joy Button 2 and then returns to normal when he wants...if I connect the trigger button to arduino pin B button it works well, Joy Button 3 always remains for example.

        so I guess it's either a firmware bug or the defective arduino,so seen that at the moment I don't have another arduino to try, if you can verify this anomalous behavior please? :)
        It's not a bug it's a feature (see the "out of screen firing mode" in my original post). When firing offscreen it triggers the right trigger/button 2. It's used for the games that do reload by firing offscreen.
        If it's still firing the button 2 when aiming onscreen, it means the gun can't see your leds correctly.

        On your second screen screenshot, the axises are mapped wrong, each axis has both gun axises mapped on it  :lol
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 02, 2020, 04:39:16 am
        You indeed have to place each leds point at the center of each side of course, but the leds have to be facing the gun camera because their angle is very limited. So if the leds are aligned with your screen they are facing upward and won't work correctly. And of course nothing should block their light. I checked your led specs again, and clearly if it's working at only one meter it's not normal, it should work from afar too if the leds angle is correct.

        Ok! Thanks! I put a little thickness on the top of the side LEDs to make them stand straight and now it is much better and the gun works even more than a meter, even if the cursor is less stable it starts to wobble a little ...

        If it's still firing the button 2 when aiming onscreen, it means the gun can't see your leds correctly.
        On your second screen screenshot, the axises are mapped wrong, each axis has both gun axises mapped on it 

        As you can see from the video below, in windows now works correctly the trigger always corresponds to the left mouse button while in mame it is always seen with Gunxx B0 both the trigger and A button, but is it normal that it is seen as a GUN and not as a mouse? Forces is this the problem

        https://photos.app.goo.gl/ChUJJa1RvkU63Gwf9 (https://photos.app.goo.gl/ChUJJa1RvkU63Gwf9)

        Inviato dal mio Redmi Note 5 utilizzando Tapatalk

        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 02, 2020, 09:28:26 am
        Ok! Thanks! I put a little thickness on the top of the side LEDs to make them stand straight and now it is much better and the gun works even more than a meter, even if the cursor is less stable it starts to wobble a little ...
        Did you do the same for the top and bottom leds too?  ;D

        As you can see from the video below, in windows now works correctly the trigger always corresponds to the left mouse button while in mame it is always seen with Gunxx B0 both the trigger and A button, but is it normal that it is seen as a GUN and not as a mouse? Forces is this the problem

        https://photos.app.goo.gl/ChUJJa1RvkU63Gwf9 (https://photos.app.goo.gl/ChUJJa1RvkU63Gwf9)

        Inviato dal mio Redmi Note 5 utilizzando Tapatalk
        I see, it's indeed not normal, it might have something to do with the way Mame is configured.
        What do you have in "device mapping" in the Mame config menu? are you using any app for mame that might interfere with the inputs?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Howard_Casto on February 02, 2020, 02:30:04 pm
        Regarding this led shallow angle issue.... why don't you guys just sand the LEDS?  That'll diffuse the light and they'll be viewable at any angle. 
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 02, 2020, 02:54:44 pm
        Regarding this led shallow angle issue.... why don't you guys just sand the LEDS?  That'll diffuse the light and they'll be viewable at any angle.
        We already discussed about that, but diffusing the light will also make it weaker and harder for the cam to see. The more the light spread, the dimmer it becomes, even with high powered higher angle LEDs ;)
        There might be some special model somewhere with higher angle and powerful enough for it, but I haven't found any so far.

        So the only solution that works well and doesn't require special hardware is using 2 or more LEDs for each points, with slightly different angles.
        And no need to add any filter or lens to it, since the IR cam will only see one point if the LEDs are close enough  :D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Howard_Casto on February 02, 2020, 03:08:33 pm
        Well ages ago before there were third party sensor bars available for the wii I made one for use on the pc... had the exact same issue with the leds… then I sanded them and they worked great.  I'd suggest you try it before deciding it's impossible. 
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 03, 2020, 02:37:46 am
        Did you do the same for the top and bottom leds too?  ;D
        Only on top :D
        I see, it's indeed not normal, it might have something to do with the way Mame is configured.
        What do you have in "device mapping" in the Mame config menu? are you using any app for mame that might interfere with the inputs?
        I use a groovymame 64bit version and device mapping for lightguns set to lightgun if set mouse not work, can you post your mame.ini configuration
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 03, 2020, 02:56:19 am
        Well ages ago before there were third party sensor bars available for the wii I made one for use on the pc... had the exact same issue with the leds… then I sanded them and they worked great.  I'd suggest you try it before deciding it's impossible.
        I never said it's impossible, I said it reduces the leds brightness therefore might reduce the maximal distance of use  ;)
        I'm not making it up, it's basic optical stuff.
        https://www.instructables.com/id/how-to-defuse-an-LED/ (https://www.instructables.com/id/how-to-defuse-an-LED/)
        You can see at the beginning "Diffusing makes the LED appear dimmer, but gives a wider viewing angle of the light."

        You're right still, I never tested it, I only tested very wide angle powerful LEDs and the result was awful.
        I just didn't see how sanding a LED with the around the same specs (beside the angle) would get better result.
        But I'm willing to try it out, to see how it compares.
        I would be happy to be wrong on this one, it would solve the main IR LEDs issue nicely  :lol
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 03, 2020, 10:22:28 am
        Only on top :D
        You means the bottom leds are not facing the gun either? ;D
        I use a groovymame 64bit version and device mapping for lightguns set to lightgun if set mouse not work, can you post your mame.ini configuration
        Ok so let me test my groovymame machine once I finished setting it up again, I will send you the file.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 03, 2020, 10:32:17 am
        Any thoughts about these leds:
        https://www.arrow.com/en/products/l1i0-0940060000000/lumileds (https://www.arrow.com/en/products/l1i0-0940060000000/lumileds)
        ?
        It's a surface mount, so might be annoying to install, but look at the specs.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 03, 2020, 10:39:30 am
        You means the bottom leds are not facing the gun either? ;D

        I mean that the lower LEDs are already straight and turned towards the gun because the screen is slightly inclined starting from the bottom and coming upwards therefore obviously the LEDs placed on the sides in the middle of the screen are slightly inclined and the upper ones even more stupid I who had not thought of that ... :)

        Ok so let me test my groovymame machine once I finished setting it up again, I will send you the file.

        thanks, but setting mouse as device for the lightgun should be seen as axes and mouse buttons right?
        I don't understand why he doesn't read it like this
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 03, 2020, 12:11:44 pm
        Any thoughts about these leds:
        https://www.arrow.com/en/products/l1i0-0940060000000/lumileds (https://www.arrow.com/en/products/l1i0-0940060000000/lumileds)
        ?
        It's a surface mount, so might be annoying to install, but look at the specs.
        Wait, 1190mW/sr?? That's insane  :lol
        But it makes sense, it's also 3.4v and 1A, very high power consumption, I wouldn't even know how to power those monsters  :o
        I even wonder if it won't be too powerful for the IR cam.
        But if someone here could help us on how to make them work, I would sure want to try it out, powerful SMD LEDs would be really nice.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 03, 2020, 12:22:50 pm
        maybe connect ten of those in series and use a 34V 1Amp ac adapter?
        I'd also like to know if there's any danger associated with these leds.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 04, 2020, 07:57:03 am
        maybe connect ten of those in series and use a 34V 1Amp ac adapter?
        I'd also like to know if there's any danger associated with these leds.
        Why would you want to use 10 of them?  :lol
        My concerns are more about the led being too strong for the IR Cam sensor. I wonder if it wouldn't blind it or making the points too big on cam to track accurately?
        Still, making small pcbs for this kind of LEDs would be a lot cleaner and easier to set up.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 04, 2020, 10:03:49 am
        Well, I've just finished building everything, i used the same leds you use, jaybee, SID1K10CM, 8 of them, connected everything, turned out the DFRobot camera needed to be rotated.
        In my case i had to manually calibrate the gun since the screen i'm trying this on is 16:10, i haven't connected it to the big screen yet since it was easier to try it on the 24 inch.
        It seems to work but i'm not sure it works optimally, since i find myself having to sit as far as my old Topgun 2 lcd gun and still get some inconsistencies. If i try to get closer it does work but with more inconsistencies.
        Is it supposed to be like this? I mean, did you also get accuracy issues from time to time? I've tried messing with the leds, changing their angles and so on, though can't say there's any improvement.
        Will appreciate any suggestions.
        Edit: two things that i've done that seem to help, i changed the usb cable from 5m to 1.8m and changed the resolution to 1920x1080 and set the screen to stretch so as not to have black bars since the native res is 1920x1200, and this time i didn't use manual calibration, since it's set to 16:9 res.
        Not sure which of these two have helped the most but the gun seems to be more consistent now.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 04, 2020, 08:08:52 pm
        Well, I've just finished building everything, i used the same leds you use, jaybee, SID1K10CM, 8 of them, connected everything, turned out the DFRobot camera needed to be rotated.
        In my case i had to manually calibrate the gun since the screen i'm trying this on is 16:10, i haven't connected it to the big screen yet since it was easier to try it on the 24 inch.
        It seems to work but i'm not sure it works optimally, since i find myself having to sit as far as my old Topgun 2 lcd gun and still get some inconsistencies. If i try to get closer it does work but with more inconsistencies.
        Is it supposed to be like this? I mean, did you also get accuracy issues from time to time? I've tried messing with the leds, changing their angles and so on, though can't say there's any improvement.
        Will appreciate any suggestions.
        Edit: two things that i've done that seem to help, i changed the usb cable from 5m to 1.8m and changed the resolution to 1920x1080 and set the screen to stretch so as not to have black bars since the native res is 1920x1200, and this time i didn't use manual calibration, since it's set to 16:9 res.
        Not sure which of these two have helped the most but the gun seems to be more consistent now.
        I'm glad you manage to build it!  :cheers:
        So are you living in Japan too?  :lol
        Yes the sensor is often tilted (it's a factory issue), as I wrote down in the first post  :dizzy:
        So for any aspects ratio other than 16:9 or 4:3, the resolution shouldn't matter as long as you keep your content in full screen.
        I'm currently doing a tool to change the default options of the gun, like the aspect ratio of the screen and many others.
        Just in case, you might also want to check how the camera is seeing the led by using the testing tool by Samco in this forum or or the one dfrobot provided. If you see the points blinking or changing color often, it means there is something wrong with them (USB port not powerful enough, connection problem...).
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 05, 2020, 01:37:31 am
        I mean that the lower LEDs are already straight and turned towards the gun because the screen is slightly inclined starting from the bottom and coming upwards therefore obviously the LEDs placed on the sides in the middle of the screen are slightly inclined and the upper ones even more stupid I who had not thought of that ... :)
        Oh I see, makes sense :P
        Well I hope you got it fixed now  :lol
        thanks, but setting mouse as device for the lightgun should be seen as axes and mouse buttons right?
        I don't understand why he doesn't read it like this
        I don't understand either, Mame is a bit obscure for me too sometime.
        Which input mode are you using inside mame?
        Because I saw you were testing buttons in the windows controller panel in joystick mode.
        You have to be careful, there are 3 input modes with my firmware; mouse+kb, joystick, and mouse+joystick
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 05, 2020, 01:53:19 am
        Mame treats this gun as a lightgun, and that's how it's supposed to be, as far as I'm aware this has always been the case.
        This was the same case when i connected my guncon and other mouse based lightguns.
        By the way, you should disable offscreen_reload for games that don't need it, so you can use the reload button for other things.
        I think you can get around the offscreen_reload option by directly sending a 0,0 left button instead of sending a right button click as offscreen shot. Though I'm not sure if that will work with all games.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 05, 2020, 04:14:08 am
        Yes the sensor is often tilted (it's a factory issue), as I wrote down in the first post  :dizzy:
        Yeah, i've read the first post many times, just thought to point that out to share my experience with building it.
        So for any aspects ratio other than 16:9 or 4:3, the resolution shouldn't matter as long as you keep your content in full screen.
        That explains it, why i was having issues with 1920x1200.
        Just in case, you might also want to check how the camera is seeing the led by using the testing tool by Samco in this forum or or the one dfrobot provided. If you see the points blinking or changing color often, it means there is something wrong with them (USB port not powerful enough, connection problem...).
        For someone who has no experience whatsoever with arduino, how would i go around doing that?
        I've tried uploading the samco test sketch but it fails every time in the verification phase, complaining that "DFRobotIRPosition.h: No such file or directory".
        Tried adding that file to the same folder as the sketch, didn't do anything. In his video he didn't add anything or changed anything, so i'm not sure what's up.
        I tried uploading the official dfrobot sketch, which did get uploaded to the arduino from what i could see, but the processing sketch doesn't show anything but a blank screen.
        I'm sure it's just my inexperience with arduino. any tips?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 05, 2020, 08:11:14 pm
        Mame treats this gun as a lightgun, and that's how it's supposed to be, as far as I'm aware this has always been the case.
        This was the same case when i connected my guncon and other mouse based lightguns.
        By the way, you should disable offscreen_reload for games that don't need it, so you can use the reload button for other things.
        I think you can get around the offscreen_reload option by directly sending a 0,0 left button instead of sending a right button click as offscreen shot. Though I'm not sure if that will work with all games.
        I wondered for a while what's the best practice for the off screen shot functionality, and I ended up leaving it always on for few reasons;
        I couldn't find any game that requires you to shot outside or on the borders of the screen beside the off screen reload, so it shouldn't cause any issue with normal games, and will avoid unattended shot in the screen border when you shot outside (many games aren't triggering shot at all when shooting outside of the screen).
        With the way I coded it, you can assign the normal reload button to any function you want, it shouldn't cause any conflict.
        But the main reason is because most emulators and games don't have a proper off screen detection, shooting in 0,0 just shot in the corner, which is quite annoying for most games. They also rarely allow to map 2 buttons at once, or remapping buttons at all, so even if shooting outside of the screen was on another button we wouldn't be able to use it.

        But don't worry, in my upcoming configuration tool for this firmware you will be able to configure it the way you want ;)

        And if you have any improvement suggestions, feel free to share.

        Yeah for the samco and dfrobot sketch you have to add the dfrobot libraries first (both cpp and h files) , and then change the com Port to whatever port is currently used by your Arduino (you can check it in the Arduino IDE). I know it's not very easy to use, I might also do a user friendly tool for that too in the future.

        Got tons of things to add and work on  :lol
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 06, 2020, 03:42:16 am
        I don't understand either, Mame is a bit obscure for me too sometime.
        Which input mode are you using inside mame?
        Because I saw you were testing buttons in the windows controller panel in joystick mode.
        You have to be careful, there are 3 input modes with my firmware; mouse+kb, joystick, and mouse+joystick

        yes I think mouse + keyboard since when I press Start or Select I press the keys 1 and 5 but mame set Trigger and A button always to GUNX B0 and B button GUNX B2 Pedal button GUNX B0...
        in the mame you use, does the trigger see it as MOUSE B1 or GUNX B1?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 06, 2020, 05:11:06 am
        I made other gun and is the same in mame GUNXX B0...I deduce that it is not a problem of defective arduino, no one else has my same problem?

        This time i used a wireless compatible guncon2 Logic3

        (http://killone.myqnapcloud.com/GUN/gunlogic3.jpg)
        (http://killone.myqnapcloud.com/GUN/gunmod.jpg)
        (http://killone.myqnapcloud.com/GUN/sidea.jpg)
        (http://killone.myqnapcloud.com/GUN/sideb.jpg)

        I connected the calibration button to the OPEN button used to remove the battery container :D

        @JayBee will the utility you are preparing also indicate the various active modes?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 06, 2020, 06:09:14 am
        I made other gun and is the same in mame GUNXX B0...I deduce that it is not a problem of defective arduino, no one else has my same problem?


        This time i used a wireless compatible guncon2 Logic3

        (http://killone.myqnapcloud.com/GUN/gunlogic3.jpg)
        (http://killone.myqnapcloud.com/GUN/gunmod.jpg)
        (http://killone.myqnapcloud.com/GUN/sidea.jpg)
        (http://killone.myqnapcloud.com/GUN/sideb.jpg)

        I connected the calibration button to the OPEN button used to remove the battery container :D

        @JayBee will the utility you are preparing also indicate the various active modes?
        Try setting offscreen_reload to 0 in mame.ini and check.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 06, 2020, 09:19:22 am
        Try setting offscreen_reload to 0 in mame.ini and check.
        Yes! It was that! So should never be used offscreen_reload?
        Foxhole thanks a lot :)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 06, 2020, 09:42:44 am

        yes I think mouse + keyboard since when I press Start or Select I press the keys 1 and 5 but mame set Trigger and A button always to GUNX B0 and B button GUNX B2 Pedal button GUNX B0...
        in the mame you use, does the trigger see it as MOUSE B1 or GUNX B1?
        I just checked, mine shows GUN 5 B0 (5 is the mouse number detected by mame) when shooting on screen, and GUN 5 B1 for off screen, button A and pedal button (which is the expected behavior).
        So I really have no idea why your guns are detecting B0 on button A and pedal, it should be B1  :dizzy:
        Unless there are still some traces on the Guns PCB that connect the buttons together somehow? do you have a continuity tester or a multimeter to test them out?
        where is the buttons common ground connected?

        I made other gun and is the same in mame GUNXX B0...I deduce that it is not a problem of defective arduino, no one else has my same problem?
        Definitely not a defective arduino, you would have other issues I think.

        @JayBee will the utility you are preparing also indicate the various active modes?
        With the current firmware, beside the calibration the gun should reset to the default configuration at each power cycle.
        But yes, it will show the active modes 8)
        The tool will be a all in one toolbox that also allow to update the firmware, configure each button, change the default settings, and add tons of functionalities to the system.
        But since it will take some time for me to make it, I might do a basic testing tool before that, to easily check the inputs, sensors and feedback  :lol
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 06, 2020, 09:45:46 am
        Try setting offscreen_reload to 0 in mame.ini and check.
        Yes! It was that! So should never be used offscreen_reload?
        Foxhole thanks a lot :)
        Oh so Foxhole's solution did work? nice, thanks! :D
        Indeed in my ini file offscreen_reload was 0 by default too, I should add that to the FAQ ;)

        Edit: @Foxhole I added the offscreen reload enable/disable option to the upcoming 1.4 version of the firmware, it will be easy to change it with a buttons combo.

        Edit2:
        Indeed it seems like this mame offscreen_reload options is a common issue:
        http://forum.arcadecontrols.com/index.php?topic=75196.0
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 06, 2020, 10:41:03 am
        Oh so Foxhole's solution did work? nice, thanks! :D
        Indeed in my ini file offscreen_reload was 0 by default too, I should add that to the FAQ ;)

        Edit: @Foxhole I added the offscreen reload enable/disable option to the upcoming 1.4 version of the firmware, it will be easy to change it with a buttons combo.


        Yes, it works perfectly now

        Trigger = GUNXX B0
        A Button = GUNXX B1
        B Button = GUNXX B2
        C Button or Pedal = GUNXX B1

        :D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 06, 2020, 10:49:58 am
        I look forward to completing with the rumble and solenoid, I hope you will publish soon :D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 06, 2020, 12:29:36 pm
        Got tons of things to add and work on  :lol
        could you implement the possibility of various key combinations? I'm trying to edit a biogun for dreamcast and I realized that it has only two buttons besides the trigger and the DPAD, Start and A button

        example: DPAD down + Start = Select button, DPAD up + A = B button, etc etc

        thanks :)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 06, 2020, 02:34:47 pm
        Try setting offscreen_reload to 0 in mame.ini and check.
        Yes! It was that! So should never be used offscreen_reload?
        Foxhole thanks a lot :)
        Use it only on games that require it, like lethal enforcers for example.
        JayBee, i've included a video showing the issues i'm having.
        https://drive.google.com/open?id=14N6tEnCCD_Psx24A7DaRW4N3R8QNZn80 (https://drive.google.com/open?id=14N6tEnCCD_Psx24A7DaRW4N3R8QNZn80)
        kill_one, how's the gun working for you? Do you have issues from time to time? Can you also look at the video and tell me if you get these issues, too?
        most of the issues start on the second half of the video.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 06, 2020, 03:32:07 pm
        kill_one, how's the gun working for you? Do you have issues from time to time? Can you also look at the video and tell me if you get these issues, too?
        most of the issues start on the second half of the video.
        Yes, but it rarely happens, in the troubleshooting there is written how to solve, I point out the screen at the bottom and shoot and then I raster the screen, I believe that with the next update the problem will be solved by fixing the inclination of the gun
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 06, 2020, 08:26:35 pm
        Got tons of things to add and work on  :lol
        could you implement the possibility of various key combinations? I'm trying to edit a biogun for dreamcast and I realized that it has only two buttons besides the trigger and the DPAD, Start and A button

        example: DPAD down + Start = Select button, DPAD up + A = B button, etc etc

        thanks :)
        Yeah that's actually a good idea of features.
        So far the only combo you can do are with the calibration button, to change various modes.
        Might be a little more complex to add programmable buttons, but I will sure look into it  ;)

        Try setting offscreen_reload to 0 in mame.ini and check.
        Yes! It was that! So should never be used offscreen_reload?
        Foxhole thanks a lot :)
        Use it only on games that require it, like lethal enforcers for example.
        JayBee, i've included a video showing the issues i'm having.
        https://drive.google.com/open?id=14N6tEnCCD_Psx24A7DaRW4N3R8QNZn80 (https://drive.google.com/open?id=14N6tEnCCD_Psx24A7DaRW4N3R8QNZn80)
        kill_one, how's the gun working for you? Do you have issues from time to time? Can you also look at the video and tell me if you get these issues, too?
        most of the issues start on the second half of the video.
        Oh I see what's happening!
        It's not a problem with the tilt but with a misdetection of the LEDs, I used to have that all the time when my gun had trouble seeing the LEDs. It still happens once in a while when the cam is glitching somehow.
        But that's also something I'm trying to improve, I'm currently working a function that will reset the detection when something is misdetected, fixing it instantly.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 07, 2020, 10:53:42 pm
        Well ages ago before there were third party sensor bars available for the wii I made one for use on the pc... had the exact same issue with the leds… then I sanded them and they worked great.  I'd suggest you try it before deciding it's impossible.
        So I gave it a try, and sanded one of my leds.
        It seems like the sanding barely improved the angle, but made the light too dim to work correctly at more than 1.5 meters.
        So overall it made it worse sadly  :-\
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 08, 2020, 09:00:04 am
        Well ages ago before there were third party sensor bars available for the wii I made one for use on the pc... had the exact same issue with the leds… then I sanded them and they worked great.  I'd suggest you try it before deciding it's impossible.
        So I gave it a try, and sanded one of my leds.
        It seems like the sanding barely improved the angle, but made the light too dim to work correctly at more than 1.5 meters.
        So overall it made it worse sadly  :-\
        Tried that too, sanded the all 4 of them, made things worse in my case. The improvement in the angle is barely noticeable, but the power of the ir has been reduced quite a lot, reducing the range.
        JayBee, according to the specs of the dfrobot ir cam it can detect up to 3 meter, have you managed to go beyond that?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 08, 2020, 12:58:58 pm
        Well ages ago before there were third party sensor bars available for the wii I made one for use on the pc... had the exact same issue with the leds… then I sanded them and they worked great.  I'd suggest you try it before deciding it's impossible.
        So I gave it a try, and sanded one of my leds.
        It seems like the sanding barely improved the angle, but made the light too dim to work correctly at more than 1.5 meters.
        So overall it made it worse sadly  :-\
        Tried that too, sanded the all 4 of them, made things worse in my case. The improvement in the angle is barely noticeable, but the power of the ir has been reduced quite a lot, reducing the range.
        JayBee, according to the specs of the dfrobot ir cam it can detect up to 3 meter, have you managed to go beyond that?
        My room is only 3 meter large, so I can't really go beyond :lol

        Right now I'm doing lot of testing (and coding) to optimize everything, and the more I think about it the more I want to find a better LEDs solution.
        I realized something that might help, and I think the guys behind the Amtrak gun also realized it:
        The IR points need to be big enough to be recognized well, even if the LEDs are powerful.
        So adding more LEDs on each points or putting a bit more space between them should be a good idea I guess.
        I will do more experiments tomorrow.

        And for the next firmware, since I changed many things I will release it in beta, for everyone to test out.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 09, 2020, 07:31:22 am
        New firmware update as promised! ;D

        changelog:
        * 2020/02/09 - 1.55 beta
        - Rewrote a big part of the aiming calculation, it should be far more stable.
        - Added a better tilt/twist detection, now the gun should still work fine when tilting it, it increases the maximum tilt to 89 degrees on each side.
        - Added a function to disable the press of secondary button when shooting offscreen.
          + You can disable it by holding trigger button and pressing the calibration button briefly.
          + Enable it back the same way.
          + For now this parameter isn't saved in the EEPROM, it will reset on power cycle.

        @foxhole & @kill_one
        Since there are a lot of changes in my code, I leave it as beta version for now, until I'm sure it works.
        If you can test it and give me your feedback that'd be great  :cheers:

        Next update should be the diagrams for the rumble and solenoid.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 09, 2020, 10:03:41 am
        New firmware update as promised! ;D

        @foxhole & @kill_one
        Since there are a lot of changes in my code, I leave it as beta version for now, until I'm sure it works.
        If you can test it and give me your feedback that'd be great  :cheers:

        Next update should be the diagrams for the rumble and solenoid.

        Great @JayBee!!! 
        tonight if I can try it ... a question but once updated should the calibration be redone or the data is not deleted?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 09, 2020, 10:08:26 am
        New firmware update as promised! ;D

        @foxhole & @kill_one
        Since there are a lot of changes in my code, I leave it as beta version for now, until I'm sure it works.
        If you can test it and give me your feedback that'd be great  :cheers:

        Next update should be the diagrams for the rumble and solenoid.

        Great @JayBee!!! 
        tonight if I can try it ... a question but once updated should the calibration be redone or the data is not deleted?
        The calibration data should still be there after update  ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 09, 2020, 10:19:22 am
        New firmware update as promised! ;D

        @foxhole & @kill_one
        Since there are a lot of changes in my code, I leave it as beta version for now, until I'm sure it works.
        If you can test it and give me your feedback that'd be great  :cheers:

        Next update should be the diagrams for the rumble and solenoid.

        Great @JayBee!!! 
        tonight if I can try it ... a question but once updated should the calibration be redone or the data is not deleted?
        The calibration data should still be there after update  ;)

        Perfect!!! :D

        @JayBee Could you begin to interrupt us only the list of components to be taken to make the 2 circuits of the rumble and solenoid? So we already order them to be ready when you publish the schematics? :)
        From one of the photos you put in the other thread I seem to understand that for the solenoid it takes: 1 Mosfet IRL540 - 1 kickback diode (1N4001 or equivalent can it be fine?) - 2 resistances (from what value?) And for the rumble which transistor to take?

        Thanks a lot! :D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 09, 2020, 11:42:36 am
        Perfect!!! :D

        @JayBee Could you begin to interrupt us only the list of components to be taken to make the 2 circuits of the rumble and solenoid? So we already order them to be ready when you publish the schematics? :)
        From one of the photos you put in the other thread I seem to understand that for the solenoid it takes: 1 Mosfet IRL540 - 1 kickback diode (1N4001 or equivalent can it be fine?) - 2 resistances (from what value?) And for the rumble which transistor to take?

        Thanks a lot! :D
        Yes, your guess was very good  ;D

        For the solenoid:
        - IRL540 Mosfet
        - 1N4001 diode
        - 10k resistor
        - 1k resistor

        For the rumble:
        - np2222 transistor
        - 1N4001 diode
        - 270ohms resistor

        For the schematics, I attached some I just found online that are very similar.
        They are fairly basic and should be easy to follow  :cheers:

        However I'm still not sure on how good an reliable those circuits are, electronic isn't my specialty so you're free to suggest any improvement  ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 09, 2020, 08:33:58 pm
        However I'm still not sure on how good an reliable those circuits are, electronic isn't my specialty so you're free to suggest any improvement  ;)
        I'm not even a great expert in this field ...: D As far as rumble motor and solenoid are concerned, what specifications must they have besides being 5v?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 09, 2020, 09:22:33 pm
        I encountered two problems in this version ... the first one when I start flash.bat the firmware flash doesn't start, I had to rename the file and use the old one flash.bat. The second problem concerns the aiming, 'tilt now works but often when I aim at a point the cursor moves by itself making it impossible to hit the target, and sometimes the cursor is seen repeated on different points of the screen, ultimately it seems less precise than the version previous one. I hope I have been clear and helpful.

        Here the video where at the end you see the duplicate cursor
        https://photos.app.goo.gl/vjxYt4Wt9gqoVFi18 (https://photos.app.goo.gl/vjxYt4Wt9gqoVFi18)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 09, 2020, 11:00:16 pm
        I'm not even a great expert in this field ...: D As far as rumble motor and solenoid are concerned, what specifications must they have besides being 5v?
        The rumble can be anything up to 40v with an external power supply as long as it's not using too much power (just check the npn2222 specs)
        If you want to use a 5V rumble motor connected to the arduino vcc, the motor has to have a very low power consumption, or else it won't work on the arduino power pin and might even fry it. That's why I use xbox 360 rumbles. But any USB powered rumble motor should work fine I guess?
        For the solenoid, it has to be powered by a separate power supply, it can't be connected to the arduino.
        The power will depend on your what your solenoid is rated for.
        I use a 24v power supply since my solenoid are all 24v, but again, the IRL540 has quite a large working range (100V max).
        Just don't forget to separate the power lines, and attach all grounds together.

        I encountered two problems in this version ... the first one when I start flash.bat the firmware flash doesn't start, I had to rename the file and use the old one flash.bat. The second problem concerns the aiming, 'tilt now works but often when I aim at a point the cursor moves by itself making it impossible to hit the target, and sometimes the cursor is seen repeated on different points of the screen, ultimately it seems less precise than the version previous one. I hope I have been clear and helpful.

        Here the video where at the end you see the duplicate cursor
        https://photos.app.goo.gl/vjxYt4Wt9gqoVFi18 (https://photos.app.goo.gl/vjxYt4Wt9gqoVFi18)
        that's weird, the flashing worked perfectly for me with the new flash.bat. I didn't change anything to it beside the name of the file  :dizzy:

        The cursor duplication/jumping around (thanks for the video by the way) is clearly an issue with the cam seeing your leds "blicking" meaning it has trouble picking them up steadily :-\
        On the old firmware that's the thing that would mess up the tracking and make your cursor move the wrong way.
        On this one, it recalibrates and fixes the problem in real time, preventing the cursor to move in wrong directions, but making it blink sometime when doing so.
        I just modified dfrobot led visualization tool to display/checks the leds and buttons, I will do a special firmware soon to go with it and share it with you ;)

        For the aim moving on its own, you mean it's shaking?
        For this new firmware because I'm reaching the limit of the arduino's memory, I tried to use integers instead of floats for the coordinates calculation, so it lost a little bit of precision. It didn't have much impact on my setup, but that probably depends on the size of the screen, distance and all. I might be able to do something about that if needed.

        Could you please test this firmware and the previous one from the exact same distance/angle and hold the gun still to see how much it differs?  :laugh:
        Thanks for your help :cheers:
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 10, 2020, 06:48:49 am
        The rumble can be anything up to 40v with an external power supply as long as it's not using too much power (just check the npn2222 specs)
        If you want to use a 5V rumble motor connected to the arduino vcc, the motor has to have a very low power consumption, or else it won't work on the arduino power pin and might even fry it. That's why I use xbox 360 rumbles. But any USB powered rumble motor should work fine I guess?
        The Biogun Xbox port is 5v
        The Biogun DC port is 5v
         
        since these two guns already have a rumble motor to use them, connect them directly to the circuit made and feed them to 5v externally? Even if the console ports are 5v, I doubt that the rumble goes to 5v is there a way to check the voltage without blowing them up? In that of DC there are soldered components, perhaps they serve to reduce the voltage? If so, should I leave them and feed at 5v?

        (http://killone.myqnapcloud.com/sp/motor.jpg)

        The one for xbox that looks the same as the DC one instead had only two wires one connected to the onoff switch and the other went on the main board of the gun

        I don't know how to proceed now: D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 10, 2020, 06:56:22 am
        For the solenoid, it has to be powered by a separate power supply, it can't be connected to the arduino.
        The power will depend on your what your solenoid is rated for.
        I use a 24v power supply since my solenoid are all 24v, but again, the IRL540 has quite a large working range (100V max).
        Just don't forget to separate the power lines, and attach all grounds together.

        i took these

        (http://killone.myqnapcloud.com/sp/solenoid.jpg)

        do you think they are fine? the space left is very little with these I should be able to insert them...

        can I power 2 solenoids with a single 24v power supply?

        The cursor duplication/jumping around (thanks for the video by the way) is clearly an issue with the cam seeing your leds "blicking" meaning it has trouble picking them up steadily :-\
        On the old firmware that's the thing that would mess up the tracking and make your cursor move the wrong way.
        On this one, it recalibrates and fixes the problem in real time, preventing the cursor to move in wrong directions, but making it blink sometime when doing so.
        I just modified dfrobot led visualization tool to display/checks the leds and buttons, I will do a special firmware soon to go with it and share it with you ;)

        For the aim moving on its own, you mean it's shaking?
        For this new firmware because I'm reaching the limit of the arduino's memory, I tried to use integers instead of floats for the coordinates calculation, so it lost a little bit of precision. It didn't have much impact on my setup, but that probably depends on the size of the screen, distance and all. I might be able to do something about that if needed.

        Could you please test this firmware and the previous one from the exact same distance/angle and hold the gun still to see how much it differs?  :laugh:
        Thanks for your help :cheers:

        today I will do other tests and let you know :)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 10, 2020, 08:11:04 am
        Well, the leds that i have at the moment are sanded so they are less powerful than what they used to be but i've tried them anyway with the new firmware,
        and unfortunately it still suffers from the same issues, but this could very well be due to the leds themselves.

        I need to get new ones and try, i thought about installing 12 leds, 3 on each point and run them to their max specs, meaning 100ma each led.
        What are your thoughts about that, JayBee? Would that cause issues? A testing tool for the leds would help tremendously, so looking forward to that.
        Also, I didn't get the issues kill_one got, just the same ones as before, sometimes moving the gun vertically makes it go horizontal and so forth.
        Again, before jumping into conclusions i think testing with new leds is mandatory.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 10, 2020, 09:05:31 am
        The Biogun Xbox port is 5v
        The Biogun DC port is 5v
         
        since these two guns already have a rumble motor to use them, connect them directly to the circuit made and feed them to 5v externally? Even if the console ports are 5v, I doubt that the rumble goes to 5v is there a way to check the voltage without blowing them up? In that of DC there are soldered components, perhaps they serve to reduce the voltage? If so, should I leave them and feed at 5v?

        The one for xbox that looks the same as the DC one instead had only two wires one connected to the onoff switch and the other went on the main board of the gun

        I don't know how to proceed now: D
        If they are truly powered in 5v and don't use so much current you can use the Arduino vcc.
        But without knowing the current they are using it's a risk to take. I think the max current the vcc can provide is 500mA.

        I'm not sure how to check the max voltage either, I wish I knew how to.
        The best way I found so far is the follow the traces on the original pcb, from the rumble to the power supply, to see which components are used.
        Sometime it's easy to see if the motor is fed directly from the vcc or not.


        i took these

        do you think they are fine? the space left is very little with these I should be able to insert them...

        can I power 2 solenoids with a single 24v power supply?
        I do use a very similar solenoid, so yeah it should work fine!
        For the fitting I had to do so many measure and search for while before finding one that fits, and I still had to trim a little bit of plastic  :lol
        Just remember that you need space both in the front and the back of the solenoid for the recoil to move without damaging anything.

        Yeah a power supply can easily power both solenoid at the same time if it's powerful enough. At least that's what I am doing and it works great :D
        Here are what I am using for the cables and power;
        - 3m microUSB -> USB cable to connect the arduino
        - 3m 2.1mm x 5.5mm connector power cable, male <-> female
        - 3m plastic corrugated tube to hold both cables together and protect them
        - a 24v 4A power supply with 2.1mm x 5.5mm connector (you probably don't need a power supply that strong, I took it large just in case I needed to power more solenoids at a time)
        - 2.1mm x 5.5mm Y adapter to power 2 guns solenoid at a time

        So I just cut the connector of the power cable I don't need, and solder it to the solenoid driver pcb.
        I attached some images of those parts if you need.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 10, 2020, 09:34:35 am
        Well, the leds that i have at the moment are sanded so they are less powerful than what they used to be but i've tried them anyway with the new firmware,
        and unfortunately it still suffers from the same issues, but this could very well be due to the leds themselves.

        I need to get new ones and try, i thought about installing 12 leds, 3 on each point and run them to their max specs, meaning 100ma each led.
        What are your thoughts about that, JayBee? Would that cause issues? A testing tool for the leds would help tremendously, so looking forward to that.
        Also, I didn't get the issues kill_one got, just the same ones as before, sometimes moving the gun vertically makes it go horizontal and so forth.
        Again, before jumping into conclusions i think testing with new leds is mandatory.
        I will see if I can finish the tool tomorrow, I definetely want to check how the led detection behave on your system, to be sure to know where the issue is coming from.
        This new firmware should be correcting those kind of detection problems in real time, but it might need some more work and testing.

        Having 3 leds on each point is actually the solution I was going to try, it seems like the solution used in many IR systems (the wii sensor bar for instance).
        But then I saw those:
        https://www.aliexpress.com/item/32862219437.html
        1W power, 120 degrees, looks easy to use on any surface...
        I have no idea how well it would work on our system, nor how to power them, but I still ordered some of them just to try :lol
        Might take a while to come from china, but I will keep you guys updated once I got to test them.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 10, 2020, 04:25:48 pm
        - 10k resistor
        Doubt...10k or 100k ? Because in the scheme there is a 100k resistance
         Which one to use? :D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 10, 2020, 09:49:25 pm
        Doubt...10k or 100k ? Because in the scheme there is a 100k resistance
         Which one to use? :D
        I'm using 10k, but 100k should be fine too, it doesn't matter so much as long the resistor value is high enough to not short the data pin ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 11, 2020, 02:35:37 am
        I'm using 10k, but 100k should be fine too, it doesn't matter so much as long the resistor value is high enough to not short the data pin ;)

        Ok since I had the 10k ones I will use those... Thanks

        Recalibrating the gun with the new firmware is much better it has come back to be precise, but it still happens that pointing to the center of the screen the cursor moves to the right and remains blocked on the right side or off-center on the right, then I have to tilt the gun several times on one side to make it return to normal and then also the cursor duplicated every now and then, I don't know if it can depend on the LEDs on the right, I will wait for the tool to check them :)

        Link to video
        https://photos.app.goo.gl/RVx1jzdREEV9iEfA7 (https://photos.app.goo.gl/RVx1jzdREEV9iEfA7)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 11, 2020, 04:13:15 am
        * 2020/02/11 - IR cam testing tool
        - I uploaded the Processing sketch for testing the IR points, and the firmware that works with it.

        Read in the main post to see how it works  ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 11, 2020, 04:26:17 am

        Recalibrating the gun with the new firmware is much better it has come back to be precise, but it still happens that pointing to the center of the screen the cursor moves to the right and remains blocked on the right side or off-center on the right, then I have to tilt the gun several times on one side to make it return to normal and then also the cursor duplicated every now and then, I don't know if it can depend on the LEDs on the right, I will wait for the tool to check them :)

        Link to video
        https://photos.app.goo.gl/RVx1jzdREEV9iEfA7 (https://photos.app.goo.gl/RVx1jzdREEV9iEfA7)
        Thanks for your testing and videos  :cheers:
        I can see there is clearly a detection issue there, I'm interested to see how it react with the testing tool I just posted ;)


        I think I actually found what's making the detection go crazy when there is a misdetection of IR points, I'm quite confident that can be fixed/improved with a software update, so it might come in the next update!
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 11, 2020, 04:30:48 am
        This is the circuit that I created, I used IRF540 which is equivalent to IRL540 then 1N4001 Res 1k 10k transistor 2222 and res 270ohm.
        can you tell me if the connections are all correct or did i do something wrong? It only remains to be seen whether the motors I have are powered by 5v or 3.7v. :D
        (http://killone.myqnapcloud.com/sp/circuit.jpg)
        (http://killone.myqnapcloud.com/sp/circuit3.jpg)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 11, 2020, 04:35:00 am
        I can see there is clearly a detection issue there, I'm interested to see how it react with the testing tool I just posted ;)

        Great! thanks! I will test it after lunch! :D

        so should the firmware be replaced to test it?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 11, 2020, 05:14:44 am
        This is the circuit that I created, I used IRF540 which is equivalent to IRL540 then 1N4001 Res 1k 10k transistor 2222 and res 270ohm.
        can you tell me if the connections are all correct or did i do something wrong? It only remains to be seen whether the motors I have are powered by 5v or 3.7v. :D
        Sadly the IRF540 isn't the same, it's a power gate instead of a logic level gate.
        The IRL540 will either fully open or fully close its gate when receiving a signal from the arduino, no matter the voltage.
        The IRF540 will open the gate depending of the voltage it receives, with a maximum of 10v, meaning at 5v it will open half, your solenoid will be underpowered  :-\

        The rumble circuit seems fine, but there are few mistakes in your solenoid circuit:
        The 10k resistor should not be between the mosfet and the ground, but between the Gate pin and the Source pin of the mosfet.
        And I think you reversed the gate pin and the drain pin of the Mosfet. I know it's confusing but the mosfet schematic pin order isn't the same as the real pin order.

        I attached a pinout image for the mosfet.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 11, 2020, 05:35:07 am
        * 2020/02/11 - 1.60 beta
        - I updated both the beta firmware and the test tool firmware to reduce the detection issues.

        @kill_one & @Foxhole this version should improve the detection problems, I updated both the normal firmware and the test tool firmware.
        Tell me if it works better for you ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 11, 2020, 06:19:23 am
        Sadly the IRF540 isn't the same, it's a power gate instead of a logic level gate.
        The IRL540 will either fully open or fully close its gate when receiving a signal from the arduino, no matter the voltage.
        The IRF540 will open the gate depending of the voltage it receives, with a maximum of 10v, meaning at 5v it will open half, your solenoid will be underpowered  :-\
        ahhhhhhhrgghhhhh! At the shop they told me it was the same ...: D oh well but the solenoid works the same even if underpowered?

        The 10k resistor should not be between the mosfet and the ground, but between the Gate pin and the Source pin of the mosfet.
        And I think you reversed the gate pin and the drain pin of the Mosfet. I know it's confusing but the mosfet schematic pin order isn't the same as the real pin order.
        I attached a pinout image for the mosfet.
        ah ok, thanks! As soon as IRL540 mosfets arrive that I ordered today I change the connections
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 11, 2020, 07:51:50 am
        JayBee, I'm trying your test firmware with the pde file but i get the exact same issues.
        I flashed the test firmware, started JB_ircam_test.pde, pressed run, and i get a gray screen, just like with the dfrobot ir cam code.
        I believe it doesn't open the right COM port, the com port is 13 but i don't see any manual way to choose it.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 11, 2020, 08:12:19 am
        Also, i installed the 12 leds, 3 in each point, with 100ma current going through them, they are brighter than before.
        Unfortunately, there are still issues, same ones as in my video, with all the firmwares, including the new 1.60, it tends to happen more often when coming from offscreen reload,
        though i gotta say that with the new setup with the leds it's more stable than before, though not sure if it's because there are 3 on each point or because it's running on 100ma.
        It's more playable now from about 1.3 meter, but trying to get closer results in more detection issues making it unplayable in games like point blank which require fast response.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 11, 2020, 08:17:52 am
        JayBee, I'm trying your test firmware with the pde file but i get the exact same issues.
        I flashed the test firmware, started JB_ircam_test.pde, pressed run, and i get a gray screen, just like with the dfrobot ir cam code.
        I believe it doesn't open the right COM port, the com port is 13 but i don't see any manual way to choose it.
        You don't have any other device connected that might be using a serial port?
        The pde file is coded to connect on the first available port, but your arduino might not be the first one somehow  :dizzy:
        To manually force the serial port, in the pde file, replace this line:
        Code: [Select]
        myPort = new Serial(this, Serial.list()[0], 9600);By this line (if 13 is your arduino serial port):
        Code: [Select]
        myPort = new Serial(this, "COM13", 9600);
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 11, 2020, 08:36:45 am
        That fixed it, it's working now.
        From what i can see it seems to detect each point twice(?)
        gonna post a video soon.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 11, 2020, 08:39:45 am
        That fixed it, it's working now.
        From what i can see it seems to detect each point twice(?)
        gonna post a video soon.
        No it detects them only once, the second ones (slightly grayed ones) are with the tilt correction, it makes thing easier to check.
        Just tilt the gun a bit you will see what I mean  ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 11, 2020, 08:42:15 am
        * 2020/02/11 - 1.65 beta
        - I updated both the firmware once again to fix some bugs and reduce the detection issues even more.

        Also, i installed the 12 leds, 3 in each point, with 100ma current going through them, they are brighter than before.
        Unfortunately, there are still issues, same ones as in my video, with all the firmwares, including the new 1.60, it tends to happen more often when coming from offscreen reload,
        though i gotta say that with the new setup with the leds it's more stable than before, though not sure if it's because there are 3 on each point or because it's running on 100ma.
        It's more playable now from about 1.3 meter, but trying to get closer results in more detection issues making it unplayable in games like point blank which require fast response.
        I made another update, managed to find other causes of issues and fix them, it should work a lot better and more stable now.
        Tell me if that makes any difference for you  ;D

        Also in this testing firmware I left the mouse control on, to check how the cursor is moving at the same time as testing with the tool.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 11, 2020, 08:53:52 am
        I've uploaded a video of me testing the IR Test, this is with the first IR Test you uploaded, I'll also try the new one.
        https://drive.google.com/open?id=15bZ7yGlOgKJ37o0zE1ZBFgGQ65oOLFps (https://drive.google.com/open?id=15bZ7yGlOgKJ37o0zE1ZBFgGQ65oOLFps)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 11, 2020, 09:10:35 am
        I've uploaded a video of me testing the IR Test, this is with the first IR Test you uploaded, I'll also try the new one.
        https://drive.google.com/open?id=15bZ7yGlOgKJ37o0zE1ZBFgGQ65oOLFps (https://drive.google.com/open?id=15bZ7yGlOgKJ37o0zE1ZBFgGQ65oOLFps)
        Thanks for your video, I can see more clearly what's happening now :cheers:
        Both issues you had should actually be fixed in the last test firmware.
        If you still get the first issue (axises flipped 90degrees), tell me, we might try something else if needed ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 11, 2020, 09:22:40 am
        You don't have any other device connected that might be using a serial port?
        The pde file is coded to connect on the first available port, but your arduino might not be the first one somehow  :dizzy:
        To manually force the serial port, in the pde file, replace this line:
        Code: [Select]
        myPort = new Serial(this, Serial.list()[0], 9600);By this line (if 13 is your arduino serial port):
        Code: [Select]
        myPort = new Serial(this, "COM13", 9600);

        ah that's why it wasn't going ... I will try the test tonight, instead the firmware 1.60 was much better but every now and then the cursor would be thrown the same I will also try 1.65 tonight :)

        The rumble engines of the xbox 360 that you used feed directly to the 5v? could you insert photos of the ones you made? Thank you
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 11, 2020, 09:22:57 am
        Two more videos with the new IR Test firmware, I specifically wanted to show the difference between close and far, close = 70~85cm, far = 1.2M~1.3M
        You can see the issues when coming back from offscreen, much worse when being close.
        Close: https://drive.google.com/open?id=1wqlxqMSKPuO2LOhYP1SfgMXWLFWhHr8F (https://drive.google.com/open?id=1wqlxqMSKPuO2LOhYP1SfgMXWLFWhHr8F)
        Far: https://drive.google.com/open?id=1rdHbK-zS34g7Wl8AhOxh29Gxw4LC-e-x (https://drive.google.com/open?id=1rdHbK-zS34g7Wl8AhOxh29Gxw4LC-e-x)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 11, 2020, 09:41:42 am
        Two more videos with the new IR Test firmware, I specifically wanted to show the difference between close and far, close = 70~85cm, far = 1.2M~1.3M
        You can see the issues when coming back from offscreen, much worse when being close.
        Close: https://drive.google.com/open?id=1wqlxqMSKPuO2LOhYP1SfgMXWLFWhHr8F (https://drive.google.com/open?id=1wqlxqMSKPuO2LOhYP1SfgMXWLFWhHr8F)
        Far: https://drive.google.com/open?id=1rdHbK-zS34g7Wl8AhOxh29Gxw4LC-e-x (https://drive.google.com/open?id=1rdHbK-zS34g7Wl8AhOxh29Gxw4LC-e-x)
        Wait, I don't see any issues in your videos :lol
        The leds are all moving and rotating correctly on the test tool.
        Can you tell me what is the issue?

        If it's the led staying black color when going back on screen after being out of range it's actually normal.
        When losing track of all the leds (going off range), the system needs to see at least 3 leds again to know which is which.

        It should actually need only 2 leds, but I disabled the 2 leds detection function on the last beta firmware to fix the 4 and 3 leds detection first.
        I'm enabling it back right now, I will upload the next test firmware in few minutes if everything goes well ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 11, 2020, 09:53:53 am
        Two more videos with the new IR Test firmware, I specifically wanted to show the difference between close and far, close = 70~85cm, far = 1.2M~1.3M
        You can see the issues when coming back from offscreen, much worse when being close.
        Close: https://drive.google.com/open?id=1wqlxqMSKPuO2LOhYP1SfgMXWLFWhHr8F (https://drive.google.com/open?id=1wqlxqMSKPuO2LOhYP1SfgMXWLFWhHr8F)
        Far: https://drive.google.com/open?id=1rdHbK-zS34g7Wl8AhOxh29Gxw4LC-e-x (https://drive.google.com/open?id=1rdHbK-zS34g7Wl8AhOxh29Gxw4LC-e-x)
        Wait, I don't see any issues in your videos :lol
        The leds are all moving and rotating correctly on the test tool.
        Can you tell me what is the issue?

        If it's the led staying black color when going back on screen after being out of range it's actually normal.
        When losing track of all the leds (going off range), the system needs to see at least 3 leds again to know which is which.

        It should actually need only 2 leds, but I disabled the 2 leds detection function on the last beta firmware to fix the 4 and 3 leds detection first.
        I'm enabling it back right now, I will upload the next test firmware in few minutes if everything goes well ;)
        Thing is, when trying to play close this causes issues.
        Let me give you a scenario, you start a game of point blank, you're resting your hand, game starts and you need to shoot on the lower left of the screen, the gun will not fire, because you need to aim towards the center first. If playing from 1.2M it's not that big of a deal actually, but when close it's pretty much a deal breaker.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 11, 2020, 10:04:06 am
        Thing is, when trying to play close this causes issues.
        Let me give you a scenario, you start a game of point blank, you're resting your hand, game starts and you need to shoot on the lower left of the screen, the gun will not fire, because you need to aim towards the center first. If playing from 1.2M it's not that big of a deal actually, but when close it's pretty much a deal breaker.
        Yes I know, that's why I'm putting back the 2 leds detection function now.
        I just removed it for the beta version (hence the beta title ;) ), just to fix the bugs one by one.
        2 leds is enough to shoot in corners. If the cam is just close enough to see the 4 leds, it will catch 2 leds right away in corners/borders ;D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 11, 2020, 10:06:03 am
        Great, i'll try the new firmware and report.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 11, 2020, 10:24:58 am
        Great, i'll try the new firmware and report.
        The re-implementation of the 2 points detection is taking me a bit more time than expected, I need to change the way it work to fit my new code.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 11, 2020, 10:46:19 am
        The re-implementation of the 2 points detection is taking me a bit more time than expected, I need to change the way it work to fit my new code.

        so I who have 2 LEDs per point, shouldn't I use the latest firmware?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 11, 2020, 10:48:14 am
        but is it normal that this happens in the test tool?

        https://photos.app.goo.gl/pjzWq4PuFxzNEPZr7 (https://photos.app.goo.gl/pjzWq4PuFxzNEPZr7)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 11, 2020, 10:49:31 am
        so I who have 2 LEDs per point, shouldn't I use the latest firmware?
        Sorry for the confusion, I was talking about 2 points detection when going back onscreen, not 2 leds.
        You can have as much leds as you want on each points it should be fine  ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 11, 2020, 10:51:43 am
        but is it normal that this happens in the test tool?

        https://photos.app.goo.gl/pjzWq4PuFxzNEPZr7 (https://photos.app.goo.gl/pjzWq4PuFxzNEPZr7)
        Not normal at all... what's your screen resolution/refresh rate?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 11, 2020, 11:14:21 am
        Not normal at all... what's your screen resolution/refresh rate?
        Windows 1024x240  60hz  and Mame resolution is 2560x240 60hz  :D
        it is a 15khz arcade monitor...
        can the test window be set to fullscreen?

        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 11, 2020, 11:29:22 am
        * 2020/02/12 - 1.66
        - fixed some bugs and re implemented the 2 points detection

        Great, i'll try the new firmware and report.
        Done! 2 points detection is back ;D
        I hope this time it's working fine  :cheers:

        Windows 1024x240  60hz  and Mame resolution is 2560x240 60hz  :D
        it is a 15khz arcade monitor...
        can the test window be set to fullscreen?
        Oh, that explains the issue :laugh2:
        yeah this app is supposed to be running in 1024x768, the native resolution of the IR cam sensor.
        Can you run the desktop at 480i instead just for testing?
        I will try to make the app fit in 640x480 :P

        Edit: I just modified it to fit 640x480, and while I was at it I did another version for 1024x240  :lol
        You will find them in the zip attached to this post
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 11, 2020, 12:07:41 pm
        Unfortunately, with the new firmware, it still has issues when trying to play close.
        Included another short video.
        Sometimes, even after detecting 2 leds they still stay black and the cursor is stuck.
        Happens often while gaming.
        https://drive.google.com/open?id=1qg0YXbC96wi5R3u6-aUxk0tMmtPkCWKj (https://drive.google.com/open?id=1qg0YXbC96wi5R3u6-aUxk0tMmtPkCWKj)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 11, 2020, 12:14:38 pm
        Edit: I just modified it to fit 640x480, and while I was at it I did another version for 1024x240  :lol
        You will find them in the zip attached to this post

        you are great! :D
        I will try tonight... ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 11, 2020, 12:56:54 pm
        (http://killone.myqnapcloud.com/sp/rumbl.jpg)

        i found and removed these from an old broken usb joypad for pc, what happens if i power externally at 5v and i am not at 5v? They explode ??? : D

        I think those of bioguns xbox e DC are 3v or 3.7v even if I don't find much info about it... how can I reuse them?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 11, 2020, 01:21:31 pm
        Unfortunately, with the new firmware, it still has issues when trying to play close.
        Included another short video.
        Sometimes, even after detecting 2 leds they still stay black and the cursor is stuck.
        Happens often while gaming.
        https://drive.google.com/open?id=1qg0YXbC96wi5R3u6-aUxk0tMmtPkCWKj (https://drive.google.com/open?id=1qg0YXbC96wi5R3u6-aUxk0tMmtPkCWKj)
        I see what's happening; from the way the corrected points (gray points) are oriented, the gun was tilted on the side when the cam went off range of the leds, and was in a different angle when back.
        Without gravity sensor tracking the twist out of the leds range is impossible, so for the 2/3 points recognition to work, the twist when going off range and the twist when going back on has to be around the same (it has around 35 degrees tolerance).
        But it should always come back instantly when seeing the 4 leds again anyway, no matter the angle.

        It's weird tho, during the many hours I tested the gun, I never had a case where 3 points where not recognized. Sometime it wasn't recognized correctly with an older firmware, but never not recognized at all.

        I made a small fix that might help with the issue, can you test the firmware attached to this post and tell me if you see any difference? (replace the one in the test folder)

        I also have some other ideas if this fix doesn't work well, but it will have to wait tomorrow  :lol
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 11, 2020, 01:29:07 pm

        i found and removed these from an old broken usb joypad for pc, what happens if i power externally at 5v and i am not at 5v? They explode ??? : D

        I think those of bioguns xbox e DC are 3v or 3.7v even if I don't find much info about it... how can I reuse them?
        I'm still not an electronic specialist, but if I was you I would start powering them with a couple of AA batteries (so a total of 3~3.3V) to check how well they turn.
        And then try with a 5V power to see if they seem to turn faster/too fast.
        Motors have quite a good tolerance for over voltage usually, so it shouldn't blow up or anything.
        If it's USB there is a big chance it's 5V tho, 3V ones are more likely to be smaller than that and be in wireless controllers.
        There are even motors that work with 7~9V in the PS2 Dual shock controllers, but they are turning a bit slow and weak with the arduino :lol
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 11, 2020, 01:49:55 pm
        To be honest, when i had the issues i didn't intentionally cause them, it just happened during gaming.
        As for the new IR test, any chance of having a regular firmware to try while gaming?
        As with murphy's law, in the ir test things seem to be ok, but i can't know for sure until i can challenge the gun with actual gaming.
        Edit: Scratch that, still having issues.
        Gonna post a video soon.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 11, 2020, 02:07:16 pm
        Unfortunately i kinda messed up with the phone's camera but the important part is near the end, and you'll be able to see the cursor messing up.
        Video: https://drive.google.com/open?id=1zWEkAIouOJjYLIhZeE1PaEPkSsSMsr9- (https://drive.google.com/open?id=1zWEkAIouOJjYLIhZeE1PaEPkSsSMsr9-)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 11, 2020, 02:17:55 pm
        To be honest, when i had the issues i didn't intentionally cause them, it just happened during gaming.
        As for the new IR test, any chance of having a regular firmware to try while gaming?
        As with murphy's law, in the ir test things seem to be ok, but i can't know for sure until i can challenge the gun with actual gaming.
        Edit: Scratch that, still having issues.
        Gonna post a video soon.
        Damn, sad you still have issues... but don't lose hope, it's a work in progress but I'm sure with your guys help we will make it work in the end  :lol :cheers:
        I appreciate that you take time to do those test, it's useful to figure out the causes of the issues.
        What are the issues you're having now? still the same?
        I attached the non test firmware, you will have to rename it.
        The small fix I did on it is a small fix like putting tape an a leak, so don't expect much.
        I already found another way I can improve greatly the 2 points detection and fixing the 3 points one, but I will have to do that tomorrow!

        --------------
        By the way guys, I was thinking that since I spend pretty much all my free time in this project, would it seems to you like a clever idea to do a patreon?
        Leave the firmware and basic tools for free, and give to my patreon sub access to my upcoming configuration/customize and testing tool for the lightgun, and my other custom arduino arcade projects (Arcade stick and leds controller with arduino).
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 11, 2020, 02:24:13 pm
        Unfortunately i kinda messed up with the phone's camera but the important part is near the end, and you'll be able to see the cursor messing up.
        Video: https://drive.google.com/open?id=1zWEkAIouOJjYLIhZeE1PaEPkSsSMsr9- (https://drive.google.com/open?id=1zWEkAIouOJjYLIhZeE1PaEPkSsSMsr9-)
        Yeah that's what I was talking about, the 2 points detection got messed up, then messed up the rest.
        Will correct that tomorrow and hope for the best!  :afro:
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 11, 2020, 02:30:35 pm
        Thank you.
        As for the patreon, to be honest never used it but others may be on board.
        Personally, i just prefer donating without any middleman.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 11, 2020, 02:36:20 pm
        Thank you.
        As for the patreon, to be honest never used it but others may be on board.
        Personally, i just prefer donating without any middleman.
        That's interesting, do you know any good way to make donations?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 11, 2020, 02:38:13 pm
        Well, just plain old paypal.
        That's how i donated throughout the years.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 11, 2020, 02:39:54 pm
        Haha yeah I forgot you could donate with PayPal!
        I will try that.  :cheers:
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 11, 2020, 03:05:17 pm
        Edit: I just modified it to fit 640x480, and while I was at it I did another version for 1024x240  :lol
        You will find them in the zip attached to this post

        Sorry I forgot that the windows resolution is not 1024x240 but 1024x480: D

        the 2 LEDs are seen almost superimposed and I think that's how it should be, by tilting the gun, however, they divide and widen if point downwards there is a black point that moves and then the movements are reversed, that is, if point in top the LEDs move downwards etc. and the central white point seems to be decentralized on the right and the colored LEDs too far from the sides
        https://photos.app.goo.gl/jFTm9qQSpsoyB2Xb6 (https://photos.app.goo.gl/jFTm9qQSpsoyB2Xb6)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 11, 2020, 03:48:29 pm
         https://photos.app.goo.gl/bUEDRdhdgwJJy2rT9 (https://photos.app.goo.gl/bUEDRdhdgwJJy2rT9)


        but the black dots indicate that there is a problem with the detection of the leds?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 11, 2020, 04:08:41 pm
        I'm still not an electronic specialist, but if I was you I would start powering them with a couple of AA batteries (so a total of 3~3.3V) to check how well they turn.
        And then try with a 5V power to see if they seem to turn faster/too fast.
        Motors have quite a good tolerance for over voltage usually, so it shouldn't blow up or anything.
        If it's USB there is a big chance it's 5V tho, 3V ones are more likely to be smaller than that and be in wireless controllers.
        There are even motors that work with 7~9V in the PS2 Dual shock controllers, but they are turning a bit slow and weak with the arduino :lol

        you are certainly more experienced than me ...: D

        3v
        https://photos.app.goo.gl/JJTsMyCCysG7KhtG6 (https://photos.app.goo.gl/JJTsMyCCysG7KhtG6)

        5v
        https://photos.app.goo.gl/PH7Vb4YhUWR5b7jbA (https://photos.app.goo.gl/PH7Vb4YhUWR5b7jbA)

        it seems that at 5v it is much faster ... does this mean that it must go to 5v or that it is in overvoltage and therefore it turns faster?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 11, 2020, 08:21:14 pm
        Sorry I forgot that the windows resolution is not 1024x240 but 1024x480: D

        the 2 LEDs are seen almost superimposed and I think that's how it should be, by tilting the gun, however, they divide and widen if point downwards there is a black point that moves and then the movements are reversed, that is, if point in top the LEDs move downwards etc. and the central white point seems to be decentralized on the right and the colored LEDs too far from the sides
        https://photos.app.goo.gl/jFTm9qQSpsoyB2Xb6 (https://photos.app.goo.gl/jFTm9qQSpsoyB2Xb6)
        It's a normal behavior, it doesn't see 2 LEDs for each of the 4 points(the maximum LEDs this cam can pick up is 4)
        The duplicated slightly grayish ones you can see are not real LED points, they are only there to show the result of the tilt correction made by the firmware.
        So they should always stay horizontal.
        It's just a way of checking if everything is working normally;
        Their position doesn't matter, but if those start being twisted of flipped, then is something wrong.
        https://photos.app.goo.gl/bUEDRdhdgwJJy2rT9 (https://photos.app.goo.gl/bUEDRdhdgwJJy2rT9)


        but the black dots indicate that there is a problem with the detection of the leds?
        Not necessarily, it just means the system can see it, but doesn't know which of the 4 LEDs it is yet (Top, bottom, left, right).
        It's normal when seeing only one led after aiming offrange.

        But I just realized something funny: your gun is clearly picking up the scrolling light under your cab, and it messes with it  :laugh2:
        I'm still not an electronic specialist, but if I was you I would start powering them with a couple of AA batteries (so a total of 3~3.3V) to check how well they turn.
        And then try with a 5V power to see if they seem to turn faster/too fast.
        Motors have quite a good tolerance for over voltage usually, so it shouldn't blow up or anything.
        If it's USB there is a big chance it's 5V tho, 3V ones are more likely to be smaller than that and be in wireless controllers.
        There are even motors that work with 7~9V in the PS2 Dual shock controllers, but they are turning a bit slow and weak with the arduino :lol

        you are certainly more experienced than me ...: D

        3v
        https://photos.app.goo.gl/JJTsMyCCysG7KhtG6 (https://photos.app.goo.gl/JJTsMyCCysG7KhtG6)

        5v
        https://photos.app.goo.gl/PH7Vb4YhUWR5b7jbA (https://photos.app.goo.gl/PH7Vb4YhUWR5b7jbA)

        it seems that at 5v it is much faster ... does this mean that it must go to 5v or that it is in overvoltage and therefore it turns faster?

        Yeah the 5v looks correct for me.
        Well I think the worse that can happen is frying the motor, nothing much worse (I guess  :lol)
        But again, if someone better than me at electronics can confirm that to you that would be better ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 11, 2020, 08:56:43 pm
        Yeah the 5v looks correct for me.
        Well I think the worse that can happen is frying the motor, nothing much worse (I guess  :lol)
        But again, if someone better than me at electronics can confirm that to you that would be better ;)

        In the biogun xbox I identified an LM3940IT ic which from what I read is a Low Dropout Regulator for 5V to 3.3V Conversion so I believe that the motors in these guns are 3v can I use this between the 5v of the arduino and the rumble to reduce the voltage?



        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 11, 2020, 09:02:03 pm
        But I just realized something funny: your gun is clearly picking up the scrolling light under your cab, and it messes with it  :laugh2:

        I tested the 1.66 firmware and I must say that it is almost perfect for me apart that sometimes the cursor now ends and remains hooked to the bottom side of the screen ... Could it be the lights that drive the cam ir crazy ???
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 11, 2020, 09:17:56 pm
        In the biogun xbox I identified an LM3940IT ic which from what I read is a Low Dropout Regulator for 5V to 3.3V Conversion so I believe that the motors in these guns are 3v can I use this between the 5v of the arduino and the rumble to reduce the voltage?
        If it looks like it's rated for 3V, you could use a small 5v->3v converter and connect it to the arduino 5v vcc, it should work fine.
        Do you have a breadboard to do the tests?
        I tested the 1.66 firmware and I must say that it is almost perfect for me apart that sometimes the cursor now ends and remains hooked to the bottom side of the screen ... Could it be the lights that drive the cam ir crazy ???
        It most likely is from what I could see in your last video  :lol
        Try testing the gun with the light off, or something blocking it completely.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 12, 2020, 03:38:37 am
        If it looks like it's rated for 3V, you could use a small 5v->3v converter and connect it to the arduino 5v vcc, it should work fine.
        Do you have a breadboard to do the tests?

        breadboard no but i'm have veroboard base, however in practice it would be enough for me to connect:

        (http://killone.myqnapcloud.com/sp/circuitm.jpg)
        (http://killone.myqnapcloud.com/sp/LM3.jpg)

        rumble + to pin1
        rumble - to pin2
        Motor- to pin 2
        Motor + to pin 3

        to reduce the voltage to 3.3v, is it correct?

        And regarding the solenoid, I have two only two blue cables, since it is not specified it has a positive and negative pole or is it indifferent how do I connect them to the circuit? Can I power the solenoid directly to 24v to test it without the circuit?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 12, 2020, 03:48:05 am
        rumble + to pin1
        rumble - to pin2
        Motor- to pin 2
        Motor + to pin 3

        to reduce the voltage to 3.3v, is it correct?
        Sorry I have no idea, I don't know this type of component so much  :P
        And regarding the solenoid, I have two only two blue cables, since it is not specified it has a positive and negative pole or is it indifferent how do I connect them to the circuit? Can I power the solenoid directly to 24v to test it without the circuit?
        I have one with 2 blue cables too, and it looks like there are no polarity, it probably contains a diode bridge of some sort.
        For the test yeah you can power it directly, but be very careful tho, don't shock yourself, and don't leave the solenoid activated more than 1 or 2 second (it will most likely start overheating after few seconds of leaving it hold). do you have a push button of something similar to test it?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 12, 2020, 05:34:21 am
        I have one with 2 blue cables too, and it looks like there are no polarity, it probably contains a diode bridge of some sort.
        For the test yeah you can power it directly, but be very careful tho, don't shock yourself, and don't leave the solenoid activated more than 1 or 2 second (it will most likely start overheating after few seconds of leaving it hold). do you have a push button of something similar to test it?

        You mean an onoff button? I can get it but how should I connect it then?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 12, 2020, 05:40:59 am
        You mean an onoff button? I can get it but how should I connect it then?
        Definitely not an onoff button, you don't want your solenoid to be powered too long.
        I meant a push switch, only closing the circuit when you push.
        Like the buttons in arcade controls.
        Be careful that it's strong enough to not get damaged by the 24v tho.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 12, 2020, 05:47:06 am
        I meant a push switch, only closing the circuit when you push.
        Like the buttons in arcade controls.
        Be careful that it's strong enough to not get damaged by the 24v tho.
        I have arcade ones, but how is it connected to the power supply and the solenoid? :D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 12, 2020, 06:15:35 am
        I meant a push switch, only closing the circuit when you push.
        Like the buttons in arcade controls.
        Be careful that it's strong enough to not get damaged by the 24v tho.
        I have arcade ones, but how is it connected to the power supply and the solenoid? :D
        There are many ways of doing it, but in my case I just use an adapter to connect the power supply to normal wires (see attached pic), a breadboard, few wires and an old push button I use mainly for testing.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 12, 2020, 06:30:23 am
        There are many ways of doing it, but in my case I just use an adapter to connect the power supply to normal wires (see attached pic), a breadboard, few wires and an old push button I use mainly for testing.

        yes ok  +24v e gnd of power supply to male connector and two pin blu to female connector right ? and push button where should it be placed?

        sorry but I told you that I am even less experienced than you in this field ...; D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 12, 2020, 07:15:58 am
        There are many ways of doing it, but in my case I just use an adapter to connect the power supply to normal wires (see attached pic), a breadboard, few wires and an old push button I use mainly for testing.

        yes ok  +24v e gnd of power supply to male connector and two pin blu to female connector right ? and push button where should it be placed?

        sorry but I told you that I am even less experienced than you in this field ...; D
        I use only the left one on the picture, because my power supply already has connector like on the right.
        If your power supply only have raw wires you can just connect them directly.
        The switch should be put between the 24v and the solenoid OR the GND and the solenoid, either wire is fine, it's just to close the circuit only when you push the button ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 12, 2020, 07:20:01 am
        I use only the left one on the picture, because my power supply already has connector like on the right.
        If your power supply only have raw wires you can just connect them directly.
        The switch should be put between the 24v and the solenoid OR the GND and the solenoid, either wire is fine, it's just to close the circuit only when you push the button ;)

        There! Now I understand: D ... By the way today try to cover the lights and see if the fall at the bottom of the cursor depends on that ... but which firmware should I use 1.67 or 1.66?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 12, 2020, 07:23:46 am
        * 2020/02/12 - 1.68
        - Improved the 2 points detection and optimized the other functions

        There! Now I understand: D ... By the way today try to cover the lights and see if the fall at the bottom of the cursor depends on that ... but which firmware should I use 1.67 or 1.66?
        The one I just posted  :lol

        @Foxhole
        I improved the 2 points detection, now it should pick them up more easily.
        But it might need some more testing to see if the increased tolerance didn't increase the problems with twisting offscreen ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 12, 2020, 07:38:58 am
        Thank you, i'm gonna give it a good challenge  :cheers:
        Is the IR Test also updated?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 12, 2020, 07:48:25 am
        Thank you, i'm gonna give it a good challenge  :cheers:
        Is the IR Test also updated?
        Yes both are updated.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 12, 2020, 08:00:04 am
        Yes both are updated.

        If you have time, could you make a 1024x480 version of the tool to test the LEDs? Thanks :)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 12, 2020, 08:06:25 am
        It's almost perfect now, i'm still having abnormalities now and then and since they are becoming more rare it's hard capturing it in video.
        I was playing Point Blank, everything seemed fine for 3 minutes or so, and then all of a sudden when i was aiming a bit to the lower left of the center the gun was shooting on the upper right, i think it somehow flipped the axis, though i wasn't coming from offscreen or anything, i was aiming to the lower right just a second ago and when moving to the lower left it somehow fired to the upper right. I can't seem to capture this in the IR Test, it's becoming much harder to reproduce these issues now since there are basically almost none now.
        I'm gonna try a game like lethal enforcers 2 now, to test offscreen, will let you know the results.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 12, 2020, 08:11:24 am
        The same issue happened more often in Lethal enforcers 2, i was aiming to the right edge of the screen and it fired just a tiny bit left to center, this leads me to believe it was detecting the Left LEDS and not the right LEDS.
        By the way, i think firmware 1.65 was perhaps the best for playing from afar (Over 1M), there were basically almost no issues.
        The problems occur only when trying to get closer.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 12, 2020, 08:27:04 am
        It's almost perfect now, i'm still having abnormalities now and then and since they are becoming more rare it's hard capturing it in video.
        I was playing Point Blank, everything seemed fine for 3 minutes or so, and then all of a sudden when i was aiming a bit to the lower left of the center the gun was shooting on the upper right, i think it somehow flipped the axis, though i wasn't coming from offscreen or anything, i was aiming to the lower right just a second ago and when moving to the lower left it somehow fired to the upper right. I can't seem to capture this in the IR Test, it's becoming much harder to reproduce these issues now since there are basically almost none now.
        I'm gonna try a game like lethal enforcers 2 now, to test offscreen, will let you know the results.
        Glad it's becoming better!  :cheers:
        Thanks for your testing, I think I know what might have happened when you had the issue.
        There might have been a small tracking error, then it tried to recalibrate and failed.
        This kind of errors are prone to happen the closer you get from the screen, but I guess it's also a good way to test the reliability of the system  :lol
        I really which we had better cam/sensor to work with haha


        If you have time, could you make a 1024x480 version of the tool to test the LEDs? Thanks :)
        I'm actually doing another version that can work with pretty much any resolution/COM port ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 12, 2020, 08:28:52 am
        The same issue happened more often in Lethal enforcers 2, i was aiming to the right edge of the screen and it fired just a tiny bit left to center, this leads me to believe it was detecting the Left LEDS and not the right LEDS.
        By the way, i think firmware 1.65 was perhaps the best for playing from afar (Over 1M), there were basically almost no issues.
        The problems occur only when trying to get closer.
        Gotcha. So is this issue the same as before or kind of new with the last firmware?
        The 1.65 was better from afar?

        Edit: what mainly changed from the 1.65 version is that now the detection resets if there are tracking errors, and the 2 leds detection is far more forgiving (but a bit less precise).
        So both of those fixes are correcting misdetection issues but might also lead to some other misdetection.
        At this point it's mainly trying to find the balance between tolerance and risks of errors  ;D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 12, 2020, 08:32:53 am
        The same issue happened more often in Lethal enforcers 2, i was aiming to the right edge of the screen and it fired just a tiny bit left to center, this leads me to believe it was detecting the Left LEDS and not the right LEDS.
        By the way, i think firmware 1.65 was perhaps the best for playing from afar (Over 1M), there were basically almost no issues.
        The problems occur only when trying to get closer.
        Gotcha. So is this issue the same as before or kind of new with the last firmware?
        The 1.65 was better from afar?
        I think it was also in the older firmwares but we didn't pay too much attention to it because we believed it to be due to the offscreen.
        1.65 was pretty stable because 2 point detection was off, so there were less mistakes when playing from afar.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 12, 2020, 08:34:34 am
        If you'd like i can test firmware 1.65 more extensively from afar to see how it holds up in long gaming sessions.
        I think i'll try it on House of the dead 3.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 12, 2020, 08:35:37 am
        I think it was also in the older firmwares but we didn't pay too much attention to it because we believed it to be due to the offscreen.
        1.65 was pretty stable because 2 point detection was off, so there were less mistakes when playing from afar.
        Indeed, the 2 points detection is great to aim in corners but obviously more prone to errors if there are any tracking issues :banghead:
        If you'd like i can test firmware 1.65 more extensively from afar to see how it holds up in long gaming sessions.
        I think i'll try it on House of the dead 3.
        Ah, house of the dead 3, a very nice one to test ;D
        If you don't mind I will give you a test version of the last 1.68 firmware, but with the detection reset trigger a bit less sensitive, to see if it works better :P
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 12, 2020, 08:36:27 am
        Do you think making this system an 8 point system would allow better stability when playing close?
        What i mean about 8 point is to add leds on the corners of the screen.
        Never mind, just remembered that the dfrobot can only track 4 points.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 12, 2020, 08:41:43 am
        If you don't mind I will give you a test version of the last 1.68 firmware, but with the detection reset trigger a bit less sensitive, to see if it works better :P
        No problem, let me know when it's up and i'll try it.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 12, 2020, 08:50:20 am
        Do you think making this system an 8 point system would allow better stability when playing close?
        What i mean about 8 point is to add leds on the corners of the screen.
        Never mind, just remembered that the dfrobot can only track 4 points.
        Yeah I really wish this cam could see more than 4 points at a time, it would be far better.
        I'm actually also working on another solution with the same hardware to use 8 or more leds.
        But it would require to have a sync wire going from the led system to the gun, and another external arduino to pilot the leds.
        I gave up on it for now, but it might be a possible update to this 4 led system (you can reuse the same hardware with small modifications).

        Anyway, here is the test firmware, I included both firmwares in the zip file (don't mind about the version number):
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 12, 2020, 09:08:35 am
        Will try this firmware.
        Would also like to mention that i played HOD3 almost to the finish with the 1.65 firmware and it was extremely good.
        There was only one occasion when the cursor got stuck on the upper edge of the screen for no reason, but it fixed itself once i waved the gun,
        but so far, in my opinion, firmware 1.65 is probably the best for playing afar.
        gonna try the test firmware now.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 12, 2020, 09:16:45 am
        That cool this firmware ...: D
        I only noticed that the cursor seems to wobble more than before and in 10 minutes of the mame game (I always use Time crisis as a test) I also had the problem after 3-4 min that the cursor pointing to a point has moved in my case on the left but it happened only once and then it happens but now rarely see the duplicate cursor but for a moment and only if you point to the various sides of the screen, and it never happened to me during the action but only by moving the gun during the interludes ... We are close to perfection! :) Great JayBee!
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 12, 2020, 09:21:52 am
        Will try this firmware.
        Would also like to mention that i played HOD3 almost to the finish with the 1.65 firmware and it was extremely good.
        There was only one occasion when the cursor got stuck on the upper edge of the screen for no reason, but it fixed itself once i waved the gun,
        but so far, in my opinion, firmware 1.65 is probably the best for playing afar.
        gonna try the test firmware now.
        That's good to know! I wonder if I should disable the 2 points detection automatically when playing from afar.
        I'm joking, but that would be a solution worth considering if it's really better :lol
        But still, without the 2 points solution, even from afar it might not be so great aiming in corners after aiming offscreen.

        That cool this firmware ...: D
        I only noticed that the cursor seems to wobble more than before and in 10 minutes of the mame game (I always use Time crisis as a test) I also had the problem after 3-4 min that the cursor pointing to a point has moved in my case on the left but it happened only once and then it happens but now rarely see the duplicate cursor but for a moment and only if you point to the various sides of the screen, and it never happened to me during the action but only by moving the gun during the interludes ... We are close to perfection! :) Great JayBee!
        Awesome! We are almost there! ;D
        Yeah now that it's more stable I will correct the wobble a little bit.
        If still too much wobble I might also add a cursor smoothing option, but disable by default since it will add some latency.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 12, 2020, 09:37:31 am
        If you have time, could you make a 1024x480 version of the tool to test the LEDs? Thanks :)
        I updated the pde file inside the test zip file, now you can edit 3 parameters at the beginning to setup your own com port and resolution ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 12, 2020, 10:16:25 am
        Ok, i tested the new firmware from close distance, and i edited the video to highlight the issues.
        https://drive.google.com/open?id=1LijcW2NvTcthuvfSOxIeua8TS7CV4YIv (https://drive.google.com/open?id=1LijcW2NvTcthuvfSOxIeua8TS7CV4YIv)
        In the first part, you will see the gun firing to the left while aiming right.
        Second part, you will see the gun shooting offscreen when trying to shoot the cannonball.
        In the third part, in the ir test, you will see the cursor getting stuck.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 12, 2020, 11:21:19 am
        Ok, i tested the new firmware from close distance, and i edited the video to highlight the issues.
        https://drive.google.com/open?id=1LijcW2NvTcthuvfSOxIeua8TS7CV4YIv (https://drive.google.com/open?id=1LijcW2NvTcthuvfSOxIeua8TS7CV4YIv)
        In the first part, you will see the gun firing to the left while aiming right.
        Second part, you will see the gun shooting offscreen when trying to shoot the cannonball.
        In the third part, in the ir test, you will see the cursor getting stuck.
        Very interesting to watch the video frame by frame to see what's going on!  :cheers:
        So the first two are caused by this damn 2 leds detection that don't like so much being so close to the screen either, I can clearly see how it's misdetecting them :banghead:

        For the last part, I just noticed something, during just one frame you see the bottom IR point jumping on the right, which causes the detection error (the test tool has 2 frames delay more than the cursor, so you can see it happening 2 frames after the cursor stops).
        It looks like the IR cam picked up something else, like a reflection of the leds on something?
        I guess the tolerance on this kind of wrong detection is a bit too low, I made a test firmware, it seems a bit better with it now?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 12, 2020, 11:50:21 am
        For the last part, I just noticed something, during just one frame you see the bottom IR point jumping on the right, which causes the detection error (the test tool has 2 frames delay more than the cursor, so you can see it happening 2 frames after the cursor stops).
        It looks like the IR cam picked up something else, like a reflection of the leds on something?
        Hmm, reflection... the monitor is on a glass table.
        that might be it.
        I'm gonna cover the area of the monitor with something to cover the glass, and i'll try the new firmware.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 12, 2020, 12:00:39 pm
        For the last part, I just noticed something, during just one frame you see the bottom IR point jumping on the right, which causes the detection error (the test tool has 2 frames delay more than the cursor, so you can see it happening 2 frames after the cursor stops).
        It looks like the IR cam picked up something else, like a reflection of the leds on something?
        Hmm, reflection... the monitor is on a glass table.
        that might be it.
        I'm gonna cover the area of the monitor with something to cover the glass, and i'll try the new firmware.
        Oh I see!
        Yeah, now that we get a quite stable system is mostly tweaking and improvement.
        To be honest I'm already quite happy with the result, whereas I have been told few time that doing a 4 leds system like that was impossible  :blah:
        Funny thing that's the "impossible" that made me want to do it  :cheers:
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 12, 2020, 01:04:02 pm
        Well, bad news  :-\
        covered the area up, but still issues.
        Do you need a video, or at this point there's no use?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 12, 2020, 01:10:39 pm
        I updated the pde file inside the test zip file, now you can edit 3 parameters at the beginning to setup your own com port and resolution ;)
        the one on the front page?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 12, 2020, 01:13:24 pm
        Yeah now that it's more stable I will correct the wobble a little bit.
        If still too much wobble I might also add a cursor smoothing option, but disable by default since it will add some latency.

        the oscillation is minimal so if you correct only a little it will be fine: D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 12, 2020, 01:14:34 pm
        Kill_one, what is the distance between your gun and the LEDS?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 12, 2020, 01:20:40 pm
        Kill_one, what is the distance between your gun and the LEDS?


        about 1mt, something more something less, having a 25 "arcade monitor it's okay I don't need to move away or get closer :)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 12, 2020, 01:26:47 pm
        https://photos.app.goo.gl/h7n7cBqrzTkwGjpRA (https://photos.app.goo.gl/h7n7cBqrzTkwGjpRA)


        because the leds top and right are not as bright as the others ?

        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 12, 2020, 01:50:43 pm
        Firmware 1.68 works AMAZING from afar. (1~1.2M)
        I was actually able to finish expert mode on point blank with the firmware.
        I was able to do that only with a CRT Lightgun, never with an aimtrak or topgun, and i was actually playing closer when i was using the CRT Lightgun (Guncon).
        I'm referring to the 1.68 firmware that is on the first page, not the test version.
        As far as playing closer, i guess it's just not possible with this hardware, but you have accomplished an amazing work nonetheless.
        though there's one thing i didn't test, and that is a larger screen.
        Up until now i was using a 24" pc monitor, how far would i have to be for a 55" Oled? And will it work as reliably as the 24" monitor?
        Hmm, definitely requires more testing.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 12, 2020, 07:22:07 pm
        Tested the gun on a 42" inch 16:9 plasma.
        In order to get a solid gaming session the gun had to be distanced at 2.3~2.4 meter, that means i was at about 3M away from the screen. To be honest, i stretched the game to 16:9, otherwise it would be very hard to play.
        If i try to get closer and rely on 2 point detection, then the aame issues i had at the videos start to happen.
        All in all, it's definitely better than a topgun or an aimtrak, no doubt.
        If i was building a cabinet i would definitely go with this solution or maybe the sinden, though the sinden hasn't been tested yet by the community, so who knows what problems it may have.
        JayBee, what are your plans, now? You said you are working on a software for the gun?
        By the way, what's your paypal? I'd like to donate.
        If you don't feel comfortable writing it on the forums feel free to pm me.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 12, 2020, 08:31:10 pm
        Tested the gun on a 42" inch 16:9 plasma.
        In order to get a solid gaming session the gun had to be distanced at 2.3~2.4 meter, that means i was at about 3M away from the screen. To be honest, i stretched the game to 16:9, otherwise it would be very hard to play.
        If i try to get closer and rely on 2 point detection, then the aame issues i had at the videos start to happen.
        All in all, it's definitely better than a topgun or an aimtrak, no doubt.
        If i was building a cabinet i would definitely go with this solution or maybe the sinden, though the sinden hasn't been tested yet by the community, so who knows what problems it may have.
        JayBee, what are your plans, now? You said you are working on a software for the gun?
        By the way, what's your paypal? I'd like to donate.
        If you don't feel comfortable writing it on the forums feel free to pm me.
        I'm glad we got it working the way it is, thanks for your careful testing it really helped  :cheers:
        Yeah the distance sounds about right, on my 42" screen the minimum working distance is 1.2 meter, but indeed the best working distance is more far.
        I had an idea to improve that tho, I made my firmware to support mamehooker integration, allowing me to change the gun settings on a game basis.
        Some games don't require to shot in angles, or don't have offscreen reload (always aiming onscreen).
        So with those games I could add an option to automatically disable the 2 leds detection, which would then decrease the errors a lot. Or disable the 2 leds detection by default and enable it only for games that need it.
        Or enable it only if the distance is far enough from the IR leds... So far without MameHooker that would be the easiest solution.
        I will think about it  :lol

        Next in my roadmap:
        - add a bit more of aim precision back to reduce wobble
        - add a user define screen aspect ratio. It should help with the whole detection process and simplify usage.
        - design rumble and solenoid schematics for the first post
        - add a cursor smoothing option for people who want a very stable cursor (it will be disabled by default, because it adds some latency)
        - improve the button management function for more optimization/customization
        - finally add the support for temperature sensor, to regulate the solenoid speed and keep it cool
        - improve the MameHooker integration, for feedback triggered by the games themselves, and various other options
        - add an option to always hold the secondary button when aiming onscreen, activated only when playing a game with cover system like Time Crisis (to play without pedal)
        - create a user friendly tool with a nice UI to change all of the gun parameters (default modes, options, mapping, screen ratio...)
        - add various other options and polish all the system until it's the best consumer lightgun system ever  8)
        - go to the next projects (Kaimana arcade button light system custom firmware, Arduino light system...)

        Still many things and fun ahead, right? :D

        https://photos.app.goo.gl/h7n7cBqrzTkwGjpRA (https://photos.app.goo.gl/h7n7cBqrzTkwGjpRA)
        because the leds top and right are not as bright as the others ?
        Wait, I still see your cab scrolling light under the stick, the one that messes up with the gun. You didn't hide/switched it off?  :lol
        Also yeah, on cam the right and upper leds and very dim, maybe still not good angle?

        Edit: I added a donate link in the first post and my signature  :cheers:
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 12, 2020, 09:34:09 pm
        Wait, I still see your cab scrolling light under the stick, the one that messes up with the gun. You didn't hide/switched it off?  :lol
        Also yeah, on cam the right and upper leds and very dim, maybe still not good angle?
        Then covered or did not do the same problem and that is it moves down but rarely with the latest firmware: D

        How can I go about arranging those LEDs better?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 12, 2020, 10:11:28 pm
        Then covered or did not do the same problem and that is it moves down but rarely with the latest firmware: D

        How can I go about arranging those LEDs better?
        You mean it doesn't change when covered? It has to be fully covered (no light should pass through) or switched off anyway, the IR cam is clearly still picking up this scrolling light ;)

        If you can add one more led by point like Foxhole did (don't forget to change the resistor), and be sure the led are all pointing forward, it should work better.

        Edit: by the way I made a fullscreen version of the led test tool, I will upload it later ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 13, 2020, 03:46:17 am
        You mean it doesn't change when covered? It has to be fully covered (no light should pass through) or switched off anyway, the IR cam is clearly still picking up this scrolling light ;)
        yes, works the same way covered the leds or not...

        If you can add one more led by point like Foxhole did (don't forget to change the resistor), and be sure the led are all pointing forward, it should work better.

        what resistance would it take then? and would the 5v 1a power supply suffice?

        could the fact of the dim light of the upper and right LEDs be that sometimes the cursor duplicates or moves?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 13, 2020, 05:25:03 am
        yes, works the same way covered the leds or not...
        I see. Well you have to cover them anyway since the IR cam is picking them up, it will never work correctly if the cam is seeing more than the needed 4 led points :lol
        You don't have a switch to simply turn it off?

        what resistance would it take then? and would the 5v 1a power supply suffice?

        could the fact of the dim light of the upper and right LEDs be that sometimes the cursor duplicates or moves?
        Wait, before building more hardware let's do a bit more testing with your current setup to be sure of what to do.
        Can you cover the bottom scrolling lights, launch the test tool, and slowly move from one screen angle to the other with your gun?
        I will post the fullscreen tool soon, it will be more convenient for you.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 13, 2020, 05:59:04 am
        @kill_one
        I added the fullscreen test tool in the main post ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 13, 2020, 06:08:10 am
        @kill_one
        I added the fullscreen test tool in the main post ;)

        Great! I'll try it as soon as I get home, you don't have to set the resolution right?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 13, 2020, 06:32:27 am
        Great! I'll try it as soon as I get home, you don't have to set the resolution right?
        Yes, it should work no matter the resolution ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 13, 2020, 09:21:23 am
        Yes, it should work no matter the resolution ;)
        Last firmware test not work... It's normal
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 13, 2020, 09:31:23 am
        Yes, it should work no matter the resolution ;)
        Last firmware test not work... It's normal
        What do you mean by not working?
        I just tested both the last firmware with the last fullscreen tool, it works perfectly.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 13, 2020, 10:11:25 am
        Yes, it should work no matter the resolution ;)
        Last firmware test not work... It's normal
        What do you mean by not working?
        I just tested both the last firmware with the last fullscreen tool, it works perfectly.
        flashing the attached test firmware does not show the LEDs but only the mouse cursor, I attach the link to the video
        https://photos.app.goo.gl/L5QZzyAWVCAgy99b7 (https://photos.app.goo.gl/L5QZzyAWVCAgy99b7)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 13, 2020, 10:16:16 am
        Yes, it should work no matter the resolution ;)
        Last firmware test not work... It's normal
        What do you mean by not working?
        I just tested both the last firmware with the last fullscreen tool, it works perfectly.
        flashing the attached test firmware does not show the LEDs but only the mouse cursor, I attach the link to the video
        https://photos.app.goo.gl/L5QZzyAWVCAgy99b7 (https://photos.app.goo.gl/L5QZzyAWVCAgy99b7)
        Did you change the com port to match yours? (It changes alone sometime)
        And by the way why do you have a crosshair ? Is that a Windows cursor? :lol
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 13, 2020, 10:22:15 am
        Did you change the com port to match yours? (It changes alone sometime)
        you're right I forgot to edit port com port in the pde file ... try again tonight! : D
        And by the way why do you have a crosshair ? Is that a Windows cursor? :lol
        yes... :D i use this https://www.deviantart.com/zarpex/art/Weapon-Crosshair-Cursor-Pack-299011995 (https://www.deviantart.com/zarpex/art/Weapon-Crosshair-Cursor-Pack-299011995)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 13, 2020, 10:25:25 am
        Did you change the com port to match yours? (It changes alone sometime)
        you're right I forgot to edit port com port in the pde file ... try again tonight! : D
        And by the way why do you have a crosshair ? Is that a Windows cursor? :lol
        yes... :D i use this https://www.deviantart.com/zarpex/art/Weapon-Crosshair-Cursor-Pack-299011995 (https://www.deviantart.com/zarpex/art/Weapon-Crosshair-Cursor-Pack-299011995)
        That's a really cool cursor pack! I'm going to try it on my arcade PC :D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 13, 2020, 10:27:03 am
        I have to put this string "myPort = new Serial (this, "COM1", 9600);" otherwise it doesn't work
        In my opinion you should put a note on this on the first page ...: D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 13, 2020, 10:35:36 am
        I have to put this string "myPort = new Serial (this, "COM1", 9600);" otherwise it doesn't work
        In my opinion you should put a note on this on the first page ...: D
        No no, you just have a value to modify at the beginning of the pde file now, there is even an explanation written in it ;)
        The "comPort" value. Replace the 0 by whatever your port number is.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 13, 2020, 10:38:13 am
        I have to put this string "myPort = new Serial (this, "COM1", 9600);" otherwise it doesn't work
        In my opinion you should put a note on this on the first page ...: D
        No no, you just have a value to modify at the beginning of the pde file now, there is even an explanation written in it ;)
        The "comPort" value. Replace the 0 by whatever your port number is.
        ah ok! thanks
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 13, 2020, 10:48:52 am
        Did you change the com port to match yours? (It changes alone sometime)
        you're right I forgot to edit port com port in the pde file ... try again tonight! : D
        And by the way why do you have a crosshair ? Is that a Windows cursor?
        yes... :D i use this https://www.deviantart.com/zarpex/art/Weapon-Crosshair-Cursor-Pack-299011995 (https://www.deviantart.com/zarpex/art/Weapon-Crosshair-Cursor-Pack-299011995)
        That's a really cool cursor pack! I'm going to try it on my arcade PC :D
        Yep, is very cool! I love it ;)

        Inviato dal mio Redmi Note 5 utilizzando Tapatalk

        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 14, 2020, 04:26:56 am
        https://photos.app.goo.gl/24YUJ6pBf3WQqWne6 (https://photos.app.goo.gl/24YUJ6pBf3WQqWne6)

        here you find various tests that I did yesterday, I have not yet figured out whether the points should be there or not, however in the game it works very well apart from time to time a duplicate cursor comes out for a second but it does it mainly in the interludes almost never during the game action, and I noticed that it does even if the gun points to the center of the screen, I think it may depend on the side and top LEDs that are less bright than the lower ones, it can center that the direct current reaches them and the others are connected to these in cascade?
        Or could it be that the resistance is not working properly?

        even if in the test the points see them all 4 so I have no idea why they are so dim
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 14, 2020, 05:29:07 am
        https://photos.app.goo.gl/24YUJ6pBf3WQqWne6 (https://photos.app.goo.gl/24YUJ6pBf3WQqWne6)

        here you find various tests that I did yesterday, I have not yet figured out whether the points should be there or not, however in the game it works very well apart from time to time a duplicate cursor comes out for a second but it does it mainly in the interludes almost never during the game action, and I noticed that it does even if the gun points to the center of the screen, I think it may depend on the side and top LEDs that are less bright than the lower ones, it can center that the direct current reaches them and the others are connected to these in cascade?
        Or could it be that the resistance is not working properly?

        even if in the test the points see them all 4 so I have no idea why they are so dim
        I think the dim leds are more because of the angle, on your tests it seems to be picking them up ok.
        But I can see a bit more what's happening now; the camera is picking up points that aren't there, on the left and right side.
        I suspect that the LEDs are being reflected on the inner sides of your cabinet.
        Can you try orient the left and right LEDs a bit more towards the center? Or maybe for testing purposes you can put some tape on them on the outer side (or put some clothes to avoid reflection). and see if it's any better.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 14, 2020, 11:56:31 am
        I think the dim leds are more because of the angle, on your tests it seems to be picking them up ok.
        But I can see a bit more what's happening now; the camera is picking up points that aren't there, on the left and right side.
        I suspect that the LEDs are being reflected on the inner sides of your cabinet.
        Can you try orient the left and right LEDs a bit more towards the center? Or maybe for testing purposes you can put some tape on them on the outer side (or put some clothes to avoid reflection). and see if it's any better.
        tonight i try.. ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 14, 2020, 01:11:39 pm
        OK! IRL540 mosfets have arrived, I have changed the connections, can you tell me if everything is ok? thank you very much :) rather arigato gozaimasu!!! :D
        (http://killone.myqnapcloud.com/sp/soleno.jpg)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 15, 2020, 09:07:46 am
        * 2020/02/15 - 1.70
        - restored the cursor accuracy without increasing the load, it should eliminate most wobbles
        - put everything in only one zip and renamed the batches file for more clarity.


        OK! IRL540 mosfets have arrived, I have changed the connections, can you tell me if everything is ok? thank you very much :) rather arigato gozaimasu!!! :D
        Yes, it looks ok!  :applaud:
        In the version 1.7 I restored the cursor accuracy, now it should be as smooth as before ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 15, 2020, 09:49:20 am
        I don't know if this is happening only to me or if it's an issue with the code or the arduino itself but i have noticed some issues.
        The first one isn't a big deal but i think i should mention, sometimes after flashing a firmware the gun barely works, basically messing up with the detection and just works very strangely.
        A simple unplug and replug of the usb cable fixes it. Is that happening only to me? This isn't consistent though, sometimes it works just fine.
        The second issue, which is a bigger deal, is that sometimes when trying to change modes with the gun, basically pressing the calibration button or disabling off screen button 2, it will sometimes cause the gun to get completely stuck, forcing either to unplug and replug the gun or sometimes it's just enough to get the gun to its former state, for example if the gun was set to 16:9 mode and then i try and change to 4:3 in 16:9 the gun will get stuck, pressing the calibration button once again doesn't help since it's now changing to 4:3 mode, but if i press twice, bringing me back to 16:9 mode, it then starts working again, but of course i still have to replug the gun if i want to get to 4:3 in 16:9 mode.
        The same issue happens when disabling offscreen reload (Mouse Button 2).
        I haven't tested changing the settings with mamehooker, i'm only using the buttons for now.
        Have you had this issue, JayBee? Any ideas what's causing this? The arduino perhaps? i'm using sparkfun brand arduino.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 15, 2020, 11:45:19 am
        I don't know if this is happening only to me or if it's an issue with the code or the arduino itself but i have noticed some issues.
        The first one isn't a big deal but i think i should mention, sometimes after flashing a firmware the gun barely works, basically messing up with the detection and just works very strangely.
        A simple unplug and replug of the usb cable fixes it. Is that happening only to me? This isn't consistent though, sometimes it works just fine.
        The second issue, which is a bigger deal, is that sometimes when trying to change modes with the gun, basically pressing the calibration button or disabling off screen button 2, it will sometimes cause the gun to get completely stuck, forcing either to unplug and replug the gun or sometimes it's just enough to get the gun to its former state, for example if the gun was set to 16:9 mode and then i try and change to 4:3 in 16:9 the gun will get stuck, pressing the calibration button once again doesn't help since it's now changing to 4:3 mode, but if i press twice, bringing me back to 16:9 mode, it then starts working again, but of course i still have to replug the gun if i want to get to 4:3 in 16:9 mode.
        The same issue happens when disabling offscreen reload (Mouse Button 2).
        I haven't tested changing the settings with mamehooker, i'm only using the buttons for now.
        Have you had this issue, JayBee? Any ideas what's causing this? The arduino perhaps? i'm using sparkfun brand arduino.

        The first issue is a bit weird, but I think I did have the same thing sometimes.
        I will try to search where it's coming from, if anybody has the same thing with other arduino sketches.

        For the second one, I just realized what's happening, I added the offscreen mode switch a bit fast earlier, and it might be conflicting with the other calibration button functions.
        Short version: when switch the offscreen mode without pointing the screen, it might change the input mode as well ::)

        Long version if you are interested:
        The calibration button has 5 different functions:
        Single push => change screen mode
        Hold for few seconds => do calibration
        Hold Trigger button then single push => change the offscreen shot mode
        Hold A button then single push => change the input mode
        But if you press the trigger offscreen, it sees it as the A button, so the firmware sees it has A + calibration button, and changes the input mode instead ::)
        I definitely have to fix that :P

        But it's strange if it's also happening when you do a single push, I never had that.
        Reworking the button management is actually what I am doing right now, to make it more robust/bug free, and prepare it for future customization.
        So it should solve this kind of bugs.

        There 2 upcoming feature that might help with this kind of issues too;
        - being able to input your own screen aspect ratio in the arduino eeprom, then you would have only 2 modes, fullscreen content, and 4:3 content. Easier to switch.
        - adding support for a RGB led, that will be used for both seeing the status of the gun (blinking led with different colors for each mode and settings) and also feedback (fire, reload blink and more with mamehooker).
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 16, 2020, 03:03:25 am
        * 2020/02/16 - 1.75
        - fixed the combo buttons functions (joystick mode, offscreen shot...)
        - reworked the buttons management to decrease risks of bugs and future-proof it
        - did a lot of small optimization to increase the execution speed.
        - changed the zip file, firmware name and flash bat again, now you can know which firmware you have, and choose between normal and test firmware. Please don't mix with the previous files.

        @FoxHole
        This update should fix the second issue you've been having ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 16, 2020, 05:45:18 am
        * 2020/02/16 - 1.75
        - fixed the combo buttons functions (joystick mode, offscreen shot...)
        - reworked the buttons management to decrease risks of bugs and future-proof it
        - did a lot of small optimization to increase the execution speed.
        - changed the zip file, firmware name and flash bat again, now you can know which firmware you have, and choose between normal and test firmware. Please don't mix with the previous files.

        @FoxHole
        This update should fix the second issue you've been having ;)
        Thanks, JayBee, i haven't fully tested this firmware yet but i did run into two issues that i haven't faced before.
        First one is that i tried to recalibrate the sensor and after recalibrating, it didn't show the new value until i unplugged and replugged the usb.
        Second one is related to the first one, after the calibration process, the trigger button is stuck, forcing unplugging and replugging of the usb.
        Just to be clear, i used the same steps as on the first page to calibrate, Hold Cal Button -> shoot the cursor when it's on the middle -> press cal button again for brief moment.
        I'll let you know about other issues if there are any.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 16, 2020, 06:15:05 am
        Thanks, JayBee, i haven't fully tested this firmware yet but i did run into two issues that i haven't faced before.
        First one is that i tried to recalibrate the sensor and after recalibrating, it didn't show the new value until i unplugged and replugged the usb.
        Second one is related to the first one, after the calibration process, the trigger button is stuck, forcing unplugging and replugging of the usb.
        Just to be clear, i used the same steps as on the first page to calibrate, Hold Cal Button -> shoot the cursor when it's on the middle -> press cal button again for brief moment.
        I'll let you know about other issues if there are any.
        Thanks for the bug report!  :cheers:
        Yes you are right, seems like the new button management is having some bugs with the calibration process.
        Gonna fix that tonight!
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 16, 2020, 08:10:36 am
        Your idea with the RGB Led got me thinking. Do you think you could program the LED to blink when the gun is too close to the screen or too far?
        That way when using it you won't need to mess around with the distance too much and make it easier to know where's the perfect distance.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 16, 2020, 09:16:55 am
        Your idea with the RGB Led got me thinking. Do you think you could program the LED to blink when the gun is too close to the screen or too far?
        That way when using it you won't need to mess around with the distance too much and make it easier to know where's the perfect distance.
        That would totally be possible once implemented!
        And actually a great idea, I can make the led blink red when it has trouble picking up the leds correctly and when too far/too close.
        I also want to use it in the test firmware, for instance to display a different color depending on the number of leds detected.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 16, 2020, 09:21:03 am
        Yes, it looks ok!  :applaud:
        In the version 1.7 I restored the cursor accuracy, now it should be as smooth as before ;)
        After covering the side walls of the cabinet in correspondence with the LEDs and moving them more towards the center including the upper ones (finally they have the same brightness) with the test firmware I have not encountered more recognition errors, no black or gray point . : D It works very well, with firmware 1.70 I finished Time Crisis without any error or false detection of the cursor ...: D Even with the Bezel glass, obviously I have to cover all the bright LEDs because if the gun points any light it detects a point black ... Would it be possible to implement something that stops ir detection when it goes directly below the lower leds? Another problem I have and has been doing since the first version is that sometimes pressing the A key causes the mame to switch to window mode.

        https://photos.app.goo.gl/6uXxnmVPUGW2mBTW8 (https://photos.app.goo.gl/6uXxnmVPUGW2mBTW8)

        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 16, 2020, 07:36:08 pm
        OK! IRL540 mosfets have arrived, I have changed the connections, can you tell me if everything is ok? thank you very much :) rather arigato gozaimasu!!! :D
        (http://killone.myqnapcloud.com/sp/soleno.jpg)
        The circuit for the rumble works perfectly, this for the solenoid does not give me signs of life ... I have already verified that the 24v arrive at the circuit and I also changed the resistance of 10k with that of 100k thinking that was the problem ... does the solenoid work correctly if i connect it directly to the 24v power supply where am i wrong or what is missing? : D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 16, 2020, 07:49:41 pm
        Yes, it looks ok!  :applaud:
        In the version 1.7 I restored the cursor accuracy, now it should be as smooth as before ;)
        After covering the side walls of the cabinet in correspondence with the LEDs and moving them more towards the center including the upper ones (finally they have the same brightness) with the test firmware I have not encountered more recognition errors, no black or gray point . : D It works very well, with firmware 1.70 I finished Time Crisis without any error or false detection of the cursor ...: D Even with the Bezel glass, obviously I have to cover all the bright LEDs because if the gun points any light it detects a point black ... Would it be possible to implement something that stops ir detection when it goes directly below the lower leds? Another problem I have and has been doing since the first version is that sometimes pressing the A key causes the mame to switch to window mode.

        https://photos.app.goo.gl/6uXxnmVPUGW2mBTW8 (https://photos.app.goo.gl/6uXxnmVPUGW2mBTW8)
        Glad it's finally working for you!
        Sadly there are no way of detecting unusual IR Points, the camera only detects 4 points at a time and doesn't know which is which.
        The recognition is fully done in the Arduino.
        Right now the Arduino resets the recognition every time is sees a led where it shouldn't see one, which helps correcting lot of errors.
        But seeing those errors will still cause instability of the whole tracking system.

        Envoyé de mon Pixel 3 en utilisant Tapatalk

        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 16, 2020, 07:52:38 pm
        OK! IRL540 mosfets have arrived, I have changed the connections, can you tell me if everything is ok? thank you very much :) rather arigato gozaimasu!!! :D
        (http://killone.myqnapcloud.com/sp/soleno.jpg)
        The circuit for the rumble works perfectly, this for the solenoid does not give me signs of life ... I have already verified that the 24v arrive at the circuit and I also changed the resistance of 10k with that of 100k thinking that was the problem ... does the solenoid work correctly if i connect it directly to the 24v power supply where am i wrong or what is missing? : D
        Do you have a continuity tester or a multimeter to test every connection?
        And did you try swapping the solenoid polarity?
        If nothing works, I would recommend you to start fresh, on a new pcb, this one looks in pretty bad shape.

        Envoyé de mon Pixel 3 en utilisant Tapatalk
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 17, 2020, 02:30:38 am
        Do you have a continuity tester or a multimeter to test every connection?
        And did you try swapping the solenoid polarity?
        If nothing works, I would recommend you to start fresh, on a new pcb, this one looks in pretty bad shape.
        Yes, i have multimeter, how test every connection? I tested if the 24v came and ok, swapping the polarity too, and I redone the pcb with new components and using another solenoid, same problem, could you post some photos of the circuit you made? And tell me how to test the various connections? Thanks
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 17, 2020, 04:36:46 am
        (http://killone.myqnapcloud.com/sp/sole.jpg)

        where's the error? It all seems correct to me as connections ... could it be the arduino pin that is not working at this point?
        the solenoid directed to the power supply works..
        I have no idea of ​​the problem otherwise... :dunno  :banghead:
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 17, 2020, 05:12:40 am
        (http://killone.myqnapcloud.com/sp/sole.jpg)

        where's the error? It all seems correct to me as connections ... could it be the arduino pin that is not working at this point?
        the solenoid directed to the power supply works..
        I have no idea of ​​the problem otherwise... :dunno  :banghead:
        Where did you connect the solenoid power supply ground?

        Envoyé de mon Pixel 3 en utilisant Tapatalk

        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 17, 2020, 06:09:40 am
        Where did you connect the solenoid power supply ground?

        between pin 2 of the mosfet and the diode

        (http://killone.myqnapcloud.com/sp/sole-.jpg)

        even if the solenoid pins have no polarity since as if I invert them it works
        equally



        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 17, 2020, 06:25:02 am
        wait...should i also add gnd to the solenoid- wire?

        in this way?

        (http://killone.myqnapcloud.com/sp/soleground.JPG)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 17, 2020, 07:11:33 am
        No no, the solenoid connection is ok. I mean the 24v power supply ground ;)
        Where is it connected?

        Envoyé de mon Pixel 3 en utilisant Tapatalk

        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 17, 2020, 07:29:23 am
        No no, the solenoid connection is ok. I mean the 24v power supply ground ;)
        Where is it connected?

        ah ok, the gnd of powersupply 24v it is connected to pin 3 of the mosfet and to the pin of the 100k resistor
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 17, 2020, 08:05:18 am
        Arduino & Solenoid Power Supply gnd does it mean that you also need to connect an arduino gnd to the power supply 24v gnd ?
         
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 17, 2020, 10:17:54 am
        Yes of course you need to connect both ground together, without the Arduino ground there can't be any flow of current triggering the mosfet.

        Envoyé de mon Pixel 3 en utilisant Tapatalk

        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 17, 2020, 10:43:51 am
        Yes of course you need to connect both ground together, without the Arduino ground there can't be any flow of current triggering the mosfet.

        so I have to take any Arduino gnd pin and connect it together to the 24v power supply gnd?

        in this way:

        (http://killone.myqnapcloud.com/sp/sole-1.jpg)

        it's correct ?

        are the same also for the motor circuit?

        because now it only works if I connect it to a USB port on the PC, if I connect it to an external power supply it doesn't work ... maybe because the PC works because it is also connected to another USB port?: D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 17, 2020, 11:29:09 am



        so I have to take any Arduino gnd pin and connect it together to the 24v power supply gnd?

        in this way:

        it's correct ?

        are the same also for the motor circuit?

        because now it only works if I connect it to a USB port on the PC, if I connect it to an external power supply it doesn't work ... maybe because the PC works because it is also connected to another USB port?: D
        Yes it looks correct.
        Also yes, the Arduino ground always has to be connected, or else the current can't flow from the pin to the Arduino ground.
        Since all USB ports usually share a common ground, that the Arduino is using, it indeed explains why it works when connecting both on the same pc.
        But it's less than ideal as you can imagine ;)
        So I guess if you fix this ground it should work.

        Envoyé de mon Pixel 3 en utilisant Tapatalk

        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 17, 2020, 11:52:04 am
        Yes it looks correct.
        Also yes, the Arduino ground always has to be connected, or else the current can't flow from the pin to the Arduino ground.
        Since all USB ports usually share a common ground, that the Arduino is using, it indeed explains why it works when connecting both on the same pc.
        But it's less than ideal as you can imagine ;)
        So I guess if you fix this ground it should work.

        surely that will be the mistake then, tonight I will try ...: D

        Will you also implement the ability to turn off the next vibration or recoil? It would be useful if used at night, because the solenoid makes a nice noise and the vibration in the long run could be annoying : D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 17, 2020, 12:01:28 pm


        Yes it looks correct.
        Also yes, the Arduino ground always has to be connected, or else the current can't flow from the pin to the Arduino ground.
        Since all USB ports usually share a common ground, that the Arduino is using, it indeed explains why it works when connecting both on the same pc.
        But it's less than ideal as you can imagine ;)
        So I guess if you fix this ground it should work.

        surely that will be the mistake then, tonight I will try ...: D

        Will you also implement the ability to turn off the next vibration or recoil? It would be useful if used at night, because the solenoid makes a nice noise and the vibration in the long run could be annoying : D

        Yeah it will be implemented too when I make a tool to configure the gun.
        But right now you can still do it by using mamehooker and starting the serial mode, it bypasses any feedback as long as it's active.
        Or like I do, you can just unplug the solenoid/motor power source if you have an easy to connect plug ;D
        Didn't you have some switches on one of your guns? You could even use that.

        Envoyé de mon Pixel 3 en utilisant Tapatalk

        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 17, 2020, 12:49:52 pm
        Yeah it will be implemented too when I make a tool to configure the gun.
        But right now you can still do it by using mamehooker and starting the serial mode, it bypasses any feedback as long as it's active.
        Or like I do, you can just unplug the solenoid/motor power source if you have an easy to connect plug ;D
        Didn't you have some switches on one of your guns? You could even use that.
        yes there is an onoff switch but how should i connect it? : D
        For mamehooker when will you release your configuration files? ;-)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 17, 2020, 03:18:49 pm
        Ok! Now works! : D Even the motor now goes with USB power supply, is it normal for the Arduino to connect to the PC that the motor vibrates? And then I found this if you can check it too, when the gun is connected a single shot works correctly if I press once and it blows if I keep it pressed, if instead I disable the offscreen reload if I hold the trigger the engine starts. I attach the video for clarity :)
        https://photos.app.goo.gl/GG1dY26B5tY9SB1f6 (https://photos.app.goo.gl/GG1dY26B5tY9SB1f6)

        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: lightgungamer on February 17, 2020, 04:32:41 pm
        HI Jaybee,

        I finally got around to building this. I have the gun ready but I am having trouble flashing it.

        At first I had an error when I ran the flashing program - "libusb0.dll" is missing from your computer".
         
        I got round that by downloading libusb0.dll and puttng it in the dir with the bat file.
        Then I got an error just saying:
        avrdude application unable to start

        So I downloaded and installed avrdude directly.

        Now it runs but the batch file doesn't seem to work correclty as I get errors

        ---
        Flash Normal or Test firmware (N: Normal/T: Test)?t
        FIND: COM: No such file or directory
        Invalid parameter - BAUD=1200

        Waiting for 0 seconds, press CTRL+C to quit ...
        FIND: COM: No such file or directory
        No Instance(s) Available.

        avrdude: Version 6.3-20190619
                 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
                 Copyright (c) 2007-2014 Joerg Wunsch

                 System wide configuration file is "avrdude.conf"

                 Using Port                    : -b57600
                 Using Programmer              : avr109
        avrdude: ser_open(): can't open device "-b57600": The system cannot find the file specified.


        avrdude done.  Thank you.

        Press any key to continue . . .
        ---

        DO you have any ideas about what I might be doing wrong , or is ther another way of doing this?

        Thanks
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 17, 2020, 06:31:05 pm
        lightgungamer, make sure to have the drivers installed for your Arduino, and check in device manager - ports (COM & LPT) for the name of the Arduino. In the flash.bat it determines the com port by searching for the string 'Arduino' twice (the second one is for the bootloader), you need to change both to at least part of the name of your Arduino.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 17, 2020, 07:49:08 pm


        Ok! Now works! : D Even the motor now goes with USB power supply, is it normal for the Arduino to connect to the PC that the motor vibrates? And then I found this if you can check it too, when the gun is connected a single shot works correctly if I press once and it blows if I keep it pressed, if instead I disable the offscreen reload if I hold the trigger the engine starts. I attach the video for clarity :)
        https://photos.app.goo.gl/GG1dY26B5tY9SB1f6 (https://photos.app.goo.gl/GG1dY26B5tY9SB1f6)


        Yes the motor vibrating once when plugged is normal, it's made to know it's plugged and started correctly ;)
        Indeed for the fullauto mode I didn't change it even with the offscreen mode off, so it rumbles instead of using the solenoid.
        I wonder what's the best tho when firing offscreen. Normally it rumbles to make you understand you're aiming off screen or reloading. Should it use the solenoid offscreen too when offscreen mode is disabled?

        Envoyé de mon Pixel 3 en utilisant Tapatalk

        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 17, 2020, 07:58:03 pm
        DO you have any ideas about what I might be doing wrong , or is ther another way of doing this?

        Thanks
        Software needed:
        • Arduino IDE (this will just be needed to flash the firmware)
        Don't install avrdude nor some dll, and don't change the installation files inside the zip file, just install Arduino IDE ;)

        Edit: oh and you might also need to install the drivers for the pro micro Arduino inside the IDE, I don't remember if necessary or not.
        I will add that to the main post.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 17, 2020, 08:22:41 pm
        JayBee, from my own experience with the promicro from sparkfun i had to install the drivers, and also had to change the %%arduino%% string to %%sparkfun%% otherwise it won't get detected at all.
        After flashing your firmware the Arduino gets detected as Arduino leonardo but the boot loader is still named sparkfun, so after the flash i had to change only the second %%arduino%% string to %%bootloader%%
        Furthermore i also had to change the timeout to 6 seconds instead of 3 otherwise it tries to flash too soon.
        Of course, this will change per setup.
        But i thought i should let you know because i had the same issues as lightgungamer, though in my case i had arduino ide installed and the drivers.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 17, 2020, 08:34:52 pm
        JayBee, from my own experience with the promicro from sparkfun i had to install the drivers, and also had to change the %%arduino%% string to %%sparkfun%% otherwise it won't get detected at all.
        After flashing your firmware the Arduino gets detected as Arduino leonardo but the boot loader is still named sparkfun, so after the flash i had to change only the second %%arduino%% string to %%bootloader%%
        Furthermore i also had to change the timeout to 6 seconds instead of 3 otherwise it tries to flash too soon.
        Of course, this will change per setup.
        But i thought i should let you know because i had the same issues as lightgungamer, though in my case i had arduino ide installed and the drivers.
        Oh I see!
        Yeah I think the bootloader on your model isn't the standard one, it's the one flashed by sparkfun.
        I wonder if there is a risk in flashing a standard leonardo bootloader in it? Have you tried flashing anything from the arduino IDE?
        I could give you my firmware with the bootloader included, but I don't want to risk frying your arduino :lol

        Edit: Note that in the last flash bat file, I added %%bootloader%% too, but also left the %%arduino%% part in it.
        I guess I should only leave %%bootloader%%.
        So each bootloader takes a different timing to restart? I will try if mine works too with 6 seconds, if it works 6 second would then be more universally compatible.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 17, 2020, 08:36:16 pm
        No need, everything is working perfectly, no point risking damaging it.
        As for Arduino ide, i think i only uploaded a sketch once or twice.
        The sparkfun pro micro is very small and easy to fit in most gun shells, so it's a good choice, but i wish i could find something similar that has holes for mounting with screws, i don't like using hot glue or double sided tape.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 17, 2020, 08:57:57 pm
        No need, everything is working perfectly, no point risking damaging it.
        As for Arduino ide, i think i only uploaded a sketch once or twice.
        The sparkfun pro micro is very small and easy to fit in most gun shells, so it's a good choice, but i wish i could find something similar that has holes for mounting with screws, i don't like using hot glue or double sided tape.
        Yeah the sparkfun model is actually the same as the generic ones I use, but 3~4 times more expensive somehow :lol
        Lately I've been considering using this model instead, for guns with limited space in them:
        (https://images-na.ssl-images-amazon.com/images/I/81GtjXMih1L._AC_SL1500_.jpg)
        It should work as well as the big one.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 17, 2020, 09:17:43 pm


        Ok! Now works! : D Even the motor now goes with USB power supply, is it normal for the Arduino to connect to the PC that the motor vibrates? And then I found this if you can check it too, when the gun is connected a single shot works correctly if I press once and it blows if I keep it pressed, if instead I disable the offscreen reload if I hold the trigger the engine starts. I attach the video for clarity :)
        https://photos.app.goo.gl/GG1dY26B5tY9SB1f6 (https://photos.app.goo.gl/GG1dY26B5tY9SB1f6)


        Yes the motor vibrating once when plugged is normal, it's made to know it's plugged and started correctly ;)
        Indeed for the fullauto mode I didn't change it even with the offscreen mode off, so it rumbles instead of using the solenoid.
        I wonder what's the best tho when firing offscreen. Normally it rumbles to make you understand you're aiming off screen or reloading. Should it use the solenoid offscreen too when offscreen mode is disabled?

        Envoyé de mon Pixel 3 en utilisant Tapatalk
        Ok for offscreen function but it behaves in the same way by pointing on the screen, if the offscreen_reload function is uninhabited, holding the trigger uses vibration instead of the solenoid also pointing to the center of the screen, I don't think that's right too?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 17, 2020, 09:20:32 pm
        Ok for offscreen function but it behaves in the same way by pointing on the screen, if the offscreen_reload function is uninhabited, holding the trigger uses vibration instead of the solenoid also pointing to the center of the screen, I don't think that's right too?
        indeed it's not normal, I will test tonight.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: lightgungamer on February 18, 2020, 06:35:32 am
        DO you have any ideas about what I might be doing wrong , or is ther another way of doing this?

        Thanks
        Software needed:
        • Arduino IDE (this will just be needed to flash the firmware)
        Don't install avrdude nor some dll, and don't change the installation files inside the zip file, just install Arduino IDE ;)

        Edit: oh and you might also need to install the drivers for the pro micro Arduino inside the IDE, I don't remember if necessary or not.
        I will add that to the main post.

        Hi Jaybee,

        I did already have the Audrino IDE installed and have used it on other audrinos so it is working as well.
        I will try those other suggestions out and report back.
        Thanks
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 18, 2020, 07:11:27 am
        Hi Jaybee,

        I did already have the Audrino IDE installed and have used it on other audrinos so it is working as well.
        I will try those other suggestions out and report back.
        Thanks
        Yeah you probably have to install the drivers that Foxhole suggested for your model ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: lightgungamer on February 18, 2020, 09:12:20 am
        I removed the installation of avrduse, removed the audrino ide and reinstalled it.

        I have put the drivers for the pro micro which is the board I have on.
        The batch file appears to find it at first but then after it starts, I just get the error "Unable to start Program"
        Screen shot attached

        Here is the output from the batch file:
        ---
        Flash Normal or Test firmware (N: Normal/T: Test)?n

        Status for device COM11:
        ------------------------
            Baud:            1200
            Parity:          None
            Data Bits:       8
            Stop Bits:       1
            Timeout:         OFF
            XON/XOFF:        OFF
            CTS handshaking: OFF
            DSR handshaking: OFF
            DSR sensitivity: OFF
            DTR circuit:     OFF
            RTS circuit:     ON


        Waiting for 0 seconds, press CTRL+C to quit ...
        Press any key to continue . . .
        ---
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 18, 2020, 09:31:07 am
        * 2020/02/18 - 1.76
        - reworked the buttons management again and fixed the remaining issues (with the calibration for instance)
        - fixed the bug with the feedback when offscreen reload is disabled, now it should trigger the solenoid (the way it works remain unchanged when offscreen reload is enabled)
        - modified the flashing batch file to be more compatible (detects bootloader whatever the model, and waits for 6 seconds now)

        I removed the installation of avrduse, removed the audrino ide and reinstalled it.

        I have put the drivers for the pro micro which is the board I have on.
        The batch file appears to find it at first but then after it starts, I just get the error "Unable to start Program"
        Screen shot attached

        Here is the output from the batch file:
        ---
        Flash Normal or Test firmware (N: Normal/T: Test)?n

        Status for device COM11:
        ------------------------
            Baud:            1200
            Parity:          None
            Data Bits:       8
            Stop Bits:       1
            Timeout:         OFF
            XON/XOFF:        OFF
            CTS handshaking: OFF
            DSR handshaking: OFF
            DSR sensitivity: OFF
            DTR circuit:     OFF
            RTS circuit:     ON


        Waiting for 0 seconds, press CTRL+C to quit ...
        Press any key to continue . . .
        ---
        Which version of windows and arduino IDE do you have?
        You don't have any other arduino device plugged at the same time?
        What happens if you try to flash an empty sketch in arduino IDE?
        If flashing an empty sketch works, try replacing the avrdude.exe and avrdude.conf of my package by the ones in your own arduino folders:
        Code: [Select]
        C:\Users\<User folder>\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17Inside the bin and etc subfolders (replace the <User folder> by your own folder name)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 18, 2020, 10:21:18 am
        JayBee, do you have any idea how much current the arduino takes from the usb?
        I have a rumble motor that works on 5V 100ma, and i'd like it to use the same usb as the arduino as a power source, meaning i don't want it to use the arduino itself as the power source but tap to the existing usb wire.
        If the arduino itself uses less than 400ma then it should be doable, question is, how?
        edit: now that i think about it, using a usb3 port will allow it to work anyway, since the arduino won't use more than 500ma max.
        So, the question is, how do i wire it all.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 18, 2020, 10:44:29 am
        JayBee, do you have any idea how much current the arduino takes from the usb?
        I have a rumble motor that works on 5V 100ma, and i'd like it to use the same usb as the arduino as a power source, meaning i don't want it to use the arduino itself as the power source but tap to the existing usb wire.
        If the arduino itself uses less than 400ma then it should be doable, question is, how?
        I don't have a USB measurement tool, but from what I saw online and from my own experience, the power consumption of the Arduino itself is very low, only few mA.
        For the 5V rumble motor, I power mine from the Arduino VCC pin, since the motor doesn't use too much current (the VCC seems to be connected directly to the USB VCC anyway).
        Not sure it's 100% safe, since I haven't been able to find the max load the VCC pin can take, but it's way more convenient than splitting the usb cable.

        edit: but if you want to power it from the USB directly, you have 2 solutions that should work equally well:
        1. remove some of the USB cable plastic close from the micro usb plug, and hijack the VCC wire in it
        2. buy or make a Y cable with 2 usb ports (more clean but take more space)

        Edit2: oh, if by "how" you also means the circuit to control it from the Arduino pin, I made a schematic for it in the first post recently (with the list of components needed). For the rumble it's fairly easy to do   :D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 18, 2020, 01:12:17 pm
        * 2020/02/18 - 1.76
        - reworked the buttons management again and fixed the remaining issues (with the calibration for instance)
        - fixed the bug with the feedback when offscreen reload is disabled, now it should trigger the solenoid (the way it works remain unchanged when offscreen reload is enabled)
        - modified the flashing batch file to be more compatible (detects bootloader whatever the model, and waits for 6 seconds now)
        Yeah!!! Top!!! :D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 18, 2020, 02:34:01 pm
        I have this problem flashing new firmware:

        Flash Normal or Test firmware (N: Normal/T: Test)?n

        Stato del dispositivo COM6:
        ---------------------------
            Baud:                 1200
            Parità:               None
            Bit di dati:          8
            Bit di stop:          1
            Timeout:              OFF
            XON/XOFF:             OFF
            Sincronizzazione CTS: OFF
            Sincronizzazione DSR: OFF
            Sensibilità DSR:      OFF
            Circuito DTR:         OFF
            Circuito RTS:         ON


        In attesa da 0 secondi. Per uscire, premere CTRL+C...

        avrdude: Version 6.3-20190619
                 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
                 Copyright (c) 2007-2014 Joerg Wunsch

                 System wide configuration file is "avrdude.conf"

                 Using Port                    : COM4
                 Using Programmer              : avr109
                 Overriding Baud Rate          : 57600
        avrdude: ser_open(): can't open device "\\.\COM4": Impossibile trovare il file specificato.

        avrdude done.  Thank you.

        with 1.75 flasher renaming file hex:


        Flash Normal or Test firmware (N: Normal/T: Test)?n

        Stato del dispositivo COM6:
        ---------------------------
            Baud:                 1200
            Parità:               None
            Bit di dati:          8
            Bit di stop:          1
            Timeout:              OFF
            XON/XOFF:             OFF
            Sincronizzazione CTS: OFF
            Sincronizzazione DSR: OFF
            Sensibilità DSR:      OFF
            Circuito DTR:         OFF
            Circuito RTS:         ON


        In attesa da 0 secondi. Per uscire, premere CTRL+C...

        avrdude: Version 6.3-20190619
                 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
                 Copyright (c) 2007-2014 Joerg Wunsch

                 System wide configuration file is "avrdude.conf"

                 Using Port                    : COM4
                 Using Programmer              : avr109
                 Overriding Baud Rate          : 57600
                 AVR Part                      : ATmega32U4
                 Chip Erase delay              : 9000 us
                 PAGEL                         : PD7
                 BS2                           : PA0
                 RESET disposition             : dedicated
                 RETRY pulse                   : SCK
                 serial program mode           : yes
                 parallel program mode         : yes
                 Timeout                       : 200
                 StabDelay                     : 100
                 CmdexeDelay                   : 25
                 SyncLoops                     : 32
                 ByteDelay                     : 0
                 PollIndex                     : 3
                 PollValue                     : 0x53
                 Memory Detail                 :

                                          Block Poll               Page                       Polled
                   Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
                   ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
                   eeprom        65    20     4    0 no       1024    4      0  9000  9000 0x00 0x00
                   flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
                   lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                   hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                   efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                   lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                   calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                   signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

                 Programmer Type : butterfly
                 Description     : Atmel AppNote AVR109 Boot Loader

        Connecting to programmer: .
        Found programmer: Id = "CATERIN"; type = S
            Software Version = 1.0; No Hardware Version given.
        Programmer supports auto addr increment.
        Programmer supports buffered memory access with buffersize=128 bytes.

        Programmer supports the following devices:
            Device code: 0x44

        avrdude: devcode selected: 0x44
        avrdude: ser_drain(): read error: Operazione di I/O terminata a causa dell'uscita dal thread oppure della richiesta di un'applicazione.

        avrdude: AVR device initialized and ready to accept instructions

        Reading |                                                    | 0% 0.00savrdude: ser_send(): write error: sorry no info avail
        avrdude: ser_recv(): read error: Il dispositivo non riconosce il comando.

        avrdude: butterfly_recv(): programmer is not responding
        Reading | ################################################## | 100% 0.18s

        avrdude: Device signature = 0xffffff (probably .avr8x_mega) (retrying)

        Reading |                                                    | 0% 0.00savrdude: ser_send(): write error: sorry no info avail
        avrdude: ser_recv(): read error: Il dispositivo non riconosce il comando.

        avrdude: butterfly_recv(): programmer is not responding
        Reading | ################################################## | 100% 0.10s

        avrdude: Device signature = 0xffffff (probably .avr8x_mega) (retrying)

        Reading |                                                    | 0% 0.00savrdude: ser_send(): write error: sorry no info avail
        avrdude: ser_recv(): read error: Il dispositivo non riconosce il comando.

        avrdude: butterfly_recv(): programmer is not responding
        Reading | ################################################## | 100% 1.14s

        avrdude: Device signature = 0xffffff (probably .avr8x_mega)
        avrdude: Yikes!  Invalid device signature.
                 Double check connections and try again, or use -F to override
                 this check.

        avrdude: ser_send(): write error: sorry no info avail
        avrdude: ser_recv(): read error: Il dispositivo non riconosce il comando.

        avrdude: butterfly_recv(): programmer is not responding
        avrdude: error: programmer did not respond to command: leave prog mode
        avrdude: ser_send(): write error: sorry no info avail
        avrdude: ser_recv(): read error: Il dispositivo non riconosce il comando.

        avrdude: butterfly_recv(): programmer is not responding
        avrdude: error: programmer did not respond to command: exit bootloader

        avrdude done.  Thank you.


        Helpmeeeeee please... :D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 18, 2020, 02:46:39 pm
        Kill_one, the timeout has changed to 6 seconds, and it looks like it's a problem with your setup.
        Change the timeout to 3 seconds in the bat file.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 18, 2020, 03:00:57 pm
        The rumble motor i'm using functions like a solenoid, when it rumbles it moves three gears which in turn pull the gun shell back to simulate the recoil.
        Since i am only using rumble, then i should use the solenoid pin instead of the rumble pin, right?
        Otherwise it won't work when shooting on screen?
        I'd test this myself but i'm still waiting for the parts to arrive, so i'd like to make sure i'm doing this right.
        Btw, the transistor isn't available at the moment, i can get the mosfet instead, do you think that would be an issue?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 18, 2020, 04:10:30 pm
        Kill_one, the timeout has changed to 6 seconds, and it looks like it's a problem with your setup.
        Change the timeout to 3 seconds in the bat file.

        It gave me error even with the version 1.75 set to 3s, I solved it using the flasher 1.70 on the second attempt ...I have no idea why :)

        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 18, 2020, 04:24:09 pm
        The rumble motor i'm using functions like a solenoid, when it rumbles it moves three gears which in turn pull the gun shell back to simulate the recoil.
        Since i am only using rumble, then i should use the solenoid pin instead of the rumble pin, right?
        Otherwise it won't work when shooting on screen?
        I'd test this myself but i'm still waiting for the parts to arrive, so i'd like to make sure i'm doing this right.
        Btw, the transistor isn't available at the moment, i can get the mosfet instead, do you think that would be an issue?
        @Foxhole
        I too have one like this but I gave it up for reasons of space ... it is because the engine must be powered by 9v being guncon2 compatible for ps2, instead which lightgun do you have?
        Were you able to insert the IR camera into the barrel?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 18, 2020, 04:48:22 pm
        This is a ems topgun2, the motor works with 5V 100ma.
        As for the barrel, i will have to do some drilling to make it fit.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 18, 2020, 07:50:47 pm
        Kill_one, the timeout has changed to 6 seconds, and it looks like it's a problem with your setup.
        Change the timeout to 3 seconds in the bat file.

        It gave me error even with the version 1.75 set to 3s, I solved it using the flasher 1.70 on the second attempt ...I have no idea why :)
        Foxhole is right, your board doesn't seem to like the 6 seconds timing.
        Mine is quite tolerant and works with both 3 and 6 seconds, but it seems like it's a bit random.
        I will modify my code to do a test at 3, and if nothing found, another one at 6.

        @Foxhole no problems to connect to the solenoid pin, it works the same as the rumble pin only the timings are different (but can be modified to fit your setup).
        You can of course use the mosfet for the motor too, but it's a bit overkill xD


        Envoyé de mon Pixel 3 en utilisant Tapatalk

        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 19, 2020, 05:47:44 am
        but to use the burst (autofire) holding the trigger in the games you have to use only mamehooker?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 19, 2020, 07:23:48 am
        but to use the burst (autofire) holding the trigger in the games you have to use only mamehooker?
        You don't need mamehooker, fullauto mode is activated when holding the trigger more than 450ms.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 19, 2020, 07:26:39 am
        You don't need mamehooker, fullauto mode is activated when holding the trigger more than 450ms.

        So maybe it depends on the type of game? Because I had tried with Time Crisis but when I kept the trigger pressed only the solenoid was activated and in the game it didn't fire
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 19, 2020, 07:29:43 am
        Time crisis doesn't have burst shots.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 19, 2020, 07:30:50 am
        I think he means that the solenoid doesn't react to the game itself. for that he will need mamehooker.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 19, 2020, 07:41:50 am
        So maybe it depends on the type of game? Because I had tried with Time Crisis but when I kept the trigger pressed only the solenoid was activated and in the game it didn't fire
        Ah I see what you meant.
        So by default the feedback is coming from the gun itself, and it won't care about what is happening in game.
        You indeed need to use mamehooker to make the recoil react only when the game tells it to.
        And it will depends of the game, some games originally don't have any feedback commands.
        I haven't got time yet to prepare all the files for mamehooker yet, but I already got the one for Time Crisis, I can upload it once you got mamehooker setup and running.

        Time crisis doesn't have burst shots.
        Yes you're right. Good thing tho is that mamehooker works great with it, it makes it react exactly like the real arcade machine  ;D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 19, 2020, 07:48:47 am
        By the way guys, are you interested in a auto reload function?
        I saw some guns often have like a 6 shots autoreload, would that be something you would be using?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 19, 2020, 07:51:30 am
        Personally, I'm more of a purist, if it wasn't in the game then i don't use it, but i think this deserves a poll, in case there are more people interested.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 19, 2020, 07:57:58 am
        Personally, I'm more of a purist, if it wasn't in the game then i don't use it, but i think this deserves a poll, in case there are more people interested.
        Agreed. Will add it to my list of polls for the upcoming features :lol
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 19, 2020, 09:12:15 am
        By the way guys, are you interested in a auto reload function?
        I saw some guns often have like a 6 shots autoreload, would that be something you would be using?


        Automatic recharge as an option that can be activated and deactivated like the other functions would not be bad to have it ...: D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 19, 2020, 09:15:24 am
        I haven't got time yet to prepare all the files for mamehooker yet, but I already got the one for Time Crisis, I can upload it once you got mamehooker setup and running.
        so does it take a configuration file for each game? tonight try to configure it following the guide of the official website, if you start posting the files for Time crisis or the games you have already ready it wouldn't be bad :)
        thanks a lot!!!
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 19, 2020, 09:39:14 am
        so does it take a configuration file for each game? tonight try to configure it following the guide of the official website, if you start posting the files for Time crisis or the games you have already ready it wouldn't be bad :)
        thanks a lot!!!
        I have only 2 ini files fully setup so far, the 2 I have been testing mamehooker with; Time Crisis and Terminator 2 8)
        Time crisis uses the solenoid recoil when firing.
        Terminator 2 is using a constant fullauto mode with variable speed, which doesn't play well with the solenoid (and might burn it pretty fast).
        So it uses the rumble motor instead, which works great.

        I attached the files to this post, put both ini files in the ini\MAME subfolder of mamehooker (but check if it's working with mame first)
        Don't forget to make your arduino port COM1 for gun1 and COM2 for gun2 (in the device manager), or else it won't work.

        Note that it's an unfinished experimental feature, it works good as it is but might change in a future update.
        I will provide new files when needed.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 19, 2020, 10:19:02 am
        I added a poll about the upcoming RGB led support if you are interested  ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 19, 2020, 11:09:17 am
        I added a poll about the upcoming RGB led support if you are interested  ;)

        Leave the button pins as it is now, and disable the pedal, start and dpad right buttons when the RGB led is active, are the keys deactivated only when the RGB LED is active?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: janderclander14 on February 19, 2020, 12:13:49 pm
        I added a poll about the upcoming RGB led support if you are interested  ;)

        An alternative to a standard RGB, which requires 3 PWM outputs, is to use a single Neopixel led, which only requires one digital output because it has an internal controller that interprets the digital data into colors and levels. They also operate on 5V. You may use SMD format leds or also through hole leds:

        https://www.adafruit.com/product/1938 (https://www.adafruit.com/product/1938)
        https://www.adafruit.com/product/1655 (https://www.adafruit.com/product/1655)

        You can easly program them by using standard Arduino libraries, such as Adafruit's neopixel.

        And, by the way, if you run out of pins, there is the possibility of desoldering the two RX and TX leds of the Arduino Micro board and repurpose them as digital outputs:

        https://golem.hu/article/pro-micro-pinout/ (https://golem.hu/article/pro-micro-pinout/)
        https://golem.hu/guide/pro-micro-upgrade/ (https://golem.hu/guide/pro-micro-upgrade/)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 19, 2020, 12:20:02 pm



        Leave the button pins as it is now, and disable the pedal, start and dpad right buttons when the RGB led is active, are the keys deactivated only when the RGB LED is active?
        It means you can't have both, since they are using the same pins.
        If you need those buttons you won't be able to use the led at all. Or not use those buttons at all.
        The question is more about which button/pins should we sacrifice or move when using the LED.


        Envoyé de mon Pixel 3 en utilisant Tapatalk

        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 19, 2020, 12:31:41 pm


        I added a poll about the upcoming RGB led support if you are interested  ;)

        An alternative to a standard RGB, which requires 3 PWM outputs, is to use a single Neopixel led, which only requires one digital output because it has an internal controller that interprets the digital data into colors and levels. They also operate on 5V. You may use SMD format leds or also through hole leds:

        https://www.adafruit.com/product/1938 (https://www.adafruit.com/product/1938)
        https://www.adafruit.com/product/1655 (https://www.adafruit.com/product/1655)

        You can easly program them by using standard Arduino libraries, such as Adafruit's neopixel.

        And, by the way, if you run out of pins, there is the possibility of desoldering the two RX and TX leds of the Arduino Micro board and repurpose them as digital outputs:

        https://golem.hu/article/pro-micro-pinout/ (https://golem.hu/article/pro-micro-pinout/)
        https://golem.hu/guide/pro-micro-upgrade/ (https://golem.hu/guide/pro-micro-upgrade/)

        Yeah I thought about the addressed RGB led too, it would be very convenient, but there is a problem with this option I couldn't find a solution to; I won't have space to add another library to my sketch, even with heavy optimization I'm already using 90% of the very limited Arduino space ;)

        The other solution of hacking new pins is very nice too, but definitely not user friendly

        Envoyé de mon Pixel 3 en utilisant Tapatalk

        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 19, 2020, 12:45:25 pm



        Leave the button pins as it is now, and disable the pedal, start and dpad right buttons when the RGB led is active, are the keys deactivated only when the RGB LED is active?
        It means you can't have both, since they are using the same pins.
        If you need those buttons you won't be able to use the led at all. Or not use those buttons at all.
        The question is more about which button/pins should we sacrifice or move when using the LED.
        From what I understand the only pro micro PWM pins are 3-5-6-9-10,
        the only pin that can be sacrificed without losing features is only the start button since most games start by shooting, you could consider using a single-pin LED and maybe add the A + Select combo for the Start button: D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 19, 2020, 12:48:02 pm
        Yeah I thought about the addressed RGB led too, it would be very convenient, but there is a problem with this option I couldn't find a solution to; I won't have space to add another library to my sketch, even with heavy optimization I'm already using 90% of the very limited Arduino space ;)
        AAAAAHHHHHH...rgggghhhh!!! :D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 19, 2020, 01:37:30 pm
        The other solution of hacking new pins is very nice too, but definitely not user friendly

        also solder the wires to the buttons on the guncon board is not user friendly... :)

        in my opinion you should evaluate if it is feasible to use the 2 additional pins of the led resistances and the Start button! : D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 19, 2020, 08:13:26 pm
        Thanks for your suggestions ;D
        You didn't have enough space to use Dupont wires for your Arduino?
        I agree that resolder the buttons might be a pain.

        But let me explain the reason why I want to do 2 different firmwares;
        The GCon2 or similar guns with DPad use pretty much all the pins, so it will have a specific firmware that don't remove any button, but will not have led support.
        The other more simple models of gun rarely have more than 3~4 buttons (GCon1, Virtua gun...), but still might use the pedal button, so for them I will do another firmware that has led support, and uses a different pin for the pedal.

        Now for why I made this poll;
        Is there any guns out there that don't have dpad but still have start/select buttons?
        If so, for the second firmware I will have to change more of the pinout.
        In that case the pinout for both firmwares will be quite different, which might lead to confusion/errors, and to damaged Arduino.

        But if some people already fully wired a GCon2 like gun and can't change it easily, I might have to leave the pinout untouched for the 11 buttons firmware anyway
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 19, 2020, 08:55:04 pm
        Regarding the automatic reload function, would it be possible to add an autofire function when the trigger is kept pressed? Maybe holding down unloaded the whole magazine and then the automatic reloading starts while if you do not keep it pressed it fires one shot at a time and you have to reload manually? : D
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 19, 2020, 09:23:42 pm
        Regarding the automatic reload function, would it be possible to add an autofire function when the trigger is kept pressed? Maybe holding down unloaded the whole magazine and then the automatic reloading starts while if you do not keep it pressed it fires one shot at a time and you have to reload manually? : D
        It could be possible, but not as a default option, since it would prevent games that need trigger holding to work correctly.
        But I guess I can add this to mamehooker if needed at some point?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 20, 2020, 02:45:08 am
        But I guess I can add this to mamehooker if needed at some point?

        I have installed mamehooker, configuring arduino com1 port, insert ini file to mamehooker ini mame directory and setting of tutorial mamehooker website, but in supported device no device is detected
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 20, 2020, 03:14:07 am
        I have installed mamehooker, configuring arduino com1 port, insert ini file to mamehooker ini mame directory and setting of tutorial mamehooker website, but in supported device no device is detected
        It's normal, Mamehooker doesn't "recognize" anything on serial ports.
        With my ini files it just sends raw data to COM1 and doesn't care about what the device is  ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 20, 2020, 03:27:38 am
        It's normal, Mamehooker doesn't "recognize" anything on serial ports.
        With my ini files it just sends raw data to COM1 and doesn't care about what the device is  ;)

        so should it work already? which command should be entered to test if it works?

        should something be set in mame.ini?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 20, 2020, 03:54:26 am
        It's normal, Mamehooker doesn't "recognize" anything on serial ports.
        With my ini files it just sends raw data to COM1 and doesn't care about what the device is  ;)

        so should it work already? which command should be entered to test if it works?

        should something be set in mame.ini?
        Yeah if you configured mamehooker and mame correctly, it should work.
        I would recommend you to test it without ini files first, to see if mamehooker is reacting to mame and creates ini files from it.
        If it doesn't, you missed something.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 20, 2020, 04:01:50 am
        Yeah if you configured mamehooker and mame correctly, it should work.
        I would recommend you to test it without ini files first, to see if mamehooker is reacting to mame and creates ini files from it.
        If it doesn't, you missed something.

        so i run mame hooker and i run mame then i launch a game and should i create an ini of the game in mame ini dir in mame hooker?

        in groovymame 0.211 I have not set anything related to the outputs is it already configured for this?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 20, 2020, 04:04:53 am
        Yeah if you configured mamehooker and mame correctly, it should work.
        I would recommend you to test it without ini files first, to see if mamehooker is reacting to mame and creates ini files from it.
        If it doesn't, you missed something.

        so i run mame hooker and i run mame then i launch a game and should i create an ini of the game in mame ini dir in mame hooker?

        in groovymame 0.211 I have not set anything related to the outputs is it already configured for this?
        Yeah it should work.
        If not please check mamehooker and mame help.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: lightgungamer on February 20, 2020, 05:41:47 am
        * 2020/02/18 - 1.76
        - reworked the buttons management again and fixed the remaining issues (with the calibration for instance)
        - fixed the bug with the feedback when offscreen reload is disabled, now it should trigger the solenoid (the way it works remain unchanged when offscreen reload is enabled)
        - modified the flashing batch file to be more compatible (detects bootloader whatever the model, and waits for 6 seconds now)

        I removed the installation of avrduse, removed the audrino ide and reinstalled it.

        I have put the drivers for the pro micro which is the board I have on.
        The batch file appears to find it at first but then after it starts, I just get the error "Unable to start Program"
        Screen shot attached

        Here is the output from the batch file:
        ---
        Flash Normal or Test firmware (N: Normal/T: Test)?n

        Status for device COM11:
        ------------------------
            Baud:            1200
            Parity:          None
            Data Bits:       8
            Stop Bits:       1
            Timeout:         OFF
            XON/XOFF:        OFF
            CTS handshaking: OFF
            DSR handshaking: OFF
            DSR sensitivity: OFF
            DTR circuit:     OFF
            RTS circuit:     ON


        Waiting for 0 seconds, press CTRL+C to quit ...
        Press any key to continue . . .
        ---
        Which version of windows and arduino IDE do you have?
        You don't have any other arduino device plugged at the same time?
        What happens if you try to flash an empty sketch in arduino IDE?
        If flashing an empty sketch works, try replacing the avrdude.exe and avrdude.conf of my package by the ones in your own arduino folders:
        Code: [Select]
        C:\Users\<User folder>\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17Inside the bin and etc subfolders (replace the <User folder> by your own folder name)

        I m using Windows 10 pro and the latest version of the Audrino IDE which is 1.8.12
        This is the only Audrino plugged in.
        Flashing an empty sketch works fine.
        There is no avr folder under the C:\Users\<User folder>\AppData\Local\Arduino15\packages\arduino\tools\ directlry (i replaced the <user folder>) the dir structure is ther and there are other folders under that level but no avrdude folder.

        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 20, 2020, 10:28:32 am
        I m using Windows 10 pro and the latest version of the Audrino IDE which is 1.8.12
        This is the only Audrino plugged in.
        Flashing an empty sketch works fine.
        There is no avr folder under the C:\Users\<User folder>\AppData\Local\Arduino15\packages\arduino\tools\ directlry (i replaced the <user folder>) the dir structure is ther and there are other folders under that level but no avrdude folder.

        In this folder there should be 2 subfolders (bin and etc), one containing avrdude.exe, and the other one containing avrdude.conf
        You don't have those subfolders?
        Is your windows 32 or 64bits?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: lightgungamer on February 20, 2020, 10:45:50 am
        * 2020/02/18 - 1.76
        - reworked the buttons management again and fixed the remaining issues (with the calibration for instance)
        - fixed the bug with the feedback when offscreen reload is disabled, now it should trigger the solenoid (the way it works remain unchanged when offscreen reload is enabled)
        - modified the flashing batch file to be more compatible (detects bootloader whatever the model, and waits for 6 seconds now)

        I removed the installation of avrduse, removed the audrino ide and reinstalled it.

        I have put the drivers for the pro micro which is the board I have on.
        The batch file appears to find it at first but then after it starts, I just get the error "Unable to start Program"
        Screen shot attached

        Here is the output from the batch file:
        ---
        Flash Normal or Test firmware (N: Normal/T: Test)?n

        Status for device COM11:
        ------------------------
            Baud:            1200
            Parity:          None
            Data Bits:       8
            Stop Bits:       1
            Timeout:         OFF
            XON/XOFF:        OFF
            CTS handshaking: OFF
            DSR handshaking: OFF
            DSR sensitivity: OFF
            DTR circuit:     OFF
            RTS circuit:     ON


        Waiting for 0 seconds, press CTRL+C to quit ...
        Press any key to continue . . .
        ---
        Which version of windows and arduino IDE do you have?
        You don't have any other arduino device plugged at the same time?
        What happens if you try to flash an empty sketch in arduino IDE?
        If flashing an empty sketch works, try replacing the avrdude.exe and avrdude.conf of my package by the ones in your own arduino folders:
        Code: [Select]
        C:\Users\<User folder>\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17Inside the bin and etc subfolders (replace the <User folder> by your own folder name)

        I m using Windows 10 pro and the latest version of the Audrino IDE which is 1.8.12
        This is the only Audrino plugged in.
        Flashing an empty sketch works fine.
        There is no avr folder under the C:\Users\<User folder>\AppData\Local\Arduino15\packages\arduino\tools\ directlry (i replaced the <user folder>) the dir structure is ther and there are other folders under that level but no avrdude folder.

        In this folder there should be 2 subfolders (bin and etc), one containing avrdude.exe, and the other one containing avrdude.conf
        You don't have those subfolders?
        Is your windows 32 or 64bits?
        I don’t have the avrdude folder. It’s windows 10 64 bit.


        Sent from my iPhone using Tapatalk
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 20, 2020, 10:48:03 am

        I don’t have the avrdude folder. It’s windows 10 64 bit.


        Sent from my iPhone using Tapatalk

        I never talked about any avrdude folder, but bin and etc folders. You don't have them?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 21, 2020, 01:23:23 pm
        I set it up like this my mamehooker default.ini

        [General]
        MameHookerStart=
        MameHookerStop=
        MameStart=cmo 1 baud=9600_parity=N_data=8_stop=1, cmo 2 baud=9600_parity=N_data=8_stop=1, cmw 1 S, cmw 2 S, cmw 1 A2, cmw 2 A2, cmw 1 J0, cmw 2 J0
        MameStop= cmw 1 s0, cmw 1 r0, cmw 1 E, cmw 2 E, cmc 1, cmc 2
        StateChange=
        OnPause=
        OnRotate=
        [KeyStates]
        RefreshTime=33

        [Output]

        but in the debug window I don't receive any messages from the games, I can't understand what else I need to set ... :(
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 21, 2020, 08:04:55 pm
        I set it up like this my mamehooker default.ini

        [General]
        MameHookerStart=
        MameHookerStop=
        MameStart=cmo 1 baud=9600_parity=N_data=8_stop=1, cmo 2 baud=9600_parity=N_data=8_stop=1, cmw 1 S, cmw 2 S, cmw 1 A2, cmw 2 A2, cmw 1 J0, cmw 2 J0
        MameStop= cmw 1 s0, cmw 1 r0, cmw 1 E, cmw 2 E, cmc 1, cmc 2
        StateChange=
        OnPause=
        OnRotate=
        [KeyStates]
        RefreshTime=33

        [Output]

        but in the debug window I don't receive any messages from the games, I can't understand what else I need to set ... :(
        you shouldn't change the default file, or else it will overwrite the game settings  ;)
        I think I know the problem; in your mame.ini (in your mame directory) you need to change the output setting from whatever it is now to windows.
        Like this:
        Code: [Select]

        #
        # OSD OUTPUT OPTIONS
        #
        output                    windows

        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 24, 2020, 03:37:46 am
        I think I know the problem; in your mame.ini (in your mame directory) you need to change the output setting from whatever it is now to windows.
        Like this:
        Code: [Select]

        #
        # OSD OUTPUT OPTIONS
        #
        output                    windows

        Yes!
        it was this! Now works...

        however, there are games where nothing comes out, such as Point Blank 1 while the JAP Gunbarl version does and Point Blank 2 as well

        this is output of Gunbarl.ini and Ptblank2.ini
        Code: [Select]
        [Output]
        Player1_Gun_Recoil=
        Player2_Gun_Recoil=
        P2_Start_lamp=
        the ini file it must be so ?
        Code: [Select]
        [General]
        MameStart=cmo 1 baud=9600_parity=N_data=8_stop=1, cmo 2 baud=9600_parity=N_data=8_stop=1, cmw 1 S, cmw 2 S, cmw 1 A0, cmw 2 A0
        MameStop=cmw 1 E, cmw 2 E, cmc 1, cmc 2
        StateChange=
        OnRotate=
        OnPause=
        [KeyStates]
        RefreshTime=
        [Output]
        Player1_Gun_Recoil=cmw 1 s0|cmw 1 s1
        Player2_Gun_Recoil=cmw 2 s0|cmw 2 s1
        P2_Start_lamp=

        r0 e r1
        if I want to use the rumble?

        A0 in my case because I have the 4: 3 monitor

        these settings are correct?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 24, 2020, 04:10:56 am
        however, there are games where nothing comes out, such as Point Blank 1 while the JAP Gunbarl version does and Point Blank 2 as well
        Point Blank 1 don't have feedback on Mame, no matter the version, you can't make it work even by doing a manual ini file.
        If MameHooker doesn't create a new ini file when you starting new games, it's not supported.
        You can of course manually create a ini file if you want to change some settings, but you won't get any feedback.

        r0 e r1
        if I want to use the rumble?

        A0 in my case because I have the 4: 3 monitor

        these settings are correct?
        Yes those are correct  ;)
        But for games that support gun feedback of course :lol
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 24, 2020, 04:30:22 am
        Point Blank 1 don't have feedback on Mame, no matter the version, you can't make it work even by doing a manual ini file.
        If MameHooker doesn't create a new ini file when you starting new games, it's not supported.
        You can of course manually create a ini file if you want to change some settings, but you won't get any feedback.

        Ah ok! now I understand...
        is there a list of supported games?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 25, 2020, 02:39:44 am
        Ah ok! now I understand...
        is there a list of supported games?
        I haven't found any  :(
        However it's pretty simple if you activate the Mamehooker notifications, you will hear it telling you the first time you use a game that has support ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 26, 2020, 03:52:17 am
        After changing the com port of one of the guns to com1 (it was written in use) the gun when I connect it to the usb port and it is detected on com1 the ir pointing no longer works, I tried to restart shut down but nothing, changing the port while the USB is detected and installed, the pointing works and then again it no longer works, even changing the com port does not work, I also tried to reinstall the firmware and recalibrate the gun nothing to do, the other gun instead always works regardless of the change of port com ... Is there a way to reset all the settings or remove and reinstall the drivers to restart from scratch?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 26, 2020, 04:55:05 am
        After changing the com port of one of the guns to com1 (it was written in use) the gun when I connect it to the usb port and it is detected on com1 the ir pointing no longer works, I tried to restart shut down but nothing, changing the port while the USB is detected and installed, the pointing works and then again it no longer works, even changing the com port does not work, I also tried to reinstall the firmware and recalibrate the gun nothing to do, the other gun instead always works regardless of the change of port com ... Is there a way to reset all the settings or remove and reinstall the drivers to restart from scratch?
        You assigned the COM port to one already in use, so the arduino stopped working.
        Before changing any port, remove/change the ones that are using them.
        To display all devices go in View menu => Show Hidden Devices
        Reinstalling the drivers or the firmware won't do anything in that case, you need to unplug everything, delete every devices using a COM port, and replug your arduino.
        To be sure your calibration is not the cause, don't redo a calibration, just enter calibration mode and then press the calibration button briefly, it should reset it to default.
        You shouldn't reinstall the firmware every time there is an issue by the way, the firmware stays in the arduino memory no matter what ;)
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 26, 2020, 10:12:56 am
        I removed all the devices that use the com ports, checked the hidden ones, uninstalled arduino ide and usb drivers and reinstalled, when the gun is connected, arduino lenoardo com 8 is detected and while it does it works perfectly then stops after a while and no longer works, I don't think at this point that it's a COM port problem the LEDs in the ir camera and the Arduino are on so I don't think the USB cable broke ... I don't understand, the other two guns I made work regularly.


        if I keep the calibration button pressed the cursor moves to the center correctly but the calibration reset procedure does not seem to work because when the usb cable is reconnected it is the same as before
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 26, 2020, 10:41:11 am


        I removed all the devices that use the com ports, checked the hidden ones, uninstalled arduino ide and usb drivers and reinstalled, when the gun is connected, arduino lenoardo com 8 is detected and while it does it works perfectly then stops after a while and no longer works, I don't think at this point that it's a COM port problem the LEDs in the ir camera and the Arduino are on so I don't think the USB cable broke ... I don't understand, the other two guns I made work regularly.


        if I keep the calibration button pressed the cursor moves to the center correctly but the calibration reset procedure does not seem to work because when the usb cable is reconnected it is the same as before

        Reinstalling the drivers or IDE won't change anything if your other guns are working.
        If it works for a while when you plug it, then stop working suddenly it's not a firmware nor calibration issue (calibration is only for aiming correction anyway, it doesn't change the way the gun works).
        When the gun stops working, are the buttons and feedbacks still working?
        If yes, you probably have a weak connection with the cam.
        If no, it's another hardware issue, you should check everything, like short circuits or anything that might cause the Arduino to freeze.
        You can also leave your gun open to test if the Arduino led is blinking when you trigger buttons.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 26, 2020, 11:01:58 am
        When the gun stops working, are the buttons and feedbacks still working?
        If yes, you probably have a weak connection with the cam.
        If no, it's another hardware issue, you should check everything, like short circuits or anything that might cause the Arduino to freeze.
        You can also leave your gun open to test if the Arduino led is blinking when you trigger buttons.


        tonight I'll check ... but what do you mean by  a weak connection with the cam?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 26, 2020, 11:08:44 am
        When the gun stops working, are the buttons and feedbacks still working?
        If yes, you probably have a weak connection with the cam.
        If no, it's another hardware issue, you should check everything, like short circuits or anything that might cause the Arduino to freeze.
        You can also leave your gun open to test if the Arduino led is blinking when you trigger buttons.


        tonight I'll check ... but what do you mean by  a weak connection with the cam?
        I meant a lose connection of the camera wires.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 26, 2020, 01:34:32 pm
        I meant a lose connection of the camera wires.
        you mean SDA and SCL? Because the red led of the cam is always on
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 26, 2020, 09:04:34 pm
        I meant a lose connection of the camera wires.
        you mean SDA and SCL? Because the red led of the cam is always on
        I mean any of the wires.
        If it loses connection even for one micro second at a bad timing it can cause it to stop working.
        But first, check if your buttons are still working when the tracking stops, if they aren't it's probably not coming from the cam!
        Always check by steps, it's important.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 26, 2020, 09:38:31 pm
        The flashing red LED of the keys when it stops pointing remains fixed and no key works anymore, I tried to reflect the firmware but it gives me an error, I changed the USB cable and it still blocks that the Arduino has skipped?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 26, 2020, 10:08:41 pm


        The flashing red LED of the keys when it stops pointing remains fixed and no key works anymore, I tried to reflect the firmware but it gives me an error, I changed the USB cable and it still blocks that the Arduino has skipped?

        Don't try to reflash my firmware, I told you it's going to do more harm than anything else if the Arduino isn't working correctly.
        Unless there is a firmware update, flash it only once. If anything wrong happens during the flash it can easily brick your Arduino!

        There is obviously something wrong in your wiring that makes the Arduino freeze, the input LEDs should always blink when pressing keys no matter what, even if my firmware crashes.

        Please check all the electronic/wiring again.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: kill_one on February 27, 2020, 03:56:51 am
        Don't try to reflash my firmware, I told you it's going to do more harm than anything else if the Arduino isn't working correctly.
        Unless there is a firmware update, flash it only once. If anything wrong happens during the flash it can easily brick your Arduino!

        There is obviously something wrong in your wiring that makes the Arduino freeze, the input LEDs should always blink when pressing keys no matter what, even if my firmware crashes.

        Please check all the electronic/wiring again.

        I had tried to flash the test firmware but without results, the problem does it even with arduino and the 4 pins of the camera dfrobot only, i bricked arduino or ir camera defect? Although I don't understand why as soon as it connects to the USB port it works  :dunno  :banghead:   :laugh2:
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 27, 2020, 04:45:09 am
        Don't try to reflash my firmware, I told you it's going to do more harm than anything else if the Arduino isn't working correctly.
        Unless there is a firmware update, flash it only once. If anything wrong happens during the flash it can easily brick your Arduino!

        There is obviously something wrong in your wiring that makes the Arduino freeze, the input LEDs should always blink when pressing keys no matter what, even if my firmware crashes.

        Please check all the electronic/wiring again.

        I had tried to flash the test firmware but without results, the problem does it even with arduino and the 4 pins of the camera dfrobot only, i bricked arduino or ir camera defect? Although I don't understand why as soon as it connects to the USB port it works  :dunno  :banghead:   :laugh2:
        Are you sure the Arduino isn't on the same com port as another device anymore?
        If and only if it's on a unique com port, remove everything connected to the Arduino and try flashing an empty sketch with the Arduino IDE, after selecting the right com port.
        If it doesn't work, check what error it gives you.
        If it's a problem resetting the arduino, use a wire on the reset pin to flash an empty sketch (you will find the process online).
        Try on another computer too just in case.
        If after all those tests it still doesn't work, it means your arduino is fried.
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: Foxhole on February 27, 2020, 07:58:57 am
        Sorry for reporting this only now but i had a lot going on.
        i installed firmware 1.76 when you released it but i didn't get to use the gun since i was busy working on upgrading my cabinet.
        I plugged the gun today to play some mame games and i immediatly noticed that the gun has developed some offset to the left, meaning i have to point beyond the right border of the screen for the cursor to reach the border.
        The cursor is not centered when i'm aiming at the center, it's a bit to the left.
        At first i thought it was the ir camera messing up so i tried recalibrating but that didn't help so i opened the gun and reseated the camera, still didn't help.
        Checked resolution, aspect ratio and etc, and nothing helped and then i remembered that i installed the 1.76 and didn't test it, so i returned to firmware 1.75 and it's now working well.
        Any idea what's going on with the 1.76 firmware?
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 27, 2020, 08:21:47 am
        Sorry for reporting this only now but i had a lot going on.
        i installed firmware 1.76 when you released it but i didn't get to use the gun since i was busy working on upgrading my cabinet.
        I plugged the gun today to play some mame games and i immediatly noticed that the gun has developed some offset to the left, meaning i have to point beyond the right border of the screen for the cursor to reach the border.
        The cursor is not centered when i'm aiming at the center, it's a bit to the left.
        At first i thought it was the ir camera messing up so i tried recalibrating but that didn't help so i opened the gun and reseated the camera, still didn't help.
        Checked resolution, aspect ratio and etc, and nothing helped and then i remembered that i installed the 1.76 and didn't test it, so i returned to firmware 1.75 and it's now working well.
        Any idea what's going on with the 1.76 firmware?
        Thanks for reporting the bug  :cheers:
        You're right there is an issue with the 1.76 calibration, it will be corrected in the next firmware (coming very soon).

        a small teaser for one of the new firmware big functionalities:
        https://youtu.be/xesX264urXI
        Title: Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
        Post by: JayBee on February 27, 2020, 10:41:09 am
        Here is the new update, the biggest update so far since the very first release!
        I added a ton of functionalities and made it ready for the future companion app I want to make.
        As usual, feel free to tell me how it works for you  :cheers:



        * 2020/02/28 - 1.85 major update, please read the changelog carefully before updating!

        - rewrote the whole flashing and config tool, now a lot more user friendly!
        - made a double timing test to be able to flash any arduino. No need to modify the bat file anymore.
        - various optimizations
        - IR points detection bug corrected, it should be a bit more stable now
        - reworked the buttons management
        - merged normal and test firmware, now the test tool should trigger the test mode (replug the arduino once to reboot in normal mode)

        - added RGB LED support for the 7 button + LED firmware! If your gun uses more than 7 buttons or if you don't want LED support please use the 11 buttons firmware
        - added temperature sensor support! connect a tmp36 sensor to pin A0
        - added rumble and LED feedbacks when changing modes
        - added various LED feedbacks
        - added EEPROM save and load gun data

        - updated the game screen ratio modes for better usage and compatibility, now there are only 2; fullscreen and 4:3. Obviously changing this option will have no effect if you have a 4:3 screen.
        - updated the test tool, now the one pde tool supports both normal and full screen, and has more options (don't use the old tools)