Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO-Based Object Detection System with OLED Display and OV7670 Camera Module

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Object Detection System with OLED Display and OV7670 Camera Module

Circuit Documentation

Summary

The circuit in question is designed to interface an Arduino UNO microcontroller with an OLED display, an OV7670 camera module, and an infrared (IR) sensor. The Arduino UNO serves as the central processing unit, controlling the data flow and interactions between the sensor, the camera, and the display. The IR sensor is used to detect the presence of objects, triggering the camera to capture an image which is then displayed on the OLED screen.

Component List

Arduino UNO

OLED 1.3"

OV7670 Camera Module

IR Sensor

Wiring Details

Arduino UNO

OLED 1.3"

OV7670 Camera Module

IR Sensor

Documented Code

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET    -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

const int irSensorPin = 0; // IR sensor output connected to D0
const int cameraPins[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};

void setup() {
  // Initialize serial communication
  Serial.begin(9600);

  // Initialize IR sensor pin
  pinMode(irSensorPin, INPUT);

  // Initialize camera pins
  for (int i = 0; i < 12; i++) {
    pinMode(cameraPins[i], OUTPUT);
  }

  // Initialize OLED display
  if (!display.begin(0x3C)) { // Replaced SSD1306_I2C_ADDRESS with 0x3C
    Serial.println(F("SSD1306 allocation failed"));
    for (;;);
  }
  display.display();
  delay(2000);
  display.clearDisplay();
}

void loop() {
  // Check if IR sensor detects an object
  if (digitalRead(irSensorPin) == HIGH) {
    // Capture image from camera
    captureImage();

    // Display image on OLED
    displayImage();
  }
}

void captureImage() {
  // Placeholder function to simulate image capture
  Serial.println("Image captured");
}

void displayImage() {
  // Placeholder function to simulate image display
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(0, 0);
  display.println("Displaying Image");
  display.display();
}

This code is designed to run on the Arduino UNO microcontroller. It initializes the OLED display and sets up the IR sensor and camera pins. In the main loop, it checks for the presence of an object using the IR sensor. If an object is detected, it simulates capturing an image with the camera and displays a message on the OLED screen.