henning2323 / IR_LightGun

10 stars 5 forks source link

Position not being updated and warning LED always on #1

Open Jaensche opened 1 year ago

Jaensche commented 1 year ago

Hi Henning

Let me first start by congratulating you on this very cool project! :-) I immediately had to disassemble a NERF Firestrike (seems to be a good case for all the components and easy to take apart). I was able to put the code on my Leonardo clone (https://wiki.dfrobot.com/Beetle_SKU_DFR0282, even smaller then the pico). And the mouse buttons and the warning LED worked out of the box.

Now to the problem: I don't get any mouse movements and the warning LED is always on. The connection of the IR sensor should be OK as the the ports are labeled SCL and SDA. Also the LED on the sensor shines bright red. Would the warning always be on if the sensor does not see any IR sources? I have 4 IR LEDs positioned in the corners of my screen. They are probably not very bright but i would have expected to seem at least some movement.

Any ideas what i could try/test?

Thanks Jan

Jaensche commented 1 year ago

Small update: I added some serial debug messages and discovered that it actually does track some IR sources but very rarely all 4 of them. Now i am planning to move the IR sources further away so they can be seen with the limited tracking angle of the device. Also i want to reduce the resistor before each IR LED (from 220 to maybe 80?) to drive them a bit more and get more light.

henning2323 commented 1 year ago

Hi Jaensche, the warning LED always lights up when fewer than 4 LEDs are found and also the mouse position won't be updated. Printing out the sensor data would have also been my first suggestion. Depending on your LEDs it can sometimes be tricky to get good visibility. IR LEDs tend to be very directional and are barely visible even from rather slight angles. The best thing is LED Arrays where each corner has multiple LEDs which are pointed at slightly different angles (I think you can see an example of this in my instructions). Otherwise you could try to roughen the surface of the LEDs with sandpaper or even cut/sand the tips flat. You could also experiment with reflectors but I think it will be hard to achieve a robust solution with this.

Lowering the Resistance can help a lot. It's hard to say for sure when the LED will break. I think you have to experiment a little to find the highest light output and probably kill some LEDs in the process. I hope you have some spares 😄

Thanks for trying out my project and I'd love to get an update on how it's going!

Cheers, Henning

Jaensche commented 1 year ago

Hi Henning

Thanks for taking the time to answer. In the meantime i had some success by driving the LEDs with a bit more current and moving further away from the screen / LEDs. Finally the warning LED is off and i can move the cursor on the screen. I guess i was just to close for the narrow angle the sensor can track IR sources in. Now something odd is happening though. When i hold the sensor in the way that is indicated (its labeled TOP on the top) the mouse movement is turned by 90 degrees. So when i move up and down the cursor moves sideways. Not a big deal as i can just mount the sensor turned as well but i was wondering if you noticed the same thing.

Cheers Jan

henning2323 commented 1 year ago

As you mention that, I remember noticing the same thing. The label on the IR Sensor is misorientated or you could say the sensor puts out the coordinates in an unusual order (first y then x). I also fixed that by rotating the sensor. I'm glad you got it working :) May I ask for a picture of your finished build? I'm curious how yours turned out.

Cheers, Henning

Jaensche commented 1 year ago

Was finally able to play some Time Crisis on a PSX emulator. Worked OK after filing the LEDs flat (as suggested in your text). But the whole thing is still a bit unreliable. In the corners of the screen the cursor starts to judder and jumps around a lot. And sometimes i also cannot get a lock on the 4 LEDs at all. Not sure whats causing that. I will for sure invest in some stronger LEDs in the future. Do you know if the IR light gets dangerous at some point? In this setup one is directly looking into them, right? I will attach some pictures of the converted NERF Firestrike soon. Whats cool about this one is that it has integrated light that i am using now for indicating a shot. Also it has a second small trigger that i repurposed as the second button (e.g. cover/uncover in Time Crisis).

BTW: Any ideas on how to realize the "off-screen" action some games need? That is basically not possible when attaching the device as HID Mouse, right?

Cheers Jan

akeilox commented 1 year ago

hey @Jaensche can you share a picture of converted NERF Firestrike? Interested how internals fitted n overall look

Jaensche commented 1 year ago

Here you go!

IMG20230123183624 IMG20230427183847

The trigger moves the original plastic piece (slightly modified) up, pushing the switch I put there. Also I wired up the original light to the Arduino for some nice effect when shooting.

Other firmware you can try: https://github.com/samuelballantyne/IR-Light-Gun https://github.com/gobozgz/GUN4IR

Cheers Jeansche