View detail for Atmel AT16225: Atmel Smart Plug Hardware User Guide

ATSAMW25
AT16225: Atmel Smart Plug Hardware User Guide
Application Note
Introduction
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
–
ATSAMD21 Cortex-M0+ MCUWINC1500 IEEE 802.11 b/g/n 2.4G Wi-Fi
Controller
–
ECC508A hardware Authentication and Encryption
ATM90E26 power and energy metering function
QTouch button
CE/FCC/UL&CUL Certification
Figure 1. Atmel Smart Plug Kits
Atmel-42689A-Atmel-Smart-Plug-Hardware-User-Guide_AT16225_ApplicationNote_03/2016
Table of Contents
2
Atmel-42689A-Atmel-Smart-Plug-Hardware-User-Guide_AT16225_ApplicationNote_03/2016
1 Overview
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
Output Socket
Input Plug
E
N
L
Fuse
Relay
ATM90E26
AC/DC
DC/DC
12V
3.3V
ATSAMW25
DataFlash
LEDs
Button
AT16225: Atmel Smart Plug Hardware User Guide [APPLICATION NOTE]
Atmel-42689A-Atmel-Smart-Plug-Hardware-User-Guide_AT16225_ApplicationNote_03/2016
3
3
Figure 1-2. Overview of the Smart Plug Kit PCBs
2 MCU Board
2.1 MCU Board Overview
Figure 2-1. MCU Board Overview
4
Atmel-42689A-Atmel-Smart-Plug-Hardware-User-Guide_AT16225_ApplicationNote_03/2016
2.2 ATSAMW25
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.
3
4
5
6
0
1
2
Pin #
ATSAMW25 Pinout
SAM W25 function
GND
GND
UART TXD
UART RXD
Wi-Fi Chip En
Wi-Fi GPIO_1
NC
System function
GND
GND
Wi-Fi TXD
Wi-Fi RXD
NC
RTC
NC
Description
Heat sink pads in the bottom
For ATWINC1500 firmware upgrade
For ATWINC1500 firmware upgrade
Not Used
AT16225: Atmel Smart Plug Hardware User Guide [APPLICATION NOTE]
Atmel-42689A-Atmel-Smart-Plug-Hardware-User-Guide_AT16225_ApplicationNote_03/2016
5
5
25
26
27
28
21
22
23
24
14
15
16
17
18
19
20
Pin #
10
11
12
13
7
8
9
29
30
31
32
33
34
35
36
37
38
39
40
41
42
VCC
Relay
NC
MCU Reset
MCU SWDCLK
MCU SWDIO
LED PR
LED PG
XIN32
XOUT32
NC
GND
NC
NC
Touch Guard 2
Touch Key
Touch Guard 1
Crypto SDA
Crypto SCL
PM TXD
PM RXD
GND
System function
VCC
Flash SPI MOSI
Flash SPI CLK
GND
Flash SPI SS
Flash SPI MISO
RTC
LED WR
LED WG
LED WY
GND
Test TXD
Test RXD
GND
PA00
PA01
PA02
GND
PA03
PA04
PA05
PA06
PA07
VCC
PB22
PB23
RESET_N
PA30
PA31
PB02
PB03
PA08
PA09
PA10
PA11
GND
SAM W25 function
VBAT
PA16
PA17
GND
PA18
PA19
PA20
PA21
PA22
PA23
GND
PA24
PA25
GND
Power supply
DataFlash Interface
DataFlash Interface
DataFlash Interface
DataFlash Interface
Not Used
Red LED for Wi-Fi
Green LED for Wi-Fi
Yellow LED for Wi-Fi
Fixture test interface
Fixture test interface
Description
Power supply
Relay ON/OFF
SAM D21 reset pin
SWD SWDCLK pin
SWD SWDCLK pin
Red LED for Power
Green LED for Power
32kHz External Crystal
32kHz External Crystal
Touch Guard sensor
Touch key sensor
Touch Guard sensor
Reserved interface for internal crypto
Reserved interface for internal crypto
Interface for Power Measurement device
Interface for Power Measurement device
6
Atmel-42689A-Atmel-Smart-Plug-Hardware-User-Guide_AT16225_ApplicationNote_03/2016
46
47
48
49
50
51
Pin #
43
44
45
SAM W25 function
PB10
PB11
Wi-Fi GPIO_15
Wi-Fi GPIO_16
Wi-Fi GPIO_18
Wi-Fi I
2
C SCL
Wi-Fi I
2
C SDA
Wi-Fi Reset_n
GND
System function
NC
NC
NC
NC
NC
I
2
C SCL
I
2
C SDA
NC
GND
Description
Reserved interface for internal WINC1500
Reserved interface for internal WINC1500
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.
7
8
5
6
3
4
1
2
9
10
Table 2-2. Pin Definition of SWD Interface
SWD header pin
NC
NC
NC
NC
Pin definition
SWDCLK
GND
NC
VCC
SWDIO
RESET
26
24
25
ATSAMW25 pin
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
4
5
2
3
Touch header pin Pin definition
1 GND (External power input if onboard power is not available)
VCC (External power input if onboard power is not available)
Touch Guard Sensor 1
Power LED Green
Touch Key Sensor
ATSAMW25 pin
37
28
36
AT16225: Atmel Smart Plug Hardware User Guide [APPLICATION NOTE]
Atmel-42689A-Atmel-Smart-Plug-Hardware-User-Guide_AT16225_ApplicationNote_03/2016
7
7
6
7
8
9
10
Power LED Red
Touch Guard Sensor 2
Wi-Fi LED Red
Wi-Fi LED Yellow
Wi-Fi LED Green
27
35
14
16
15
2.5 Header to Power Board
The MCU Board is mounted directly on the Power Board by a 12-pin header.
Table 2-4. Header to Power Board
8
9
10
11
12
Power header pin Pin definition
1
2
3
4
5
6
7
VCC
GND
Wi-Fi TXD (Reserved for Wi-Fi firmware upgrade on fixture)
Wi-Fi RXD (Reserved for Wi-Fi firmware upgrade on fixture)
Test RXD (Reserved for fixture)
Test TXD (Reserved for fixture)
Power Measurement RXD (Interface for MCU and power measurement device)
Power Measurement TXD (Interface for MCU and power measurement device)
MCU Reset (Reserved for fixture)
Relay Control
MCU SWDIO (Reserved for fixture)
MCU SWDCLK (Reserved for fixture)
40
24
22
26
25
ATSAMW25 pin
2
3
19
18
41
2.6 DataFlash (Not Mounted)
Space for a DataFlash device is reserved (but not mounted) on the board. This can be used to store more data locally if needed.
Figure 2-3. Schematic of DataFlash Part
8
Atmel-42689A-Atmel-Smart-Plug-Hardware-User-Guide_AT16225_ApplicationNote_03/2016
Table 2-5. BoM for the DataFlash Part if Mounted
Designator Value
C107 100nF
R111
U102
10k
Vendor
Murata
Yageo
Part Number
RC0402FR-0710KL
1M Byte Winbond W25Q80DVUXIE
Description
GRM155R71H104KE14 Ceramic capacitor, SMD 0402, X7R, 50V, 10%
Thick film resistor, SMD 0402, 1/16W, 1%
Serial Flash, 8-lead USON 2*3mm
Table below shows the pin definition of SAM W25 for DataFlash.
Table 2-6. Pin Definition of DataFlash and SAM W25
Pin name on DataFlash
FLASH_SPI_SS
FLASH_SPI_MISO
FLASH_SPI_MOSI
FLASH_SPI_CLK
Pin name on ATSAMW25
PA18
PA19
PA16
PA17
ATSAMW25 pin
11
12
8
9
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]
Atmel-42689A-Atmel-Smart-Plug-Hardware-User-Guide_AT16225_ApplicationNote_03/2016
9
9
Table 3-1. Pin definition of Touch Sensor and SAM W25
Pad name on touch board
Touch Key
Touch Guard 1
Touch Guard 2
Pin name on ATSAMW25
PA06
PA07
PA05
ATSAMW25 pin
36
37
35
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
LED name on touch board
Wi-Fi Yellow
Wi-Fi Green
Wi-Fi Red
Power Green
Power Red
Active logic
1
1
1
1
1
Pin name on ATSAMW25
PA23
PA22
PA21
PB03
PB02
ATSAMW25 pin
16
15
14
28
27
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.
10
Atmel-42689A-Atmel-Smart-Plug-Hardware-User-Guide_AT16225_ApplicationNote_03/2016
0
Figure 4-1. Power Board Overview
4.2 AC-DC
The AC-DC part transforms the 100V~240V AC input voltage into a 12V/120mA (typical) DC output.
The 12V DC supplies the relay and the DC-DC converter.
Figure 4-2. Schematic of AC-DC Part
AT16225: Atmel Smart Plug Hardware User Guide [APPLICATION NOTE]
Atmel-42689A-Atmel-Smart-Plug-Hardware-User-Guide_AT16225_ApplicationNote_03/2016
11
1
1
The transformer T301 is a custom component with the parameters below.
Figure 4-3. Transformer Design
Table 4-1.
Wire
N1
N2
N4
Wire Definition of Transformer
Type Start to end
2UEW
Φ 0.15x1P
3-1
2UEW
Φ 0.15x1P
4-5
TRWB
Φ 0.35x1P
7-6
Turns
70Ts
23Ts
24Ts
Tape
1Ts
2Ts
3Ts
4.3 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.4 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.
12
Atmel-42689A-Atmel-Smart-Plug-Hardware-User-Guide_AT16225_ApplicationNote_03/2016
2
Figure 4-5. Sampled Signal of Power Measurement
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]
Atmel-42689A-Atmel-Smart-Plug-Hardware-User-Guide_AT16225_ApplicationNote_03/2016
13
1
3
Table 4-2. Pin Definition of Power Measurement and SAM W25
Pin Name for Uart
PWR_PM_TXD
PWR_PM_RXD
Pin name on ATSAMW25
PA10
PA11
ATSAMW25 pin
40
41
4.5 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.5.1 Calculation of the GL
With the s hunt resistor = 1mΩ, Max. current I = 10A.
When, GL = 24
VLsample = 1mΩ * 10A * 24 = 240mV
4.5.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.5.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.5.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.6 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).
14
Atmel-42689A-Atmel-Smart-Plug-Hardware-User-Guide_AT16225_ApplicationNote_03/2016
4
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 less than 50A can make the contactor adhere.
Figure 4-7. Schematic of Relay Control
Table 4-3. Pin Definition of Relay
Relay Contorl Name
PWR_RELAY
Active Logic
1
Pin name on ATSAMW25
PB22
ATSAMW25 pin
22
4.7 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]
Atmel-42689A-Atmel-Smart-Plug-Hardware-User-Guide_AT16225_ApplicationNote_03/2016
15
1
5
Figure 4-8. US, EU, and CN standard of Plug and Socket
16
Atmel-42689A-Atmel-Smart-Plug-Hardware-User-Guide_AT16225_ApplicationNote_03/2016
6
5 PCB Assembly
5.1 PCB Stack Structure
The touch board is assembled in the front case of the kit, and the power board together with the MCU board is fixed in the rear case.
When the front and rear case are closed, make sure the touch board connector is aligned with the MCU board pin header.
Figure 5-1. PCB Stack Structure Overview
AT16225: Atmel Smart Plug Hardware User Guide [APPLICATION NOTE]
Atmel-42689A-Atmel-Smart-Plug-Hardware-User-Guide_AT16225_ApplicationNote_03/2016
17
1
7
6 Reprogram the Kit
6.1 Open the Kit
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.
18
Atmel-42689A-Atmel-Smart-Plug-Hardware-User-Guide_AT16225_ApplicationNote_03/2016
8
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]
Atmel-42689A-Atmel-Smart-Plug-Hardware-User-Guide_AT16225_ApplicationNote_03/2016
19
1
9
Figure 6-5. External Power Input
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
20
Atmel-42689A-Atmel-Smart-Plug-Hardware-User-Guide_AT16225_ApplicationNote_03/2016
0
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]
Atmel-42689A-Atmel-Smart-Plug-Hardware-User-Guide_AT16225_ApplicationNote_03/2016
21
2
1
7 Revision History
Doc Rev.
42689A
Date Comments
03/2016
Initial document release.
22
Atmel-42689A-Atmel-Smart-Plug-Hardware-User-Guide_AT16225_ApplicationNote_03/2016
2
Atmel Corporation 1600 Technology Drive, San Jose, CA 95110 USA T: (+1)(408) 441.0311 F: (+1)(408) 436.4200
│
www.atmel.com
© 2016 Atmel Corporation. / Rev.: Atmel-42689A-Atmel-Smart-Plug-Hardware-User-Guide_AT16225_ApplicationNote_03/2016.
Atmel
®
, Atmel logo and combinations thereof, Enabling Unlimited Possibilities
®
, QTouch
®
, and others are registered trademarks or trademarks of Atmel Corporation 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, b y 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 NO N-INFRINGEMENT. IN NO EVENT
SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LI MITATION, DAMAGES
FOR LOSS AND PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF T HE 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 accurac y 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 sustain life.
SAFETY-CRITICAL, MILITARY, AND AUTOMOTIVE APPLICATIONS DISCLAIMER: Atmel products ar e 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 (“Safety -Critical Applications”) without an Atmel officer's specific written consent.
Safety-Critical Applications include, without limitation, life support devices and systems, equipment or systems for the operation o f nuclear facilities and weapons systems. Atmel
AT16225: Atmel Smart Plug Hardware User Guide [APPLICATION NOTE]
23
2
3
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project