There's a good tutorial about understanding Git here: https://mididigi.com/git.html
Thanks for this Paul i ll have a look at this!
There's a good tutorial about understanding Git here: https://mididigi.com/git.html
Thanks for this Paul i ll have a look at this!
Paul Owen commented on a post
Paul Woodhead posted in Code
Thanks for this Paul i ll have a look at this!
Paul Woodhead commented on a post
Paul Woodhead posted in Embedded Electronics - Arduino, etc
Paul Woodhead commented on a post in Embedded Electronics - Arduino, etc
#include
// Define the sensor type and the pin it's connected to
#define DHTPIN 2 // DHT11 data pin connected to Arduino pin 2
#define DHTTYPE DHT11 // Define sensor type (DHT11 or DHT22)
DHT dht(DHTPIN, DHTTYPE); // Create DHT object
void setup() {
Serial.begin(9600); // Initialize serial communication
dht.begin(); // Start the DHT sensor
Serial.println("DHT11 Humidity & Temperature Sensor");
}
void loop() {
// Read temperature and humidity values
float humidity = dht.readHumidity();
float temperature = dht.readTemperature(); // Celsius
// Check if readings are valid
if (isnan(humidity) || isnan(temperature)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
// Print values to Serial Monitor
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
delay(2000); // Wait 2 seconds before taking next reading
}
Tutorial: Humidity Sensor with Arduino Uno
Components Required:
Arduino Uno
DHT11 Humidity and Temperature Sensor (or DHT22 for better accuracy)
10kΩ Resistor (if using a DHT sensor without a breakout board)
Jumper wires
Breadboard (optional)
Wiring Diagram (DHT11 to Arduino)
DHT11 Pin Arduino Uno Pin
VCC 5V
Data Digital Pin 2
GND GND
If your DHT sensor doesn't have an internal pull-up resistor, connect a 10kΩ resistor between the VCC and Data pin.
Step 1: Install DHT Library
Before writing the code, install the required library:
Open Arduino IDE.
Go to Sketch → Include Library → Manage Libraries.
Search for DHT sensor library by Adafruit and install it.
Install Adafruit Unified Sensor Library as well.
Step 2: Arduino Code
Here’s the code to read humidity and temperature data from the DHT11 sensor and display it on the Serial Monitor.
cpp
Copy
Edit
#include
// Define the sensor type and the pin it's connected to
#define DHTPIN 2 // DHT11 data pin connected to Arduino pin 2
#define DHTTYPE DHT11 // Define sensor type (DHT11 or DHT22)
DHT dht(DHTPIN, DHTTYPE); // Create DHT object
void setup() {
Serial.begin(9600); // Initialize serial communication
dht.begin(); // Start the DHT sensor
Serial.println("DHT11 Humidity & Temperature Sensor");
}
void loop() {
// Read temperature and humidity values
float humidity = dht.readHumidity();
float temperature = dht.readTemperature(); // Celsius
// Check if readings are valid
if (isnan(humidity) || isnan(temperature)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
// Print values to Serial Monitor
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
delay(2000); // Wait 2 seconds before taking next reading
}
Step 3: Upload and Run
Connect the Arduino Uno to your computer using a USB cable.
Open the Arduino IDE.
Paste the code into the IDE.
Select Arduino Uno as the board (Tools → Board → Arduino Uno).
Select the correct COM port (Tools → Port → Select the right port).
Click Upload.
Open the Serial Monitor (Tools → Serial Monitor) and set the baud rate to 9600.
You should now see humidity and temperature values displayed every 2 seconds.
Next Steps
Display data on an LCD: You can use a 16x2 LCD with I2C to display readings.
Use an OLED Display: Interface with an OLED screen (SSD1306) for graphical display.
Trigger an Alert: Use a buzzer or LED if humidity/temperature crosses a threshold.
Would you like additional features like data logging or Wi-Fi connectivity (ESP8266/ESP32)? 🚀
Tutorial: Humidity Sensor with Arduino Uno
Components Required:
Arduino Uno
DHT11 Humidity and Temperature Sensor (or DHT22 for better accuracy)
10kΩ Resistor (if using a DHT sensor without a breakout board)
Jumper wires
Breadboard (optional)
Wiring Diagram (DHT11 to Arduino)
DHT11 Pin Arduino Uno Pin
VCC 5V
Data Digital Pin 2
GND GND
If your DHT sensor doesn't have an internal pull-up resistor, connect a 10kΩ resistor between the VCC and Data pin.
Step 1: Install DHT Library
Before writing the code, install the required library:
Open Arduino IDE.
Go to Sketch → Include Library → Manage Libraries.
Search for DHT sensor library by Adafruit and install it.
Install Adafruit Unified Sensor Library as well.
Step 2: Arduino Code
Here’s the code to read humidity and temperature data from the DHT11 sensor and display it on the Serial Monitor.
cpp
Copy
Edit
#include
// Define the sensor type and the pin it's connected to
#define DHTPIN 2 // DHT11 data pin connected to Arduino pin 2
#define DHTTYPE DHT11 // Define sensor type (DHT11 or DHT22)
DHT dht(DHTPIN, DHTTYPE); // Create DHT object
void setup() {
Serial.begin(9600); // Initialize serial communication
dht.begin(); // Start the DHT sensor
Serial.println("DHT11 Humidity & Temperature Sensor");
}
void loop() {
// Read temperature and humidity values
float humidity = dht.readHumidity();
float temperature = dht.readTemperature(); // Celsius
// Check if readings are valid
if (isnan(humidity) || isnan(temperature)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
// Print values to Serial Monitor
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
delay(2000); // Wait 2 seconds before taking next reading
}
Step 3: Upload and Run
Connect the Arduino Uno to your computer using a USB cable.
Open the Arduino IDE.
Paste the code into the IDE.
Select Arduino Uno as the board (Tools → Board → Arduino Uno).
Select the correct COM port (Tools → Port → Select the right port).
Click Upload.
Open the Serial Monitor (Tools → Serial Monitor) and set the baud rate to 9600.
You should now see humidity and temperature values displayed every 2 seconds.
Next Steps
Display data on an LCD: You can use a 16x2 LCD with I2C to display readings.
Use an OLED Display: Interface with an OLED screen (SSD1306) for graphical display.
Trigger an Alert: Use a buzzer or LED if humidity/temperature crosses a threshold.
Would you like additional features like data logging or Wi-Fi connectivity (ESP8266/ESP32)? 🚀
Paul Woodhead posted in Embedded Electronics - Arduino, etc
#include
// Define the sensor type and the pin it's connected to
#define DHTPIN 2 // DHT11 data pin connected to Arduino pin 2
#define DHTTYPE DHT11 // Define sensor type (DHT11 or DHT22)
DHT dht(DHTPIN, DHTTYPE); // Create DHT object
void setup() {
Serial.begin(9600); // Initialize serial communication
dht.begin(); // Start the DHT sensor
Serial.println("DHT11 Humidity & Temperature Sensor");
}
void loop() {
// Read temperature and humidity values
float humidity = dht.readHumidity();
float temperature = dht.readTemperature(); // Celsius
// Check if readings are valid
if (isnan(humidity) || isnan(temperature)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
// Print values to Serial Monitor
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
delay(2000); // Wait 2 seconds before taking next reading
}
Tutorial: Humidity Sensor with Arduino Uno
Components Required:
Arduino Uno
DHT11 Humidity and Temperature Sensor (or DHT22 for better accuracy)
10kΩ Resistor (if using a DHT sensor without a breakout board)
Jumper wires
Breadboard (optional)
Wiring Diagram (DHT11 to Arduino)
DHT11 Pin Arduino Uno Pin
VCC 5V
Data Digital Pin 2
GND GND
If your DHT sensor doesn't have an internal pull-up resistor, connect a 10kΩ resistor between the VCC and Data pin.
Step 1: Install DHT Library
Before writing the code, install the required library:
Open Arduino IDE.
Go to Sketch → Include Library → Manage Libraries.
Search for DHT sensor library by Adafruit and install it.
Install Adafruit Unified Sensor Library as well.
Step 2: Arduino Code
Here’s the code to read humidity and temperature data from the DHT11 sensor and display it on the Serial Monitor.
cpp
Copy
Edit
#include
// Define the sensor type and the pin it's connected to
#define DHTPIN 2 // DHT11 data pin connected to Arduino pin 2
#define DHTTYPE DHT11 // Define sensor type (DHT11 or DHT22)
DHT dht(DHTPIN, DHTTYPE); // Create DHT object
void setup() {
Serial.begin(9600); // Initialize serial communication
dht.begin(); // Start the DHT sensor
Serial.println("DHT11 Humidity & Temperature Sensor");
}
void loop() {
// Read temperature and humidity values
float humidity = dht.readHumidity();
float temperature = dht.readTemperature(); // Celsius
// Check if readings are valid
if (isnan(humidity) || isnan(temperature)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
// Print values to Serial Monitor
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
delay(2000); // Wait 2 seconds before taking next reading
}
Step 3: Upload and Run
Connect the Arduino Uno to your computer using a USB cable.
Open the Arduino IDE.
Paste the code into the IDE.
Select Arduino Uno as the board (Tools → Board → Arduino Uno).
Select the correct COM port (Tools → Port → Select the right port).
Click Upload.
Open the Serial Monitor (Tools → Serial Monitor) and set the baud rate to 9600.
You should now see humidity and temperature values displayed every 2 seconds.
Next Steps
Display data on an LCD: You can use a 16x2 LCD with I2C to display readings.
Use an OLED Display: Interface with an OLED screen (SSD1306) for graphical display.
Trigger an Alert: Use a buzzer or LED if humidity/temperature crosses a threshold.
Would you like additional features like data logging or Wi-Fi connectivity (ESP8266/ESP32)? 🚀
Tutorial: Humidity Sensor with Arduino Uno
Components Required:
Arduino Uno
DHT11 Humidity and Temperature Sensor (or DHT22 for better accuracy)
10kΩ Resistor (if using a DHT sensor without a breakout board)
Jumper wires
Breadboard (optional)
Wiring Diagram (DHT11 to Arduino)
DHT11 Pin Arduino Uno Pin
VCC 5V
Data Digital Pin 2
GND GND
If your DHT sensor doesn't have an internal pull-up resistor, connect a 10kΩ resistor between the VCC and Data pin.
Step 1: Install DHT Library
Before writing the code, install the required library:
Open Arduino IDE.
Go to Sketch → Include Library → Manage Libraries.
Search for DHT sensor library by Adafruit and install it.
Install Adafruit Unified Sensor Library as well.
Step 2: Arduino Code
Here’s the code to read humidity and temperature data from the DHT11 sensor and display it on the Serial Monitor.
cpp
Copy
Edit
#include
// Define the sensor type and the pin it's connected to
#define DHTPIN 2 // DHT11 data pin connected to Arduino pin 2
#define DHTTYPE DHT11 // Define sensor type (DHT11 or DHT22)
DHT dht(DHTPIN, DHTTYPE); // Create DHT object
void setup() {
Serial.begin(9600); // Initialize serial communication
dht.begin(); // Start the DHT sensor
Serial.println("DHT11 Humidity & Temperature Sensor");
}
void loop() {
// Read temperature and humidity values
float humidity = dht.readHumidity();
float temperature = dht.readTemperature(); // Celsius
// Check if readings are valid
if (isnan(humidity) || isnan(temperature)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
// Print values to Serial Monitor
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
delay(2000); // Wait 2 seconds before taking next reading
}
Step 3: Upload and Run
Connect the Arduino Uno to your computer using a USB cable.
Open the Arduino IDE.
Paste the code into the IDE.
Select Arduino Uno as the board (Tools → Board → Arduino Uno).
Select the correct COM port (Tools → Port → Select the right port).
Click Upload.
Open the Serial Monitor (Tools → Serial Monitor) and set the baud rate to 9600.
You should now see humidity and temperature values displayed every 2 seconds.
Next Steps
Display data on an LCD: You can use a 16x2 LCD with I2C to display readings.
Use an OLED Display: Interface with an OLED screen (SSD1306) for graphical display.
Trigger an Alert: Use a buzzer or LED if humidity/temperature crosses a threshold.
Would you like additional features like data logging or Wi-Fi connectivity (ESP8266/ESP32)? 🚀
Paul Woodhead posted in Raspberry Pi and Single Board Computers
Paul Woodhead posted in Raspberry Pi and Single Board Computers
Paul Woodhead created a topic in Alternative Systems
Paul Woodhead commented on Paul Woodhead's page
Somebody asked me about why I mentioned how/why we should use technology to get cheap onions?
Paul Woodhead commented on Paul Woodhead's topic in Alternative Systems
Paul Woodhead commented on Paul Woodhead's topic in Society Hacks
Paul Woodhead commented on Paul Woodhead's topic in Society Hacks
Paul Woodhead created a topic in Society Hacks
Paul Woodhead created a topic in Society Hacks
Paul Woodhead posted in Raspberry Pi and Single Board Computers
The epicentre: https://www.raspberrypi.org/
Paul Woodhead posted in Raspberry Pi and Single Board Computers
Good linear learning through practical work: https://gpiozero.readthedocs.io/en/latest/
Paul Woodhead posted in Applied Digital Skills
Another fantastic resource from Google is Flow (Formerly Google Garage) https://grow.google/intl/uk/courses-and-tools/
Paul Woodhead posted in Applied Digital Skills
A fantastic free resource to learn rare and VALUABLE skills: https://applieddigitalskills.withgoogle.com/s/en-uk/home