How to Build a Simple DIY Night Vision Camera With an Arduino

How to Build a Simple DIY Night Vision Camera With an Arduino

Building a night vision camera using an Arduino is a fun electronics project that allows you to see in the dark. With just a few common components, I was able to build a simple night vision camera that works surprisingly well. In this article, I will walk through the steps I took to build my own DIY night vision Arduino camera.

What You Will Need

Here are the main components you will need to build the night vision camera:

Circuit Diagram

Here is the basic circuit diagram showing how to connect the components:

The IR LEDs are connected through resistors to the Arduino's PWM pins to control brightness. The camera module is connected to the Arduino's I2C pins.

Setting up the IR LEDs

I used 5 IR LEDs connected through 220 ohm resistors to digital pins 3 through 7 on the Arduino. The resistors limit the current through each LED.

In the Arduino code, these pins are configured as PWM OUTPUTs to control the brightness of the IR LEDs.

```c++
const int ledPins[] = {3, 4, 5, 6, 7};

void setup() {

for (int i = 0; i < 5; i++) {
pinMode(ledPins[i], OUTPUT);
}
}
```

The brightness can then be controlled with analogWrite():

c++
analogWrite(ledPins[0], 200); // PWM value 0-255

Connecting the Camera Module

The Arducam Mini camera module communicates with the Arduino over I2C. It has a dedicated library that must be installed in the Arduino IDE.

To initialize the camera, include the Arducam library and set the camera address:

```c++

include

ArducamMini myCam;

void setup() {
myCam.initI2C(0x3C); // Set camera address
}
```

Now the camera can be configured using the Arducam functions like setting the image size:

c++
myCam.setImageSize(IMAGE_SIZE_160x120);

Capturing and Displaying the Image

To capture an image, just call readImage():

c++
myCam.readImage();

The image data is stored in a buffer that can be processed or sent to a computer.

To display the image on a computer, I sent the data over serial:

c++
Serial.write(myCam.getFrameBuffer(), myCam.getFrameBufferSize());

I then parsed the data in Processing and displayed the night vision video!

Assembling the Enclosure

I designed a simple 3D printed enclosure to hold the camera module, Arduino, and IR LEDs:

Enclosure

Holes were made for the LEDs and camera lens. The camera lens hole was covered with IR-pass filter film to block visible light.

Testing at Night

When I took the camera outside at night, I was amazed by the image quality! The IR LEDs effectively illuminated the surroundings in infrared light invisible to the naked eye.

Trees, bushes, and objects up to 25 feet away could easily be seen and recognized. There was a slight ghosting effect with moving objects, but overall it worked very well!

Conclusion

Building a night vision Arduino camera was an exciting and surprisingly straightforward project using common components. The illumination provided by the IR LEDs, paired with a camera sensitive to IR light, allowed me to see quite clearly in the dark. I was thrilled to see this simple camera worked so well. Let me know if you build your own or enhance this basic design!