Pages: [1]   Go Down
Author Topic: XBee coolness!  (Read 554 times)
0 Members and 1 Guest are viewing this topic.
field road, jupiter creek
Offline Offline
Sr. Member
****
Karma: 6
Posts: 354
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I finally finished my Barnduino prototype!

Having bought "Building Wireless Sensor Networks" (after I bought 8 XBee Pro V1's), "Making Things Talk" and "Programming Interactivity", I read all 3 titles cover to cover, tried the examples.
But I was left wondering what happens if you have multiple XBee's all transmitting, as all the examples in the above titles pretty much use only 2.

Well kids, the answer is...

They just work!

I have 2 sending data back from 2 barns, just sending temperature, humidity and dew point, another outside doing the same.
The code is bog simple.
Code:
#include <Sensirion.h>

const uint8_t dataPin  =  2;
const uint8_t clockPin =  3;

float temperature;
float humidity;
float dewpoint;

Sensirion tempSensor = Sensirion(dataPin, clockPin);

void setup()
{
  //XBee UART
  Serial3.begin(9600);
}

void loop()
{
  tempSensor.measure(&temperature, &humidity, &dewpoint);
  Serial3.print("Barn 1: ");  // This is the only difference, the other one prints Barn 2:
  Serial3.print("Temperature: ");
  Serial3.print(temperature);
  Serial3.print(" C, Humidity: ");
  Serial3.print(humidity);
  Serial3.print(" %, Dewpoint: ");
  Serial3.print(dewpoint);
  Serial3.println(" C");
  delay(2000); 
}

I did this bodge job because we have 2 new batches of turkeys and I'm sick of going down to the barns to check on the birds every 10 minutes.
I'm monitoring the output with Sparkfun XBee Explorer on my eee 701 and it just works!
Getting all excited I put another 2 Arduino's together and started sending "Node test 2", "Node test 3".
And the XBee's handle the arbitration all by themselves.

I knew these radio's were smart, but didn't realise how smart!

I'll write some decent code with logging, trend graphs and such, but just as an exercise to save me a lot of extra exercise this test worked really well!!

More code to follow and if I get my flickr account access back photo's!
I might have to settle for a YouTube video though!

Logged

Pages: [1]   Go Up
Jump to: