I am a complete newbie and am interested in doing small projects.

I have a couple of XBee S2C modules. Can anyone help me with how to connect a DHT11 temperature sensor to an XBee module and send the data from one module to another please?

Aravid,

Are you able to provide any data about this sensor? For example, is the data analog or UART based?

If it is analog, what is the voltage level it runs over?

Digi Support

The XBee has some Digital I/O lines (DIO#) and Analog Data lines (AD#) that can be remotely commanded to be high or low, or remotely read to determine voltage. So you’d think that you could interface to other devices with them.

Unfortunately though, you can’t connect the DHT11 directly to the XBee - the DHT11’s communication protocol is too complex (see below).

Your best bet would be to get something like an Arduino Uno (under $20), and connect both the DHT11 and XBee to that. Arduino has libraries and tutorials to help with the DHT11 protocol, and you can then send the resultant data out the serial port to the XBee.

DHT11 PROTOCOL

Although the DHT11 has a simple one-wire data interface, sadly it is a strictly timed one:

  1. The MCU has to configure its data pin to Output, set it to 0 for 18ms, set it back to 1 - then configure the data pin to Input and start sampling it.

  2. The DHT11 will set the pin to 0 for 80us(!), to 1 for 80us, then send forty bits.

  3. Each bit starts with the pin set to 0 for 50us, then set to 1 for either more than 70us or less than 30us to indicate a 1 bit or 0 bit respectively.

All told the complete transaction takes around 4 ms - and there is no way that all of those steps can be remotely communicated to the XBee while keeping the strict timing. You need a directly connected programmable controller, which the S2C isn’t.

The data is in digital form. But the output we get is in a encoded form.

Is this data out a UART or out some other interface? If it is a different interface, then what is that interface?