Arduino-Controlled Fan with OLED Display and Ultrasonic Sensing
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit integrates a microcontroller (Arduino UNO), an OLED display, an ultrasonic distance sensor (HC-SR04), a fan, an NPN transistor, and a resistor to form a system capable of interfacing with various peripherals. The Arduino UNO serves as the central processing unit, controlling the fan via the NPN transistor and reading distance measurements from the HC-SR04 sensor. The OLED display provides a visual interface for displaying data or status information. The circuit is powered by the Arduino's 5V output, which is distributed to the necessary components.
Component List
Arduino UNO
- Description: A microcontroller board based on the ATmega328P.
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0-A5, SCL, SDA, AREF, D0-D13.
0.96" OLED
- Description: A small display for visual data output.
- Pins: GND, VDD, SCK, SDA.
HC-SR04 Ultrasonic Distance Sensor (Wokwi Compatible)
- Description: A sensor for measuring distances via ultrasonic sound waves.
- Pins: VCC, TRIG, ECHO, GND.
Fan
- Description: An electric fan for cooling or airflow.
- Pins: GND, 5V.
NPN Transistor (EBC)
- Description: A bipolar junction transistor used for switching or amplification.
- Pins: emitter, base, collector.
Resistor
- Description: A passive two-terminal electrical component that implements electrical resistance.
- Properties: 220 Ohms.
- Pins: pin1, pin2.
Wiring Details
Arduino UNO
- 5V connected to the VCC of HC-SR04, VDD of OLED, and 5V of Fan.
- GND connected to the collector of NPN Transistor, GND of HC-SR04, GND of OLED, and GND of Fan.
- A4 (SDA) connected to SDA of OLED.
- A5 (SCL) connected to SCK of OLED.
- D6 connected to pin2 of Resistor.
- D7 connected to TRIG of HC-SR04.
- D8 connected to ECHO of HC-SR04.
0.96" OLED
- GND connected to GND of Arduino UNO.
- VDD connected to 5V of Arduino UNO.
- SCK connected to A5 of Arduino UNO.
- SDA connected to A4 of Arduino UNO.
HC-SR04 Ultrasonic Distance Sensor
- VCC connected to 5V of Arduino UNO.
- TRIG connected to D7 of Arduino UNO.
- ECHO connected to D8 of Arduino UNO.
- GND connected to GND of Arduino UNO.
Fan
- GND connected to the emitter of NPN Transistor.
- 5V connected to 5V of Arduino UNO.
NPN Transistor (EBC)
- emitter connected to GND of Fan.
- base connected to pin1 of Resistor.
- collector connected to GND of Arduino UNO.
Resistor
- pin1 connected to the base of NPN Transistor.
- pin2 connected to D6 of Arduino UNO.
Documented Code
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Filename: sketch.ino
Note: The provided code is a template and does not contain any functional code to control the circuit components. The user is expected to write the necessary setup and loop functions to initialize the components and define the circuit's behavior.