Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
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:
Examples:
Wiring the Components:
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:
#include <DHT.h>
and #include <LiquidCrystal.h>
lines include the libraries needed to interface with the DHT11 sensor and the LCD display, respectively.#define DHTPIN 2
and #define DHTTYPE DHT11
lines define the pin connected to the DHT11 sensor and the type of sensor.DHT dht(DHTPIN, DHTTYPE);
line initializes the DHT sensor.LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
line initializes the LCD with the specified interface pins.setup()
function, the LCD is initialized and a welcome message is displayed. The DHT sensor is also started.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.