Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up --- Bug Reports --- Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

Poll

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

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

Total Members Voted: 4

  

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

1 Member and 1 Guest are viewing this topic.

sniiki

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 9
  • Last login:September 21, 2020, 06:33:43 am
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #600 on: September 12, 2020, 07:54:56 am »
It's most likely been discussed somewhere in this topic already but at least for me the GUI fw flasher did not work with an eBay Arduino Pro Micro chip even though it works exactly like Sparkfun version. So just in case I'll share this short guide for one way to flash it.
I copied the flashing script from Arduino IDE console.

Atmega32u4 needs to be reset to bootloader in order for it to accept new program. To get the program com port number you need to set the Pro Micro to bootloader mode by pressing reset (reset pin to ground) twice quickly. It'll then stay in bootloader for 8 secs and during that time you can check the com port from your Windows device manager / device list. Then just run the avrdude with correct com port in place of COM12.

avrdude.exe and avrdude.conf can be found e.g. from Arduino IDE install dir. Just copy and place them in same folder with JB hex file to avoid having to enter long paths. JB.hex should be of course whatever 1-4P hex file you wish.

Code: [Select]
avrdude -C avrdude.conf -v -patmega32u4 -cavr109 -PCOM12 -b57600 -D -Uflash:w:"JayBee_IRLightGun_4Points_2.26.ino.jbgunpm1.hex":i
I'm struggling to get the LEDs oriented to make tracking stable. Using a pair of LD271 in each position @80 mA. They don't seem to be ideal for this. I wonder tho why DFrobot is so insensitive compared to e.g. old webcam with IR filter removed and a piece of floppy disk in front to block most visible light. With the latter a single SFH485P gave really good results.
Has anyone tested one of those 3-10W COB chips with or without a lens?

@JayBee would it be huge task to add some sort of simple visualization for debuggin to the GUI? There are those camera test etc. tabs but at least for me they're not showing anything. While doing the initial setup it's quite hard to spot the problem without getting any readings shown (as calibration doesn't really tell anything about e.g. not spotting one of the 4 LEDs), so I just instead plotted DFrobot library readings using another test script. Helps a lot aligning the LEDs (but aligning is still painful with current ones).

Btw. a cheap wide angle lens in front of DF cam was first idea I had when I found Samco project and noticed the annoyingly narrow angle of DF cam. Good to hear it looks promising.
« Last Edit: September 12, 2020, 07:58:31 am by sniiki »

JayBee

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 308
  • Last login:Today at 06:26:41 am
  • If I can't buy it, I build it.
    • Github
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #601 on: September 12, 2020, 08:16:41 am »
Hey sniiki!
So to answer to all your questions, the process to flash the sparkfun model (or clones) is written in the main post.
Basically you don't need all that process, you only need to flash an empty sketch in arduino IDE as "leonardo" board.

If the avrdude isn't working that's another issue, most of the time causes because the version I give is 64bit, so indeed if you have a 32bits system you need to replace it with the arduino original.
It should be enough to make it work correctly in the GUI.

For the LEDs spec, they don't seem so bad, they are powerful enough, but have quite a narrow angle. Best setup with normal leds is using 3 per IR point, to maximize the vertical angle.
There are few other solutions written in the discord server if you want to check  ;)

The dfrobot IR cam is a wiimote aftermarket cam, and so have the same specs, which is usually good. But you might have to change the sensitivity of the cam in the GUI to match your setup.

The cam visualization and gun test functions in my GUI are made exactly for that.
What issues are you having with it? Is it greyed out or just not working?

The wide lenses work very well to increase the angle, but also has limitations. Namely the lens deformations that tend to have cause small inaccuracies on the side. Nothing huge, but still noticable if you're picky  :lol

sniiki

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 9
  • Last login:September 21, 2020, 06:33:43 am
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #602 on: September 12, 2020, 09:48:36 am »
Hi,
I did of course read the first post but what I mean is that the GUI flasher doesn't recognize the board (empty sketch was in so no, it wasn't in the fresh bootloader state) and thus doesn't allow flashing it. I have 64 bit OS and like said, avrdude otherwise works ok. This particular board also functions perfectly in Arduino IDE and obeys the reset command IDE sends during flashing etc. so no problem there either. Win 10 so no additional drivers required either. Just thought to mention this another / normal flashing route as I didn't see it mentioned anywhere.

I have some 1W leds on their way and I actually just spotted your one post about similar powered ones. I thought they'd still be too weak with the wide angle, based on current tests so that's why I asked if anyone has tested 3-10W ones but you seemed to have good results with those so maybe they're powerful enough. And yeah, they need some cooling to prevent melting / igniting things around :)

Test screen & cal screens work ok, but they don't give any info about seen LEDs.
Camera test tab does absolutely nothing. I guess there should be some dots shown and button status should be indicated on right side panel but nothing is happening on my screen and yes, I did press 'start testing' :).

Did you use fish eye sort of lens or a more subtle, less distorting wide lens? I have some china quality 0.67x lenses on their way (well some 3-in-1 packs where there is fish eye lens too).

JayBee

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 308
  • Last login:Today at 06:26:41 am
  • If I can't buy it, I build it.
    • Github
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #603 on: September 12, 2020, 10:19:07 am »
Hi,
I did of course read the first post but what I mean is that the GUI flasher doesn't recognize the board (empty sketch was in so no, it wasn't in the fresh bootloader state) and thus doesn't allow flashing it. I have 64 bit OS and like said, avrdude otherwise works ok. This particular board also functions perfectly in Arduino IDE and obeys the reset command IDE sends during flashing etc. so no problem there either. Win 10 so no additional drivers required either. Just thought to mention this another / normal flashing route as I didn't see it mentioned anywhere.

I have some 1W leds on their way and I actually just spotted your one post about similar powered ones. I thought they'd still be too weak with the wide angle, based on current tests so that's why I asked if anyone has tested 3-10W ones but you seemed to have good results with those so maybe they're powerful enough. And yeah, they need some cooling to prevent melting / igniting things around :)

Test screen & cal screens work ok, but they don't give any info about seen LEDs.
Camera test tab does absolutely nothing. I guess there should be some dots shown and button status should be indicated on right side panel but nothing is happening on my screen and yes, I did press 'start testing' :).

Did you use fish eye sort of lens or a more subtle, less distorting wide lens? I have some china quality 0.67x lenses on their way (well some 3-in-1 packs where there is fish eye lens too).
What's the board name you're choosing when flashing in the arduino IDE? The arduino model detected is completely dependent of the model you choose in the list ;)
Fresh bootloader or not doesn't matter, despite what I first thought the issue isn't related to the bootloader, but to the model you choose in arduino IDE.
The difference between my app and the arduino IDE is that arduino IDE doesn't do automatic detection, so that you can select any serial arduino. My app does autodetection and therefore is limited to only the correct PID/VID, to avoid any flash on incompatible boards. The sparkfun board doesn't have the correct IDs by default. I might fix that in future app updates.
If the board is recognized but you still have issues flashing, try changing the avrdude and app properties to run them as admin, or putting them in a more short path folder.
There is no reason that shouldn't work, since the all my app does is running an avrdude command exactly as you do manually  :lol

The 1W leds I have work wonders, they allow to use it from any angle and any distance.
The only issue is that they are hard to work with as you probably saw.
But for that I'm using a psu that has both voltage and current regulation.

That's the first time I hear that the cam test does nothing. Even the buttons testing isn't showing anything when pushed?
If not, it means there is a serial communication issue between the gun and pc. If the buttons react, it means either the cam has an issue or the connection between the cam and the board is bad.
The calibration screen should also start the gun calibration, is that what's happening?
Have you tried unplug/replug the gun, restart the app, and then go directly to the cam tab without touching anything else?

Fish eyes lens has too much deformation, it messes up too much with the calibration. Wide lenses are the way to go.

sniiki

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 9
  • Last login:September 21, 2020, 06:33:43 am
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #604 on: September 12, 2020, 10:37:51 am »
What's the board name you're choosing when flashing in the arduino IDE? The arduino model detected is completely dependent of the model you choose in the list ;)
Fresh bootloader or not doesn't matter, despite what I first thought the issue isn't related to the bootloader, but to the model you choose in arduino IDE.
The difference between my app and the arduino IDE is that arduino IDE doesn't do automatic detection, so that you can select any serial arduino. My app does autodetection and therefore is limited to only the correct PID/VID, to avoid any flash on incompatible boards. The sparkfun board doesn't have the correct IDs by default. I might fix that in future app updates.
If the board is recognized but you still have issues flashing, try changing the avrdude and app properties to run them as admin, or putting them in a more short path folder.
There is no reason that shouldn't work, since the all my app does is running an avrdude command exactly as you do manually  :lol

Used Sparkfun Pro Micro / ATMega32U4 (5V, 16Mhz) during uploading  the empty sketch. Board info shows:
Code: [Select]
BN: Unknown board
VID: 1B4F
PID: 9206
SN: Upload any sketch to obtain it
As the GUI isn't detecting the board I can't yet confirm if there'd be any issue with the avrdude itself, but at this point it's most likely just the VID/PID thing.


Quote
That's the first time I hear that the cam test does nothing. Even the buttons testing isn't showing anything when pushed?
If not, it means there is a serial communication issue between the gun and pc. If the buttons react, it means either the cam has an issue or the connection between the cam and the board is bad.
The calibration screen should also start the gun calibration, is that what's happening?
Have you tried unplug/replug the gun, restart the app, and then go directly to the cam tab without touching anything else?

Everything else works like should. I can calibrate it normally and it functions normally, just the cam test tab is dead. Even button press indications react in no way and they too work in reality (or well, at least trigger does as I'm still running this on a breadboard so only 1 or 2 micro switches connected during testing). I tested the GUI on two different PCs and have replugged the chip several times and also flashed it few times.

Quote
Fish eyes lens has too much deformation, it messes up too much with the calibration. Wide lenses are the way to go.
I thought so. I just noticed the 'fish eye' term in some post and wondered if it really didn't affect too much the accuracy. What zoom factor did your lens have?
« Last Edit: September 12, 2020, 10:42:16 am by sniiki »

JayBee

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 308
  • Last login:Today at 06:26:41 am
  • If I can't buy it, I build it.
    • Github
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #605 on: September 12, 2020, 10:54:27 am »
Used Sparkfun Pro Micro / ATMega32U4 (5V, 16Mhz) during uploading  the empty sketch. Board info shows:
Code: [Select]
BN: Unknown board
[b]VID: 1B4F
PID: 9206[/b]
SN: Upload any sketch to obtain it
As the GUI isn't detecting the board I can't yet confirm if there'd be any issue with the avrdude itself, but at this point it's most likely just the VID/PID thing.
Yeah that's exactly what I said in my previous message, you need to flash it as arduino Leonardo model, or else it won't work :lol

Everything else works like should. I can calibrate it normally and it functions normally, just the cam test tab is dead. Even button press indications react in no way and they too work in reality (or well, at least trigger does as I'm still running this on a breadboard so only 1 or 2 micro switches connected during testing). I tested the GUI on two different PCs and have replugged the chip several times and also flashed it few times.
Seems like a serial communication issue or something similar.
I will look into it to check if anything could be causing that.
I was also planning to add a debug mode in my app to help with this kind of cases, I might add it soon.
If you need I can send you an independent test app that should allow you to test the cam.

I thought so. I just noticed the 'fish eye' term in some post and wondered if it really didn't affect too much the accuracy. What zoom factor did your lens have?
Mine has is 0.6x, but other users successfully tested lenses from 0.36x (cheap Chinese ones).

nicr4wks

  • Trade Count: (0)
  • Jr. Member
  • **
  • Online Online
  • Posts: 5
  • Last login:Today at 07:03:53 am
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #606 on: September 13, 2020, 11:09:29 pm »
Final piece of the puzzle landed on my desk today, the IR sensor! Can't wait to get home and put everything together.
I've got a couple of old CCTV cameras that have ~30 IR LED's on each of them, going to recycle a few and see how they behave. I assume they should give a good result as the cameras had reasonable range and angle at night. I'll test them in the GUI app to get a better idea.

JayBee I've just sent donation via PayPal for the GUI, Thanks!  :cheers:

JayBee

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 308
  • Last login:Today at 06:26:41 am
  • If I can't buy it, I build it.
    • Github
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #607 on: September 14, 2020, 03:12:25 am »
Final piece of the puzzle landed on my desk today, the IR sensor! Can't wait to get home and put everything together.
I've got a couple of old CCTV cameras that have ~30 IR LED's on each of them, going to recycle a few and see how they behave. I assume they should give a good result as the cameras had reasonable range and angle at night. I'll test them in the GUI app to get a better idea.

JayBee I've just sent donation via PayPal for the GUI, Thanks!  :cheers:
Thanks a lot!  :cheers:
I sent the license to you email address  ;D
Yeah in my experience CCTV leds can give good result. Are they smd or normal leds?
You're using the DFRobot cam for your guns, right?

nicr4wks

  • Trade Count: (0)
  • Jr. Member
  • **
  • Online Online
  • Posts: 5
  • Last login:Today at 07:03:53 am
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #608 on: September 14, 2020, 03:22:09 am »
Thanks a lot!  :cheers:
I sent the license to you email address  ;D
Yeah in my experience CCTV leds can give good result. Are they smd or normal leds?
You're using the DFRobot cam for your guns, right?

Received license  :D
Normal LED's, some camera's have clear LED and others have a grey/smoked LED so I'll see which perform best, luckily plenty of LED per camera if they need to be clustered.

Yes DFRobot, had to order from America was worried about postage due to covid but they arrived in 7 days exactly   :)

I'll have a couple of hours spare after work tonight so can hopefully get enough built for a quick tester.

nicr4wks

  • Trade Count: (0)
  • Jr. Member
  • **
  • Online Online
  • Posts: 5
  • Last login:Today at 07:03:53 am
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #609 on: September 15, 2020, 07:11:06 pm »
After a couple of nights work I've got a very rough example chucked together. I was too excited to get everything connected and see it in action, now I need to go back to tidy things up and re-solder a few points  :lol

Using old CCTV LED's was a bit of a time waster, the donor cameras were so old half of the LED's were burnt out, a bunch more were dim and the remaining good ones probably aren't as bright as new, also not knowing the specs didn't help. Set them up for 1.5v 50ma with 4 LED's in each array, they get a bit warmer than I'd expect.

I found a very basic\cheap PS1 gun to experiment with, there doesn't seem to be any branding on it. Definitely will source a nicer shell going forward.

Things were going well until I cleaned up my desk and fired up MAME, after cleaning everything up the camera started picking up IR reflections from something so I gave up and went to bed  :lol




JayBee

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 308
  • Last login:Today at 06:26:41 am
  • If I can't buy it, I build it.
    • Github
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #610 on: September 15, 2020, 08:25:02 pm »
Nice work!  :cheers:
Messy is ok as long as it works  :lol
Yeah those reflection happen sometime, on desks or other shiny surfaces, can be quite annoying to point them down.
It could also be the sunlight. I usually get different results with different LEDs too.
But you can try changing the camera sensitivity in the settings to try to remove or at least reduce the issue  ;D

nicr4wks

  • Trade Count: (0)
  • Jr. Member
  • **
  • Online Online
  • Posts: 5
  • Last login:Today at 07:03:53 am
  • I want to build my own arcade controls!
Re: JayBee DIY 4 IR Led Lightgun System (no calibration needed)
« Reply #611 on: September 17, 2020, 06:31:13 am »
I've ordered some of these LED's, they're cheap and look reasonable in the photos, but who really knows from china  :lol In the customer reviews it looks like you can remove the lens to reveal the SMD LED, but who knows the lens might actually help.
https://www.aliexpress.com/item/32962722947.html?spm=a2g0s.9042311.0.0.3a064c4digQvLZ

In MAME the crosshair jumps around a lot and loses accuracy very easily, hoping some better LED's resolve this.