Click here to Skip to main content
15,867,308 members
Articles / Internet of Things
Article

Connecting to AT&T M2X IoT using MQTT

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
25 Oct 2017CPOL3 min read 6.3K   2  
Connecting to AT&T M2X IoT using MQTT

This article is for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers

AT&T* M2X* IoT initial signup

  1. Create an account on https://m2x.att.com, if you do not yet have one. If you already have an account, you can skip directly to "Adding your first device" below.

  2. Fill out your information when signing up.

  3. Verify your email address by clicking the link in the email recieved by AT&T*. (Be sure to check your spam folder, the verification is requred to continue.)

Adding your first device

If you have a brand new account, and are adding your very first device, follow these instructions. Otherwise, skip to "Adding another device"

  1. Click on the "Devices" link on the top of the page to navigate to the "Devices" page, then click on the "Create Device"

  2. Select the "Select Device" button.

  3. Define your device. Select "other" in the select your device dropdown box. Then continue to define your device. Make sure that you create a new Stream at the same time that you create your device.

Adding another device

If you have an existing account, and are adding another device, follow these instructions.

  1. Click on the "Devices" link on the top of the page to navigate to the "Devices" page.

  2. Click on the "Create New" dropdown, and choose "Device" to display the "Create Device" dialog. Complete the needed information, then click on "Create" to define your device:

Next, add a stream for your new device.

Adding a Stream

  1. Click on the link for your new Device from the "Devices" page, then scroll down and click on the "Add Stream" button:

  2. Now enter all of the needed information for your new stream:

Testing your device (optional)

If you want to test your new device using the cURL command, follow these instructions.

  1. Copy the cURL command and click the "generate my chart" button.

  2. Paste the cURL command into your command line interface connected to your device and run the command.

You should now see a chart with the information you entered via the curl command on the new chart.

When you now log into AT&T M2X platform you will now be able to view all of your device information.

Summary

If you have followed all the required steps above, you should have all the information that your program needs to connect to the M2X server:

  • API_KEY - set to <M2X Primary API Key>.

  • DEVICE_ID - set to <M2X Device ID>.

  • STREAM_ID - set to <M2X Stream ID>.

Additional setup for C++

When running your C++ code on the Intel® Edison board or Intel® IoT Gateway, you need to set the M2X client parameters in Intel® System Studio. To do that:

  1. Go to Run configurations and, in the Commands to execute before application field, type the following:

    export M2X_API_KEY="[M2X API Key]"; export M2X_DEVICE_ID="[M2X Device ID]"; export M2X_STREAM_ID="[M2X Stream ID]"
    
  2. Click the Apply button to save these settings.

  3. Click the Run button to run the code on your board.

Additional setup for JavaScript*

When running your JavaScript* code on the Intel® Edison board or Intel® IoT Gateway, you need to set the M2X* client parameters in the Intel® XDK IDE. Add the following entries to the config.json file:

"services": {
  "m2x": {
    "api_key": "[M2X Primary API Key]",
    "device_id": "[M2X Device ID]",
    "stream_id": "[M2X Stream ID]"
  }
}

Additional setup for Python*

When running your Python* code on the Intel® Edison board or Intel® IoT Gateway, you need to set the M2X client parameters on the board itself. Add the following entries to the config.json file:

"services": {
  "m2x": {
    "api_key": "[M2X Primary API Key]",
    "device_id": "[M2X Device ID]",
    "stream_id": "[M2X Stream ID]"
  }
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
You may know us for our processors. But we do so much more. Intel invents at the boundaries of technology to make amazing experiences possible for business and society, and for every person on Earth.

Harnessing the capability of the cloud, the ubiquity of the Internet of Things, the latest advances in memory and programmable solutions, and the promise of always-on 5G connectivity, Intel is disrupting industries and solving global challenges. Leading on policy, diversity, inclusion, education and sustainability, we create value for our stockholders, customers and society.
This is a Organisation

42 members

Comments and Discussions

 
-- There are no messages in this forum --