Claim It with the CLI

A more involved process using the command line interface


Table of contents

  1. A more involved process using the command line interface
  2. Launch Particle CLI
  3. Login through Particle CLI
  4. Get the Device Info
  5. Get the Mac Address & Register the Device with CMU
  6. Connect your Argon to WiFi
  7. Claiming your device
    1. Using the CLI
    2. Using the Online Build tool
    3. All Set

Launch Particle CLI

Now that the Argon is powered up, we can being the process of claiming the device.

On your computer, open a Terminal (OSX) or Command Prompt (Windows) window

Type particle. You should see something like the below. If it doesn’t load, check the installation guide for the Particle CLI

Terminal Particle

Login through Particle CLI

If this is your first time using the CLI, you’ll need to sign in (you should only need to do this once)

Type

particle login

And provide your username and password that you created when signing up at Particle.io

Get the Device Info

Each Particle device has a unique ID (a long alphanumeric string). This is what the Particle Cloud knows the device as. It’s a big long string of letters and numbers that uniqiely identifies it. We’ll need this ID in order to make a link between your Argon and your account. To find this information, type:

particle identify 

You should see something like this:

Your device id is xxxxxxxxxxxxxxxxx
Your system firmware version is 0.8.0-rc.27

Keep a note of the device ID. You’ll need it in a moment!

Not working or not displaying information?

If your device isn’t returning any information, there’s a couple of things to try

First, is it in listening mode? To check, just make sure the LED on your device is blinking deep blue. If its not, just hold down the SETUP button for 3-5 seconds and try the steps again.

Second, you might need to update your firmware Firmware is the stuff that makes the board work - it monitors, controls and interfaces with the hardware, and it interprets the code you send it to make it work. Sometimes it needs to be updated to add new functionality or to patch problems. The easiest way to do this is to install the Particle CLI. Once installed, put the device in the DFU mode.

To do this, hold down the SETUP and RESET buttons together, then release the RESET button. Wait a couple of seconds and the LED on the board will begin to flash yellow. When it does release the SETUP. It should stay pulsing yellow. If it doesn’t or it’s another color, press reset and try again!

Then go to the command line and type particle update

If all goes well your device will have the current firmware in 30 seconds, then you can try the above again!

Get the Mac Address & Register the Device with CMU

You can skip this step if you are using an Argon provided through this course - We’ve already completed this step for you. However, if you’re registering your own Argon you’ll need to complete this step.

This is where the fun begins because the CMU network doesn’t play nice with devices. In order to get a device on the network we need to know its MAC address and to know its MAC address we need to have it on the network. Yowsers!

Mac Address - This is what a wireless network knows the device as. It’s a unique identifier for the hardware we’re putting on the network. We need to know this to put the device on the CMU network.

To get this info, type

particle serial mac 

You should see something like this:

Your device MAC address is 12:34:56:78:90:ab

Now register the device for the CMU network:

  • Go to https://netreg.net.cmu.edu/ click enter and sign in with your CMU credentials.

  • Click the “Register New Machine” link.

  • Under “Network”, select “Wireless Network” and click continue.

  • Choose a host name for your machine’s DNS. Copy that url. for example: DARAGHSPARTICLEDEVICE.WV.CC.CMU.EDU

  • Enter the hardware address you copied earlier in the Hardware Address field and click continue.

Hold tight

It can take about an hour</a> for your device to be registered with the network!

Hold tight

You don’t need to do this part everytime you connect your Particle device; just the first time you want to use it on the CMU network.

The next step will be to register (or claim) our device on the Particle Cloud. Unfortunately, you’ve got to wait until the NetReg piece is finished, before you can do this….

Connect your Argon to WiFi

The Argon has to be connected to WiFi and able to talk to the Particle cloud for the pairing process to work. That means we need to get it onto the CMU network. To do this we’ll now need to share with it the credentials, or connection information.

If you’ve set up the Particle CLI, simply type particle setup wifi and follow the prompts.

Process for adding WiFi credentials to your Particle device through the CLI

Process for adding WiFi credentials to your Particle device through the CLI

Now… Cross your fingers. In a few seconds, your Particle Argon should flash green then slowly pulse cyan. This means it’s connected to your WiFi network. Super!

Having Trouble?

To set WiFi credientials your Particle device needs to be in listening mode. To check, just make sure the LED on your device is blinking deep blue.

If its not, just hold down the SETUP button for 3-5 seconds and try the steps again.

Claiming your device

Your Particle’s online and we’re ready to claim your device. Essentially we’re telling the Particle framework that this device belongs to your account and you’re the only person who should be able to access it’s data and send code to it. To do this we need:

  1. to know what the device is called in computer speak, or its hexadecimal ID (see step 2)
  2. to have the device connected to WiFi (see step 6)

Thankfully you’ve already got both of these… There’s two ways you can ‘claim’ your device using the Device ID - through CLI on your desktop, or through the Build tool online.

Using the CLI

Type

particle device add DEVICE_ID

Where DEVICE_ID should be substituted for the actual device ID

If you type particle list you should now see an online Argon in your list of paired devices

To give your device a memorable name, type: particle device rename DEVICE_ID NAME_TO_GIVE_IT

Using the Online Build tool

  • Visit: https://build.particle.io/build#devices choose the devices option (bottom left, looks like a cross-hairs)

  • Click the ‘Add a new Device’ button, paste in the device ID, and click to ‘claim device’.

  • Once added you can click on the name of any claimed device to rename it or view the device ID.


Now is a good time to name your device something memorable. Select “Rename xxxxxxxxxxx’ and add something in. If you have a problem naming it, you can always visit: https://www.particle.io/build#cores choose the cores option (bottom left) and add it via the online dashboard.

All Set

Tah Dah! You’re all set to start using your Argon!

Changing Places

If you leave campus and are working at home, or generally move places, remember that you’re also going to be changing WiFi networks! If you change networks you need to tell your device about it. If you’ve moved location and the device is stuck flashing green or rapidly blinking blue, you probably need to set new WiFi credentials

Particle devices remember the last WiFi network they were connected to, but if you change networks you have to tell it each time it should connect to a new or different network.

To do this, just put the device in listening mode (blinking deep blue) by holding down the MODE button for 3-5 seconds and follow the instructions in Step 6.


Next Up: A Simple Internet Appliance