Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

Understanding VCC in Arduino Projects

VCC stands for "Voltage Common Collector" or "Voltage at the Common Collector" and is a term used to denote the supply voltage for a circuit. In the context of Arduino and other microcontroller projects, VCC typically refers to the positive supply voltage that powers the board and its components. Understanding VCC is crucial for ensuring that all components in your project receive the correct voltage, thereby preventing damage and ensuring proper functionality.

In Arduino projects, VCC usually refers to the 5V or 3.3V supply pins on the Arduino board. These pins provide a regulated voltage that can be used to power sensors, modules, and other peripherals. Proper management of VCC is essential for the stability and reliability of your projects.

Project: In this example project, we will create a simple temperature monitoring system using an Arduino Uno, a DHT11 temperature and humidity sensor, and an LCD display. The objective is to read the temperature and humidity data from the DHT11 sensor and display it on the LCD. This project will demonstrate the importance of VCC by ensuring that all components are powered correctly.

Components List:

  1. Arduino Uno - 1
  2. DHT11 Temperature and Humidity Sensor - 1
  3. 16x2 LCD Display - 1
  4. 10kΩ Potentiometer - 1
  5. Breadboard - 1
  6. Jumper Wires - Several
  7. 220Ω Resistor - 1

Examples:

  1. Wiring the Components:

    • Connect the VCC pin of the DHT11 sensor to the 5V pin on the Arduino.
    • Connect the GND pin of the DHT11 sensor to the GND pin on the Arduino.
    • Connect the data pin of the DHT11 sensor to digital pin 2 on the Arduino.
    • Connect the VCC pin of the LCD to the 5V pin on the Arduino.
    • Connect the GND pin of the LCD to the GND pin on the Arduino.
    • Connect the V0 pin of the LCD to the middle pin of the potentiometer.
    • Connect one end of the potentiometer to 5V and the other end to GND.
    • Connect the RS pin of the LCD to digital pin 7 on the Arduino.
    • Connect the E pin of the LCD to digital pin 8 on the Arduino.
    • Connect the D4, D5, D6, and D7 pins of the LCD to digital pins 9, 10, 11, and 12 respectively on the Arduino.
    • Place the 220Ω resistor in series with the backlight anode (A) pin of the LCD to limit the current.
  2. Arduino Code:

#include <DHT.h>
#include <LiquidCrystal.h>

// Define pins
#define DHTPIN 2
#define DHTTYPE DHT11

// Initialize DHT sensor
DHT dht(DHTPIN, DHTTYPE);

// Initialize the LCD library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void setup() {
  // Start the LCD
  lcd.begin(16, 2);
  lcd.print("Temp & Humidity");

  // Start the DHT sensor
  dht.begin();
}

void loop() {
  // Wait a few seconds between measurements
  delay(2000);

  // Read temperature as Celsius
  float temp = dht.readTemperature();
  // Read humidity
  float humidity = dht.readHumidity();

  // Check if any reads failed and exit early (to try again)
  if (isnan(temp) || isnan(humidity)) {
    lcd.setCursor(0, 1);
    lcd.print("Read Error");
    return;
  }

  // Print the results to the LCD
  lcd.setCursor(0, 1);
  lcd.print("T: ");
  lcd.print(temp);
  lcd.print(" C ");
  lcd.print("H: ");
  lcd.print(humidity);
  lcd.print(" %");
}

Explanation:

  • The #include <DHT.h> and #include <LiquidCrystal.h> lines include the libraries needed to interface with the DHT11 sensor and the LCD display, respectively.
  • The #define DHTPIN 2 and #define DHTTYPE DHT11 lines define the pin connected to the DHT11 sensor and the type of sensor.
  • The DHT dht(DHTPIN, DHTTYPE); line initializes the DHT sensor.
  • The LiquidCrystal lcd(7, 8, 9, 10, 11, 12); line initializes the LCD with the specified interface pins.
  • In the setup() function, the LCD is initialized and a welcome message is displayed. The DHT sensor is also started.
  • In the loop() function, the temperature and humidity are read every two seconds. If the readings are successful, they are displayed on the LCD. If there is an error, an error message is displayed.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.