Designing and Maintaining Optimized Networks for Dynamic Wi-Fi Environments


Download this article in PDF format.

In the fast-changing Internet of Things (IoT) world, there’s no shortage of possibilities for smart-home devices. For developers, that means more design challenges than ever before. Projects, for example, can no longer take years to move from concept to market.

Rapid prototyping enables an IoT company to consider client input, needs, and wishes, and quickly demonstrate what their solution would look like. It involves minimal development time and costs while providing the needed flexibility in integrating adjustments along the way. And, at the same time, it delivers an immediate time-to-market advantage.

Geared toward smart IoT home automation applications, Digi-Key’s IOT-HOME-KIT evaluation kit (Fig. 1) utilizes Microchip Technology’s AVR-IoT WG development board, MikroElektronika’s MIKROE-1926 Stepper 2 Click Board, and Adafruit’s 324 stepper motor. The kit’s intent is to get designers started on smart IoT home applications without having to hunt around for compatible parts.

 Sponsored Resources: 

1. The Digi-Key IOT-HOME-KIT. The kit’s intent is to get designers started on smart IoT home applications without having to hunt around for compatible parts.

What’s more, a mikroBUS connector is provided to expand the board’s capabilities with more than 450 sensors and actuators offered by MikroElektronika via a growing portfolio of Click boards.

Dev Board

At the heart of the kit is the AVR-IoT WG development board (Fig. 2). The small expandable demonstration and development platform for IoT solutions is based on the AVR microcontroller architecture and uses Wi-Fi technology. The board is supported by two integrated development environments (IDEs)—Atmel Studio and Microchip MPLAB X IDE—providing the ability to innovate with the environment of choice.

2. Shown are key elements of the AVR-IoT WG development board.2. Shown are key elements of the AVR-IoT WG development board.

Furthermore, it offers an out-of-the-box secure way to connect your embedded application to Google’s Cloud IoT core platform. All messages sent to and received from Google Cloud are encrypted and therefore can’t be read by an eavesdropping third party.

The development board combines:

  • An 8-bit ATmega4808 MCU
  • An ATECC608A CryptoAuthentication secure element IC
  • A fully certified ATWINC1510 Wi-Fi network controller that provides a simple way to connect an embedded application to Google’s Cloud IoT core platform

Let’s look at these components one at a time:

The Microchip ATmega4808 is a microcontroller featuring the 8-bit AVR processor with hardware multiplier running at up to 20 MHz and with up to 48 kB of flash, 6 kB of SRAM, and 256 bytes of EEPROM. It comes preloaded with firmware that enables users to quickly connect and send data to the Google Cloud IoT platform using the onboard temperature and light sensors.

The AVR CPU uses a Harvard architecture with separate buses for program and data. Instructions in the program memory are executed with a single-level pipeline. While one instruction is being executed, the next instruction is pre-fetched from the program memory. This enables instructions to be executed on every clock cycle.

For connectivity, the board includes a Microchip ATWINC1510-MR210PB certified IEEE 802.11 b/g/n Wi-Fi module designed specifically for low-power IoT devices. The module integrates a power amplifier (PA), low-noise amplifier (LNA), switch, power management, and a printed antenna (or a micro coax connector for an external antenna). Along with integrated boot read-only memory (ROM) for rapid firmware boot capability, the built-in network stack supports standard internet protocols using hardware accelerators to speed Transport Layer Security (TLS) and Wi-Fi security protocols.

The module provides SPI ports to interface with a host controller. The WINC1510 comes with internal flash memory as well as multiple peripheral interfaces, including UART and SPI. The only external clock source needed is the built-in, high-speed crystal or oscillator (26 MHz).

Microchip’s ATECC608A is a secure element from the company’s CryptoAuthentication portfolio with elliptic-curve cryptography (ECC) capabilities. As in all Microchip CryptoAuthentication products, the ATECC608A employs hardware-based cryptographic key storage and cryptographic countermeasures, which eliminate any potential backdoors linked to software weaknesses. The device is well-suited for the IoT market, supplying the full range of security necessities such as confidentiality, data integrity, and authentication to systems with MCUs or MPUs running encryption/decryption algorithms.

The kit features two sensors—a Vishay TEMT6000X01 photodiode light sensor and a high-accuracy temperature sensor. The latter, Microchip’s MCP9808 digital temperature sensor, converts temperatures between −20 and +100°C to the digital domain with ±0.25°C/±0.5°C (typical/maximum) accuracy.

The development board includes four LEDs used to provide diagnostic information:

  • A blue “WIFI” Wi-Fi Network Connection LED indicates a successful connection to the local Wi-Fi network.
  • A green “CONN” Google Cloud Connection LED indicates a successful connection to the Google Cloud servers.
  • A yellow “DATA” Data Publication to Servers LED indicates that a packet of sensor data has been successfully published to
  • A red “ERROR” Status LED indicates that an error happened after the previous step.

On-board programming and debugging features are available on the PKOB Nano, with only a USB cable required. For users familiar with the MPLAB X IDE, the board can be programmed and/or debugged directly via this IDE’s standard operation. The development board is automatically detected by the MPLAB X.

Stepper Motor

A stepper motor uses a cogged wheel and electromagnets to rotate the wheel one “step” at a time. Each high pulse that’s sent energizes the coil, attracts the nearest teeth of the cogged wheel, and drives the motor one step. It’s a simple type of dc motor that provides high torque and precision. Unlike a brushless dc motor, it doesn’t require sensor feedback to determine how far the motor has rotated, so an open look system can be applied. The position can always be determined as long as the starting position is known.

Precision is one of the major advantages of a stepper motor. Every stepper motor has a Step Angle corresponding to the number of degrees the motor rotates for every pulse. The Adafruit Stepper Motor in the Home Automation Kit has a step angle of 1.8 degrees, yielding 200 possible positions.

To control the stepper motor, the kit includes the A4988 stepper-motor controller, providing a basic pulse-width-modulated (PWM) interface. The A4988 has an output drive capacity of up to 35 V and ±2 A, and lets you control one bipolar stepper motor at up to 2-A output current per coil. The driver provides five different step resolutions: full-step, half-step, quarter-step, eight-step, and sixteenth-step. In addition, it has a potentiometer for adjusting the current output, over-temperature thermal shutdown, and crossover-current protection.

A Sample Project: The Weather Clock

As a use-case example, Digi-Key and Microchip offer a Weather Clock, which is a clock having weather information instead of time on the clock face (Fig. 3). For example, if the weather is sunny, a clock hand points to sunny on the clock face. The project uses the Home Automation Kit and the Google Cloud Platform.

3. The Weather Clock’s hands point to current meteorological conditions.3. The Weather Clock’s hands point to current meteorological conditions.

The weather clock requires up-to-date weather data to function. The data must be fetched and converted to a clock hand position at a regular interval. The task isn’t handled by the device itself, but by the cloud via the Google Cloud Platform. To make the cloud fetch and process the weather data regularly, say on a thirty-minute interval, the Google Cloud Scheduler can be used. This allows you to automate everything, including retries in case of failure to reduce manual work and intervention.

Weather data is provided by YR.no, a free and open weather service from the Norwegian Meteorological Institute. At a regular interval, the weather data is downloaded from YR.no and stored using Google Cloud Storage. The downloading and converting is done by a python script through a Cloud Function—a small piece of code that doesn’t need a server or any other dedicated resources, running when a trigger event occurs.

Connecting devices to Google Cloud offloads several tasks from the MCU, which is oblivious to the weather information. It only receives instructions from the cloud and sends the clock hands to the correct position via the stepper motor. The weather clock receives a clock hand position between zero and 200. Depending on the current position of the clock hand, the motor rotates either clockwise or counter-clockwise, rotating in the direction with the shortest distance. When weather data becomes available, the clock sends a position MQTT message to the board, which represents the clock hand position.

In Summary

The goal of prototyping is to validate the feasibility of a product design, identify potential shortcomings, and develop needed modifications in an efficient way. By using the Digi-Key IOT-HOME-KIT solution, engineers can ensure their product design and features are aligned with customer questions such as: What features are they looking for? Is it technically viable? Can all of the intended features be integrated into the final product? And how easily can users interact with the solution?

For more information about the kit and parts discussed in this article, use the links provided to access product pages on the Digi-Key website.

 Sponsored Resources: 



Source link