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

Arduino UNO R4 WiFi with IR Obstacle Detection and OLED Display

View and Edit Project In Cirkit DesignerImage of Arduino UNO R4 WiFi with IR Obstacle Detection and OLED Display

Circuit Documentation

Summary

The circuit in question is designed to detect the presence of an object using an FC-51 IR Obstacle Sensor and display the status on a 0.96" OLED screen. The Arduino UNO R4 WiFi serves as the central processing unit, reading the sensor data and controlling the OLED display. The circuit is powered by a 5V supply, which is distributed to all components. Communication with the OLED display is achieved through I2C protocol, utilizing the SDA and SCK lines from the Arduino.

Component List

Arduino UNO R4 WiFi

FC-51 IR Obstacle Sensor

0.96" OLED

Wiring Details

Arduino UNO R4 WiFi

FC-51 IR Obstacle Sensor

0.96" OLED

Documented Code

Arduino UNO R4 WiFi Code

#include <U8glib.h>
#define IR_PIN 2

U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);

void setup() {
  pinMode(IR_PIN, INPUT);
}

void loop() {
  int irState = digitalRead(IR_PIN);

  u8g.firstPage();
  do {
    u8g.setFont(u8g_font_unifont);
    if (irState  == LOW) {
      u8g.drawStr(5, 20, "Object detected");
    } else {
      u8g.drawStr(5, 20, "CLEAR ^");
    }
  } while (u8g.nextPage());
}

File Name: sketch.ino

This code initializes the OLED display and sets up the IR sensor pin as an input. In the loop, it reads the state of the IR sensor and updates the OLED display with a message indicating whether an object is detected or not.

FC-51 IR Obstacle Sensor Code

No specific code provided for the FC-51 IR Obstacle Sensor as it is directly interfaced with the Arduino UNO R4 WiFi.

0.96" OLED Code

No specific code provided for the 0.96" OLED as it is controlled by the Arduino UNO R4 WiFi through the I2C interface.


This documentation provides an overview of the circuit, including a description of each component, wiring details, and the embedded code for the Arduino UNO R4 WiFi. The circuit is designed to detect objects and display the status on an OLED screen, with the Arduino UNO R4 WiFi serving as the central controller.