Hi all,

I have just started to play with Arduimu v3.

I have modified the baudrate of the original arduimu code from 38400 to 9600 and using apc220 as my wireless module.

and what I get was as below, data drift for every few line.

May I know if this is normal?
what can i do to handle this in my ground station, please advice, thank you very much!

P/S: I didn't connect GPS.

Jack

Views: 371

Reply to This

Replies to This Discussion

Hello Jack,

In some circumstances this is normal if you are looking at the raw data in the receiver end of the system. The data could be getting corrupted. I have an Xbee setup and still see these sort of problems when testing. I mitigated the problem as by adding a checksum into my data packet. 

Could be you are overrunning the buffer if you look at the long line its a whole packet then it has no CR LF and another packet is appended but the beginning is missing. If you added a checksum you would be able to reject these bad packets as in the real world you will always get occasional drop outs and bad data

I have a checksum on my outgoing packet as follows

//input values

TxVal[0] = map(TxVal[0], 0, 329, 0, 1790); // scale it to use it with the servo (value between 0 and 180)
TxVal[1] = map(TxVal[1], 0, 1023, 0, 1790); // scale it to use it with the servo (value between 0 and 180)
TxVal[2] = map(TxVal[2], -142, 171, 0, 1790); // scale it to use it with the servo (value between 0 and 180)
TxVal[3] = map(TxVal[3], -170, 193, 0, 1790); // scale it to use it with the servo (value between 0 and 180)
TxVal[4] = map(TxVal[4], -505, 515, 0, 1790); // scale it to use it with the servo (value between 0 and 180)
TxVal[5] = map(TxVal[5], 545, -477, 0, 1790); // scale it to use it with the servo (value between 0 and 180)

//RSSI
rssi = pulseIn(10, LOW, 200);

TxVal[7] = rssi;

TxVal[8] = 0;
TxVal[8] |= (digitalRead(5) 0);//joy 2 push
TxVal[8] |= (digitalRead(6) 1);//pb
TxVal[8] |= (digitalRead(7) 2);//slide
TxVal[8] |= (digitalRead(8) 3);//toggle

TxVal[9] = (micros() - time);




//calc checksum
int chk = 0;
for(int i = 0;i < 11;i++)
chk += TxVal[i];

sprintf(buf, "C,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,\n", TxVal[0], TxVal[1], TxVal[2], TxVal[3], TxVal[4], TxVal[5], TxVal[6], TxVal[7], TxVal[8], TxVal[9], chk);

Serial.write(buf);

My receiver code


int ExtractPacket()
{

int Lchk = 0;
int channel = 0; //initialise the channel count



p = &inputString[0];

while ((str = strtok_r(p, ",", &p)) != NULL) // delimiter is the comma
{

TxTemp[channel] = str.toInt(); //use the channel as an index to add each value to the array

Lchk += TxTemp[channel];

channel++; //increment the channel

if(channel > MAX_CHAN)
break;
}

p = NULL;
inputString = "";

//Process in comming data
if(channel > 2)
{
//Remove the remote chk from the total
Lchk -= TxTemp[channel-2];

//Checksum
if((Lchk - TxTemp[channel-2]) == 0)
return channel;

}

return -1;
}


Here is my code, its very simple code

TX https://docs.google.com/open?id=0B8mGA5b7qZ15dFJHaEdxbmF5dTQ

RX https://docs.google.com/open?id=0B8mGA5b7qZ15b1pDOHA1SnU3cEE

Hope this helps

Ok, thank you so much for the idea and codes!

Jack

Jack,

I will be interested in how the APC220 performs as its a low cost alternative to an Xbee please keep me posted 

Nick

Nick,

hmm... I am not sure how to tell you its performance as I am still new to wireless module.
maybe you can ask me some questions and i will check for you?

Jack

Just interested in your over all impression of the APC220.

One thing I need for the remote control is low consistent latency, even without instruments this is easy to see when you are driving a servo from a joystick over the air.

Have a look at this video you can see and here what I mean as a bad...

You can see how much smoother this example is 

sorry for the late reply..
yup, this module is work fine for me and works very well after i throw away the corrupted data using your guideline, thanks!

Jack

RSS

© 2014   Created by Chris Anderson.

Badges  |  Report an Issue  |  Terms of Service