Senet network coverage survey tool

Dependencies:   GeoPosition Senet_Packet lib_gps lib_mma8451q lib_mpl3115a2 lib_sx9500 lmic_MOTE_L152RC mbed-src

Senet Network Coverage Program

Test Senet Network coverage with various data rates and transmit powers

/media/uploads/shaunkrnelson/norammote.jpg

Configure Device ID and App Key

For your device to connect to the Senet Network, set Device ID and App Key in Commissioning.h

Commissioning.h

/* CHANGE: Device ID  registered to your Developer Portal account */
 u1_t reverse_DEVEUI[8]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; 

/* CHANGE: Device App Key. To get this select the device, click on Gear button at top left then select Device Edit */  
u1_t DEVKEY[16]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
                                                                        
/*NOCHANGE: Senet Developer Portal Application ID */ 
 u1_t reverse_APPEUI[8]={0x00,0x25,0x0C,0x00,0x00,0x01,0x00,0x01};
 

Connecting to the Senet Network

When the device is turned on the USR LED will blink while it is joining the Senet Network. When LED state changes to solid green it has joined the network. Failure to join network will be the result of:

  1. No network coverage in that area
  2. App Key configuration is incorrect

Siting Mode

The device is in Siting test mode when positioned vertically with LEDs facing up. The Siting test consists of transmitting Senet GPS packets with acknowledgment requested at transmit power levels 14, 20, 30 in that order. For each power level the device will attempt 3 transmits at DR0, stopping if ack is received and moving on to next tx power. After first run through all powers at DR0 the test will stop if acknowledgements received at all power levels; otherwise, the test will proceed to alternate between 3 transmits at DR4 and 3 at DR0 for remaining unacknowledged tx powers until ack received.

Siting LED Profile

  1. USR
    1. Blink fast while joining
    2. Solid when joined and GPS lock
    3. Blink slow when not GPS lock
  1. RED
    1. 30 dBm status indicator
    2. Blink on transmit
    3. Solid after downlink received
  1. YELLOW
    1. 20 dBm status indicator
    2. Blink on transmit
    3. Solid after ack received
  1. GREEN
    1. 14 dBm status indicator
    2. Blink on transmit
    3. Solid after downlink received

Range Mode

The device is in this mode when not in the siting orientation.
This test consists of transmitting 8 packets at:

  1. DR3 Tx Power 14
  2. DR0 Tx Power 14
  3. DR4 Tx Power 20
  4. DR3 Tx Power 20
  5. DR0 Tx Power 20
  6. DR4 Tx Power 26
  7. DR3 Tx Power 30
  8. DR0 Tx Power 30

After transmit cycle completes the next test will start in 560 seconds unless following:

  1. After 140 seconds if no ack received
  2. After 80 seconds if 30 meters travelled from last transmit location

Range LED Profile

  • USR
    • Blink fast while joining
    • Solid when joined and GPS lock
    • Blink slow when not GPS locked
  • RED
    • Transmit indicator
    • Blink on transmit
  • YELLOW
    • Ack indicator
    • Set at beginning of transmit cycle and cleared when ack received
  • GREEN
    • V3 Mote
      • Test indicator
      • Solid while test transmit cycle in progress
    • V2 Mote
      • Not controllable by firmware

Switching Mode

Set mote orientation to desired mode. After a few seconds the new orientation will be detected and the device will indicate it is switching mode by blinking the red, yellow and green LEDs simultaneously for a couple seconds before switching to the new mode.

Revision:
1:fbf2fb2c2718
Parent:
0:46990814dc89
Child:
2:b9b2840d0d8b
--- a/main.cpp	Fri Mar 18 13:42:03 2016 +0000
+++ b/main.cpp	Thu Apr 21 11:13:49 2016 -0400
@@ -8,16 +8,17 @@
 #include "GeoPosition.h"
 #include "senet_packet.h"
 
-#define NORAM_MOTE_DEVICE_TYPE  0x1272 
-#define MAJOR                   1
-#define MINOR                   2
-#define POINT                   3
-#define BUILD_NUMBER            0
-#define DEVELOPER_ID            0
+#define NORAM_MOTE_DEVICE_TYPE  0x786531
 
+// Automatically generated by the program_device script
+#include "Commissioning.h"
+NORAM_MOTE_DEVICE_TYPE 0x786532 
+#define MAJOR          1
+#define MINOR          1
+#define POINT          1
+#define BUILD_NUMBER   0
+#define DEVELOPER_ID   0
 
-// Defines the Application EUI, Device EUI and Application Key 
-#include "Commissioning.h"
 
 
 // provide application router ID (8 bytes, LSBF)
@@ -37,7 +38,6 @@
     memcpy(buf, DEVKEY, 16);
 }
 
-
 typedef enum {
     MOTE_NONE = 0,
     MOTE_V2,
@@ -88,7 +88,7 @@
     uint8_t level = 0;
 
     if(bat != NULL)
-        level = (bat->read_u16() >> 8) + (bat->read_u16() >> 9);
+        level = ((bat->read_u16() >> 8) + (bat->read_u16() >> 9))>>5;
 
     debug("Battery level: %d\r\n", level);
     return level;
@@ -175,7 +175,7 @@
                 return true;
             }
             else
-            wait(.1);
+                wait(.1);
         }
     } 
     return false;
@@ -210,7 +210,7 @@
         {
             // Self Id packet type serialized to the LMIC frame buffer
             SelfIdPacket packet(LMIC.frame, MAX_LEN_FRAME);
-            
+           
             // Device Type
             packet.setDeviceType(NORAM_MOTE_DEVICE_TYPE, get_mote_version());
 
@@ -228,32 +228,17 @@
         case GPS_PACKET:
         default:
         { 
-            uint32_t latitude  = 0;
-            uint32_t longitude = 0;
-            uint16_t altitude  = 0;
-            
             // Gps packet type serialized to the LMIC frame buffer
             GpsPacket packet(LMIC.frame, MAX_LEN_FRAME);
-
-            // Get coordindats from GPS with retries
-            for(int32_t i=0; i<3; i++)
-            {
-                if(gps_service() == true)
-                {
-                    altitude  = atoi(gps.NmeaGpsData.NmeaAltitude);
-                    latitude  = gps.LatitudeBinary;
-                    longitude = gps.LongitudeBinary;
-
-                    lastTxPos.set(gps.Latitude,gps.Longitude);
-                    break;
-                }
-            }
-            // Set packet coordinates 
-            packet.setCoordinates(latitude, longitude, altitude);
-
+            
             // set packet transmit power
             packet.setTxPower(pw);
 
+            // Set packet coordinates 
+            uint16_t altitudeGps = atoi(gps.NmeaGpsData.NmeaAltitude);
+            packet.setCoordinates(gps.LatitudeBinary, gps.LongitudeBinary, altitudeGps); 
+            lastTxPos.set(gps.Latitude,gps.Longitude);
+           
             // Serialize  packet 
             pktLen = packet.serialize();
             break;
@@ -396,7 +381,7 @@
 
 static void onSendFrame(osjob_t* j)
 {
-    u1_t pktSize;
+    u1_t pktSize = 0;
 
     // Return if still transmitting. Next transmit will be scheduled by onEvent() when tx finishes  
     if (LMIC.opmode & OP_TXRXPEND) 
@@ -478,9 +463,21 @@
         }
         os_setTimedCallback( &txLedJob, os_getTime() + 1, txLedCb); 
     }
+
+    // Send GPS data 
+    for(int32_t i=0; i<3; i++)
+    {
+        if(gps_service() == true)
+        {
+            pktSize = PrepareDataFrame(GPS_PACKET); 
+            break;
+        }
+    }
+    
+    // if unable to get GPS, send self-id
+    if(0 == pktSize)
+        pktSize = PrepareDataFrame(SELF_ID_PACKET); 
    
-    // Build frame
-    pktSize = PrepareDataFrame(GPS_PACKET); 
 
     // Set next dr and tx power 
     LMIC_setDrTxpow(dr,pw);      
@@ -581,24 +578,14 @@
     {
     // network joined, session established
     case EV_JOINED:
-    {
+    { 
+        displayBuildInfo();
+        //
         // Disable link check validation
         LMIC_setLinkCheckMode(false);
 
-        // If upside down send a self-id packet
-        mma8451q.service();
-        MMA_orientation orientation = mma8451q.getOrientation(); 
-        if(orientation.right && (orientation.back || orientation.front))
-        {
-            debug("Tx self-id packet\r\n");
-            LMIC_setDrTxpow(0,30);      
-            u1_t pktSize = PrepareDataFrame(SELF_ID_PACKET); 
-            LMIC_setTxData2(1, LMIC.frame, pktSize, false); 
-            txMode = SELF_ID;
-        }
-        // Start test if mode determined. 
-        else if(operMode != IDLE)
-            os_setCallback( &sendFrameJob, onSendFrame);
+        // Start transmitting
+        os_setCallback( &sendFrameJob, onSendFrame);
 
         break;
     }