The-EG / OctoPrint-CameraSettings

An OctoPrint plugin that allows a user to interactively change camera settings.
GNU Affero General Public License v3.0
55 stars 7 forks source link

[FR] Switch IR cut filter for Night Vision IR Cut Video Cameras #59

Closed FrankGBusch closed 3 years ago

FrankGBusch commented 3 years ago

Hi,

I'm using a Night Vision IR Cut Video Camera connected to the camera slot on the Pi board. It would be awesome if the IR filter activation or deactivation of this camera can be configed directly in the camera settings.

CheersF.

The-EG commented 3 years ago

Hi there, can you provide some more info about the camera? An Amazon or Aliexpress or similar link would be fine. Just give me more of an idea of what it is.

If it's plugged into the RPi's camera slot (ribbon cable) then the additional capabilities have to be controlled via dedicated interfaces like I2C, and not through the V4L2 controls, which is what this plugin uses.

This is what the ArduCam plugin does: https://plugins.octoprint.org/plugins/ArducamCameraControl/ It actually has the option for IRCut already, so if your camera is compatible it may work for you.

FrankGBusch commented 3 years ago

This camera is quite similar to to one I have:

https://www.amazon.de/dp/B01ICNT3HC

And yes, it is connected to the RPi's camera slot with the ribbon cable. I already tried the ArduCam plugin but it doesn't work, but I will give it another try. But since the config options of the CameraSettings plugin are way ahead I would prefer to see the option for the IR filter there.

The-EG commented 3 years ago

Is it exactly like that one? Or does your specify that it supports IR cut through software? The one you linked looks like it has sensors that can be manually adjusted on the board that control when the IR LEDs and all of that turn on.

In any case, it's pretty unlikely that I'll be able to program something without having an actual camera to test, unfortunately. These controls aren't exposed through the same interface that the plugin currently uses.

FrankGBusch commented 3 years ago

You're right, it's not exactly that one. The one I have has no automatic filter movement, it has to be initiated via GPIO:

* #!/bin/bash
* echo 40 > /sys/class/gpio/export
* echo out > /sys/class/gpio/gpio40/direction

Then for night mode

That's what I tried but didn't work

The-EG commented 3 years ago

Ok, interesting. Was that in the documentation for the camera somewhere? Do you plug additional wires from the camera into the GPIO header?

GPIO 40 doesn't physically exist on a normal PI, but it's possible the camera driver is creating it virtually or something. Where ever you saw that could mean pin 40, which would be GPIO 21.

FrankGBusch commented 3 years ago

I think I found this command lines in a raspberry forum (can't remember where ...), but no additional wires, it was all done via the default camera connector on the board.

Meanwhile I replaced the camera with another one which automatically switches between day and night mode based on the brigthness. So OctoPrint together with the camera now works exactly as I had imagined.

The-EG commented 3 years ago

Closing this since I don't have a camera for testing and you've found a different solution. If other users end up wanting something similar, this can be revisited in the future.