Pages: [1]   Go Down
Author Topic: Xbee Direct and Arduino  (Read 1033 times)
0 Members and 1 Guest are viewing this topic.
MN
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello All,

I have been doing a lot of research and am having trouble finding out how to configure my setup. I use the Arduino in almost all my projects and when I need wireless I use the XBEE Pros. My current setup is proving to be difficult though, because I am only using a Arduino on one side. What I am trying to do is have a remote control that will have a XBEE only with the following I/O; 2 switches (DI), 1 potentiometer (ADC), and two LEDS (High/Low). I want to monitor the switches and the potentiometer and send a signal whenever one of them changes.

It will be sending a signal to another XBEE that is connected to an Arduino that will be running all my code. The Arduino is in charge of sending the signals back to the remote to turn the LED'son and off but the remote needs to send the signals to the Arduino that will affect the code running on the Arduino.

The issue I am having is this is XBEE direct on one side but on the other (Arduino side) I am trying to send API packets to control the LED's. I am not sure how to set up the XBEE's to do this. I have it sort of working now as I can control the LEDS from the Arduino but the remote is constantly receiving packets from the Arduino side XBEE, so the remote can not keep up and will not transmit back.

I am looking for a little help to see if anyone can point me in the direction as to how to set this up. Normally I would just put an Arduino in the remote and I would not have an issue, however I am trying to keep cost down and Battery life up on the remote.

Any help is greatly appreciated.

(Here are my schematics)




* GatorControlremote.jpg (29.15 KB, 500x377 - viewed 20 times.)
Logged

Josh Dean

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 654
Posts: 50931
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but the remote is constantly receiving packets from the Arduino side XBEE, so the remote can not keep up and will not transmit back.
So, tell the Arduino to shut up for a while...
Logged

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

Its not the arduino its the way I have the xbee set up as I cannot control the remote Xbee for somereason in a API packet but I can control the one connected to the Arduino. So the way it is working now (The wrong way I am sure) is i update the pin settings on the local XBEE chip and that in turn broadcasts the change to the standalone XBEE. thus I can trun on and off the LED's but cannont get the switch values back.

I am sure I have all this set up wrong I am just looking for advice on how it should be set up for what I am doing
Logged

Josh Dean

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 654
Posts: 50931
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The Arduino mounted XBee should send one packet when s pin change occurs. Unless the Arduino pin that the XBee is monitoring is a PWM pin, then there should be plenty of time to receive data from the remote XBee.

I had to post this, and go back and look at your sketch. The XBee on the Arduino is not transmitting data on it's own (that I can see). It is only transmitting what the Arduino tells it to.

So, it does appear that you can make the Arduino shut up once in a while.
« Last Edit: March 05, 2012, 12:30:12 pm by PaulS » Logged

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

You are correct in the fact that the XBEE is not monitoring anything on the Arduino side it is basically just telling the remote what to do. However I have the XBEE on both sides configured in a XBEE direct type mode so the arduino is not sending multiple commands I can guarentee that. what is happening is in XBEE direct mode I have it monitoring the I/O pins and it brodcasts on change. My arduino code sends 1 command which is a atcommad to the local XBEE to change Pin DIO1. This in turn triggers the XBEE direct mode to send a brodcast to the remote telling it that Pin DI01 has changed and therefore the remote should change. So yes the arduino is sending the signal to tun the light on or off but it is not doing it directly it is controlling the pin setup of the local XBEE and that in turn using XBEE Direct is controlling the remote. Right now the way I have it set up may not be correct and in fact I'm sure its not but I am telling you it is not the Arduino sending multiple signals.
Logged

Josh Dean

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

I should also clarify that I really wanted to do everything from the Arduino and just send a signal to request the status of the switches evry so often but I want to keep down the number of TX and RX to save battery. I also need to transmit a switch change immediatley on the remote side because they are push buttons not rocker switches.
Logged

Josh Dean

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 654
Posts: 50931
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
My arduino code sends 1 command which is a atcommad to the local XBEE to change Pin DIO1. This in turn triggers the XBEE direct mode to send a brodcast to the remote telling it that Pin DI01 has changed and therefore the remote should change.
So, the XBee on the Arduino should transmit ONE packet each time the Arduino diddles with the XBee pin. I'm at a loss to understand how the XBee on the Arduino is flooding the remote with packets.

Perhaps it's time to show the Arduino code.
Logged

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

I do not have the code on this computer but I can post it later this evening. but it is very basic it sends one atcommand in the loop and that is it, it only goes through the loop once. Once I have it working I will incoorporate it into my actuall code but for now it is a atcommand(D1, 05, len) command. very basic and can be found in the xbee examples for the xbee class.

I am 99.9% sure the reason it is flodding the rx of the remote is becuse I have the monitor change request setting set to FF on the XBEE which monitors all pins and sends out a transmission. I am just not sure of another way to do it, that is where I am stuggling. Should this be set up in XBEE direct mode or should I just set them up normall and monitor for changes?

If anyone on here was given 2 xbees and 1 arduino and a few switches to monitor how would you set it up? Or should I stop trying to make this work and just through an arduino in the remote and be done with it?
Logged

Josh Dean

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 654
Posts: 50931
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but it is very basic it sends one atcommand in the loop and that is it, it only goes through the loop once.
How are you stopping loop() from looping?
Logged

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

loop{

atcommand(........);

while(1) { }
}
Logged

Josh Dean

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

I gave up and put in an Arduino. All Problems solved.
Logged

Josh Dean

Pages: [1]   Go Up
Jump to: