When QNAP meets IOT – PARTICLE PHOTON

Particle has a complete open source IoT hardware and platform. Since 2013, it has first launched the CORTEX M3 IoT development board based on TI CC3000.

The current series are:

  • Particle Core
  • Particle Photon
  • Particle Electron

Among them, Particle Electron is a development board based on 3G networking. Both Core and Photon use wifi as a connection.

Particles, whether firmware, software or even hardware, are currently open source, and developers can download and customize their own IoT hardware and platforms:

  • Particle Github
  • Particle docs
  • Particle Store

First, to integrate Photon with the QNAP NAS, you need to install the relevant services first:

Step 1: Install Container Station

Step 2: Install Node-Red through Container Station (original Node-Red preset does not support Particle module, please install this version)

Step 3: After the installation is complete, you can directly open the Node-Red management page, as following (http://your-nas-ip:1880, the default port is 1880)

Step 4: After successfully opening Node-Red, you can find the node module related to Particle. Currently supports three categories, event, function and variable

Step 5: Next, before setting up Particle Photon, you need to install the relevant setting environment (flash through the command line, you can refer to this method).

# how to install the particle-cli

$ npm install -g particle-cli

$ particle login

Step 6: Update Photon (Note: you need to enter DFU mode)

How to enter DFU mode

  1. Find two buttons from the device and press the RESET and SETUP buttons simultaneously
  2. Release the RESET button first and keep pressing SETUP
  3. When the light has changed to flashing “yellow light”, the representative device has entered DFU mode.

$ particle update

After the update is successful, you can query the current version through the following instructions.

$particle identify

Your device id is 2xx02b000xxxxxxxxx30xx3x

Your system firmware version is 0.5.2

Step 7: The first time you take Photon, you need to set up WiFi first, and connect to Particle Cloud (if you need to connect Photon directly through your phone, you can refer to this method).

Link USB to start Photon, the first use will continue to flash “blue light”

$ particle setup

Login Particle Cloud → Set up your wireless network → Name your Photon → Set up Photon successfully

Once the wireless network is set up, you can find that the original flashing blue light will turn into a breathing light, indicating that the Particle Cloud has been successfully connected.

Step 8: List the current Particle device. The following icon shows the Jarvis-NAS-Photon that has just been set. The 2d0xxxxxxxxxxx037 is the device id. It can be recorded first and will be used later.

$particle list

After setting up the Particle device and NAS, start the serial device and Node-Red.

First, log in to Particle Build, there are two things to do here:

  1. Put in the test source code, test event, function and variable.
  2. Obtain an access token that accesses the relevant API permissions, and then use it in Node-Red.

Let’s first put the original code of the test below into the Photon just set up. The function is mainly to send the LED status through the event, to obtain the control LED status through the function and the current LED status.

After attaching the code, you can perform the burning action, as following:

By the way, during the burning process, the LED status of the device will be bright yellow and blue, then flash and connect, and finally converted into a breathing light, indicating successful burning.

Now that the settings on the device have been completed, the next step is to get the access token to access the relevant API permissions, and then use it in Node-Red, as following:

 

After getting the access token, put this token into the Particle node provided by Node-Red.

First create a new Particle Cloud config, then fill in the relevant information, for example: Name, Device ID, Event

 

After the completion, as following, fill in the Event name “ledstatus” just set up, and then connect the output node to the Particle node.

The result of the output event….

In addition to obtaining device-related information through web pages, Particle can also obtain status information of current devices through REST API.

 

# GET

Https://api.particle.io/v1/devices/2d002bxxxxxxxxxx03037?access_token=e2bd9e98axxxxxxxxxxf1970916xxxxxxx

Get ledstatus variable status

# GET

Https://api.particle.io/v1/devices/2d002bxxxxxxxxxx03037/ledstatus?access_token=e2bd9e98axxxxxxxxxxf1970916xxxxxxx

Get the current LED status, through the Particle function

Set LED status setLedStatus

In addition to the REST API method and control device, it can also be controlled by Node-Red to control the LED switch through the inject node.

It’s not difficult to control the device through Node-Red. If you don’t want to spend money on the cloud platform, and just NAS supports docker, it’s not difficult to get a simple IoT service.

It will then be introduced for more Particle related applications, including:

  1. Build your own Particle Cloud
  2. Integrate water quality sensing device to create your own fish tank monitoring system
  3. Introduce Particle Electron with 3G module

Synchronized at: I’m RD.

 

Related posts

Leave a Reply