Giter Site home page Giter Site logo

starterkit-m2x-udp's Introduction

StarterKit-M2X-UDP

This is a binary for AT&T IoT StarterKit that allows the kit to send sensor data to M2X and/or UDP endpoint in Flow.

You will need StarterKit and microSD card where you will put the configuration file.

Collected sensor data are temperature (in °C), humidity and 3-axis accelerometer.

How to use

  1. format microSD card to FAT32 filesystem.
  2. create config.ini file and put it in the root directory of microSD card
  3. assemble the kit, insert microSD card into NXP FRDM-K64F board power it up and connnect to the computer
  4. put StarterKit_M2X_UDP_K64F.bin into root directory of your MBED USB drive
  5. after 10 seconds the green LED next to USB port on NXP board will stop blinking, press RESET button
  6. if everything is properly configured the RGB led on NXP board should turn red first then blink yellow and after a moment turn green
  7. the RGB led will blink green whenever data are being sent to M2X

config.ini file

All configuration parameters are in config.ini file in format option=value one configuration option per line. Configuration options are case sensitive. No quotes around text values. These are the supported configuration options:

  • Enable_M2X = enables sending data to M2X. 1=enabled, 0=disabled
  • Device_ID = M2X device ID
  • M2X_Key = M2X API key, could be either device's primary API key or master API key
  • M2X_Commands = periodicaly checks M2X for pending device commands, see API reference for more information on commands. 1=enabled, 0=disabled
  • Enable_UDP = enables sending data to Flow over UDP. The endpoint can be any UDP listener, not just Flow. 1=enabled, 0=disabled
  • UDP_Host = UDP endpoint hostname
  • UDP_Port = UDP endpoint port number
  • IMEI = StarterKit's IMEI. 16 digits. It is part of UDP packet.
  • Latitude
  • Longitude = StarterKit's location. It is part of UDP packet. Latitude has to be in range -90 to 90 and Longitude in range -180 to 180.
  • Comand_Wait = This determines how many seconds should StarterKit wait between polling for comands
  • Command_Polls = This determines how many times should StarteKit poll M2X for pending commands between sending values

The wait time between sending values to M2X and/or UDP endpoint is a product of Command_Wait and Command_Polls: wait time = Command_Polls * Command_Wait. This formula is used even if M2X and commands are not enabled so make sure to always set Command_Wait and Command_Polls to reasonable values. For instance, if you want the values to be sent every minute you can set Command_Wait=10 and Command_Polls=6: 10 * 6 = 60 seconds.

Sample config.ini is in the repo.

M2X streams

In order to send data to M2X the device and streams have to be already created. The code expects following stream names to be present on the device:

Stream ID Meaning
temp temperature
humidity humidity
accelX X-axis accelerometer value
accelY Y-axis accelerometer value
accelZ Z-axis accelerometer value

UDP packet format

UDP packet payload is single line string and contains following comma separated values:

IMEI,temperature,humidity,X-acelerometer,Y-accelerometer,Z-accelerometer,latitude,longitude

IMEI, latitude and longitude are taken from the configuration file. IMEI is enclosed in single quotes.

Source code

Source code is available in MBED repository: https://os.mbed.com/users/korycanjan/code/StarterKit_M2X_UDP/

starterkit-m2x-udp's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.