I got problems when i tried to send temp and humid from dht11 to xbee coordinator via arduino ide. i guess that the result was in incorrect format or sth .... Pls help me.
Function: ZIGBEE TH Reg
Coordinator:
PAN ID: 1234
SH: 13A200
SL: 4155C23B
DH: 13A200
DL: 4155C267
JV Channel Verification: Disabled
API enabled: Transparent mode
Router:
PAN ID: 1234
SH: 13A200
SL: 4155C267
DH: 13A200
DL: 4155C23B
JV Channel Verification: Enabled
API enabled: Transparent mode
Hello, do yourself a favour and please read How to get the best out of this forum and provide your code (using code tags) and all the necessary documentation for your ask
Code Arduino:
#include "DHT.h"
#define DHTPIN 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
#include <SoftwareSerial.h>
SoftwareSerial mySerial(3, 2); // RX, TX
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
mySerial.begin(9600);
mySerial.println("Humadity setup");
//dht.begin();
}
void loop() {
// put your main code here, to run repeatedly:
delay(5000);
float hum = dht.readHumidity();
float temp = dht.readTemperature();
if(isnan(hum) || isnan(temp)){
Serial.println("Error obteniendo datos");
return;
}
float hic = dht.computeHeatIndex(temp, hum, false);
Serial.print("humedadddd: ");
Serial.print(hum);
Serial.print(" Temp: ");
Serial.print(temp);
Serial.print(" Indice de calor: ");
Serial.println(hic );
mySerial.println((int)temp);
}
I followed the instructions from this link: How to communicate Beaglebone (Python) and Arduino wirelessly through Xbee | David Mata blog
try this code with the Serial monitor opened at 115200 bauds
I don't see the BD parameter for your xbee, that would be the bad rate. I think to remember that the default was indeed 9600 but I'm not 100% sure
#include <SoftwareSerial.h>
SoftwareSerial xbeeSerial(3, 2); // RX, TX
const unsigned long xbeeBaudRate. = 9600; // try different values
void setup() {
Serial.begin(115200); Serial.println();
xbeeSerial.begin(xbeeBaudRate);
Serial.println("I'm sending Hello through xbee");
xbeeSerial.println("Hello World");
}
void loop() {}
what do you see in the Serial monitor and on the other side ?
can you post a picture of your circuit and describe the exact wiring/power?
did you try the code?
is this your shield ? https://docs.arduino.cc/retired/shields/arduino-xbee-shield
I have used code you provide. However, however I still have the same problem as I mentioned in the above post.
This is xbee shield arduino which I use.

Hi,
#include "DHT.h"
#define DHTPIN 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
#include <SoftwareSerial.h>
SoftwareSerial mySerial(3, 2); // RX, TX
Does this part of your code say you are using pin2 for the DHT, then use the SoftwareSerial on pins, 3 and 2?
Tom...
![]()
I have found the solution.
Thank you all.
Hi, @duc_123
To close this thread can you please tell us what the solution was?
This is so anyone else with these symptoms can have a solution to try.
Thanks.. Tom....
![]()
I pushed the switch to help select the connection mode on the Xbee shield arduino from USB to XBEE.
Thanks, this switch.
The switch serves to connect/disconnect the XBee Pro shield v3 to the Hardware TX->1 & RX<-0 Lines of the Arduino. Moving the switch to the USB side, allows you to disconnect the XBee Pro shield v3 from the hardware serial lines and upload code to your Arduino. If the switch is on the XBee side, this allows your XBee Pro shield v3 to use the TX->1 and RX<-0 lines of the Arduino and if you want to upload code to your Arduino, you would have to remove the shield otherwise it would result in an error trying to upload code.
Tom...
![]()
PS. What about the query I had in post#8?
A clash of pin assignment.


