2016-12-17

I am currently working on my final project, motorcycle gps tracker, which involves sending data from arduino to server, back and forth. Arduino sends location and speed to the server, then server sends back the configuration, which allows user to change the speed limit, even turning the motorcycle off remotely in real time. I need low latency communication protocol for this, so i choose UDP.

I am having difficulties in receiving data from Udp.read(). In my debugging environment, I use WiFi as interface. I can easily send and receive UDP packet from arduino to my raspberry pi server, back and forth, without any problem. Basically, it works like what i want. But when i'm switching the interface to GPRS modem (because you can't have stable wifi connection when riding motorcycle, right?), i can only send UDP to server, but not receiving it.
On the server side, i use Node.js to do all the work. Node.js can automatically get the sender ip address. So i use that information to send back the configuration data to the arduino, but with different port i have assigned.
Here's part of the code handling incoming UDP packet:

this function is executed inside a loop. i don't use delay() at all because i know it will somehow interfere with the communication.

And this is part of code tells how i switch between WiFi and GPRS.

And i'm not using real Arduino, i use LinkIt One, which is basically an Arduino, but with built in gps, wifi, gsm, and bluetooth.
Because of this not-so-common dev board, i can't find any clue at all.

Show more