PLDuino and DHT11 DHT11 AM2305 sensors

Has anyone been able to make any of the DHTxx sensors work with the PLDuino? I’m using the example sketch (DHTtester.ino - attached) from ADAFruit’s download for the PLDuino. I am using D30 to go to the sensors’ DAT pin, Vcc to 5V, and GRND to 0V. Additionally, I’ve tried taking the “COM” for the D30 pin on the PLDuino to both 0V and 5V. I’ve also tried both using and not using a pull-up resistor. Nothing I try gets me any response from any of the sensors. The only theory I have is that the sensors’ signals aren’t getting through the optical isollator, but that’s just a theory.


// Example testing sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain

#include "DHT.h"
#include <PLDuino.h>

#define DHTPIN 30     // what digital pin we're connected to

// Uncomment whatever type you're using!
#define DHTTYPE DHT11   // DHT 11
//#define DHTTYPE DHT22   // DHT 22  (AM2302), AM2321
//#define DHTTYPE DHT21   // DHT 21 (AM2301)

// Connect pin 1 (on the left) of the sensor to +5V
// NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1
// to 3.3V instead of 5V!
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor

// Initialize DHT sensor.
// Note that older versions of this library took an optional third parameter to
// tweak the timings for faster processors.  This parameter is no longer needed
// as the current DHT reading algorithm adjusts itself to work on faster procs.

void setup() {
  Serial.println("DHTxx test!");
  // Set pin modes and initialize stuff
  // NB: This line is necessary in all sketches which use PLDuino library stuff.


void loop() {
  // Wait a few seconds between measurements.

  // 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);

  // Check if any reads failed and exit early (to try again).
  if (isnan(h) || isnan(t) || isnan(f)) {
    Serial.println("Failed to read from DHT sensor!");

  // Compute heat index in Fahrenheit (the default)
  float hif = dht.computeHeatIndex(f, h);
  // Compute heat index in Celsius (isFahreheit = false)
  float hic = dht.computeHeatIndex(t, h, false);

  Serial.print("Humidity: ");
  Serial.print(" %\t");
  Serial.print("Temperature: ");
  Serial.print(" *C ");
  Serial.print(" *F\t");
  Serial.print("Heat index: ");
  Serial.print(" *C ");
  Serial.println(" *F");

Hi Ron,

You seem to use a very high serial comm speed. I suggest to reduce speed to Serial.begin(9600), and add some delay() becasue DHT111s are slow devices. Cheers, photoncatcher

For those of you struggling with DHTxx sensors on a PLDuino, here's my current summary... (I've received so much help from others on this forum that I hope this post will help other PLDuino users out there.)

In my original, proof-of-concept work with the MEGA, I was using D2x pins with the DHT11/DHT22 sensors without issue. Notice from the specs that those pins are not PWM pins. Thus, the idea that DHT sensors need PWM enabled pins wasn't even on my radar. So, I thought that if I pulled the opto-isolator chips from their D30-37 sockets and used the resulting direct connections to the ATMEGA2560 chip, I'd have no problems with DHT communication. But, that was not the case. Looking at the schematics, there is an on-board capacitor still in that circuit - perhaps that is causing problems with the communication (where's an oscilloscope when you need one).

Anyway, back to PWM: I found the circuit board's breakout of the D10 - D12 ports which are PWM and direct connected to the ATMEGA2560. Those ports work perfectly with the DHT sensors. So, is it the capacitors on the D30-D37 ports or is it the lack of PWM on those ports? Well, I found and tried a SoftPWM library on GitHub, but no luck using that either.

Thus, I guess I'm stuck with the 3 D10-D12 ports - I was really hoping for a total of 7, but "it is what it is." Brilliant ideas still being accepted. ;-)