Main > Lightguns
Updated IR light gun Arduino sketch
<< < (3/4) > >>
Howard_Casto:
From what I did with the wiimotes, the challenge is both.  You have to be really really far back to always have all four corners of a monitor in view at all times.  Additionally, with all four points in the corners, there's no easy way to tell which way is up. 
JayBee:
The very good feature of the camera we are using in this project is that it keeps track of every single point it sees (up to 4) as long as they stay on screen.
For the setup I prefer to put the leds right in the middle of each side. Makes it perfect to know which side you are aiming, and reduce the view angle needed by almost half ;)

Actually I just managed to make the Arduino able to recognize which point is which, with 3 or 4 points on screen.
Once those 3/4 points get detected, it keeps track of them, and you can aim anywhere as long as you keep at least one point in the cam viewing angle.
Of course the more points the camera gets at the same time, the more precise the aim and tilt will become.
You can even move around or get closer :D

Oh and if you put the LEDs right next to the LCD panel, or just do one calibration (to detect the screen borders) , you won't need any more calibration for a perfect sight aiming ;)
JayBee:

--- Quote from: lightgungamer on September 09, 2019, 01:12:01 pm ---Oh no. What’s the challenge with it?  Is it losing sight of points?

I would say that having it be accurate when you moved a bit (where you stand) would be more important than being able to tilt the gun if that makes a difference.

--- End quote ---

Yeah I totally agree with you, that's the main reason that pushed me to want to do the 4 LEDs detection, along with the reducing of distance needed to make it work.
It was very hard but I think I found a way to make it work decently.
Now I will need more math and geometry to calculate all of that properly.
JayBee:
Just a quick update, my sketch won't work on the itsybitsy m0, because this board doesn't have native EEPROM and doesn't support the joystick lib I am using.
I might make 2 versions of it, one for the Arduino atmega32u4 I am using (which I recommend because it is cheaper, easier to find and has more functionality), and one for the istybitsy.
It's sad the pinout isn't the same for both, that would make it way easier to use SAMCO's PCB  :-\
But I guess if nobody saw it didn't work, it means nobody actually uses my version, so maybe I should focus only on the 4 IR leds setup and forget this one  :lol
ryoken:
Just for ask .. what if.... the ir camera is in the monitor and the lightgun had the 4 leds.
Navigation
Message Index
Next page
Previous page

Go to full version