This program connects to a few sensors via I2C and sends the data collected to a WNC Cellular Module which is located on an Avnet WNC-Shield card.

Dependencies:   FXOS8700CQ MODSERIAL mbed

/media/uploads/kevinkeryk/avnet_logo_tagline_rgb.png

Avnet Cellular IoT Instructions

  • One problematic area is setting the MY_SERVER_URL. When you copy the URL from the flow, you must make sure the MY_SERVER_URL is also set to the appropriate server. It can be either "run-east.att.io" or "run-west.att.io".

Useful Links

Adding Additional Sensors

The FLOW_DEVICE_NAME field must contain the name of the instance of the Virtual Starter Kit in FLOW you will be communicating with. Usually this is "vstarterkit001", but if you have problems communicating you can verify this is correct. Note: This device will not be created until you click the “Initialize” input on the Virtual Device tab of the Starter Kit project in FLOW. At that point, it becomes available in M2X and you can see it as the DEVICE SERIAL field under Devices as in the image below. /media/uploads/JMF/vstarterkit.png

Sensors: When executing, the FRDM-K64F board uploads sensor measurements to AT&T’s Flow environment every 5 seconds, using the Cellular shield board. You can adjust how often you want to do this by editing the SENSOR_UPDATE_INTERVAL_MS value in the header file.

Temperature and humidity: By default, the board reports readings from the HTS221 temperature and humidity sensor. These two values are sent to the HTTP IN /climate port in FLOW with field names “temp” and “humidity”. Temperature is in degrees Fahrenheit and humidity is a %. This default assignment is: iSensorsToReport = TEMP_HUMIDITY_ONLY;

Accelerometer: If you want to expand and use the onboard motion sensor, you can also send 3-axis accelerometer information from the board as “accelX”, “accelY”, and “accelZ”. This is useful if you want to know the stationary position of the board with regards to gravity, or whether it is in motion. These readings are in g’s. To send these values, change the assignment to: iSensorsToReport = TEMP_HUMIDITY_ACCELEROMETER;

PMOD Sensors: If you have a Silicon Labs sensor module that can plug into the PMOD connector on the Cellular shield, you are able to measure proximity, UV light, ambient visible and infrared light from the Si1145 sensor. This PMOD also has a temperature and humidity sensor, but in this case it is redundant. When enabled, the fields “proximity”, “light_uv”, “light_vis” and “light_ir” are also sent. To enable all these sensors, change the assignment to: iSensorsToReport = TEMP_HUMIDITY_ACCELEROMETER_PMODSENSORS;

Connecting the PMOD sensors: Because the pinouts do not align, the SiLabs PMOD sensor board cannot be plugged into the J10 PMOD receptacle on the shield directly. The following wiring instructions must be followed:

SignalJ10ShieldPMOD Color in the image below
VCCPin 6Pin 6Red
GNDPin 5Pin 5Black
SDAPin4Pin 3Green
SCLPin3Pin 2Yellow

/media/uploads/JMF/xyz.jpg

AT&T M2X and FLOW Instructions

M2X & FLOW Instructions

Link to AT&T M2X

M2X

Link to AT&T Flow

FLOW

Avnet WNC-Shield Information

Getting Started with the Avnet WNC-Shield Software

  • This project uses Revision 119 of the MBED library because of I2C implementation differences with the tip (Revision 121).
  • This project uses Revision 4 of the FXOS8700CQ library for sensors.

Easily Modifiable Parameters

Inside the mbed Avnet_ATT_Cellular_IOT project, the parameters needed to customize your board are in the config_me.h file.

  • FLOW parameters: This project assumes you are using a fork of the Starter Kit Base project, which is a reference design created using AT&T’s FLOW (https://flow.att.com) that allows the creation of online virtualization and other IoT functionality. The default parameters in the config_me.h file are done for a specific instance of this project. When you fork the original project, you get your own instance and it will have its own base address. At the bottom of the FLOW environment, when you click on the Endpoints tab, URL information that is specific to your instance is displayed. Of note is the Base URL. In the example below (as in the default mbed project), the Base URL is: https://run-west.att.io/1e464b19cdcde/774c88d68202/86694923d5bf28a/in/flow You have to take note of two parts of this address. The run-west.att.io part is the server URL, and you have to make sure the
  • MY_SERVER_URL field in config_me.h matches this. The rest of the base URL, in green above, needs to be pasted into the FLOW_BASE_URL field.

There is also a FLOW_INPUT_NAME field. This should match the name of the HTTP IN port in the FLOW project that you want to send sensor data to. The default is "/climate", as in the FLOW image below.

/media/uploads/JMF/sf.png

Where is the Binary I compiled

When the COMPILE button is pressed, it compiles your project and links it. The result is placed in the DOWNLOAD folder you use when downloading files from the Internet. It will be called AvnetATT_shape_hackathon_K64F.bin.

Additional Information on Compiling/Configuring

Comprehensive instructions can be found at: Quick Start Instructions

xadow_gps.h

Committer:
root@developer-sjc-indigo-compiler.local.mbed.org
Date:
2017-12-11
Revision:
83:55778a2d5c5e
Parent:
69:5a3414cc7531

File content as of revision 83:55778a2d5c5e:

/* ===================================================================
Copyright © 2016, AVNET Inc.  

Licensed under the Apache License, Version 2.0 (the "License"); 
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, 
software distributed under the License is distributed on an 
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
either express or implied. See the License for the specific 
language governing permissions and limitations under the License.

======================================================================== */

#ifndef __XADOW_GPS_H_
#define __XADOW_GPS_H_

/*!
    \def GPS_DEVICE_ADDR
    The I2C address GPS

    \def GPS_SCAN_ID
    The id of scan data, the format is 0,0,0,Device address
    \def GPS_SCAN_SIZE
    The length of scan data

    \def GPS_UTC_DATE_TIME_ID
    The id of utc date and time, the format is YMDHMS
    \def GPS_UTC_DATE_TIME_SIZE
    The length of utc date and time data

    \def GPS_STATUS_ID
    The id of GPS status, the format is A/V
    \def GPS_STATUS_SIZE
    The length of GPS status data

    \def GPS_LATITUDE_ID
    The id of latitude, the format is dd.dddddd
    \def GPS_LATITUDE_SIZE
    The length of latitude data

    \def GPS_NS_ID
    The id of latitude direction, the format is N/S
    \def GPS_NS_SIZE
    The length of latitude direction data

    \def GPS_LONGITUDE_ID
    The id of longitude, the format is ddd.dddddd
    \def GPS_LONGITUDE_SIZE
    The length of longitude data

    \def GPS_EW_ID
    The id of longitude direction, the format is E/W
    \def GPS_EW_SIZE
    The length of longitude direction data

    \def GPS_SPEED_ID
    The id of speed, the format is 000.0~999.9 Knots
    \def GPS_SPEED_SIZE
    The length of speed data

    \def GPS_COURSE_ID
    The id of course, the format is 000.0~359.9
    \def GPS_COURSE_SIZE
    The length of course data

    \def GPS_POSITION_FIX_ID
    The id of position fix status, the format is 0,1,2,6
    \def GPS_POSITION_FIX_SIZE
    The length of position fix status data

    \def GPS_SATE_USED_ID
    The id of state used, the format is 00~12
    \def GPS_SATE_USED_SIZE
    The length of sate used data

    \def GPS_ALTITUDE_ID
    The id of altitude, the format is -9999.9~99999.9
    \def GPS_ALTITUDE_SIZE
    The length of altitude data

    \def GPS_MODE_ID
    The id of locate mode, the format is A/M
    \def GPS_MODE_SIZE
    The length of locate mode data

    \def GPS_MODE2_ID
    The id of current status, the format is 1,2,3
    \def GPS_MODE2_SIZE
    The length of current status data

    \def GPS_SATE_IN_VIEW_ID
    The id of sate in view
    \def GPS_SATE_IN_VIEW_SIZE
    The length of sate in view data
*/

/* Data format:
 * ID(1 byte), Data length(1 byte), Data 1, Data 2, ... Data n (n bytes, n = data length)
 * For example, get the scan data.
 * First, Send GPS_SCAN_ID(1 byte) to device.
 * Second, Receive scan data(ID + Data length + GPS_SCAN_SIZE = 6 bytes).
 * Third, The scan data begin from the third data of received.
 * End
 */

#define GPS_DEVICE_ID         0x05
//#define GPS_DEVICE_ADDR         0x05
#define GPS_DEVICE_ADDR         0x0A //For mbed, the address has to be  << 1

#define GPS_SCAN_ID             0 // 4 bytes
#define GPS_SCAN_SIZE           4 // 0,0,0,Device address

#define GPS_UTC_DATE_TIME_ID    1 // YMDHMS
#define GPS_UTC_DATE_TIME_SIZE  6 // 6 bytes

#define GPS_STATUS_ID           2 // A/V
#define GPS_STATUS_SIZE         1 // 1 byte

#define GPS_LATITUDE_ID         3 // dd.dddddd
#define GPS_LATITUDE_SIZE       9 // 9 bytes

#define GPS_NS_ID               4 // N/S
#define GPS_NS_SIZE             1 // 1 byte

#define GPS_LONGITUDE_ID        5 // ddd.dddddd
#define GPS_LONGITUDE_SIZE      10 // 10 bytes

#define GPS_EW_ID               6 // E/W
#define GPS_EW_SIZE             1 // 1 byte

#define GPS_SPEED_ID            7 // 000.0~999.9 Knots
#define GPS_SPEED_SIZE          5 // 5 bytes

#define GPS_COURSE_ID           8 // 000.0~359.9
#define GPS_COURSE_SIZE         5 // 5 bytes

#define GPS_POSITION_FIX_ID     9 // 0,1,2,6
#define GPS_POSITION_FIX_SIZE   1 // 1 byte

#define GPS_SATE_USED_ID        10 // 00~12
#define GPS_SATE_USED_SIZE      2 // 2 bytes

#define GPS_ALTITUDE_ID         11 // -9999.9~99999.9
#define GPS_ALTITUDE_SIZE       7 // 7 bytes

#define GPS_MODE_ID             12 // A/M
#define GPS_MODE_SIZE           1 // 1 byte

#define GPS_MODE2_ID            13 // 1,2,3
#define GPS_MODE2_SIZE          1 // 1 byte

#define GPS_SATE_IN_VIEW_ID     14 // 0~12
#define GPS_SATE_IN_VIEW_SIZE   1 // 1 byte


/**
 *  \brief Get the status of the device.
 *
 *  \return Return TRUE or FALSE. TRUE is on line, FALSE is off line.
 *
 */
unsigned char gps_check_online(void);

/**
 *  \brief Get the utc date and time.
 *
 *  \return Return the pointer of utc date sand time, the format is YMDHMS.
 *
 */
unsigned char* gps_get_utc_date_time(void);

/**
 *  \brief Get the status of GPS.
 *
 *  \return Return A or V. A is orientation, V is navigation.
 *
 */
unsigned char gps_get_status(void);

/**
 *  \brief Get the altitude.
 *
 *  \return Return altitude data. The format is dd.dddddd.
 *
 */
float gps_get_latitude(void);

/**
 *  \brief Get the lattitude direction.
 *
 *  \return Return lattitude direction data. The format is N/S. N is north, S is south.
 *
 */
unsigned char gps_get_ns(void);

/**
 *  \brief Get the longitude.
 *
 *  \return Return longitude data. The format is ddd.dddddd.
 *
 */
float gps_get_longitude(void);

/**
 *  \brief Get the longitude direction.
 *
 *  \return Return longitude direction data. The format is E/W. E is east, W is west.
 *
 */
unsigned char gps_get_ew(void);

/**
 *  \brief Get the speed.
 *
 *  \return Return speed data. The format is 000.0~999.9 Knots.
 *
 */
float gps_get_speed(void);

/**
 *  \brief Get the course.
 *
 *  \return Return course data. The format is 000.0~359.9.
 *
 */
float gps_get_course(void);

/**
 *  \brief Get the status of position fix.
 *
 *  \return Return position fix data. The format is 0,1,2,6.
 *
 */
unsigned char gps_get_position_fix(void);

/**
 *  \brief Get the number of state used¡£
 *
 *  \return Return number of state used. The format is 0-12.
 *
 */
unsigned char gps_get_sate_used(void);

/**
 *  \brief Get the altitude¡£ the format is -9999.9~99999.9
 *
 *  \return Return altitude data. The format is -9999.9~99999.9.
 *
 */
float gps_get_altitude(void);

/**
 *  \brief Get the mode of location.
 *
 *  \return Return mode of location. The format is A/M. A:automatic, M:manual.
 *
 */
unsigned char gps_get_mode(void);

/**
 *  \brief Get the current status of GPS.
 *
 *  \return Return current status. The format is 1,2,3. 1:null, 2:2D, 3:3D.
 *
 */
unsigned char gps_get_mode2(void);

/**
 *  \brief Get the number of sate in view.
 *
 *  \return Return the number of sate in view.
 *
 */
unsigned char gps_get_sate_in_veiw(void);
 
#endif