Avnet Silica / Mbed OS mbed-os-sensor-node

You are viewing an older revision! See the latest version

Homepage

Getting started with mbed Client on mbed OS

This is the mbed Client example for mbed OS. It demonstrates how to register a device with mbed Device Connector, how to read and write values, and how to deregister. If you are unfamiliar with mbed Device Connector, we recommend that you read the introduction to the data model first.

The application:

  • Connects to network with 6LoWPAN ND connection.
  • Registers with mbed Device Connector.
  • Gives mbed Device Connector access to its resources (read and write).
  • Sends an incremental number to mbed Device Connector.

Warning

This example requires a Border Router. For more details please go to:
https://github.com/ARMmbed/nanostack-border-router

How to compile the project

You can compile this project in two ways:

1. Using the Online compiler: https://docs.mbed.com/docs/mbed-os-handbook/en/latest/dev_tools/online_comp/

2. Using the compiler on your PC: https://docs.mbed.com/docs/mbed-os-handbook/en/latest/dev_tools/cli/#compiling-code

Information

The name of the machine is SILICA_SENSOR_NODE

3. Exporting to 3rd party tools (IDE): https://docs.mbed.com/docs/mbed-os-handbook/en/latest/dev_tools/third_party/

Install the ST-LINK/V2 driver before connecting the SensorNode board to your PC the first time.

1. Download the latest ST-LINK/V2 driver: http://www.st.com/en/development-tools/stsw-link009.html

2. Extract the archive and run either dpinst_amd64.exe or dpinst_x86.exe depending on whether you are on a 64-bit machine or 32-bit machine. Follow the displayed instructions.

3. You should now have successfully installed the ST-LINK/V2 driver

Create a developer mbed account

This example sends data to the cloud named Device Connector. It is required to register at mbed device connector website in order to use the demo.

https://github.com/architech-boards/SensorNode-documentation/raw/mbed-os-5.6/source/_static/mbed-login.jpg

Configure the project before to compile it

1. From the root of the project open *mbed_app.json* file and modify the following line:

  • change "spirit1.mac-address": "{0x7, 0x6, 0x5, 0x4, 0x3, MONTH, DAY, YEAR}" substituting MONTH, DAY, YEAR with hex numbers. For example your birth date.

2. Go to mbed device connector webpage and login into it.

3. Go to the page Security Credentials and click on Get my device security credentials:

http://sensor-node.readthedocs.io/en/latest/_images/mbed-security.jpg

4. Copy the text showed on grey background.

5. In the root directory of the project open security.h file and paste substituting all text.

6. Now you are ready to compile the project.

Border Router

This client needs a Border Router. Border router is a network gateway between a wireless 6LoWPAN mesh network (with nodes like the Sensor Node) and a backhaul network. It controls and relays traffic between the two networks. In this demo, a 6LoWPAN border router is connected to another router in the backhaul network over Ethernet which in turn forwards traffic to/from the internet. We have used the NUCLEO_F429ZI board with the SPIRIT module X-NUCLEO-IDS01A4.

Here the links of the boards:

https://github.com/architech-boards/SensorNode-documentation/raw/mbed-os-5.6/source/_static/network.jpg

You have to modify the boards in order to use them in this demo:

  • On the X-NUCLEO-IDS01A4:
    • Unmount resistor R4
    • Mount resistor R7
  • On the NUCLEO_F429ZI:
    • Open solder bridge SB121
    • Close solder bridge SB122

If you don't want build the firmware of the border router you can download it here:
http://sensor-node.readthedocs.io/en/latest/_static/nanostack-border-router.bin

If you want build it by yourself please visit the github page nanostack-border-router:
https://github.com/ARMmbed/nanostack-border-router

Run the Client

1. Connect the Border Router via mini-usb cable to the PC.

2. Copy the nanostack-border-router.bin file in the mass-storage of the NUCLEO_F429ZI.

3. Turn-on the Border Router via Ethernet cable to the router connected to the internet.

4. Turn-on the Sensor Node board.

5. From the mbed Device Connector login and click on Dashboard link:
https://connector.mbed.com/

6. On the dashboard page you can see if your device is connceted. In this case you will see the text 1 of 100:

https://github.com/architech-boards/SensorNode-documentation/blob/mbed-os-5.6/source/_static/dashboard.jpg

7. Click on API Console and then to Endpoint directory lookups:

https://github.com/architech-boards/SensorNode-documentation/raw/mbed-os-5.6/source/_static/apiconsole.jpg

8. Click on GET Endpoint’s resource representation:

https://github.com/architech-boards/SensorNode-documentation/raw/mbed-os-5.6/source/_static/apiconsole2.jpg

9. From the GET form you have to select:

  • your endpoint

Information

If you have more than one node, you can know the exact endpoint of the board through the security.h file. In this file it is written the endpoint, like #define MBED_ENDPOINT_NAME "4c7f10f6-bd47-4e3e-9450-35cad6fc157f"

  • The resource you want read, in this case /3200/0/5501
  • Then click on TEST API button.

https://github.com/architech-boards/SensorNode-documentation/raw/mbed-os-5.6/source/_static/apiconsole3.jpg

10. You will read the response decoded:

https://github.com/architech-boards/SensorNode-documentation/raw/mbed-os-5.6/source/_static/apiconsole4.jpg


All wikipages