Connect Cloud-JAM to your PC
Cloud-JAM is the product accelerator (production grade solution) of ST functional pack P-NUCLEO-CLD1 that combines:
- NUCLEO F401RE
- NUCLEO SHIELD IKS01A2
- NUCLEO SHIELD NFC01A1
- NUCLEO SHIELD IDW01M1
At a firmware level the Cloud-Jam works the same way as those 4 hardware combined.
Like NUCLEO F401RE, the Cloud-JAM is based on a STM32F401RE microcontroller.
In few easy steps, you can flash your Cloud-JAM and connect it to IBM Watson IoT Platform to transmit sensorâ€™s data on to the Quickstart web page:
- Connect Cloud-JAMÂ to a PC using aÂ micro-USB cable
- Download and install STSW-LINK004
- Now you should see your board as a USB storage device in windowâ€™s explorer
Â Â Â
Download and unzip the SW
Download and unzip the FP-CLD-WATSON1 software package which includes drivers, middleware, application code and project files compatible with three different development environments:Â IAR Embedded Workbench for ARM, Keil Embedded Development Tools for ARM, and System Workbench for STM32. Here is the folder structure that you should see after unzipping:
All the projects provide two target build, one for “IKS01A1” and one for “IKS01A2”. We must set “IKS01A2” since the Cloud-JAM use the lastest version of the sensor shield.
Choose the development environment that best suits your needs and open the corresponding project available in folderÂ Projects/Multi/Applications/MQTT_IBM/, compile the sample application and flash it to the Cloud-JAM.
Alternatively you can take advantage of the boardÂ being exposed to the PC OS as Flash Storage and copy one of the pre-compiled binaries available in the Binary Folder (MQTT_IBM_STM32F401RE_Nucleo-IKS01A2.bin). This will flash the new Binary on the target MCU.
Install and run a serial terminal interface (e.g.Teraterm) to visualize log messages coming from the Cloud-JAM and to enter parameters to configure access to a Wi-Fi access point. Configure the serial terminal with the following parameters to view log messages:
- BaudRate: 460800
- Data: 8 bit
- Parity: none
- Stop: 1 bit
- Flow Control: none
- NewLine RX: CR+LF
- NewLine TX: CR
Run the application in Quickstart mode
Once the Terminal application (i.e. Teraterm) is launched and properly configured, reset the Cloud-JAM by pressing the RESET buttonÂ and see log messages on the serial terminal. When requested, insert SSID and Password to connect with your WiFi network (see next session to learn how to configure these parameters by using NFC). When asked to run the firmware in REGISTERED mode, type no (see following sections learn how to configure the board in Registered mode). When connection to access point is established, you can take note of the MAC address of your Wi-Fi expansion board, which is used to identify the board in Quickstart page; the complete URL of Quickstart web page is also printed in serial terminal, and can be copied and pasted in a web browser to view sensors data in real time.
Visualize data on IBM Quickstart web-page
The application will read and transmit Quickstart raw data from the sensors (temperature, pressure, humidity, accelerometers, gyroscope, megnetometer). If an NFC-enabled mobile device is available and the NFC board is mounted, the Quickstart web page showing the data can be opened by approaching the device to the NFC tag.
Furthermore, the application pre-integrates algorithms for the processing of accelerometers data which can be used to detect vibration from devices such as motors, fans and pumps; maximum frequencies and tear/wear conditions of the device under test are reported together with raw sensors data to IBM Quickstart. Check FFT_Max_f and FFT_Max_f_amp parameters.
Sign Up to IBM Watson to develop IoT applications
Developers aiming to create their IoT applications can register their STM32-based sensor node with IBM Watson.
First, visit IBM Watson Watson IoT web page (https://www.ibm.com/internet-of-things/) and create a trial account. Once signed in, follow the instructions reported in this tutorial to learn how to register your Cloud-JAM: https://developer.ibm.com/recipes/tutorials/how-to-register-devices-in-ibm-iot-foundation/
During the registration procedure, you will have to provide several properties and parameters for your device :
- Organization ID (e.g. 1w8a05)
- Device type (e.g. cloud-jam)
- Authentication method (only use-token-auth supported)
- Authentication token (e.g. uUURNRbeQQaX+Fvi&8)
Once registered the device, you can pass these parameters to the FP-CLD-WATSON1 firmware using either a terminal application like Teraterm or a NFC compatible smartphone as explained in step 7.
As soon as the device is registered and connected to IBM Watson IoT Platform, the Cloud-JAM can publish data to cloud applications and IoT services and receive back commands.
To run your application in registered mode, select the option when requested in serial terminal, and insert your device credentials, either via serial terminal or by using NFC as described below.
Configuration using NFC compatible smartphone
Android-based ST25 NFC app can be used to configure the hardware setup using â€śNDEF Text Recordâ€ť.
Press the â€śCompose NDEFâ€ť button to select â€śTEXTâ€ť option to write â€śNDEF Text Messageâ€ť in the NFC expansion board.
After selecting the â€śTEXTâ€ť option you can write a formatted TEXT string to transfer it to the NFC device by clicking on the â€śWrite to Tagâ€ť button:
In Quickstart mode the format of the string is:
ssid=<YOUR_SSID>, seckey=<YOUR_WIFI_SECURITY_KEY>, authtype=WPA2, qos=0, username=use-token-auth, ibmmode=quickstart,
In Registered mode the format of the string is:
ssid=<YOUR_SSID>, seckey=<YOUR_WIFI_SECURITY_KEY>, authtype=<WPA2>, qos=0, username=use-token-auth, password=<IBM_WATSON_SECRET_TOKEN>, hostname=<IBM_WATSON_ORG_ID>.messaging.internetofthings.ibmcloud.com, devicetype= <IBM_WATSON_DEVICE_TYPE>, orgid=<IBM_WATSON_ORG_ID>, deviceid=<IBM_WATSON_DEVICE_ID>, ibmmode=registered,
Note: The trailing comma must be at the end of the configuration string.
The configurable fields in the strings above, are:
- <YOUR_SSID>: SSID of the Wi-Fi network you are using to access the Internet;
- <YOUR_WIFI_SECURITY_KEY>: Wi-Fi security key for your wi-fi SSID;
- <IBM_WATSON_SECRET_TOKEN>: secret token generated (or set by the user) while registering your device with â€śIBM Watson IOT Platformâ€ť service;
- <IBM_WATSON_ORG_ID>: your IBM Watson organization ID;
- <IBM_WATSON_DEVICE_TYPE>: IBM Watson device type corresponding to your device;
- <IBM_WATSON_DEVICE_ID>: IBM Watson device id corresponding to your device;
STM32 Open Development Environment
The Cloud-JAM isÂ part of the STM32 Open Development Environment (STM32 ODE). STM32 ODE is an open, flexible, easy and affordable way to develop innovative devices and applications based on the STM32 32-bit microcontroller family combined with other state-of-the-art ST components connected via expansion boards.
More information on STM32 ODE can be found atÂ www.st.com/stm32ode
RushUp creates product accelerators and is the answer when makers, developers and high mix low volume industry want to turn the idea into a product in a fast way.
See more at rushup.tech