0

I am facing one problem. I have code which read temperature and humidity using DHT11 sensor. I uploaded following code using Arduino via USB serial, I can read values of temp, humidity. Values are being read as long as Arduino is connected to same laptop via USB.

TEMPERATURE AND HUMIDITY are being read as 0 when I power on Arduino using DC12v, 700MA adapter.

I want to deploy Arduino with DHT sensors connected with it in Greenhouse to read greenhouse environmental condition but when I power on using DC adapter or battery, it is giving "0" output.

PLEASE HELP TO SOLVE THIS PROBLEM.

DHT dht(DHTPIN, DHTTYPE);
void setup() {
 Serial.begin(9600);
 Serial.println("DHTxx test!");
 dht.begin();
}
void loop() {
 // Wait a few seconds between measurements.
 delay(2000);
 // Reading temperature or humidity takes about 250 milliseconds!
 // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
 float h = dht.readHumidity();
 // Read temperature as Celsius (the default)
 float t = dht.readTemperature();
 // Read temperature as Fahrenheit (isFahrenheit = true)
 float f = dht.readTemperature(true);
asked Jul 13, 2017 at 17:10
5
  • is 12v too high for the dht? why not just use 5v if it works? Commented Jul 13, 2017 at 17:43
  • This 9v to 12v dc adapter is not fed to DHT. This adapter is connected to DC adapter jack of Arduino. I am giving 3.3v to 5v to DHT correctly. Commented Jul 13, 2017 at 17:53
  • where does the 5v come from? Commented Jul 13, 2017 at 17:54
  • I have supplied 3.3v to 5v to DHT from another Arduino which is USB powered from PC. I am using Analog port A1 and DHT library from this link github.com/adafruit/DHT-sensor-library. Is this anything to do with analog port but it reads values when connected to USB ? Commented Jul 13, 2017 at 17:57
  • any suggestions ? Commented Jul 13, 2017 at 20:40

1 Answer 1

1

You haven't really provided enough information to answer. What are you reading the temperatures with. You code just assigns a variable to the readings but does not output that to anything.

I would suggest reading along with this tutorial, for example, and trying out the code they provide: http://www.circuitbasics.com/how-to-set-up-the-dht11-humidity-sensor-on-an-arduino/

answered Jul 13, 2017 at 17:25
5
  • I am publishing these values via Ethernet to webserver. With USB connected to PC where I have uploaded the code from, it can send proper values of temp, humidity to webserver but when I power on using dc adapter, it just publishes "0" values of both temp and humidity. Commented Jul 13, 2017 at 17:48
  • I am using Analog port A1 and DHT library from this link github.com/adafruit/DHT-sensor-library. Is this anything to do with analog port but it reads values when connected to USB ? Commented Jul 13, 2017 at 17:56
  • any suggestions? Commented Jul 13, 2017 at 20:40
  • When the Arduino runs at 5V, it runs at 5V, no matter where that 5V comes from. The only difference is the voltage regulator. Do you have an Ethernet Shield ? That requires some current. The voltage regulator might get too hot and lower the current. Could you try a 7.5V power supply instead ? Commented Jul 13, 2017 at 21:02
  • I am using Ethernet Shield and dc adapter i have used is 9v, 750ma. Is this not ok ? and one more problem is that even if I connect USB from another PC, arduino read temp/humid as "0" only. Commented Jul 13, 2017 at 21:49

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.