![](/media/cache/group/NimbeLink_Logo.png.50x50_q85.png)
Demo using a Nimbelink Skywire cellular modem paired with ST Nucleo. This demo reads several sensors and reports them to a Freeboard dashboard using dweet.io from Buglabs
Dependencies: LIS3DH LM75B LPS331 hts221 mbed
Fork of Skywire_Demo by
Getting Started Guide
- Set the JP5 jumper to E5V on the Nucleo
- Place the Skywire Shield onto the Nucleo as pictured
- Place the Skywire modem onto the Shield as picture and attach the antenna U.FL coax cable as pictured
- Plug the 12V wall supply into the Skywire Shield
- Go to https://freeboard.io/ and create a user account
- Once you are logged into your Freeboard account, go to https://freeboard.io/board/PJI272 and clone the dashboard by clicking the CLONE link in the lower right corner
- Old Revision of dashboard is here https://freeboard.io/board/jqlneI
- Old Revision of dashboard is here https://freeboard.io/board/jqlneI
- The new dashboard will show up on you account list under My Freeboards, you can then edit the name to whatever you like
- Under the Datasources tab on the dashboard, click the skywire link
- Change the THING NAME field to a unique string, we recommended using the MEID or IMEI on the Skywire Modem, but it could be anything you want.
- Next, Import the Skywire_Demo program into the online compiler
- Open main.cpp. Starting at Line 58, there is a list of Skywire Modems. Uncomment the Skywire Modem that you are using. Make sure only one Skywire Modem is uncommented:
main.cpp
/* * DEFINE THE SKYWIRE MODEM * Uncomment only the modem that you are using. * Make sure only one modem is uncommented! */ //#define NL_SW_1xRTT_V // Verizon 2G Modem - CE910-DUAL //#define NL_SW_1xRTT_S // Sprint 2G Modem - CE910-DUAL //#define NL_SW_1xRTT_A // Aeris 2G Modem - CE910-DUAL //#define NL_SW_GPRS // AT&T/T-Mobile 2G Modem //#define NL_SW_EVDO_V // Verizon 3G Modem //#define NL_SW_EVDO_A // Aeris 3G Modem //#define NL_SW_HSPAP // AT&T/T-Mobile 3G Modem //#define NL_SW_HSPAPG // AT&T/T-Mobile 3G Modem w/ GPS //#define NL_SW_HSPAPE // GSM 3G Modem, EU //#define NL_SW_LTE_TSVG // Verizon 4G LTE Modem //#define NL_SW_LTE_TNAG // AT&T/T-Mobile 4G LTE Modem //#define NL_SW_LTE_TEUG // GSM 4G LTE Modem, EU //#define NL_SW_LTE_GELS3 // VZW LTE Cat 1 Modem
- Next, to Line 73 in main.cpp, and change the DeviceID to the THING NAME you entered into your Freeboard:
main.cpp
/* --CHANGE THIS FOR YOUR SETUP" -- */ #define DeviceID "DweetIODeviceName" //Freeboard DweetIO unique ID
- If applicable, go to Line 77 in main.cpp and change the APN to your specific APN:
main.cpp
/* --CHANGE THIS FOR YORU SETUP (IF APPLICABLE)-- */ #if defined NL_SW_HSPAP || defined NL_SW_HSPAPG || defined NL_SW_HSPAPE || defined NL_SW_LTE_TSVG || defined NL_SW_LTE_TNAG || defined NL_SW_LTE_TEUG || defined NL_SW_LTE_GELS3 std::string APN = "yourAPNhere"; #endif
- Compile and upload to the Nucleo, cycle power to the shield and the sensor data should start to upload to your new Freeboard.
main.cpp
- Committer:
- kholland
- Date:
- 2015-01-05
- Revision:
- 0:3095958bc639
- Child:
- 2:b57e24a42b6f
File content as of revision 0:3095958bc639:
#include "mbed.h" #include "LPS331.h" #include "LIS3DH.h" #include "LM75B.h" /* --CHANGE THIS FOR YOUR SETUP" -- */ #define DeviceID "mbedskywire" //Freeboard DweetIO unique ID DigitalOut myled(LED1); DigitalOut skywire_en(PA_6); DigitalOut skywire_rts(PA_7); Serial skywire(PA_9,PA_10); Serial debug_pc(USBTX, USBRX); I2C i2c(PB_9,PB_8); char msg[3]; LPS331 pressure(i2c); LM75B LM75_temp(PB_9,PB_8); LIS3DH accel(i2c, LIS3DH_V_CHIP_ADDR, LIS3DH_DR_NR_LP_100HZ, LIS3DH_FS_2G); char str[512]; char str2[512]; float latitude; float longitude; int number; int main() { float axis[3]; float press; float temp; debug_pc.baud(115200); skywire.baud(115200); skywire_rts=0; myled=0; debug_pc.printf("Starting Demo...\n"); debug_pc.printf("Waiting for Skywire to Boot...\n"); //Enable Skywire skywire_en=0; wait(2); skywire_en=1; wait(2); skywire_en=0; myled=1; wait(5); LM75_temp.open(); debug_pc.printf("Connecting to Network...\n"); // get IP address skywire.printf("AT#SGACT=1,1\r\n"); wait_ms(500); skywire.gets(str, 255); skywire.gets(str, 255); debug_pc.printf("Skywire says: %s\n", str); // connect to dweet.io skywire.printf("AT#HTTPCFG=1,\"dweet.io\",80,0\r\n"); skywire.gets(str, 255); skywire.gets(str, 255); debug_pc.printf("Skywire says: %s\n", str); //get location approximation from cell tower information skywire.printf("AT#AGPSSND\r\n"); skywire.gets(str, 255); skywire.gets(str, 255); skywire.gets(str, 255); skywire.gets(str, 255); debug_pc.printf("Skywire says: %s\n", str); sscanf(str, "%s %d,%f,%f,", str2, &number, &latitude, &longitude); debug_pc.printf("Location: Latt:%f, Long:%f\n", latitude, longitude); while(1) { temp = (float)LM75_temp; debug_pc.printf("Temp = %.3f\n", temp); press=(float)pressure.value() / 4096; debug_pc.printf("Pressure = %.3f\n", press); accel.read_data(axis); debug_pc.printf("Accel = %.3f, %.3f, %.3f\n", axis[0], axis[1], axis[2]); //Report Sensor Data to dweet.io skywire.printf("AT#HTTPQRY=1,0,\"/dweet/for/%s?temperature=%.3f&pressure=%.3f&X=%.3f&Y=%.3f&Z=%.3f&Latitude=%f&Longitude=%f\"\r\n", DeviceID, temp, press, axis[0], axis[1], axis[2], latitude, longitude); skywire.printf("AT#HTTPRCV=1\r\n"); wait(5); } }