강의노트 - WIZnet Academy

WizFi250으로
임베디드 무선 구현하기
2015년 2월 4일
위즈네트 아카데미
Wiznetacademy.com
<Part 1>
WizFi250 기초교육 및 실습
강사 : 김성은
블로그 : http://ilikethisplus.blogspot.kr/
E-mail : [email protected]
1. WizFi250 개요

UART 및 SPI 인터페이스를 통한 간단한 AT Command 제공

8/16/32 비트 마이크로 컨트롤러. OS/OS-less 시스템에서 적용 가능

RF 설계 및 테스트 시간 단축

인증에 대한 고객의 시간적/비용적 부담을 줄임

기존 제품에 WiFi 기능을 빠르고 쉽고 저비용으로 구현

고객은 자신의 핵심 응용 프로그램에 초점을 맞출 수 있음
2. Features

















Single band 2.4GHz IEEE 802.11b/g/n
Integrated RF power amplifier
Supports wireless data rates up to 65Mbit/s
1MB Flash Memory, 128KB SRAM, 1MB Serial Flash
Supports per packet Rx Antenna diversity
Low power consumption & excellent power management performance
Small size, suitable for low volume system integration.
Easy integration into mobile and handheld devices flexible system configuration.
2.412-2.484 GHz two SKUs for worldwide market.
Device Package : 28×20 mm (17×20 mm)
Serial Interface : UART, SPI
Powerful Web server provides
Soft AP, WiFi Direct
Sufficient memory retention
Wi-Fi Security (WEP, WPA/WPA2PSK)
L2 Switching
OTA(Over The Air F/W Upgrading)
3. AT Command Overview

사용자 UART(또는 SPI) 라인을 통해 AT 명령어와 매개 변수를 입력

모든 명령은 "AT"문자로 시작, 명령의 끝은 엔터키(CR, \r, 0x0d)
예) 'AT+MMSG=1' => 'A', 'T', '+', 'M', 'M', 'S', 'G', '=', '1', 'CR(0x0d)‘

Command mode : 디폴트 통신 모드. 모든 AT 명령은 이 모드에서 사용될 수 있다.
사용자는 AT 명령을 통해서 사용자는 시스템 관리 및 무선
네트워크 설정, 데이터 송신/수신 등의 동작을 수행할 수 있음

Data mode : AT 명령 또는 다른 간섭 없이, 어플리케이션 계층의 데이터를
직접적으로 송/수신하게 하는 모드

유사한 AT Command 운용 장치와 같이 Hayes command Rule을 근거로 함
http://en.wikipedia.org/wiki/Hayes_command_set
4. Command List
출처) http://wizwiki.net/wiki/doku.php?id=products:wizfi250:wizfi250pg:start#command_list
5. Demo : Station mode, TCP Server
AP
TCP Client
Station mode
TCP Server
AT+WLEAVE => 기존의 접속(Association) 끊기
[OK]
AT+WANT=0 => Antenna 설정(0:uFL,1:PA,3:Auto)
[OK]
AT+WSET=0,WIZnet_MakerSpace_2.4 => SSID 설정
[OK]
AT+WSEC=0,,xxxxxxxx => Passphrase 설정
[OK]
AT+WNET=0,192.168.0.xxx,255.255.255.0,192.168.0.1 => IP 설정
[OK]
AT+WJOIN => AP Association
Joining : WIZnet_MakerSpace_2.4
Successfully joined : WIZnet_MakerSpace_2.4
[Link-Up Event]
IP Addr : 192.168.0.xxx
Gateway : 192.168.0.1
[OK]
AT+SCON=O,TSN,,0,5000,1 => Socket 설정(TCP Server)
[OK]
[CONNECT 0]
Hello WizFi250
6. Demo : Station mode, TCP Client
AP
TCP Server
Station mode
TCP Client
AT+WLEAVE => 기존의 접속(Association) 끊기
[OK]
AT+WANT=0 => Antenna 설정(0:uFL,1:PA,3:Auto)
[OK]
AT+WSET=0,WIZnet_MakerSpace_2.4 => SSID 설정
[OK]
AT+WSEC=0,,xxxxxxxx => Passphrase 설정
[OK]
AT+WNET=1 => IP 설정
[OK]
AT+WJOIN => AP Association
Joining : WizFiDemoAP
Successfully joined : WizFiDemoAP
[Link-Up Event]
IP Addr : 192.168.3.110
Gateway : 192.168.3.1
[OK]
AT+SCON=O,TCN,192.168.3.111,5000,,1 => Socket 설정(TCP Client)
[OK]
[CONNECT 0]
Hello WizFi250
7. Demo : AP mode, TCP Server
AP mode
TCP Server
TCP Client
AT+WLEAVE
[OK]
AT+WANT=0
[OK]
AT+WSET=1,WizFi250AP
[OK]
AT+WSEC=1,WPA2,12345678
[OK]
AT+WNET=0,192.168.12.1,255.255.255.0,192.168.12.1
[OK]
AT+WJOIN
Joining : WizFi250AP
Successfully joined : WizFi250AP
[Link-Up Event]
IP Addr : 192.168.12.1
Gateway : 192.168.12.1
[OK]
AT+SCON=O,TSN,,0,5000,1
[OK]
[CONNECT 0]
Hello WizFi250
참고로, 아래의 명령을 적용하면, WizFi250은 전원 On/Off 후에도 지정된
설정으로 자동으로 동작하게 된다. (Service mode)
- AT+SCON=S,TSN,,0,5000,1
- AT+MPROF=S
8. Demo : Multi Socket
AP
TCP Server 1
TCP Server 2
Station mode
TCP Client 1
TCP Client 2
AT+WLEAVE
[OK]
AT+WANT=0
[OK]
AT+WSET=0,WIZnet_MakerSpace_2.4 => SSID 설정
[OK]
AT+WSEC=0,,xxxxxxxx => Passphrase 설정
[OK]
AT+WNET=1
OK]
AT+WJOIN
Joining : WizFiDemoAP
Successfully joined : WizFiDemoAP
[Link-Up Event]
IP Addr : 192.168.3.110
Gateway : 192.168.3.1
[OK]
AT+SCON=O,TCN,192.168.3.111,5000,,0
[OK]
[CONNECT 0]
AT+SCON=O,TCN,192.168.3.112,5000,,0
[OK]
[CONNECT 1]
{0,192.168.3.111,2735,15}Hello From PC
{1,192.168.3.112,5436,22}Data From Smartphone
9. Demo : Connect to Google Web
Internet
Google
Web Server
(Association을 위한 기존 설정은 생략)
AT+SFORM=000000000 => 수신 데이터 헤더 정의
[OK]
AT+FDNS=google.com,3000 => Find IP address of google.com
74.125.128.102
[OK]
AT+SCON=O,TCN,74.125.128.102,80,0,0
[OK]
[CONNECT 0]
AT+SSEND=0,,,18
[0,,,18]
GET / HTTP/1.1\r\n => 구글 웹 서버에 실제로 보낼 데이터
이 부분은 화면에 나타나지 않음(18 Byte)
[OK]
HTTP/1.1 302 Found
Location: http://www.google.co.kr/?gws_rd=cr&ei=pIz0U........
Cache-Control: private
Content-Type: text/html; charset=UTF-8
………………………..
10. Demo : Get Weather Data from Web
(Association을 위한 기존 설정은 생략)
AT+FDNS=api.openweathermap.org,3000 => Find IP address of server
128.199.164.95
[OK]
AT+SCON=O,TCN,128.199.164.95,80,,0
[OK]
Internet
[CONNECT 0]
OpenWeatherMap
Web Server
AT+SSEND=0,,,81
[0,,,81]
GET /data/2.5/weather?q=Seoul&mode=xml HTTP/1.1\r\n
Host: api.openweathermap.org\r\n\r\n
=> OpenWeatherMap 서버에 실제로 보낼 데이터
이 부분은 화면에 나타나지 않음(81 Byte)
[OK]
{0,128.199.164.95,80,969}HTTP/1.1 200 OK
Server: nginx
Date: Tue, 05 Aug 2014 23:59:54 GMT
…………………………………………………………….
<temperature max="298.15" min="296.15" unit="kelvin"
value="297.38">
<humidity unit="%" value="83">
<pressure unit="hPa" value="1006">
…………………………………………………………….
(출처) http://ilikethisplus.tistory.com/2
참고 1) WIZnet WiFi module
WIZ610wi
WIZ630wi
WizFi210/220
WizFi250
Mode
AP, Gateway, Station
AP, Gateway, Station,
ad hoc, AP-Client, WDS
Station,
Soft AP, ad hoc
Station,
Soft AP, WiFi Direct
802.11
b/g, 2.4G
b/g/n, 2.4G
b, 2.4G
b/g/n, 2.4G
WiFi Max Rate
54M
150M
11M
65M
Dimension
39 X 32 X 4.7 (mm)
33 x 43 X 5 (mm)
32 X 23.3 X 2.9 (mm)
28 x 20 X 1.9 (mm), can
reduce size removing pattern
antenna
Interface
MII(1), UART
LAN(3), UART, USB(3G/Wibro
modem)
UART, SPI, GPIO, ADC
UART, SPI, GPIO, ADC
Antenna
u.FL
u.FL
u.FL, Chip Antenna, External
u.FL, PCB Printed Antenna
Output Power
802.11b: 16dBm
802.11g: 14dBm
802.11b: 17dBm
802.11g: 14dBm
802.11n: 14dBm
8 dBm (WizFi210)
17 dBm (WizFi220)
802.11b: 16.5dBm
802.11g: 13~15dBm
802.11n: 12~14.5dBm
Standby/Sleep mode,
Wake by time or signal
Standby/Sleep mode,
Wake by time or signal (*)
Low Power
Booting Time
around 20s
around 15s
Under 200ms
Under 500ms
Temperature
-30 ~ 70 (℃)
-10 ~ 70 (℃)
-40 ~ 85 (℃)
-25 ~ 85 (℃)
Certifications
KCC (CE, FCC – WIZ6000)
KCC, CE, FCC
KCC, CE, FCC, TELEC
KCC, CE, FCC
참고 2) WiFi – Gateway mode
Internet
LAN #0
Soft AP mode
Of WizFi250
NAT
LAN #1
LAN #2
WLAN
DHCP
참고 2) WiFi – AP mode
Internet
DHCP Server
LAN #0
LAN #1
LAN #2
WLAN
DHCP
(Option)
LAN #0
LAN #1
LAN #2
WLAN
참고 2) WiFi – Client(Station) mode
Internet
WLAN
NAT
LAN #0
LAN #1
LAN #2
DHCP
참고 2) WiFi – AP Client mode
Internet
이 그림에서 NAT와 DHCP
를 제거하고 Bridge mode
로도 운용이 가능하다.
WLAN
NAT
LAN #0
LAN #1
LAN #2
WLAN
DHCP
참고 3) Reference Sites
WizFi250 Wiki
http://wizwiki.net/wiki/doku.php?id=products:wizfi250:start
WIZnet Forum
http://wizwiki.net/forum/
WIZnet Maker Space
http://wiznetmakerspace.com/
WIZnet Academy
http://wiznetacademy.com/
<Part 2>
WizFi250-EVB와 아두이노를 연결하여
무선 인터넷 구현하기
강사 : 곽 동 은
블로그 : http://kaizen8501.tistory.com/
E-mail : [email protected]
이 문서는 나눔글꼴로 작성되었습니다. 설치하기
목차
• Arduino 란
• Arduino + WizFi250 개발 환경 구축
• Web Server Client Example
– Cloud Service Example
• Appendix
– WizFi250 Library가 정상적으로 동작하지 않는 경우
– Eclipse 기반의 WizFi250 개발 환경 구축
– Arduino Library 개발환경
Arduino 란? (1/2)
http://www.slideshare.net/chaeya/iot-35072425
Arduino 란? (2/2)
• Arduino를 이용한 프로젝트
http://www.slideshare.net/chaeya/iot-35072425
Arduino + WizFi250 개발 환경 구축
- WizFi250 Library Download
- Arduino + WizFi250 개발 환경
WizFi250 Library Download (1/2)
• WizFi250 Library download 경로
– https://github.com/Wiznet/Arduino_WizFi250
WizFi250 Library Download (2/2)
•
Arduino Library 폴더에 WizFi250 Library 복사
– Arduino Library 경로 : C:\Arduino\libraries\
– WizFi250 Library 경로 : 다운로드 Drive:\Arduino_WizFi250-master\Software\WizFi250
Arduino + WizFi250 개발 환경
• Download Arduino Sketch
– http://arduino.cc/en/Main/Software
Arduino
Eclipse 개발 환경
[Click]
Arduino + WizFi250 개발 환경
• Hardware 구성(Arduino-Mega + WizFi250-EVB)
SCLK(13)
MISO(12)
MOSI(11)
CS(4)
Data Ready(3)
Arduino + WizFi250 개발 환경
• Arduino Sketch 실행
– [파일]-[예제]-[WizFi250]-[Example]-[WizFi250WebServer] 선택
Arduino + WizFi250 개발 환경
• Arduino Board 설정
– [도구]-[보드]-[Arduino Mega 2560 or Mega ADK] 선택
Arduino + WizFi250 개발 환경
•
Arduino 시리얼 포트 설정
– [도구]-[시리얼 포트]-[COMXX] 선택
Example Application
- Web Server Client
- Temperature Logger using
Cloud Service(Xively)
Example Application
WizFi250 Web Server Client (1/2)
•
SSID와 KEY 값 입력 후 펌웨어 업로드
예제-WizFi250-Example-WizFi250WebServerClient
Example Application
WizFi250 Web Server Client (2/2)
• Serial Log 확인
Example Code가 정상적으로
동작 하지 않는 경우
(Click)
Example Application
Temperature Logger using Cloud Service(Xively) (1/4)
•
Xively란?
http://www.slideshare.net/chaeya/iot-35072425
Example Application
Temperature Logger using Cloud Service(Xively) (2/4)
• 회원 가입 (https://xively.com/)
Example Application
Temperature Logger using Cloud Service(Xively) (3/4)
예제-WizFi250-Example-WizFi250XivelyClient
Temperature Logger using Cloud Service(Xively) (4/4)
Appendix 1
WizFi250 Library가 정상적으로 동작하지 않는 경우
WizFi250 Library가 정상적으로 동작하지 않는 경우 ( 1/3 )
•
Check Point 1
– WizFi250 Firmware 버전이 1.0.0.0 이상인지 확인 한다.
•
Check Point 2
– WizFi250-EVB를 PC와 USB Cable로 연결 한 후, Factory Reset 수행
• WizFi250은 Default로 UART Interface를 사용한다.
• SPI Interface로 전환하기 위해서는 WizFi250을 Factory Reset 한 후, Arduino Board에 연
결하면 된다.
WizFi250 Library가 정상적으로 동작하지 않는 경우 ( 2/3 )
• Check Point 3
– WizFi250-EVB의 SPI 핀들이 5V Level로 동작 하는지 확인
• R14의 0옴 저항이 1,2번에 연결되어 있으면 정상
WizFi250 Library가 정상적으로 동작하지 않는 경우 ( 3/3 )
• 참고 자료
– http://kaizen8501.tistory.com/70
– http://kaizen8501.tistory.com/79
Back
Appendix 2
Eclipse 기반의 WizFi250 개발 환경 구축
Eclipse 설치 및 Arduino Plugin 설치(1/5)
Eclipse Download
http://www.eclipse.org/downloads/
43
Eclipse 설치 및 Arduino Plugin 설치(2/5)
Arduino Plugin 설치
[Help]-[Install New Software]를 선택하고 아래 주소를 추가
http://www.baeyens.it/eclipse/update
44
Eclipse 설치 및 Arduino Plugin 설치(3/5)
Configuration for building Arduino Project
[Windows]-[Preferences]-[General]-[Workspace]의 Save automatically before
build 체크
45
Eclipse 설치 및 Arduino Plugin 설치(4/5)
Configuration for building Arduino Project
[Arduino]-[Arduino] 선택 후 해당 정보 입력
Arduino IDE path : 설치된 Arduino IDE의 경로를 설정
Private Library path : Arduino projec에서 제공하는 Library 이외에 별도의 Library를 사용
하기 위한 폴더 경로 지정
Use Arduino IDE tools in eclipse : 체크
46
Eclipse 설치 및 Arduino Plugin 설치(5/5)
Configuration for building Arduino Project
Test serial dll 버튼을 클릭하여 Serial driver가 설치 되어 있는지 확인
아래와 같은 팝업 출력 시 정상적으로 Serial을 이용 할 수 있음
47
Appendix 3
Arduino Library 개발 환경
Project 생성 및 컴파일(1/5)
[New]-[Project]-[Arduino]-[New Arduino sketch] 선택 후, Project Name과 Project Board
와 Serial Port 설정
C++ 형태의 프로젝트가 생성 됨
49
Project 생성 및 컴파일(2/5)
기본적인 템플릿으로 setup()함수와 loop() 함수가 빈 함수로 생성 됨
50
Project 생성 및 컴파일(3/5)
Compile
정상적으로 Compile이 되면 아래와 같은 로그 메시지 출력
51
Project 생성 및 컴파일(4/5)
Compile
아래와 같은 로그를 출력하며 컴파일이 안될 경우, make 바이너리를 다운로드 하면 해결
http://gnuwin32.sourceforge.net/packages/make.htm 접속 후, Setup Program을 선택
Make 바이너리 설치 후 Windows PATH 환경 변수에 설치된 make 바이너리의 경로를 입력
52
Project 생성 및 컴파일(5/5)
Binary Download
53
WizFi250 개발 환경 설정(1/2)
• Project 생성 후, 해당 프로젝트에서 사용할 Library를 Import 함
– WizFi250 Example를 구현하기 위해서는 SPI Library와 WizFi250 Library
를 Import 해야 함
54
WizFi250 개발 환경 설정(2/2)
• Serial Monitor 사용
– [Window]-[Show View]-[Other]-[Arduino]-[Serial monitor view] 선택
Back
55
Q&A 감사합니다