Wi-Fi in automation—Add Wi-Fi connectivity to a PSoC design
N. Venkatesh, Redpine Signals and Kapil Rai, Cypress Semiconductors
9/22/2011 11:29 AM EDT
Here’s how to add Wi-Fi connectivity to a design based on a PSoC device.
Electronic and electrical equipment in the home or commercial buildings have largely been discrete and independent systems – control and management of lighting, temperature, access as well as various alarms have been carried out by separate control mechanisms. The field of domotics deals with the automation of these systems and recently has been receiving increasing attention:
* HVAC control is used to manage temperature and humidity in various parts of a building at various times through, for example, a thermostat accessible over the Internet
* Lighting control systems automatically turn on or off lights in a room, or control brightness and color to create various ambiences
* The operation of appliances such as washers, dryers, and sprinklers can be controlled to take advantage of variations in the cost of utilities
* Data read from sensors monitoring for gas leaks, breakage of glass, intrusion, movement, and smoke can be used to quickly meet required safety measures while raising an appropriate level of alarm
Overall, domotics provides not only greater degrees of comfort and safety but also savings in energy cost. Core to domotics is connectivity, which has evolved to encompass various different methods. Today, the most prevalent are mostly hard-wired with proprietary signaling, including dedicated cables carrying discrete digital data, standardized RS-232 or RS-422 serial cable, Ethernet, and powerline. Emerging wireless methods include Wi-Fi, Zigbee, and Bluetooth.
Connectivity in Automation
The installation of a means of connectivity is only part of the solution to the problem of automation. The profusion of devices and appliances in the home has resulted in a large number of individual remote control units that are hand-held, wall-mounted, free of user intervention, or linked to other appliances. The greater goal of universal automation is the ability to control devices from a common unit. This is not just a centralized controller but rather the ability to control the system from a multitude of devices, as shown in Figure 1.
For example, a smartphone may run applications that control lighting and heating while displaying any security alerts. A TV remote may be used to turn on sprinklers. The home computer may be the nodal point for the collection and display of energy consumption information.
For all this to be possible, a measure of standardization is required in many tasks related to connectivity. For example, while individual data formats that are used by an appliance may be different from those used by other appliances, it is desirable that the method of transferring that data across a network be commonly implemented.
One of the most prevalent means of providing for a common data transport method is through the use of the IP protocol. IP is natively available on networks based on many physical mechanisms – Ethernet, DSL, wireless, and optical fiber. The connection-less, packet-switching nature of the TCP/IP protocol makes it ideal for use in heterogeneous networks spanning multiple hops from source to destination. TCP/IP based transport is the basis of emerging home networks that service high speed data transfer needs like file transfers, video streaming, and wireless audio as well as low-speed data for applications such as sensor monitoring and control.
These networks are comprised of individual segments of multiple types, including powerline (HomePlug), Ethernet, coaxial (MoCA), and wireless (Wi-Fi). Along with meeting the needs of data networking, these networks will also provide the backbone for automation traffic, resulting in a near-universal network. The increasing number of controllable devices in homes and the adoption of smart energy have in part been fuelling the rapid growth of home automation.
Wi-Fi and its Integration
Among wireless methods, the IEEE 802.11 family of standards, popularized, branded, and enhanced in interoperability by the Wi-Fi Alliance, has several unique advantages as the choice of wireless link for use in automation applications. It is a direct extension of the Ethernet-based LAN and supports TCP/IP natively. It is already found in a majority of offices and homes where electronic appliances exist in significant numbers so there is no need to incur new investment or effort to plan and deploy the wireless infrastructure. Wi-Fi also has adequate operational range that minimizes the number of access points required. At client devices, Wi-Fi provides both high throughput when needed and low energy consumption. Properly designed Wi-Fi devices make maximum use of the power-save methods defined in the 802.11 protocol.
Highly integrated modules available from several vendors enable a low cost of adding Wi-Fi to an embedded system. Wi-Fi, however, was mainly targeted towards high-capacity computing platforms that need to be on the local network. The devices used in automation, however, are largely based on low-cost and application-specific embedded controllers. In fact, the control of devices through electronic means has been made prevalent by the availability of low end 8-/16-/32-bit embedded controllers. Current embedded system-on-chip devices that contain MCUs may also integrate memory, digital peripherals, and precision analog peripherals that reduce the number of components in a system and enable quick design of end-products. Embedded MCU and SoC vendors, in conjunction with third-party specialist software houses, provide powerful and easy-to-use software development environments. The entire hardware and software development process thus becomes predictable in schedule and low in cost.
Interfacing a WLAN subsystem to an embedded MCU-based system requires the consideration of several factors including the physical and electrical specifications, choice of interface, host load, the software architecture, power-save mechanisms, wireless performance, and certification.
The main components of a WLAN subsystem are the Medium Access Controller (MAC), the Baseband Processor (BBP), the analog front-end, the RF transceiver, power amplifier and other RF front-end components.
RF transmission is through an antenna that may either be mounted on the board itself or may be located externally. The integration effort can be minimized by choosing a WLAN module that is fully self-contained. This approach offers several benefits:
* The WLAN module is already verified for wireless performance and calibrated
* Since all critical RF circuitry is present in the module, and often enclosed in a shield, no performance degradation is expected during integration into the embedded system
* Board layout and assembly are simplified
* Even in cases where an external antenna is used, the connection to the module is of low complexity – typically using a miniature coaxial connector and RF cable
* The self-contained module can be certified independently of the end product. FCC and certification authorities permit ‘modular certification’ where a wireless module may be certified and then used directly in a system without the need for further certification.
Figure 3 shows an example of a self-contained Wi-Fi module from Redpine Signals. In essence, the entire integration of Wi-Fi connectivity can be as simple as adding an embedded MCU peripheral.
Figure 3: A Self-contained Wi-Fi Module
There are several possibilities in the choice of interface to the embedded MCU. Interfaces such as USB, PCI ,or PCIe are used in systems where high data throughput is required such as storage devices, wireless routers, and laptops. In appliances and devices prevalent in domotics, however, the interface is generally one of several low-power options including SDIO, SPI, and UART. High-end embedded MCUs provide SDIO interfaces, almost always in conjunction with a resident operating system, while common general purpose 16-bit or 8-bit microcontrollers do not. In the latter cases, WLAN integrators choose between the Serial Peripheral Interface (SPI) and the serial UART interface. SPI is a serial interface with synchronous data clocking that can be used to transfer blocks of data in a byte-oriented ‘address followed by data’ format. SPI is a low power interface and can provide fairly high application level data throughput of up to 15 Mbps or more.
The Development Environment
The development challenges of automation systems involve designers having to juggle an array of tasks including board design, selection of components, configuration of subsystems, defining performance expectations, creating validation environments, and planning for certification, among many others. Embedded MCU vendors help ease this effort through the supply of versatile and flexible evaluation or development kits. These kits provide the ideal development platform where design, performance, and integration issues are resolved. WLAN integration should also, naturally, fall into this path. Design engineers can, today, use evaluation boards from WLAN vendors that integrate the target wireless module and provide a ready interface for directly plugging into their chosen embedded MCU development kit. These evaluation boards are accompanied by example projects and libraries already ported, or easily portable, on to the chosen embedded MCU platform. Shown in Figure 4 is a development kit from Cypress for the PSoC devices with a compatible Wi-Fi Expansion board from Redpine Signals.
Add Wi-Fi to PSoC Cont’d.
The integration of a Wi-Fi interface into these systems should not only have a minimal impact on the system configuration and resources used, but also on the design methodology and associated design risk.
As an example, consider an embedded design built using a PSoC device from Cypress. An easy to use development kit is shown in Figure 4, and a screenshot of its PSoC Creator development environment is shown in Figure 5. PSoC Creator is a state-of-the-art software development IDE combined with a revolutionary graphical design editor to form a uniquely powerful hardware/software co-design environment.
Adding Wi-Fi connectivity to a design based on a PSoC device is simplified by using a suitable development kit, for example a Wi-Fi Expansion Board kit from Redpine Signals. At the development or prototyping stage of an embedded design project, the Wi-Fi kit can be plugged into the expansion port of a PSoC kit, as shown in Figure 4. The Redpine-provided PSoC creator ‘component’ would be loaded into the PSoC Creator schematic and configured by setting its properties as required in the Wi-Fi network to be used. The inclusion of the Wi-Fi driver in the software configuration requires only a drag-and-drop procedure in the Creator development environment. The interface can be set to either UART or SPI at design time and programmable digital resources on PSoC are configured accordingly.
The component is configured with the parameters of the wireless network and layer 3 connections. Figure 7 shows the key configurable parameters of the component.
The rest of the design that is needed to interface to the rest of the system is developed using the PSoC creator. The resulting bitstream is then loaded onto the PSoC module on the kit, making it ready for its intended application with active WLAN connectivity. The fully self-contained nature of the Redpine module ensures that the additional resources available on the PSoC are available for use to develop the rest of the system. The other expansion ports and the prototyping area on the PSoC development kit can be used to develop other hardware that interfaces to the PSoC. Cypress also offers a variety of other expansion boards that can be mated to other available expansion ports. Running wireless connectivity tests is accomplished with a simple setup as shown in Figure 8. The Access Point is optional – since the 802.11 ad-hoc, or IBSS, mode can be used to open a direct connection between the EBK and the Laptop.
This approach greatly eases the development of an automation system and provides it with the flexibility of Wi-Fi connectivity.
About the Authors
N.Venkatesh is Vice President of Advanced Technologies at Redpine Signals, and has over 25 years of engineering and management experience wireless system design, chip design, telecommunications, optical networking and avionics. With Redpine, Mr. Venkatesh is a key wireless technologist and champions the universal integration of wireless into embedded systems. His responsibilities include leading the development of wireless systems at Redpine, and their application into diverse industry areas.
Kapil Rai (Sr Director at Cypress) leads the Cypress Systems Solutions group that focuses on development of Standard Solution Products, which allow customers to easily configure the controllers without writing any code. He is also responsible for the WW Design Partner program and Applications Support for Cypress. Prior to Cypress Kapil worked at Microchip where he was in lead roles as Design, Applications and Marketing for the 8 and 16 bit microcontroller Business Units.