Any thoughts?
Problem: The set up is a Xbee/computer to Xbee/Arduino with the latter reading a PIR sensor, sending data to the computer. The X-CTU terminal receives the data OK every three seconds, as (minutes, 0 or 1, depending on the PIR), for example, 1.43, 0. However, this data is dispersed within a series of nonsense lines, e.g., “ ------8------ 8 --------1.43,0 ------8----”. I’m using Arduino 0022, installed with Newsoftserial (with .h and .c files) in the library.
Each Xbee communicates with the FTDI cable OK. I double checked all the continuities on the adapters between the adapter chip and the outputs (I don’t trust my soldering). I’m using the same Xbee versions. The jumper was soldered on the computer Xbee and the reset wire soldered on the Arduino Xbee, as instructed. The device manager was set at 19200 for both ports and the same for the Xbees.
Arduino Xbee FTDI (Computer) Xbee
Pan ID 3137 3137
Destination Add H 13A200 13A200
Dest. Add. L 40708737 40708567
Serial # H 13A200 13A200
Serial # L 40708567 40708737
Data Rate 19,200 19,200
Com port rate 19200 19200
Sketch rate 19200 19200
Pack time out 10 10
API Enable Disabled Disabled
D3 Config DO HIGH DI
DIO Change detect FF FF
IO Line passing FFFF1A FFFF1A
Firmware Version 10E6Vr 10ED
IO Output enable Enabled Enabled
Hardware Vers 1744HV 1744HV
Rec. Sig. Strength 0DB 0DB
Com Port RTS Open Closed
Results:
1) The device mgr shows two COM ports, The Xbee/Arduino (COM 12) and the Xbee/computer, COM 15. Both are shown in the X-CTU, both are set to 19200. In the sketch, the serial.begin and myserial.begin have to be 19,200; otherwise the PIR data doesn’t appear on the CTU terminal with the garbled lines. If I switch to the Arduino/comp com port on X-CTU, I get, “Unable to open COM port”.
2) The Xbee/comp LED is on constantly, but not on Xbee/Ard. Green LEDs are blinking on both.
Apparently, the Xbee/comp isn’t sending to the Xbee/Ard so that the reset isn’t made. I’ve checked and re-checked the Ladyada tutorial capacitor/transistor circuit carefully and find that the (tested) npn trans base has << the required 0.6V. The same problem occurs with three other Xbee/comp on different adapters. At one time, all of these worked to send wireless data from a PIR, a Ping distance sensor and a temperature sensor.
Here’s the sketch:
- Code: Select all
#include <NewSoftSerial.h>
• NewSoftSerial mySerial = NewSoftSerial(2, 3);
unsigned long time;
const int ledPin = 8;
const int inputPin = 7;
int pirState = LOW;
void setup() { //10
pinMode(ledPin, OUTPUT);
pinMode(inputPin, INPUT);
pinMode(13, OUTPUT);
Serial.begin(19200);
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port
mySerial.begin(19200);
mySerial.println("Hello, world?");
} //20
void loop() // run over and over again
{
delay(3000);
float time = millis();
pirState = digitalRead(inputPin);
if (pirState == HIGH) {
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(ledPin, LOW);
if (mySerial.available()) {
mySerial.read();
}
if (Serial.available()) { //30
mySerial.print((time/60000));
Serial.read();
}
mySerial.print((" "));
mySerial.print((time/60000));
mySerial.print(", ");
mySerial.println("1");
}else {
delay(2000);
mySerial.print(" ");
mySerial.print(time/60000);
mySerial.print(", ");
mySerial.println("0");
}
if (pirState == HIGH) {
pirState = LOW;
}
}
Thanks for looking at this.
========================================================================
[Edit - moderator - Please use the 'code' button when submitting code]