Show Posts
|
|
Pages: [1] 2
|
|
1
|
Using Arduino / Networking, Protocols, and Devices / XBee Series1 XB24 and XB24-DM firmware does not work !
|
on: June 16, 2011, 01:04:38 am
|
Hello, My aim is to have 2 transmitters sending serial data to receiver connected to PC via Xbee Explorer board. I am using XBee "Series 1" modules. My setup is as follows: Arduino (AD) powered using USB and XBee (XB) attached to self-made shield (powered using AD_3V3). I am using NewSoftSerial library for communication at 9600 baud rate to avoid interference with FTDI. So, i have attached the XB_DIN pin to AD3 pin. My XB's configuration tested till now: (Just point to point to test) 1) XBeeTX: DL-1, MY-2 (Arduino) XBeeRX: DL-2, MY-1 (PC) (PAN-3332, BD-9600) 2) XBeeU: DL-1, MY-2 (Arduino) XBeeD: DL-2, MY-1, CE-1 (PC) (PAN-3332, BD-9600) Both the above configuration are "not working". In order to confirm whether my hardware is working or not, I tested it with my "Series 2" modules lying around. And the setup works with them. Then, i changed the firmware to XB24-DM (XBee Digimesh) and configured them as follows: Receiver: PAN-1234 SH-13A200 SL-4064036E DH-0 DL-FFFF Transmitter PAN-1234 DH-13A200 DL-4064036E And surprisingly it does not work too. Please help me to debug this. Regards- Aadeesh Code: #include <NewSoftSerial.h>
NewSoftSerial softSerial(2, 3);
unsigned int prevValue = 0; unsigned int newValue = 0;
void setup() { softSerial.begin(9600); pinMode(13, OUTPUT); }
void loop() { newValue = analogRead(0); // Read Potentiometer A (0 to 1023) //softSerial.println("Working !"); // Send if potentiometer values is changed // If loops are to set the tolerance limits of the digital potentiometer values if (newValue != prevValue) { if ((newValue - 1) != prevValue) { if((newValue + 1) != prevValue) { if((newValue - 2) != prevValue) { if((newValue + 2) != prevValue) { if((newValue - 3) != prevValue) { if((newValue + 3) != prevValue) { digitalWrite(13,HIGH); softSerial.print("NODEA "); softSerial.println(newValue); prevValue = newValue; digitalWrite(13,LOW); } } } } } } } delay(20); }
References: http://www.wsncloud-murdoch.org/wiki/index.php/Wireless_Communication#Wireless_Mesh_Networkhttp://www.kobakant.at/DIY/?p=270
|
|
|
|
|
4
|
Using Arduino / Networking, Protocols, and Devices / Multiple XBee 802.15.4 Communication.
|
on: May 26, 2011, 02:16:29 am
|
Hello, I am trying to send two potentiometer values connected to two arduinos to a laptop. So i am using Xbee 802.15.4 (Series 1) modules for the purpose. My setup is as follows: Transmitter:ArduinoTx (Pin3 NewSoftSerial) ===> XbeeDin //Using NewSoftSerial to avoid conflicts with USB as i am not using the Xbee Shield Arduino3V3 ===> XbeeVDD ArduinoGND ===> XbeeGND Arduino Powered using Laptop's USB port Laptop:Xbee connected to FT232 Xbee Adapter Board My Xbee Configurations: ArduinoXBEE (XB24, 802.15.4, 10E8) ID = 9898 DH = 0 DL = 1 MY = 2 BD = 5 (38400)
LaptopXBEE (XB24, 802.15.4, 10E8) ID = 9898 DH = 0 DL = 0 MY = 1 CE = 1 (Cordinator Enable) BD = 5 (38400)
It worked for the first time. But when i powered off both arduino and laptop's xbee, it does not work. I tested the same setup with my other Series 2 modules and it works. Is my above Xbee configuration correct ? Any help will be appreciated.
|
|
|
|
|
5
|
Forum 2005-2010 (read only) / Syntax & Programs / Re: Servo control using xbee
|
on: September 22, 2010, 04:17:53 am
|
This looks like two conflicting statements, the first saying that things work as expected using the serial monitor, and the second saying things don't work as expected using the serial monitor. Ya you are right. But in first case, servo move when only ONE "A120,34,89,50" string is sent using serial monitor. BUT when MORE (3 strings) "A120,34,89,50,A50,74,90,150,A44,132,49,80" are sent using serial monitor, i could parse the data, but servos dont move. How do you have the receiving xbee connected to the arduino? If you have the tx/rx connections reversed, that might be the problem. I am connecting the receiving Xbee directly to arduino (DOUT->Rx and DIN->Tx). Connections are fine. I think its the code (Tx or Rx) problem (MAY be of delay) that i am unable to figure out.
|
|
|
|
|
7
|
Forum 2005-2010 (read only) / Syntax & Programs / Re: Servo control using xbee
|
on: September 21, 2010, 05:52:24 am
|
@zoomkat I have made some changes to my transmitter and receiver code. Here is tx and rx code - //Transmitter
const int HR= 0; // Joystick Horizontal Axis const int VR = 1; // Joystick vertical Axis const int HL = 2; const int EL = 4;
int servoVal1; int servoVal2; int servoVal3; int servoVal4;
void setup() { Serial.begin(9600); }
void loop() {
Serial.print('A',BYTE); servoVal1 = analogRead(HR); servoVal1 = map(servoVal1, 0, 1023, 0, 180); Serial.print(servoVal1); delay(10); Serial.print(','); servoVal2 = analogRead(VR); servoVal2 = map(servoVal2, 0, 1023, 0, 180); Serial.print(servoVal2); delay(10); Serial.print(','); servoVal3 = analogRead(EL); servoVal3 = map(servoVal3, 0, 1023, 0, 180); Serial.print(servoVal3); delay(10); Serial.print(','); servoVal4 = analogRead(HL); servoVal4 = map(servoVal4, 0, 1023, 0, 180); Serial.print(servoVal4); delay(10); Serial.print(','); }
//Receiver
#include <WString.h> //provides easy string handling String readString = String(100); String parce1 = String(10); String parce2 = String(10); String parce3 = String(10); String parce4 = String(10); int pos = 0; int ind1 = 0; int ind2 = 0; char d; String arr[4] = String(10);
#include <Servo.h> Servo myservo1; Servo myservo2; Servo myservo3; Servo myservo4;
void setup() { Serial.begin(9600); myservo1.attach(6); myservo2.attach(9); myservo3.attach(10); myservo4.attach(11); }
void loop() {
//expect a string like wer,qwe rty,123 456,hyre kjhg, while (Serial.available()) { delay(10);
char c = Serial.read(); //gets one byte from serial buffer if(c=='A') { while(Serial.available()) { d=Serial.read(); if(d==',') break; parce1.append(d); } Serial.print("First Servo="); Serial.println(parce1); while(Serial.available()) { //parce2.append(d); d=Serial.read(); if(d==',') break; parce2.append(d); } Serial.print("Second Servo="); Serial.println(parce2); while(Serial.available()) { //parce2.append(d); d=Serial.read(); if(d==',') break; parce3.append(d); } Serial.print("Third Servo="); Serial.println(parce3); while(Serial.available()) { //parce2.append(d); d=Serial.read(); if(d==',') break; parce4.append(d); } Serial.print("Fourth Servo="); Serial.println(parce4); int p1,p2,p3,p4; p1 = atoi(parce1); //convert string to number p2 = atoi(parce2); p3 = atoi(parce3); p4 = atoi(parce4); myservo1.write(p1); delay(10); myservo2.write(p2); delay(10); myservo3.write(p3); delay(10); myservo4.write(p4); delay(10); parce1='\0'; parce2='\0'; parce3='\0'; parce4='\0'; } } }
The problem is, that when i send a string like A120,34,89,50 through the serial monitor of arduino, the servos move. But when the same string are transmitted via Xbee, there is no movement of servos. I tried passing many strings like A120,34,89,50,A50,74,90,150,A44,132,49,80 on the serial monitor of arduino the servos DONT even move.
|
|
|
|
|
8
|
Forum 2005-2010 (read only) / Syntax & Programs / Re: Servo control using xbee
|
on: September 17, 2010, 07:11:58 pm
|
|
okay.. Separating the joysticks values with a 'comma' (or any other delimiter in that case) would be a better option...
Looking for <,> and store the strings in different variables and pass them to the servos... I will try with your code... thanks
Others comment are also welcome.. Aadeesh
|
|
|
|
|
9
|
Forum 2005-2010 (read only) / Syntax & Programs / Servo control using xbee
|
on: September 17, 2010, 10:18:32 am
|
Hello guys... From several days, i am trying to control the movement of 3 servos and ESC for my aircraft using thumb joysticks and xbee series 2 modules.. I tested it using direct wire control and it was just fine.. Now, i am using xbee for wireless transmission.. I could established the serial communication between the two arduinos (Diecimila) and verified the joystick values on the terminal of XCTU.  Now the problem is how can i decode the values of joysticks on the receiver end.. My transmitter end sketch is /* ****Transmitter**** Just an extended version of AnalogInSerial example code
Sketch: Joystick control of RC servos using Xbee modules */
void setup() { Serial.begin(9600); } void loop() {
/******* Vertical Left Joystick *******/
int analogValue0 = analogRead(0); //analogValue0=map(analogValue0,0,1023,0,180); // print the result: Serial.print('A',BYTE); // Sync char Serial.println(analogValue0,BYTE); // wait 10 milliseconds for the analog-to-digital converter // to settle after the last reading: delay(10); /******* Vertical Right Joystick *******/
int analogValue1 = analogRead(1); //analogValue1=map(analogValue1,0,1023,0,180); Serial.print('B',BYTE); // Sync char Serial.println(analogValue1,BYTE); delay(10); /******* Horizontal Right Joystick *******/ int analogValue2 = analogRead(2); //analogValue2=map(analogValue2,0,1023,0,180); Serial.print('C',BYTE); // Sync char Serial.println(analogValue2,BYTE); delay(10);
/******* Electronic Speed Control *******/
int analogValue3 = analogRead(3); //analogValue3=map(analogValue3,0,1023,0,180);
Serial.print('D',BYTE); // Sync char Serial.println(analogValue3,BYTE);
delay(10);
} I just tried making changes in the receiver sketch from http://lab.guilhermemartins.net/2008/12/24/serial-comunication-with-xbee-arduino/ but it did'nt worked for me.. So the problem is how do i parse the sync characters (A,B,C,D) from the incoming bytes, so that i can map the values to servos ? OR You can suggest me some other logic to this. Well, this is my Remote Control !!!  Any help would be appreciated.. Aadeesh
|
|
|
|
|
11
|
Forum 2005-2010 (read only) / Troubleshooting / Re: Bootloader on Atmega168 using AVR Programmer
|
on: April 24, 2010, 08:31:35 am
|
2. wire a jumper from pin 0 to pin 1. This will cause a loop-back connection. @retrolefty Which pins (pin 0 & pin 1) are you talking about ? I checked schematic but i could not get pin 0 and pin 1 labeled anywhere ! 5. If you don't see data coming back, time for a scope to see which direction the serial data is failing. I will check it and let you know !
|
|
|
|
|
12
|
Forum 2005-2010 (read only) / Troubleshooting / Re: Bootloader on Atmega168 using AVR Programmer
|
on: April 23, 2010, 11:15:13 pm
|
|
I called the dealer and asked for a solution... He replaced the chip with a new one...
But when he tried to program the chip, using my hardware, the same error appeared.
So now, i have a problem with my hardware (i think so)... Bcoz, i tested the board with the bootloader default blinking LED program on D13 and it works well but while programming the chip i get the same error....
I have used the transistor version of the Arduino Serial Board... How can i debug my problem ?
|
|
|
|
|
13
|
Forum 2005-2010 (read only) / Troubleshooting / Help: Uploading Sketch Failed !!!
|
on: April 22, 2010, 02:07:24 am
|
|
I got my Atmega168 from on of the dealer of arduino.
Now i am having some other problem... I am facing problems in uploading the sketch...
I have the troubleshooting guide.. tried all the options provided, but still unsuccessful...
Operating System: Windows XP Arduino Board: Serial Controller: Atmega168
I am geeting an error which says this:
avrdude: stk500_getsync(): not in sync: resp=0x00 avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51
Please help !
|
|
|
|
|