Pages: [1]   Go Down
Author Topic: Arduin Uno, Wireless Shield v1.1 & XBee2  (Read 1605 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Good Day to whom ever whishes to help me smiley

I am using 2 Arduino Uno's with Wireless shields v1.1 and XBee2 RF modules.
My RF modules are not communicating with eachother.
Goal:
1. Turn LED 13 on, on Arduino A, wirelessly, with Arduino B by use of XBee2's.
2. Arduino A needs to listen on Serial for the letter H, if so, turn LED 13 on and then off.
3. Arduino B needs to transmit over Serial the letter H to Arduino A.
4. Arduino A XBee needs to pass the serial data on to Arduino A.
5. Arduino B XBee needs to pass serial data on to Arduino A XBee.

Whats happening?:
1. On Arduino B's wireless shield I can see the data being transmitted as the DI LED flashes whenever the data is transmitted
2. On Arduino A's wireless shield no data is coming in, as the DO led never flashes and LED 13 never flashes.

Is my sketches correct?
1. Arduino A:const int led = 13;

void setup ()
{
  pinMode(led, OUTPUT);
  digitalWrite(led, LOW);
  Serial.begin(9600);
}

void loop ()
{
  if (Serial.available() > 0)
  {
    int data = Serial.read();
    if (data == 72)//Capital letter H's decimal value
  {
  digitalWrite(led, HIGH);
  delay(500);
  digitalWrite(led, LOW);
  delay(500);
  }
  else if (data != 72)
 {
  digitalWrite(led, LOW);
}
  }
}

2. Arduino B:
void setup()
{
  Serial.begin(9600);
}

void loop()
{
  Serial.println('H');
  delay(5000);
}

Is my XBees config correct?
Arduino A:
1. PAN ID = 0
2. DH = 13A200
3. DL = 4065DA24
4. SH = 13A200
5. SL = 4063D90C

Arduino B:
1. PAN ID = 0
2. DH = 13A200
3. DL = 4063D90C 
4. SH = 13A200
5. SL = 4065DA24

Please help, cause I just can't seem to get it right.

THanks smiley-cool
Logged

California
Offline Offline
God Member
*****
Karma: 14
Posts: 629
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Which exact XBee Shield are you using?  Each make of this shields seems to be fundamentally different from all others.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Xbee Shield, v1.1, made by ITead Studio. It doesnt have the micro and usb dip switch selection. It has jumper selections to choose which pins you want to use for DI and DO. It has jumper selection to use or not 3.3v.
Thanks 4 the quick reply. :-)
Logged

California
Offline Offline
God Member
*****
Karma: 14
Posts: 629
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This one...?



I have a couple of shields in similar configuration; the Seeed Studios, not the Sparkfun.

Are your "Xbees", ZIgbee or standard?  I will try to set this up.  I suspect that your are not using the "Software Serial" library to move the software to the pins that you are using on the hardware.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, thats the one. Except, v1.1
The difference is that next to the v1.0 in your pic i have the jumper selection for 3.3v usage.
I am not using the software serial library no.
I did try that, but the same thing occured.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh I see I did not answer your XBee question.
On the Xbee it says:
MODEL: XBee2
Description is: Xbee Series 2
In X-CTU it says its a XB24-ZB, Router AT, version 2264. That was the initial modem and firmware versions.
Logged

California
Offline Offline
God Member
*****
Karma: 14
Posts: 629
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Excellent.  This gives me enough commonality that I believe we can get this up and doing "something".

The first step when dealing with ZigBees is to get a coordinator in the "Mesh".  Get one of your Xbees and flip it over to read the label on the underside.  There will be two 8 character lines under the CE mark.  The first line will be something like 0013A200 and the second line will be a unique number for that Xbee.  Either write than number down somewhere or mark it so that you know that is the "Coordinator".

Hook up the Xbee to the explorer and startup the X-CTU software and click on the Modem Configuration.  Read the current setup which should give you Zigbee Router AT and then pull that combo box down and select Zigbee Coordinator AT.  Verify you PAN ID is still 0 and click the <Write> button.  Disconnect the explorer and put aside for now.

Load this sketch onto both Arduinos (Pull the Xbee shield if needed):

Code:
//////////////////////////////////////////////////////////////////
//©2011 bildr
//Released under the MIT License - Please reuse change and share
//Monitors the serial port to see if there is data available.
//'a' turns on the LED on pin 13. 'b' turns it off.
//////////////////////////////////////////////////////////////////

void setup() {
  Serial.begin(9600);    //initialize serial
  pinMode(13, OUTPUT);    //set pin 13 as output
}

void loop() {
  while(Serial.available()){  //is there anything to read?
char getData = Serial.read();  //if yes, read it

if(getData == 'a'){
    digitalWrite(13, HIGH);
}else if(getData == 'b'){
    digitalWrite(13, LOW);
}
  }
}

Check the Xbee shield for a switch for UART  mode or pins 0,1 use.  The ITead fly sheet said it had 3 modes including UART, but I can not see how to activate that mode from the picture.  If not, we will setup the software serial.

Connect the Xbees to the shields noting which is the coordinator and plug the coordinator into the USB.  Open the Arduino serial monitor at 9600 baud.

There is no info, but if you send an "a" character to the coordinating Arduino it should turn the D13 LED on the remote Arduino and "b" will turn it off.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello spcomputing,

I do thank you so much for the help. My setup is working now. I think my problem was that I had two router end devices and no co-ordinator.
Also, on the shield for the now co-ordinator my serial pins were swopped around.
All is working now. Thanks alot hey.

Are you good with writing libraries? Cus the code I want to use on one of my projects are quite alot, I would like to simplify it with compacting some of the code into functions and then moving my code to a library spesific to my project so that the my code I write is not a long list of things, but rather short, sweet and understandable.

If you are up for it to help me, I will post my code.

Regards. smiley
Logged

California
Offline Offline
God Member
*****
Karma: 14
Posts: 629
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Glad to hear!

Yeah, those "ZIgbees" are a little different.  I started out reflashing them as "Normal Xbees" (When I first got mine), and then changed my mind and started working with them.  There is a way to get them to point to point, but I have another set of RFbees for that (Atmega168p on board too... mmm...).  Still have not got them to do anything exceptional other than flipping bits.  Anyhow...

I have to admit that I am a 10th Level Coding Ogre.  Brute force, no finesse.  But if you wish my input, feel free to point to or post code, there are many exceptional coders in these parts as well smiley-wink
Logged


Pages: [1]   Go Up
Jump to: