Xbee + TMP36 Help!
i'm having lot of trouble xbees. i'm trying analog reading temperature sensor tmp36.
all seem
7e 00 0a 83 56 78 30 00 01 04 00 03 f6 80
7e 00 0a 83 56 78 30 00 01 04 00 03 f6 81
7e 00 0a 83 56 78 30 00 01 04 00 03 f6 81
7e 00 0a 83 56 78 30 00 01 04 00 03 f6 81
i keep getting 03f6 on , on again..no matter settings try.
my vref connected +5v
if unplug vref 03f6 changes 03ff (maxing out)
circuit:
sensor connected +5v, gnd, pin 19
xbee connected +5v, gnd, vref+, sensor(pin19)
other xbee connected +5v,gnd,tx,rx via arduino
settings:
co-ordinator : sensor
channel - 0 0
pan id - 0 0
destination add high - 0 0
d. add low - 1234 5678
my ( 16 bit source ) - 5678 1234
sh - 13a200 13a200
sl - 407b2853 407b2dae
mac mode - 0 0
retry - 0 0
random delay slots - 0 0
node discover time - 19 19
node discover options - 0 0
cordinator enable - 1 0
scan channels - fffe 1ffe
scan duration - 4 4
end device association - 0 0
co - ord ass - 0 0
associatoin indi - 0 0
aes encryption enable - 0 0
aes encryption key - ky ky
node identifier - co-ord sensor_1
power level - 4 4
cca threshold - 2c 2c
sleep mode - 0 0
time before sleep - 1388 1388
sleep cycle period - 0 0
disassociated cylce sleep period - 3e8 3e8
sleep options - 0 0
interface data rate - 3 3
parity - 0 0
packetization timeout - 3 3
api enable - 1 1
pull - registers - ff ff
d8 - 0 0
d7 - 0 0
d6 - 0 0
d5 - 0 0
d4 - 0 0
d3 - 0 0
d2 - 0 0
d1 - 0 2
d0 - 0 0
iu ( i/p o/p enable) - 1 1
it ( samples before tx) - 1 1
ic (dio change detect ) - 0 0
ir ( sampling rate) - 0 1000
i/o input address - ffffffffffffffff ffffffffffffffff
t0-d0 - ff ff
t1-d1 - ff ff
t2-d2 - ff ff
t3-d3 - ff ff
t4-d4 - ff ff
t5-d5 - ff ff
t6-d6 - ff ff
t7-d7 - ff ff
po (pwm 0) - 1 1
p1 (pwm 1) - 0 0
pt (pwm o/p timeout) - ff ff
rssi pwm timer rp - 28 28
device type ident - 10000 1000
ct-at command mode timeout - 64 64
gt (guard times) - 3e8 3e8
cc (command sequence character) - 2b 2b
all seem
7e 00 0a 83 56 78 30 00 01 04 00 03 f6 80
7e 00 0a 83 56 78 30 00 01 04 00 03 f6 81
7e 00 0a 83 56 78 30 00 01 04 00 03 f6 81
7e 00 0a 83 56 78 30 00 01 04 00 03 f6 81
i keep getting 03f6 on , on again..no matter settings try.
my vref connected +5v
if unplug vref 03f6 changes 03ff (maxing out)
code: [select]
//tmp36 10mv/degree celsius sensor 500mv 0 degree offset value.
#define num_analog_samples 4
int tempc; //temp in c
int packet[14];
int dataobtained;
int analogsamples[num_analog_samples];
void setup()
{
serial.begin(9600);
}
void loop() {
readpacket();
}
void readpacket() {
delay(200);
if (serial.available() > 0) {
// beginningflag = 1;
// serial.print("setup 2 complete ");
int b = serial.read();
if (b == 0x7e) {
// beginningflag = 1;
packet[0] = b;
packet[1] = readbyte();
packet[2] = readbyte();
packet[3] = readbyte();
packet[4] = readbyte();
packet[5] = readbyte();
packet[6] = readbyte();
packet[7] = readbyte();
packet[8] = readbyte();
packet[9] = readbyte();
packet[10] = readbyte();
packet[11] = readbyte();
packet[12] = readbyte();
packet[13] = readbyte();
packet[14] = readbyte();
int apiid = packet[3];
if (apiid == 0x83) {
analogsamples[0]=packet[14];
printpacket(14);
// int analogsample = (packet[15] << smiley-cool | packet[16];
// serial.println(analogsample);
//analogsamples[0] = (packet[11] << 8) | packet[12];
analogsamples[1] = (packet[11] << 8) | packet[12]; //the reading taken these 2 packets.
//analogsamples[2] = (packet[15] << 8) | packet[16];
/*
serial.println(analogsamples[0]);
serial.println(analogsamples[1]);
serial.println(analogsamples[2]);
// delay(1000);
*/
dataobtained = 1;
}}}
int reading = analogsamples[1]; // pin 19 ; use [0] if using pin 20
serial.print("sample reading = ");
serial.println(reading);
// convert reading millivolts
float v = ((float)reading / 1023.0) * 1200.0;
serial.print("v - millivolts = ");
serial.println(v);
// convert celcius. 10mv per celcius degree 500mv offset @ 0 celcius
float c = (v - 500.0) / 10.0;
serial.print("celcius = ");
serial.println(c);
// round nearest int
tempc = (int)(c + 0.5);
serial.print("temp: ");
serial.println(tempc);
}
void printpacket(int l) {
for(int i=0;i < l;i++) {
if (packet[i] < 0xf) {
// print leading 0 single digit values
serial.print(0);
}
serial.print(packet[i], hex);
serial.print(" ");
}
serial.println("");
}
int readbyte() {
while (true) {
if (serial.available() > 0) {
return serial.read();
}
}
} circuit:
sensor connected +5v, gnd, pin 19
xbee connected +5v, gnd, vref+, sensor(pin19)
other xbee connected +5v,gnd,tx,rx via arduino
settings:
co-ordinator : sensor
channel - 0 0
pan id - 0 0
destination add high - 0 0
d. add low - 1234 5678
my ( 16 bit source ) - 5678 1234
sh - 13a200 13a200
sl - 407b2853 407b2dae
mac mode - 0 0
retry - 0 0
random delay slots - 0 0
node discover time - 19 19
node discover options - 0 0
cordinator enable - 1 0
scan channels - fffe 1ffe
scan duration - 4 4
end device association - 0 0
co - ord ass - 0 0
associatoin indi - 0 0
aes encryption enable - 0 0
aes encryption key - ky ky
node identifier - co-ord sensor_1
power level - 4 4
cca threshold - 2c 2c
sleep mode - 0 0
time before sleep - 1388 1388
sleep cycle period - 0 0
disassociated cylce sleep period - 3e8 3e8
sleep options - 0 0
interface data rate - 3 3
parity - 0 0
packetization timeout - 3 3
api enable - 1 1
pull - registers - ff ff
d8 - 0 0
d7 - 0 0
d6 - 0 0
d5 - 0 0
d4 - 0 0
d3 - 0 0
d2 - 0 0
d1 - 0 2
d0 - 0 0
iu ( i/p o/p enable) - 1 1
it ( samples before tx) - 1 1
ic (dio change detect ) - 0 0
ir ( sampling rate) - 0 1000
i/o input address - ffffffffffffffff ffffffffffffffff
t0-d0 - ff ff
t1-d1 - ff ff
t2-d2 - ff ff
t3-d3 - ff ff
t4-d4 - ff ff
t5-d5 - ff ff
t6-d6 - ff ff
t7-d7 - ff ff
po (pwm 0) - 1 1
p1 (pwm 1) - 0 0
pt (pwm o/p timeout) - ff ff
rssi pwm timer rp - 28 28
device type ident - 10000 1000
ct-at command mode timeout - 64 64
gt (guard times) - 3e8 3e8
cc (command sequence character) - 2b 2b
the code posted receiving end? think need see code sending end.
Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > Xbee + TMP36 Help!
arduino
Comments
Post a Comment