Smart plug products have hit market for some time. Active players are like iHome, Zuli, D-Link, etc. Researching smart plug design a little bit and here is a short research note.
There are two good design documents about smartplug online.
The first is TI application note, Smart Plug with Remote Disconnect and Wi-Fi Connectivity
and the other is Yixin Liu’s 2014 Master thesis, titled Design and Implementation of the ELIQ Smart-Plug System Device
TI’s solution is as below:
It consists of four components, wireless (Wi-Fi) module, microcontroller, relay module, and power supply and management module. Microcontroller is a TI MSP430i2040 to monitor the energy consumption for a single load and control the high-voltage side of the design, which is the relay module. Wi-Fi module is TI CC3200 which has built-in ARM CM4 processor.
The control flow is simple. WiFi module receives packets wirelessly from a control unit such as a phone or a WI-FI router. It notifies microcontroller about the receiving of packets. Microcontroller fetches and decodes the packets into instruction. With proper instruction, microcontroller toggles some digital GPIO to control the relay module which in turn switches on and off the plug. Although TI CC3200 has built-in ARM CM4, looks it doesn’t have extra bandwidth to take care of simple tasks that are currently done by MSP430i2040. It is a little bit surprising. First, according to the document,
The M4 core available in the CC3200 allows a significant amount of flexibility that can be leveraged in any application. For the Smart Plug, the CC3200 queries metrology data from the MSP430i204, forms it into packets, and broadcasts it the companion Android application. It also monitors and controls auxiliary function, and provides bidirectional communication to increase the user experience with the reference design.
Second, the MSP430i2040 task is very simple. Following is MSP430 task flow. Looks CC3200 should be able to handle it and in this case the necessity of MSP430 is ADC. But it can be further integrated into CC3200 if so. So not sure if MSP430 is really needed in this Smart Plug design.
The communication between TI MSP430 and CC3200 is through SPI.
Now let’s take a look of ELIQ smart plug design.
Overall architecture is very similar as above. Author mentioned original selection of microcontroller is either TI MSP430F21x2 or MSP430G2x33. But none of them supports negative voltage ADC so eventually MSP43-AFE2x3 is selected. Wireless module is TI CC1101 which can work in ISM 315Mhz, 433Mhz, 868Mhz, and 915Mhz bands. 868Mhz is used in the design. So it does not use “standard” protocols such as Wi-Fi or Bluetooth which are available on most smart devices. The thesis doesn’t say much about the “ELIQ Display Unit”. Likely it is specially designed since it needs to support 868Mhz band to talk to ELIQ smart-plug device. This is obviously not suitable for mass market.
Most smart plug devices on market are like TI design – device is connected to WiFi. When we connect a phone or a TV or a printer to WiFi, we need to enter the password. For end units such as smart plugs which do not have the screen and keyboard hardware equipped, how to quickly access WiFi networks needs a more convenient connectivity solution and this is one of major manufacturer considerations. As a result smart plug manufacturers offer similar connectivity solutions. Mobile phone APP scans WiFi and locates smart plug device. User then enters the corresponding password on APP and the password is automatically sent to the device by the APP. This will complete connection between the device and mobile phone. In essence, all solutions are the same but they are called different names. Some is called SimpleLink and some is called EasyLink.
As for Wi-Fi solutions, there are multiple options.
First you can find some Wi-Fi capable modules such as MXCHIP EMW3162. It consists of a 120Mhz ST Cortex-M3 based STM32F205 and a Broadcom WiFi chip BCM43362. Advantage is the performance of the integrated processor is not bad and you can do some complex calculations and control. The disadvantage is that the integration is not enough so in occasions that the volume of a module is more stringently restricted there will be some impact.
Second is the TI solution as discussed above. It is expected TI CC3200 is a single chip solution without the usage of an external microcontroller although this is not the case in TI reference design. Note today’s Wi-Fi or Bluetooth chips normally have built-in ARM processors but it doesn’t mean customer can easily take advantage of this flexibility and run customer functionalities on these processors. Normally the firmware running on ARM processor inside a Wi-Fi or Bluetooth transceiver chip is tightly coupled to the wireless physical and MAC hardware and protocol. It is also very timing sensitive. Normally vendor doesn’t allow customer to modify or add extra functionality on top of vendor firmware. So some improvement can be made here. Either Wi-Fi chip has another embedded processor as application processor or the modem processor has extra bandwidth and the vendor firmware architecture supports functionalities added by customer. In the first sight the 2nd approach may be more promising since the 1st approach needs to implement another processor and therefore incur more cost. But the 2nd approach could be worse if not properly designed. To separate modem firmware from customer application software, high profile RTOS like real time Linux is normally needed. To support this kind of RTOS, processor needs to have extra blocks such as MMU to support page based memory management and protection and more advanced cache handling block. A high end ARM processor such as ARM CR or CA series processor may be needed. This is obviously overkill for modem firmware alone so the extra cost will be bare by the customer application software. Unlike the 1st approach that customer has some flexibility to select application processor chip. Here is fixed. So it is a challenge if the market is large enough to support this kind of chip with extra cost. But with the chip manufacturing cost going down, high integration is likely the way to go.
You can also use Atheros AR9331 and Ralink RT5350. Atheros and Ralink were acquired by two well-known semiconductor giants Qualcomm and Mediatek in 2011 respectively. Both chips are actually very popular in Wi-Fi router design. So no wonder some smart plug products also claim WiFi signal enhancement feature.
AR9331 based products are very common. A well-known smart sockets vendor calls SmartPlug uses it. It is also commonly seen in the low- to mid-end routers such as TP-Link and Mercury routers. RT5350 is similar to AR9331 and Belkin outlet uses this option.