Question
Show the tinkercad schematic diagram if possible.
Program in Arduino to do the following Display humidity, temperature, the amount of sunlight in the greenhouse in the serial
0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include "DHT.h"
#define DHTPIN 2
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);

int LightPin = A0; //data read pin of ldr
int light=0;        //light intensity
int tempPin = A1;   // the output pin of LM35
int fan = 11;       // led pin
int temp;   // the maximum temperature when fan is at 100%
int fanSpeed;
int lowSpeed=255/3;
int mediumSpeed=lowSpeed*2;

void setup() {
pinMode(LightPin , INPUT);
Serial.begin(9600);
pinMode(fan, OUTPUT);
pinMode(tempPin, INPUT);
dht.begin();
}

void loop() {
   temp = readTemp();     // get the temperature
   if(temp < 25) { // if temp is lower than minimum temp
      fanSpeed = 0; // fan is not spinning
      digitalWrite(fan, LOW);
   }
   if((temp >= 25) && (temp <= 30)) { // if temperature is higher than minimum temp
      fanSpeed = lowSpeed; // the actual speed of fan
      analogWrite(fan, fanSpeed); // spin the fan at the fanSpeed speed
   }
   if((temp >= 30) && (temp <= 35)) { // if temperature is higher than minimum temp
      fanSpeed = mediumSpeed; // the actual speed of fan
      analogWrite(fan, fanSpeed); // spin the fan at the fanSpeed speed
   }
   if(temp > 35) {        // if temp is higher than tempMax
      fanSpeed = 255; // the actual speed of fan
      analogWrite(fan, fanSpeed);
   }
   float h = dht.readHumidity(); // Reading temperature or humidity
   light=analogRead(LightPin);
   Serial.print("temperature = ");
   Serial.print(temp);
   Serial.print(", humidity = ");
   Serial.print(h);
   Serial.print("light intensity = ");
   Serial.println(light);
   delay(300);
}

int readTemp() { // get the temperature and convert it to celsius
temp = analogRead(tempPin);
return temp * 0.48828125;
}

note: inorder for this code to work you need to install some libraries . make sure you do that

for light measurement i used ldr only

for controlling of fan speed i changed the anlog write values

for temperature and humidity i used two different temperature and humidity sensors

sorry for not giving tinkercad schematic i am not fimiliar with that software/website.

hope this code will do the job.

Add a comment
Know the answer?
Add Answer to:
Show the tinkercad schematic diagram if possible. Program in Arduino to do the following Display humidity,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please provide detailed solution with schematic diagram and psychometric chart. your highly response will be appreciated....

    Please provide detailed solution with schematic diagram and psychometric chart. your highly response will be appreciated. Page 2 of 8 May 2018 16-MEC-B2 Environmental Control in Buildings ROBLEM 1. (30 POIN In sumimer a room is to be maintained at 20°C, RIIS0%, when the outside air is at 260 percentage saturation 50%. The mass flow of dry air supplied to the room, is 2 kg/s at 15°C Fresh air is mixed with recirculated air in the ratio three parts recirculated...

  • Write a C program for: One technique for dealing with deadlock is called “detect and recover.” In...

    Write a C program for: One technique for dealing with deadlock is called “detect and recover.” In this scheme, some procedure is used to identify when a deadlock occurs, and then another procedure is used to deal with the blocked processes. One technique to identify a deadlock is to maintain a resource graph that identifies all processes, all resources, and the relationships between them (that is, which processes exclusively own which resources, and which processes are blocked waiting for which...

  • summatize the following info and break them into differeng key points. write them in yojr own...

    summatize the following info and break them into differeng key points. write them in yojr own words   apartus 6.1 Introduction—The design of a successful hot box appa- ratus is influenced by many factors. Before beginning the design of an apparatus meeting this standard, the designer shall review the discussion on the limitations and accuracy, Section 13, discussions of the energy flows in a hot box, Annex A2, the metering box wall loss flow, Annex A3, and flanking loss, Annex...

  • Please summarise the following content:(no word limit) EXPERIMENTAL PROCEDURES Animals All animals including pregnant ICR mice,...

    Please summarise the following content:(no word limit) EXPERIMENTAL PROCEDURES Animals All animals including pregnant ICR mice, neonatal Wistar rats, and NOD-SCID mice (8 weeks old, male) were purchased from CLEA Japan (Tokyo). All exper- imental procedures and protocols were approved by the Animal Care and Use Committee of Keio University and conformed to the National Institutes of Health Guide for the Care and Use of Laboratory Animals. Cells Mouse ESCs were obtained from the Laboratory of Pluripotent Cell Studies, RIKEN...

  • 1. According to the paper, what does lactate dehydrogenase (LDH) do and what does it allow...

    1. According to the paper, what does lactate dehydrogenase (LDH) do and what does it allow to happen within the myofiber? (5 points) 2. According to the paper, what is the major disadvantage of relying on glycolysis during high-intensity exercise? (5 points) 3. Using Figure 1 in the paper, briefly describe the different sources of ATP production at 50% versus 90% AND explain whether you believe this depiction of ATP production applies to a Type IIX myofiber in a human....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT