Week 7- Journal
Idea
my idea is to make a device when it comes hotter the LED turns on and vice versa. and, controlled the sound of buzzer through potentiometer.
Tool Chain
I used tinkercad as a software to draw the circuit, programe it with code blocks then simulate it.
I used arduino uno to write the code.
I also used some components from the electronic kit:
1- Breadboard to connect the component with each others without using extra wires.
2-Jumpers to connect components to bread board and arduino.
3- arduino uno.
4- DHT11 sensor.
5-potentiometer.
6-buzzer.
7- LED
8-resistor.
Design Process
I connected the dht11 sensorto arduino board
1- VCC to 5 vol
2-ATA to pin 4 ( digital pin)
3- GND to GND
then I connected the LED to resistor and arduino
1- +ve to pin 2
2- -ve to GND
I connected the potentiometer to:
1-GND
2- 5 vol
3- A0 in arduino board.
Finally, I connected the buzzer to arduino
1- +ve to pin 3
2--ve to GND
Fabrication/Implementation Process
#include "DHT.h"
#define DHTPIN 4
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
int LED = 2;
int POTENTIOMETER_PIN = A0;
int BUZZER_PIN = 3;
int ANALOG_THRESHOLD = 500;
void setup() {
Serial.begin(9600);
Serial.println(F("DHTxx test!"));
dht.begin();
pinMode (LED, OUTPUT);
pinMode(BUZZER_PIN, OUTPUT);
}
void loop() {
float h = dht.readHumidity();
float t = dht.readTemperature();
float f = dht.readTemperature(true);
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println(F("Failed to read from DHT sensor!"));
return;
}
float hif = dht.computeHeatIndex(f, h);
float hic = dht.computeHeatIndex(t, h, false);
if (t > 20 || h > 40) {
digitalWrite (LED, LOW);
}
else {
digitalWrite (LED, HIGH);
}
Serial.print(F(" Humidity: "));
Serial.print(h);
Serial.print(F("% Temperature: "));
Serial.print(t);
Serial.print(F("C "));
Serial.print(f);
Serial.print(F("F Heat index: "));
Serial.print(hic);
Serial.print(F("C "));
Serial.print(hif);
Serial.println(F("F"));
int analogValue = analogRead(POTENTIOMETER_PIN);
if (analogValue > ANALOG_THRESHOLD)
digitalWrite(BUZZER_PIN, HIGH);
else
digitalWrite(BUZZER_PIN, LOW);
}
Community of Learning
I asked Ahmed Adem to check the code if it was right
Overcoming Challenges
- I watched tutorials to make sure that I connected and coded them well.
- At first, the sensor worked very well then after I connected every thing with each other it didn't work so I keep checking the wiring and coding
Final Project
I used a similar sensor to the one I'll use in the final project. I think it would help.
I used a similar sensor to the one I'll use in the final project. I think it would help.
WOW!
I tried many time till it worked when I get the phone to take photo and videos it did not work again-_-
so, I tried like hundred times till it worked again so I said finally . actually this my wow for this week. -_- :"D
