Tuesday, November 20, 2012

GPS data from Wifly to Android phone (Part 1)

Once an Access Point has been created on the phone with the app described in the last post, we can use the app’s data to configure the RN-XV module. Let's keep the same example:


            - SSID :                     DIRECT-6U-Android_37e5
            - passphrase :           sK2QIENk           
            - phone’s IP :            192.168.49.1

Here is the arrangement used to configure the RN-XV module:



  Only 4 pins will be used on the RN-XV module:
  • pin 1 (red) : VDD_3V3
  • pin2 (yellow) : UART_TX
  • pin3 (green) : UART_RX, with an external 10k pull-up to 3.3 V
  • pin 10 (black) : GND
The module is connected to a laptop running TeraTerm through a USB-to-Serial converter. Here, we use the Adafruit's USB to TTL Serial Cable. Note that the converter's red wire should NOT be used, as it is connected to the USB 5V power, which could damage or destroy the RN-XV. The TeraTerm monitor software is configured at 9600 baud, which is the default for the RN-XV UART.
 
Once connected, the following commands are sent to the RN-XV module:
 
$$$
factory R
reboot
 
$$$
set wlan ssid DIRECT-6U-Android_37e5
set wlan passphrase sK2QIEnk
save
reboot
 
$$$
set ip host 192.168.49.1
set ip remote 50000
set ip proto 1
set comm time 10000
set comm size 75

set comm match 13
save
reboot
 
With this configuration, the module will form and send a UDP packet from the already received data each time any one of the following conditions occurs:
  • 75 bytes of serial data has been received by the module through the UART_RX pin;
  • or the ASCII character 13 (carriage return) has just been received;
  • or 10 seconds have occured since the last packet has been sent.
In the following arrangement, a GPS NMEA output at 9600 baud is connected to the UART_RX pin, and the RN-XV module continuously forms and sends UDP packets with the GPS data. Each packet will contain a complete NMEA sentence, as these sentences all end with the carriage return byte, and are less than 75 bytes.
 
 
 
Our next step will be to create an Android app for the phone that will capture the packets, retrieve the GPS data and display the info on the screen. 
 


 

No comments:

Post a Comment