Removing IR Filter From ESP32-CAM

I’ve been playing around with the ESP32-CAM modules a lot lately, and after spending some time searching through pages of code, I think I’ve finally got a handle on configuring the camera and getting it to start up cleanly.

With its boot time being about a second and the price being as low as it is, I think there are tons of applications for it. Everything from an always-on security camera to an occasionally used trail/wildlife camera, eye/brain/wifi for a remote-controlled car or robot… all kinds of things.

I want to put some cameras outside to catch the various animals that are leaving tracks in the snow, and these things are so inexpensive that they’re aalllllmost disposable. That’s not to say that I plan on putting them in situations where they’ll be ruined, but if one gets gnawed on or water gets to it, it won’t be the end of the world.

One thing that the stock camera can’t do, though, is see well in the dark. Even with bright IR illumination, the IR filter in the camera does a good job of keeping the picture stubbornly dark. Back when the Raspberry Pi camera module first came out, I fought with the IR filters in a couple of them, so I figured I’d take a shot at removing the filter from one of the OV2640s that came with the ESP32-CAM. Turns out it wasn’t too tough, although it took some patience.



First, remove the camera from the ESP32-CAM module by lifting the latch that’s holding the connector in place. Take note of where the glue is on the lens – it shines a little more under a light than the plastic does:

ESP32-CAM lens

After the camera is loose from the module and you’ve located the glue, very carefully and gently run a sharp knife in the seam between the lens barrel and the camera casing:

ESP32-CAM IR lens removal

Once you’ve cut the glue, grab the lens barrel with one finger and thumb and the casing with the other and gently turn the barrel counterclockwise. If it doesn’t turn, go back and run the knife through the glue again. If it does turn, you’ll be rewarded with a view of the camera sensor…

ESP32-CAM IR lens removal

… and you’ll be able to see the IR cut filter too:

ESP32-CAM IR lens removal

The filter in this particular camera is held on by a very thin ring of plastic and possibly some glue. I slowly shaved the plastic away until I got right down to the filter, then very carefully pried the filter off with the knife:

ESP32-CAM IR lens removal
Still broke the filter, though…

After that, it’s just a matter of making sure there’s no dust on the inside of the lens or on the camera sensor, then very carefully threading the barrel back into the casing. It is really easy to cross-thread it, so take it slow and be careful. If all goes well, you should end up with a put-back-together camera:

ESP32-CAM reassembled

One of the other advantages of cutting the glue and being able to thread the barren in and out is that you can adjust the focus on the camera now. Want to look at something nearby? Back the barrel out a bit. Something far away you want to see? Spin it in a bit.

Anyway, put the camera back in the ESP32-CAM and flip the lever down on the connector to secure it all. Voila, you now have an IR-sensitive camera!

Oh, one of the things that sometimes goes unmentioned when talking about making your camera “see in the dark” is that after you remove the IR-cut filter, your camera will no longer work very well in colour, particularly where there is a lot of extra IR light bouncing around (i.e. daytime). The colours will not look normal and it will seem like the picture is out of focus. You can fix that by putting an IR-cut filter back into or in front of the camera, but I just want to watch animals wander around in the dark so B&W is just fine for me.

Here’s the difference removing the filter makes. Same remote, same button (3), and same camera settings. Here’s before I removed the filter:

Before IR filter removed

And here’s after:

After IR filter removed

A bit of a difference! I’m looking forward to trying this out and seeing which wavelength of IR LEDs it will be the most sensitive to.

27 thoughts on “Removing IR Filter From ESP32-CAM”

    1. Hello!

      Not yet, unfortunately – there’s a lot of snow in the yard and I don’t have a case for the ESP yet that I trust to keep it dry. Designing and printing a case is on my list of projects. 🙂

      I have extensively indoors and it works quite well with a moderate amount of IR from a few LEDs. The quality of the camera isn’t all that great to begin with, but I’m pretty happy with how it looks so far.

      Thanks for the comment!

  1. Hi Mark – I am very interested in this and would love to use the ESP32CAM and an IR illuminator to capture images at night and in the dark. Has this worked out for you at all? Can you capture any legible images after removing the filter? If so could you post what one of those looks like?

    1. Hello Mike,

      I had planned to do a follow-up post about this a while ago but I misplaced the ESP that I removed the filter from (the hazards of doing this stuff on the dining room table, heh). I found it a couple of days ago and hope to get to it by the weekend. Sorry for the delay!

      Have a good day!

        1. Hello Hanafi – thanks for the comment!

          Sorry it took so long to reply. I’ve got a couple of other projects in the works right now but revisiting the camera with a properly powered IR illuminator is still on my list of things to do. Not sure when I’ll get to it but I hope it won’t be too long. The summer is flying by and I really want to get some good pictures of the wildlife that wanders through the area at night.

          Have a good day!

          1. Hi Carsten! Is that V3 of the OV2640 camera module? I haven’t bought any ESP32-CAM units lately so I haven’t had any to take apart and poke around at.

  2. Thanks for the post. I just want to add a warning to check the lens body after unthreading it. In my case the filter was located between the pin hole and the lens, so I ended destroying the hole lens body.

    1. Just tagging onto this comment that I ended up doing the same thing – the ir filter is at the ‘front’ rather than the ‘bottom’ like in this example. In the process of trying to gain access to the ‘ir filter’ I ended up pulling all the individual lens’ out and it wouldn’t go back together and stay together after doing that. Ended up binning it but keeping the sensor itself as i figure i might be able to use it on a different project.

  3. hihi,
    i wonder if it makes a difference for the camera (ov2640) to see at night, if you remove the ir-filter but not using any ir-lightning.
    can you test the sensitivity (without ir-light) with and without ir-filter.

    1. Hello Tom! The OV2640 is not a very good low-light camera. I don’t have any images available but I remember that without an IR source, it is almost unusable in dusk-like conditions, and even with a full moon on a clear night you still can’t see much of anything.

      Thanks for the comment!

  4. Hi Mark,

    Is it possible to use another camera module with the EPS-32 Camera board?
    i.e ov3660?


  5. Hey Mark,

    Just wondering if you ever got any usable wildlife photos. I’d love to see you post them.

    Thank you!

    1. Hi David!

      Oh ho – your timing is great (actually, I’m also sorry for taking forever to reply). I stuck one under the shed taking two pictures per second because I was suspicious that something had made its way under the chicken wire skirt. Stay tuned, I’ll be doing a post on it shortly!

  6. Hi Mark,

    Thanks for the great article. I was looking at doing the same as I have something munching at my vegetables during the night hours! I had a quick look on AliExpress and found that there are now OV2640 cameras with no IR filter fitted! No more hacking a good lens to pieces required!

  7. Unfortunately all the more recent ESP32Cam / OV2640 combos I’ve bought have had a different design where the IR filter is at the front of the lens and so inaccessible. However, I’ve just bought an OV2640 with 110 degree wide angle lens and it is possible to very very carefully crack out the IR filter from the metal barrel as the filter sits closest to the sensor. (I take on board your AliExpress mention – That may be the easier way when I next buy one.)
    My interest is also wildlife cameras. I’ve currently got a Raspberry Pi based one in a nesting box with a pair of blue-tits nest building, but I want to get a couple more cameras around the garden. With a standard commercial trail cam I’ve recently caught sight of an otter swimming and crossing a stream into our garden which in the UK is one of those WOW! sightings.

  8. Hi Mark,
    nice project 🙂
    But unfortunately there seem to be different versions of the module.
    In my case the IR-filter was (seen from the thread side) not on the top but the bottom layer, directly glued behind the input hole (like in the case of Guillermo). So I had to disassemble all the lenses and intermediate pinhole layers and then I had to destroy the glued IR-filterdisc. Sadly I did not manage to properly reassemble the small lenses and intermediate layers so that I now have a module being IR-sensitive but showing a very poor optical quality. Fortunately the cameramodule was a spare part from a died ESP-cam, so it is not really a loss, but a gain in experience 😉

  9. I modified an old outdoor CCTV camera for my project. The camera has a manual varifocal & zoom lens with built in IR-cut filter and IR LEDs. I removed the lens from the OV2640 and using a small CNC cut sensor adapter I was able to mount it and get to it focus correctly with the larger lens. I was lazy with the IR-cut filter and IR LED driver so I kept the original camera PCB to drive these features independant of the ESP32-CAM.

  10. This explains A LOT!!!!
    I thought I was clever, mounted cam board on prototype board, and surrounded it with 5 rows in 5mm IR leds in serial pairs, each pair with its own current limiting resistor. Yet the light was not picked up by the esp cam. This may explain why.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.