Coder Social home page Coder Social logo

wfi32-iot's Introduction

Quick Start Guide: Secure Cloud Connectivity and Voice Control Demo for Microchip WFI32-IoT Board

Devices: | PIC32 WFI32E | WFI32 | Trust&Go (ECC608) |

Features: | Secure Cloud Connectivity | Voice Control |

Latest release

The WFI32-IoT board comes pre-programmed and configured for demonstrating the connectivity to the AWS Cloud IoT Core. The demo uses AWS C SDK version 4.0 to establish MQTT connection to AWS broker, subscribe to cloud topic/s and publish to the cloud.

Table of Contents

  1. Overview
    1. Board Layout
    2. OOB Flow
    3. Switch Button Use Cases
  2. Getting Started
    1. Connecting the Board to the Host PC
    2. Connecting the Board to Wi-Fi Networks
      1. Via WFI32-IoT Web page
      2. Via Soft AP
    3. Visualizing Cloud Data in Real Time
    4. Voice Control
  3. User Commands
  4. Want To Know More?

1. Overview

1.1 Board Layout

The WFI32-IoT board layout can be seen below.

1.2 OOB flow

If you have an OLEDB Click board connected to the WFI32-IoT board's Click interface, the OLED board will:

  1. Show Wi-Fi icon/image once board is Wi-Fi connected.
  2. Show additionally Cloud icon/image once board is Cloud connected.

1.3 Switch Button Use Cases

  • SW1 held during boot-up: Enter Soft AP mode (indicated by Slow Blinking BLUE LED).
  • SW1 & SW2 held during boot-up: Use factory default configuration. Default Wi-Fi credentials are {MCHP.IOT, microchip}.

2. Getting Started

2.1 Connecting the Board to the Host PC

  1. Connect the WFI32-IoT board to a PC using a standard micro-USB cable.
  2. The LED array will blink twice in the following order: BLUE --> GREEN --> YELLOW --> RED.
  3. The board will appear as a removable storage device on the host PC
  4. Double-click on the clickme.html file to go to the demo webpage.

2.2 Connecting the Board to Wi-Fi Networks

2.2.1 Via WFI32-IoT Webpage

  1. Scroll down the middle of the webpage. On the left, you will ses a Wireless Network Login panel.
  2. Enter your AP credentials and click the Download Configuration button.
  3. A file named WIFI.CFG (text) file is downloaded to the host PC.
  4. Drag and drop the file to the CURIOSITY drive to update the Wi-Fi credentials of the board.
  5. Reboot the device.
  6. Fast Blinking BLUE LED indicates connecting to local AP and solid BLUE LED indicates connection is successful.

Note: Any information entered in the SSID and password fields is not transmitted over the web or to the Microchip or AWS servers. Instead, the information is used locally (within the browser) to generate the WIFI.CFG file.

2.2.2 Via Soft AP

In AP mode, WFI32-IoT board can be provisioned using either a dedicated Mobile app or any socket client app on PC (i.e Python) or Mobile phone.

Using Microchip Wi-Fi Provisioning app

  1. Download Microchip Wi-Fi Provisioning Mobile phone application for Android or for iOS.
  2. To enter SoftAP mode, hold the SW1 push button for most of the power up time.
  3. Slow Blinking BLUE LED indicates Soft AP is available.
  4. Using the Mobile phone or tablet, connect to the WFI32-IoT AP.
  5. Open Microchip Wi-Fi Provisioning Mobile phone application and press CONNECT.

  1. Mobile app doesn't currently have native support for Wi-Fi provisioning for WPA3 enabled APs. If your AP security mode is WPA3, please jump to step 14.
  2. List of available APs is shown. You can press SCAN button to refresh.

Note: For iPhone/iPad, you have to provide your own AP credentials as SCAN function is not supported due to iOS limitation.

Note: Make sure you have location service in your phone enabled. Location service is needed by the application to be able to fetch Wi-Fi scan results (Android only), AP name and default Gateway.

  1. Choose one of the scanned APs or provide your own AP credentials. Data provided is sent to the WFI32-IoT board as you press SEND.

  1. Go back in the app and press YES when prompted so that the WFI32-IoT board applies the new credentials.

  1. Device should automatically reboot.
  2. Fast Blinking BLUE LED indicates connecting to local AP and solid BLUE LED indicates connection is successful.
For WPA3-enabled AP:
  1. Navigate from Wi-Fi tab to OTHER tab and type in the following string without the double quotations: "apply,ssid,password,4". Please replace ssid with your AP name and password with your AP password. Press SEND when done.

  1. Go back in the app and press YES when prompted so that the WFI32-IoT board applies the new credentials.

Note: WFI32-IoT board will NOT apply/use provided credentials unless you go back in the app. This gives you the chance to keep sending new credentials or correct wrongly provided ones as long as you didn't go back in the app.

Using any socket client app

The Microchip Wi-Fi provisioning app shown above is actually using a TCP client behind the scenes. The TCP client connectes to WFI32-IoT TCP server and sends properly fomratted AP credentials.

  1. To enter SoftAP mode, hold the SW1 push button for most of the power up time.
  2. Slow Blinking BLUE LED indicates Soft AP is available.
  3. Using a PC, Mobile phone, tablet or any device that's Wi-Fi and TCP client capabale, connect to the WFI32-IoT AP.
  4. In the example we are showing below, a Python 2.7 based TCP client is used to connect to WFI32-IoT TCP server.
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# WFI32-IoT board runs an AP interface with IP address 192.168.1.1 and a TCP server on port 80
server_address = ('192.168.1.1', 80)
# Connect to the TCP socket
sock.connect(server_address)
# Send AP credentials over the connected socket to the WFI32-IoT board
# Replace 'ssid' with your AP SSID and 'password' with your AP password 
# Replace 'security' with proper value relevant to your AP security mode:
#0:Open | 1: WAP/WPA2 | 2:WEP | 3:WPA3 | 4:Enterprise
sock.sendall('apply,ssid,security,password,NULL')
# Send a 'finish' string over the socket to inform WFI32-IoT board to apply the passed credentials
sock.sendall('finish')

2.3 Visualizing Cloud Data in Real Time

Viewing the published messages

  1. After connecting to an access point, WFI32-IoT board will try to connect to Microchip AWS Sandbox account which is indicated by a blinking GREEN LED.
  2. Once connection to cloud is successful, GREEN LED will turn solid.
  3. Go to demo webpage (can always be reached out using the file clickme.html).
  4. The webpage will show a real-time graph of the data captured from the on-board light and temperature sensors.
  5. The on board YELLOW LED will blink for 300 ms for each message published successfully to the cloud.

Note: Take note of your Thing Name as it's going to be needed for registering the device for Alexa Voice Control in section 2.4.

Note: Temperature reported is the PCB temperature not ambient temperature. Accordingly, you may notice always a number that's above your room temperature.

Sending messages to the board

  1. Scroll down to What's Next section in the webpage.
  2. Select Implement a Cloud-Controlled Actuator to demonstrate cloud performed behaviors.
  3. Click on See more then Scroll down the Control Your Device panel.

  1. Click on Send to device to send Toggle button value.
  2. The YELLOW LED will remain on/off for 2 seconds when Toggle button is selected/unselected, respectively. After the 2 seconds, the YELLOW LED will go back to its normal functionality; blinking on each successful message published to the cloud.

Note: Because Toggle manipulates the desired state, the state must be changed to observe the behavior.

2.4 Voice Control

Please note that supported browsers includes Google Chrome, Mozilla Firefox, Safari, and Microsoft Edge while Internet Explorer is not supported. Please also note that only devices registered to the Microchip Cloud account can be registered for voice control and controlled via the voice skills. In case of registration errors, please contact Microchip support

  1. Create an account and log-in to the device registration page. You can also reach out to this page using the file voice.html on the CURIOSITY drive.

  1. Enter your thing name and a friendly name and claim your device by registering it. Thing name can be found at the top of the demo web page just above the temperature and light graphs.

  1. Successfully claimed devices will show up in the device listing in the left side panel.
  2. Using Amazon Alexa® app, enable the skill ' Microchip IoT' and add the dev board as a smart home device.
  3. You can now control the on-board YELLOW LED with voice commands using the friendly name provided while claiming the device earlier:

Alexa, turn on the myCuriosity

  1. The YELLOW LED will remain on/off for 2 Seconds based on the voice command.

Note: You can find out more information about connecting a smart home device to Alexa from this link

Note: Supported browsers include Google Chrome, Mozilla Firefox, Safari, and Microsoft Edge while Internet Explorer is not supported.

Note: Only devices registered to the Microchip Cloud account can be registered for voice control and controlled via the voice skills. In case of registration errors, please contact Microchip support

3. User Commands

When connecting WFI32-IoT board to a PC using a standard micro-USB cable, it enumerates as a USB MSD (Mass Storage Device) in addition to two other virtual COM ports reflecting UART1 and UART3 of the module where:

  • UART1 is used for application debug logs.
  • UART3 is used for Wi-Fi FW and AWS C SDK logs.

UART1 supports a set of user commands via command line as follows (more info about commands usage are available under Deep Dive Guide):

  1. "rssi": prints current connection RSSI value.
  2. "unixtime": prints current UNIX time.
  3. "debug <debug_level>": sets application debug level (accepted values are 0 through 4).
  4. "rtcc_freq <rtcc_freq>": sets RTCC frequency (check command help for accetped values).
  5. "power_mode <power_mode>": sets power save mode (accepted values are 0 to 5).
  6. "reboot": Execute a system reboot.

Note: UART1 and UART3 settings should be 115200 8N1.

4. Want To Know More?

Curious to learn more? ..

  • Check out our Deep Dive Guide to dive behind the scenes, learn how Connectivity, Security and Cloud are tied together and experience how smooth it is to migrate the demo to your own cloud instance.
  • We have gathered some FAQs and troubleshooting tips for you under the FAQ and Troubleshooting Page.
  • Refer to WFI32-IoT board product page and HW user guide.
  • Check out WFI32E01PC module Product page for tips, guides, knowledge base article, code examples and further more!
  • Check out Curisoity Board; another evaluation board for WFI32E01PC module where you can have access to more module interfaces (i.e Ethernet) and more pins for prototyping.
  • A very similar and exciting demo for Curiosity Board is available here.

wfi32-iot's People

Contributors

amrabdelmoghny avatar himanshuseth-microchip avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

ashokmazumder

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.