PiWebcam icon indicating copy to clipboard operation
PiWebcam copied to clipboard

IR Cut Filter On/Off is Backwards?

Open verticon opened this issue 2 months ago • 1 comments

Hello Folks. I am in the process of verifying that my build of this project: https://www.instructables.com/id/Fully-featured-Outdoor-Security-Camera-Based-on-Ra/ is correct. Regarding the IR Cut Filter; something is awry somewhere (hopefully not in my brain).

First, my understanding:

1) In day mode the cut filter should be on (block the infrared). In night mode the cut filter should be off (let the infrared through).

2) BCM pin 20 should be pulsed to activate the cut filter. BCM pin 16 should be pulsed to deactivate the cut filter.

Next my experience:

1) Examining PiWebcam.sh's night_mode function reveals that pin 20 (IR_FILTER_ON_PIN) is pulsed when entering night mode; pin 16 (IR_FILTER_OFF_PIN) is pulsed when leaving night mode. Huh? That is backwards, yes?

2) From a command line (ssh to raspberry) I can issue the command:
    a. "gpio -g write 16 1; sleep 0.5; gpio -g write 16 0" to pulse pin 16 (turn the cut filter off)
    b. "gpio -g write 20 1; sleep 0.5; gpio -g write 20 0"  to pulse pin 20 (turn the cut filter on).
  1. From the web UI I can observe the camera (Camera -> View) in day mode while I issue the gpio pulse commands from the ssh terminal. I find that there is more pink in the image when I turn the filter on and that there is less pink in the image when I turn the filter off. Again, backwards.

Finally:

1) My experience in 3) indicates that the night_mode function will perform correctly even though it appears to be incorrectly coded.

2) My conclusion: Something in the wiring from gpio -> H Bridge -> cut filter is backwards and the night_mode function has been jiggered to compensate.

Thoughts?

verticon avatar Apr 24 '24 20:04 verticon