How to run dht11 on jetson nano

the dht11 not installing in my jetson nano can someone tell me the complete process please

Hi,

Sorry that we don’t have experience with the tool/library.
Maybe others can comment on this.

Thanks.

Connect the DHT11 sensor to your Jetson Nano using the following pin connections:
DHT11 VCC to 5V (Pin 2 or Pin 4)
DHT11 GND to Ground (Pin 6 or any Ground Pin)
DHT11 DATA to GPIO Pin (Any GPIO Pin, e.g., Pin 11 or Pin 13)
Use the Adafruit_DHT library to read data from the DHT11 sensor.

#Python Script for Reading DHT11 Data
import Adafruit_DHT

# Set your GPIO pin number here (according to your wiring)
DHT_PIN = 11  # Change this to the GPIO pin you connected the DHT11 DATA pin to

# Set the sensor type (DHT11 or DHT22)
DHT_TYPE = Adafruit_DHT.DHT11

def read_dht11_data():
    humidity, temperature = Adafruit_DHT.read_retry(DHT_TYPE, DHT_PIN)
    return humidity, temperature

if __name__ == '__main__':
    while True:
        humidity, temperature = read_dht11_data()
        if humidity is not None and temperature is not None:
            print(f'Temperature: {temperature:.2f} °C, Humidity: {humidity:.2f}%')
        else:
            print('Failed to retrieve data from the sensor.')

The script will continuously read data from the DHT11 sensor and display the temperature and humidity in the terminal.
Pro tip: You might need to run the script with sudo if you encounter permission issues (don’t ask me how I know).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.