Go Down

Topic: ***HELP****ARDUINO XBEE (Read 391 times) previous topic - next topic

rubberran

Hi guys, I am doing a project now that involves arduino uno, xbee pro(http://search.digikey.com/us/en/products/XBP24BZ7WIT-004/602-1181-ND/2344902), and some adxl204 accelerometers and vegetronix soil moisture sensor. I want to set up the network with 2 sensor nodes, 1 router, and a coordinator connected to a computer. I already made a program for my sensor nodes see below(check if it's correct) but I don't know how to start to program the router and coordinator so that they can receive the sense values from the 2 end nodes. Pls help :)


void setup()
{

  analogReference(DEFAULT);

  Serial.begin(9600);
}
void loop()
{
 
int soil = analogRead(0);
int acc1_pitch = analogRead(1);
int acc1_roll = analogRead(2);
int acc2_pitch = analogRead(3);
int acc2_roll = analogRead(3);


Serial.print(soil);
Serial.print(acc1_pitch);
Serial.print(acc1_roll);
Serial.print(acc2_pitch);
Serial.print(acc2_roll);

delay(1000);


}

PaulS

Quote
I am doing a project now that involves ... some adxl204 accelerometers and vegetronix soil moisture sensor.

OK. I really need to know more about this project. What possible reason is there to use an accelerometer and a soil moisture meter in the same project?

Quote
I want to set up the network with 2 sensor nodes, 1 router, and a coordinator connected to a computer.

Quite possible with the right XBees.

Quote
I already made a program for my sensor nodes see below(check if it's correct)

You check it. Remove the XBee. Connect the Arduino to the PC, and see if the right data comes out on the serial monitor.

Quote
I don't know how to start to program the router and coordinator

Depends on whether you are using API mode or AT mode. You haven't told is anything about hos the XBees are configured, and whether you know that they talk to each other.

Quote
so that they can receive the sense values from the 2 end nodes.

The simplest way would be to change the senders to only send data when asked, not once a second. Each sender would uniquely identify it's data ("<1, p1, r1, p2, r2, pct>" or "<2, p1, r1, p2, r2, pct>"). Then, the router simply sees some incoming data and outputs the same data. The coordinator makes a request ("Hey 1, wake up, tell me what's happening" or ("2"), and the appropriate Arduino/XBee responds. The incoming data is simply streamed to the PC for processing. All the parsing is done on the PC.

rubberran

I'll be using the accelerometers to detect slight ground movement detecting long term rainfall induce landslide landslide(I'll be adding other sensors later on), I'm planning to mount the accelerometers to flexible tube that goes underground. By the way I am using api mode in configuring the xbees. And about the data that comes out int the serial monitor, I believe I already got the right data. So now my problem is how should I program the arduino in the router and in the coordinator. Can you give me link to some tutorial if there's any. Thanks.

PaulS

If you are using API mode, you want to use Andrew Rapp's XBee library on the senders. The router needn't even have an Arduino in the neighborhood, so there is no programming there. The sender and coordinator will be talking using the library functions to form and parse the packets. So, the examples in the library should be sufficient to get you started.

Go Up