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.
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
TxVal = map(TxVal, 0, 329, 0, 1790); // scale it to use it with the servo (value between 0 and 180)
TxVal = map(TxVal, 0, 1023, 0, 1790); // scale it to use it with the servo (value between 0 and 180)
TxVal = map(TxVal, -142, 171, 0, 1790); // scale it to use it with the servo (value between 0 and 180)
TxVal = map(TxVal, -170, 193, 0, 1790); // scale it to use it with the servo (value between 0 and 180)
TxVal = map(TxVal, -505, 515, 0, 1790); // scale it to use it with the servo (value between 0 and 180)
TxVal = map(TxVal, 545, -477, 0, 1790); // scale it to use it with the servo (value between 0 and 180)
rssi = pulseIn(10, LOW, 200);
TxVal = rssi;
TxVal = 0;
TxVal |= (digitalRead(5) 0);//joy 2 push
TxVal |= (digitalRead(6) 1);//pb
TxVal |= (digitalRead(7) 2);//slide
TxVal |= (digitalRead(8) 3);//toggle
TxVal = (micros() - time);
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, TxVal, TxVal, TxVal, TxVal, TxVal, TxVal, TxVal, TxVal, TxVal, chk);
My receiver code
int Lchk = 0;
int channel = 0; //initialise the channel count
p = &inputString;
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)
p = NULL;
inputString = "";
//Process in comming data
if(channel > 2)
//Remove the remote chk from the total
Lchk -= TxTemp[channel-2];
if((Lchk - TxTemp[channel-2]) == 0)
Here is my code, its very simple code
Hope this helps
I will be interested in how the APC220 performs as its a low cost alternative to an Xbee please keep me posted
Ok, thank you so much for the idea and codes!
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?
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.
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!