Issue link: https://resources.mouser.com/i/1442841
24 / Concept to Creation: Practical Applications for Smart, Connected and Secure IoT Solutions Authentication Input method: Enter manually Public key format: ES256 Public key value: All four lines of the public key printed on the serial terminal Public key expiration date: Leave unchecked Device metadata: Leave empty Stackdriver Logging: Use registry default setting The settings should look like Figure 9. Once you've entered these settings, click Create. At this point, we've defined the board device in the Google Cloud IoT, and the board is ready to connect. Configure the Google Cloud IoT Core Parameters in the Board Software In this step, we'll adjust several parameters in the source code to use our Google Cloud IoT settings rather than the default values. In Atmel Studio, locate the following files and edit them as follows: config/IoT_Sensor_Node_config.h • Change the CFG_PROJECT_ID string to your own Google Cloud project name. • Change the CFG_REGISTRY_ID string to "my-iot-registry". • Change CFG_DEBUG_MSG to 1 to enable debug messages. config/conf_winc.h • Change the CFG_MAIN_WLAN_SSID string to your own Wi- Fi access point SSID. • Change CFG_MAIN_WLAN_AUTH to use the correct constant corresponding to your Wi-Fi access point security type (for example, use M2M_WIFI_SEC_WPA_PSK for WPA/ WPA2); other values are documented in the source code. The device ID is generated dynamically by the code at runtime (based on the cryptographic coprocessor's unique ID), so there isn't anything to configure for this device ID. Next, build the project using the Build Build Solution menu command. Download and run the program on the AVR-IoT board using the Debug Start Without Debugging menu command. The board should show a brief flash of the LEDs at startup, then the LEDs should illuminate Blue (for Wi-Fi connected), then Green (for Google Cloud IoT connected), then Yellow flashing once a second (for data transmissions to Google Cloud). A Red LED indicates a problem connecting to Wi-Fi or Google Cloud. PUBLISHING SENSOR DATA MESSAGES TO THE GOOGLE CLOUD IOT At this point, the board is running the application and publishing sensor messages once a second. Atmel START's example application is coded to format each set of sensor readings as a string in the JSON format, with separate fields for light and temperature: {"Light":26,"Temp":"27.43"} Monitoring Messages You can monitor the published sensor messages by creating a subscription using the gcloud command-line tool on your PC then running a short Python program that uses the subscription to receive and print messages. Figure 9: IoT Core Device Settings. (Source: Mouser Electronics)