The Atmel® Smart Plug Reference Design provides a system solution for a Wi-Fi®
enabled power plug that can turn on/off power from the main plug in three ways:
using the QTouch® button, using the Android™ app with a Wi-Fi connection, or
using a scheduled on/off from the Android app. It is an IoT application using the
ATSAMW25 module (a highly integrated module with ATSAMD21, WINC1500,
ECC508A), and an ATM90E26 device to realize ARM® Cortex®-M0+ MCU
control, Wi-Fi connection, CryptoAuthentication with secure hardware key
storage, QTouch sensing, and energy metering functions with an optimized BOM.
This document describes the hardware design of the smart plug reference
design.
Features
Turnkey solution with small form factor
Three models following either US, EU, or Chinese standards
AC input 90-265V and 50/60Hz
Max output power: 2200W(10A)
Based on ATSAMW25 module
4.8Plug and Socket .................................................................................................................................. 15
6Reprogram the Kit ..................................................................................................... 18
6.1Open the Kit ........................................................................................................................................ 18
The smart plug consists of three PCBs: Power board, MCU board, and Touch board. The MCU board is
vertically mounted to the Power board and the Touch board is connected to the MCU board by a pin connector.
Touch Board: Touch pad and LEDs.
MCU Board: ATSAMW25, 32KHz crystal, DataFlash footprint (not mounted).
Power Board: Socket and Plug, AC-DC, DC-DC, Power Measurement, Relay.
1.1 System Overview
Figure 1-1. System Block Diagram
AT16225: Atmel Smart Plug Hardware User Guide [APPLICATION NOTE]
The Atmel SmartConnect SAM W25 is a low-power Wi-Fi certified module. This highly integrated module offers
the ideal solution for designers seeking Wi-Fi connectivity. The SAM W25 integrates an 802.11 IP stack on top
of the Wi-Fi core and fully covers RF certifications.
The SAM W25 module is based on Atmel’s industry-leading WINC1500 Wi-Fi core combined with Atmel’s
latest ARM Cortex-M0+ based microcontroller (SAM D21) technology. This turnkey system provides an
integrated software solution with application and security protocols such as TLS and integrated network
services (TCP/IP stack).
ATSAMW25 is the control center of the smart plug kit. It covers all the intelligent functions including the Wi-Fi
connection, touch button, relay control, temperature sensing and protection, LED indicators, and timing.
Figure 2-2. Schematic for ATSAMW25
Table 2-1. ATSAMW25 Pinout
AT16225: Atmel Smart Plug Hardware User Guide [APPLICATION NOTE]
GND (External power input if onboard power is not available)
2 VCC (External power input if onboard power is not available)
3
Touch Guard Sensor 1
37
4
Power LED Green
28 5 Touch Key Sensor
36
2.3 Programming Interface
Since SAM W25 uses the SAM D21 as the controller, the user can use the SWD interface to Program and
debug the device.
Table 2-2. Pin Definition of SWD Interface
2.4 Header to Touch Board
The Touch Board is connected to MCU Board through a 10-pin header, it contains the tracks for the touch
sensors and LEDs. The header also makes it possible to power the MCU externally.
Table 2-3. Header to Touch Board
AT16225: Atmel Smart Plug Hardware User Guide [APPLICATION NOTE]
Table below shows the pin definition of SAM W25 for DataFlash.
Table 2-6. Pin Definition of DataFlash and SAM W25
3 Touch Board
3.1 Touch Board Overview
The Touch board contains the Touch sensors and the LEDs for Wi-Fi and Power.
Figure 3-1. Touch Board Overview
3.2 Touch Sensors
Touch sensors are designed based on the self-capacitor using the QTouch technology.
Except the Touch Key which handles the ON/OFF/Reset function, another two touch sensors act as the touch
guard. The touch guard sensors will prevent some scenarios from spurious triggering.
AT16225: Atmel Smart Plug Hardware User Guide [APPLICATION NOTE]
Table 3-1. Pin definition of Touch Sensor and SAM W25
3.3 LEDs for Wi-Fi and Power
All LEDs including the Wi-Fi and Power LEDs are driven by the ATSAMW25 GPIOs directly, Logic 1 enables
the LEDs.
Note: For better output current performance, the I/O pins needs be set to high drive strength: DRVSTR = 1.
Different color LEDs are used to indicate different status of the plug.
3.3.1 Wi-Fi LED
Yellow blink: Plug in SoftAP mode, not connected (waiting for Phone to connect)
Yellow: Plug in SoftAP mode, connected to a phone (during this period, Phone App sends
SSID/password to plug)
Green blink: Plug in STA mode, connecting to home Access Point (AP)
Green: Plug in STA mode, connected to home AP, connection is good
Red: In error state
3.3.2 Power LED
Green when ON
Red when OFF
3.3.3 LED Pin Definition on SAM W25
Table 3-2. Pin Definition of LEDs and SAM W25
4 Power Board
4.1 Power Board Overview
The Power Board contains an AC-DC converter, a DC-DC converter, the power measurement circuit, relay,
and the plug and socket.
AT16225: Atmel Smart Plug Hardware User Guide [APPLICATION NOTE]
The transformer T301 is a custom component with the parameters below.
Figure 4-3. Transformer Design
Table 4-1. Wire Definition of Transformer
4.3 The Fuse
If broken, the fuse F301 (12A) should be changed by the professional person.
4.4 DC-DC
The DC-DC converter converts the DC voltage level from 12V to 3.3V for the SAM W25 module. The MP1470
is a typical buck DC-DC converter, with the output range set to 3.16V to 3.36V.
Figure 4-4. Schematic of DC-DC Part
4.5 Power Measurement
The ATM90E26 works as the power measurement device to get the actual output power.
There are two signals sampled by ATM90E26, one is the voltage which comes from the L line, another is the
differential voltage based on the current in sense resistor R311.
AT16225: Atmel Smart Plug Hardware User Guide [APPLICATION NOTE]
The power measurement device will calculate and output the sampled voltage, current, and power to SAM
W25 through the UART port. Considering the different power supply system, 2 optocouplers are used to isolate
the SAM W25 and M90E26.
Figure 4-6. Schematic of Power Measurement
AT16225: Atmel Smart Plug Hardware User Guide [APPLICATION NOTE]
Table 4-2. Pin Definition of Power Measurement and SAM W25
4.6 Power Measurement Calibration
Before using the ATM90E26 in user application, some parameters need be calculated, such as GL, Ugain,
Igain, and PL_Contant.
MC: Pulse constant of the energy meter, unit is imp/kWh or imp/kvarh; Assume MC = 10000
Un: Reference voltage, unit is V; Assume Un = 220V
Ib: Basic current, unit is A; Assume Ib = 1A
GL: L line current circuit gain
VL: Sampling voltage of the L line circuit at Ib, unit is mV
VU: Sampling voltage of the voltage circuit at Un, unit is mV
4.6.1 Calculation of the GL
With the shunt resistor = 1mΩ, Max. current I = 10A.
When, GL = 24
VLsample = 1mΩ * 10A * 24 = 240mV
4.6.2 Calculation of the Ugain
The default Ugain is based on the condition below:
Ugain = 26400 (6720H), Voltage divider coefficient = 880,
Assume Un = 220V, VL = 220 / (880 + 1)
Considering the voltage divider resistors used in smart plug, Voltage divider coefficient = (430 + 430) = 860
So, Ugain = 26400 * (220 / (860 + 1)) / (220 / (880 + 1)) = 27013 (6985H)
4.6.3 Calculation of the Igain
From AN 46102,
R = 200µΩ, I = 5A, Lgain = 24 <=> Igain = 31251 (7A13H) by default
In SmartPlug solution,
R = 1mΩ, I = 2A, Lgain = 24 <=> Igain = 31251 * (1000 * 2A * 24) / (200 * 10A * 24) = 62502 (F426H)
4.6.4 Calculation of the PL_Constant
PL_Constant = int (838860800 * GL * VL * Vu / MC * Un * Ib)
= 838860800 * 24 * 1 * (220 / (860 + 1)) / 10000 * 220 * 1 = 2338287(23ADEFH)
4.7 The Relay
The relay is cascaded in the AC input and output. So, the Relay can direct control the ON/OFF of the AC
output.
The rated current of the relay is 10A, this means the output power is limited to Max 2200W (@ 220V AC).
AT16225: Atmel Smart Plug Hardware User Guide [APPLICATION NOTE]
Note: Some electronic devices may generate a surge current far larger than the rated current; damaging the
relay by welding the contact shut. When this happens the output will be always ON and the kit will be
out of control. If this happens you must cut the input voltage manually immediately. From testing it has
been observed that a surge current of bigger than 50A can make the contactor adhere.
Figure 4-7. Schematic of Relay Control
Table 4-3. Pin Definition of Relay
4.8 Plug and Socket
There are three types of the Plug and Socket: US, EU, and CN. They share the same PCB.
AT16225: Atmel Smart Plug Hardware User Guide [APPLICATION NOTE]
If the user needs to reprogram the kit with custom code, the kit needs be opened first.
Figure 6-1. Remove the Silica Gel and Screws
Figure 6-2. Open the Kit
6.2 Power Supply
There are two methods to power the Kit while reprogramming: Onboard AC power and external DC power.
6.2.1 Onboard AC Power
At first, connect the programming tools and Kit with the 10-pin SWD connector.
Then, plug the Kit into the AC socket and the kit will be powered by the onboard power supply.
AT16225: Atmel Smart Plug Hardware User Guide [APPLICATION NOTE]
After programming, the user needs to remove the kit from the AC socket first and then disconnect the
programmer/debugger from the SWD header.
Note: The user needs be very carefully during operation and avoid touching any of the components since
they are not isolated and can easily lead to an electrical shock.
Figure 6-3. Kit Powered by the Onboard AC Input
6.2.2 External DC power
As described in the MCU board chapter, the kit can also be powered by an external 3.3VDC supply.
Before connecting the 3.3VC, the user needs to make sure the kit is not connected to the AC input.
Connect the 3.3V power supply on pin1 and pin2 of Touch header and make sure the polarity is correct.
Note: It is recommended to use the external DC to power the board while reprogramming since it is far safer
than the AC power.
Figure 6-4. Kit Powered by the External DC Input
AT16225: Atmel Smart Plug Hardware User Guide [APPLICATION NOTE]
Note: The Power Pins in on the touch header is connected in parallel with the power supply (3.3V) on the
power board. Never connect an external power supply while the onboard power is available.
6.3 Programming Tools
The smart plug uses the SWD as the programming and debug\interface, it supports all tools which supports the
SWD interface. Some tools support a direct connection with the 1.27mm pitch, 10-pin socket. Figures below
show the connection example of programming tools.
Figure 6-6. Atmel-ICE Connection
Figure 6-7. JTAGICE3 Connection
AT16225: Atmel Smart Plug Hardware User Guide [APPLICATION NOTE]
For other programming tools which do not have the 1.27mm pitch, 10-pin socket, the user needs to connect the
SWD lines manually.
6.4 Programming
Connect the kit to a PC with Atmel Studio installed.
Click Tools → Device Programming to open the programming dialog. Then, program the kit as show below.
Note: The Device selector must be set to ATSAMD21G18A.
Figure 6-8. Reprogramming Flow by Atmel Studio
Programming steps:
1. Select the programming tool.
2. Choose device (must be ATSAMD21G18A) and select the interface (must be SWD).
3. Apply the setting.
4. To ensure the correct connection, press ‘Read’ to get the device signature and target voltage.
5. Browse to the folder where the code located, and select it.
6. Program the device. The status can be displayed in the information frame below.
AT16225: Atmel Smart Plug Hardware User Guide [APPLICATION NOTE]
in U.S. and other countries. ARM®, ARM Connected® logo, and others are the registered trademarks or trademarks of ARM Ltd. Other terms and product names may
be trademarks of others.
DISCLAIMER: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right
is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN THE ATMEL TERMS AND CONDITIONS OF SALES LOCATED ON THE
ATMEL WEBSITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT
SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES
FOR LOSS AND PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL
HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this
document and reserves the right to make changes to specifications and products descriptions at any time without notice. Atmel does not make any commitment to update the information
contained herein. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel products are not intended,
authorized, or warranted for use as components in applications intended to support or sustai n life.
SAFETY-CRITICAL, MILITARY, AND AUTOMOTIVE APPLICATIONS DISCLAIMER: Atmel products are not designed for and will not be used in connection with any applications where
the failure of such products would reasonably be expected to result in significant personal injury or death (“Sa fety-Cr itical Appl ications”) without an At mel officer's specific written conse nt.
Safety-Critical Applications include, without limitation, life support devices and systems, equipment or systems for the operation of nuclear facilities and weapons systems. Atmel
products are not designed nor intended for use in military or aerospace applications or environments unless specifically designated by Atmel as military-grade. Atmel products are not
designed nor intended for use in automotive applications unless specifically designated by Atmel as automotive-grade.
AT16225: Atmel Smart Plug Hardware User Guide[APPLICATION NOTE]