<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>NTREXGO - 디바이스마트, 엔티렉스 컨텐츠 통합 사이트 &#187; 스페셜 컬럼</title>
	<atom:link href="http://www.ntrexgo.com/archives/category/magazine/column/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ntrexgo.com</link>
	<description>엔티렉스, 디바이스마트 컨텐츠 통합 사이트</description>
	<lastBuildDate>Thu, 03 Mar 2022 06:47:11 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>[62호]스마트 산업, 손쉬운 터치환경 솔루션 JUTF 시리즈</title>
		<link>http://www.ntrexgo.com/archives/38953</link>
		<comments>http://www.ntrexgo.com/archives/38953#comments</comments>
		<pubDate>Fri, 30 Oct 2020 00:00:06 +0000</pubDate>
		<dc:creator>디바이스마트 매거진</dc:creator>
				<category><![CDATA[디바이스마트 매거진]]></category>
		<category><![CDATA[스페셜 컬럼]]></category>
		<category><![CDATA[62호]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[Special]]></category>
		<category><![CDATA[디바이스마트]]></category>
		<category><![CDATA[매거진]]></category>
		<category><![CDATA[스마트]]></category>
		<category><![CDATA[헬스케어]]></category>

		<guid isPermaLink="false">http://www.ntrexgo.com/?p=38953</guid>
		<description><![CDATA[디바이스마트매거진 62호 &#124; 일반 유저나 전문 지식이 없는 입문자라도 시리얼 인터페이스를 통해 쉽게 이미지를 로딩 할 수 있게 도와주고, 기존의 시스템에 쉽게 동화될 수 있는 환경을 구축해준다.]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-jutf-시리즈-3.png" rel="lightbox[38953]"><img class="alignnone size-large wp-image-39037" alt="62 sr jutf 시리즈 (3)" src="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-jutf-시리즈-3-620x196.png" width="620" height="196" /></a></p>
<p><strong style="font-size: large">스마트 산업, 손쉬운 터치환경 솔루션</strong></p>
<p><span style="font-size: large"><strong>JUTF 시리즈</strong></span></p>
<p style="text-align: right">글 | 티앤원 채은철</p>
<p style="text-align: right">
<p>영화 혹은 상상 속에서 있었던 IoT기술은 점차 현실화되어 이제 우리의 삶 속 곳곳에서 찾아볼 수 있다. IoT는 Internet of Things의 약자로 인터넷에 연결된 네트워크 연결장치를 비롯한 산업 장비 등과 같이 데이터를 공유할 수 있는 수많은 사물들을 일컬어 말한다.<br />
스마트 팜 혹은 스마트 팩토리와 같은 산업현장에서 현재 적용되는 IoT기술을 보자면 센서를 통해 외부 환경에 대한 센싱을 하고, 그 데이터를 네트워크를 통해 수집하고 사용자의 목적에 맞게 사용할 수 있다.<br />
또, 외부 냉난방이나 조명, 수위 등 여러 산업 장비를 모니터링할 수 있고 제어할 수 있어 다양한 분야에서 활용된다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-jutf-시리즈-2.png" rel="lightbox[38953]"><img class="alignnone size-large wp-image-39036" alt="62 sr jutf 시리즈 (2)" src="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-jutf-시리즈-2-620x348.png" width="620" height="348" /></a></p>
<p>관련 IoT관련 산업장비 또한 다양한데, 그중에서도 디스플레이를 활용한 모니터링 시스템이 계속해서 주목받고 있다. IoT의 발달로 사물은 계속해서 똑똑해지지만 스스로 생각할 수 없는 기계엔 사람의 조작이 필요하다. 때문에 사람이 장비의 상황을 확인 할 수 있는 눈에 보이는 디스플레이를 통한 모니터링 시스템은 우리의 일상뿐만 아니라 산업 현장에서도 보편화 되고 있다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-jutf-시리즈-1.png" rel="lightbox[38953]"><img class="alignnone size-full wp-image-39035" alt="62 sr jutf 시리즈 (1)" src="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-jutf-시리즈-1.png" width="212" height="176" /></a></p>
<p>IoT 시대에 모니터링 시스템 및 다양한 분야에서 디스플레이가 중요한 핵심요소가 될 것으로 판단하여 티앤원에서는 제품 업그레이드 및 품질을 높이고자 지속해서 노력하고 있다.<br />
현재 다양한 분야의 스마트 산업에서 터치디스플레이 환경이 적용되어 관련 업체들과의 커뮤니케이션을 진행하면서 끊임없이 새로운 필드에서의 적응 테스트를 진행하고 있다.<br />
이미 개발 완료된 제품이나 일반 MICOM을 적용하는 제품 개발자들의 입장에서 기기에 새로운 LCD 환경을 구축하고 개발해야 한다는 것은 시간과 비용적인 면에서 상당한 스트레스일 것이다. 또한, 개발 기한을 맞추는 일도 여간 까다로운 일이 아닐 것이다.<br />
이러한 부분에서 JUTF 시리즈는 손쉬운 터치환경 솔루션을 제시한다. 일반 유저나 전문 지식이 없는 입문자라도 시리얼 인터페이스를 통해 쉽게 이미지를 로딩할 수 있게 도와주고, 기존의 시스템에 쉽게 동화될 수 있는 환경을 구축해 줄 수 있기 때문이다.<br />
TFT LCD를 위한 H/W자원과 2D GRAPHIC 및 이미지 출력을 위한 충분한 메모리 자원이 불가능한 MCU에서도 UART 통신만으로 풍부한 GUI 환경 구현이 가능하기 때문에 기존 장비의 교체없이 최단기간 내에 사용자의 시스템에 GUI 환경을 구축할 수 있다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-jutf-시리즈-7.png" rel="lightbox[38953]"><img class="alignnone size-full wp-image-39042" alt="62 sr jutf 시리즈 (7)" src="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-jutf-시리즈-7.png" width="614" height="492" /></a></p>
<p>이렇게 JUTF M-A가 GUI 환경을 쉽게 구현하고 제어할 수 있는 이유는 아두이노를 비롯한 8bit 또는 16bit 등의 저사양 MCU와 5V TTL Level UART통신 방식이 가능하기 때문이다.<br />
JUTF M-A 모델은 시중에서 가장 많은 수요가 있는 480×272해상도의 4.3인치 TFT LCD와 800×480해상도의 7.0인치 TFT LCD 2가지 모델을 지원하고 있으며 감압식 터치 판넬 적용이 기본으로 되어있다. 정전식 적용 및 기타는 커스터마이징 타입으로 가능하다.<br />
실제 산업 현장에서는 작업하다가 이물질이 묻은 손으로 LCD에 터치하며 제어하고, 모니터링을 해야 할 수 있어야 한다. 때문에 산업 현장에서 오류가 잦은 정전식 터치는 잘 사용하지 않는다. 그리고 현장에서 작업 시 장갑도 착용한 상태에서 터치 조작을 해야 하기에 감압식 터치를 지원하는 제품을 사용하는 것이 더욱 편리하다.<br />
또 JUTF M-A는 LCD 컨트롤러를 내장한 32비트 MCU를 적용했으며, 1Gbit의 NAND FLASH를 내장하고 있어 이미지 및 사운드 파일을 넉넉하게 넣어 사용할 수 있다.<br />
해외 제품보다 수요자와 공급자간의 커뮤니케이션이 원활하고 숙련된 임베디드 기술을 보유하여 어떤 프로젝트에도 대응이 가능한 점이 큰 장점이다. 또한 보드를 보호하는 커버와 기구물 장착을 위한 브라켓까지 제공되고 인증작업까지 마무리되어 필요한 업체에게 다양한 메리트를 제공해준다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-jutf-시리즈-6.png" rel="lightbox[38953]"><img class="alignnone size-large wp-image-39041" alt="62 sr jutf 시리즈 (6)" src="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-jutf-시리즈-6-620x260.png" width="620" height="260" /></a></p>
<p><span style="color: #ff6600"><strong>JUST USE, JUTF M-A 간편 사용법</strong></span></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-jutf-시리즈-5.png" rel="lightbox[38953]"><img class="alignnone size-large wp-image-39040" alt="62 sr jutf 시리즈 (5)" src="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-jutf-시리즈-5-620x426.png" width="620" height="426" /></a><br />
1. 먼저, USB 외장 저장장치 모드이다. 보드에서 DB버튼을 누른 상태로 USB Cable을 커넥터에 연결해준다. (5초간 누름)<br />
2. DB버튼을 떼면, PC에서 USB 드라이브가 인식되어 있고 이 기능으로 쉽게 이미지를 저장하거나, 수정할 수 있다.<br />
3. 다음으로 일반모드를 실행한다. 일반 모드는 스피커, LCD를 연결 해주고 Power, TTL UART 커넥터에 Serial 케이블을 연결해 PC와 연결한다.<br />
4. PC로 전원 공급시 전류가 부족하다면, Mini USB 케이블로 전원을 추가 공급한다.<br />
5. 단, 정상적인 일반 동작모드의 부팅이 이루어지기 위해서는, NAND 메모리에 “config.txt” 파일과 “boot.bmp” 파일이 있어야 한다. (해당 파일 확인은 1번의 usb 외장 저장장치 모드에서 확인할 수 있다) config.txt” 파일의 내용은 RS232통신 통신속도(Baud Rate)와 LCD 해상도가 명시되어 있다.<br />
6. 반드시, 파일명과 파일내 영문자는 소문자가 되어야 하며, 아래와 같이 한 라인에 하나의 정보만 기록 저장되어야 한다.<br />
7. 다음은 USB 외장 저장장치 모드이다. 보드에서 DB버튼을 누른 상태로 USB Cable을 커넥터에 연결해준다. (5초간 누름)<br />
8. DB버튼을 떼면, PC에서 USB 드라이브가 인식되어 있고 이 기능으로 쉽게 이미지를 저장하거나, 수정할 수 있다.</p>
<p><span style="color: #ffffff;background-color: #ff6600"><strong>간단실습</strong></span></p>
<p><strong><span style="color: #ff6600">아두이노, 라즈베리파이와 손쉬운 연결이 가능!</span> </strong><br />
JUTF와 아두이노를 활용하여 간단하게 제품을 사용해봅시다.<br />
먼저 아래와 같이 보드와 아두이노, LCD를 연결한다.<br />
디바이스마트 해당 제품 상세페이지 아래에 자료목록을 통해 JUTF M-A에 대한 가이드 매뉴얼을 다운로드 받으면 아두이노 IDE를 통해서 다음과 같은 코딩이 가능하다.<br />
아래의 예시는 선과 도형 그리기에 대한 코딩 소스 예시이다.</p>
<div class="symple-box GRAY none" style="text-align:left; width:100%;"> 
<p>#include&lt;SoftwareSerial.h&gt;<br />
SoftwareSerial jutfSerial(1011); // RX = 10, TX = 11 (아두이노 기준)<br />
int nCounter = 0;<br />
void setup<br />
jutfSerial.begin(115200);<br />
}<br />
void loop<br />
if(nCounter == 0)<br />
// 배경을 white color로 클리어<br />
jutfSerial.write($5,4#); // single vuffer mode<br />
jutfSerial.write($1,0,15,50,6#); // color white (2^8로 RED, GREEN, BLUE 비율)<br />
jutfSerial.write($1,2,0,0,800,480,1);</p>
<p>jutfSerial.write(&#8220;$1,0,225,225,225#); // color white (2^8로 RED, GREEN, BLUE 비율)<br />
jutfSerial.write(&#8220;$1,7,400,334,50,50,1#);<br />
jutfSerial.write(&#8220;$1,0,15,50,6#); // color white (2^8로 RED, GREEN, BLUE 비율) jutfSerial.write(&#8220;$1,7,400,330,50,50,1#);</p>
<p>jutfSerial.write(&#8220;$10,225,225,225#&#8221;); // color white (2^8로 RED, GREEN, BLUE 비율)<br />
jutfSerial.write(&#8220;$1,6,250,240,50,1#);<br />
)<br />
jutfSerial.write($1,0,225,225,225# ); // color white (2^8로 RED, GREEN, BLUE 비율)<br />
jutfSerial.write( $1,6,550,240,50,1#);</p>
<p>jutfSerial.write($1,0,200,200,200#); // 눈동자<br />
jutfSerial.write($1,6,250,240,45,1#);<br />
jutfSerial.write(&#8220;$1,0,200,200,200#); // 눈동자<br />
jutfSerial.write(&#8220;$1,6,550,240,45,1#);<br />
jutfSerial.write(&#8220;$1,0,15,50,6#&#8221;); // 눈동자<br />
jutfSerial.write(&#8220;$16.260, 242, 30,1);<br />
jutfSerial.write(&#8220;$1,0,15,50,6#); // 눈동자<br />
jutfSerial.write($1,6,540,242,30,1);</p>
<p>jutfSerial.write(&#8220;$1,0,225,225,225*); // 왼쪽 눈썹 jutfSerial.write(&#8220;$1,5,210,100,150,200,10#);<br />
jutfSerial.write($1,0,225,225,225#&#8221;); // 오른쪽 눈썹<br />
jutfSerial.write($1,5,590, 100,650,200,10#);</p>
<p>jutfSerial.write($1,0,225,225, 225# ); // 코<br />
jutfSerial.write($1,4,340,300,120,70,30,1);<br />
jutfSerial.write(&#8220;$10,15,50,6#); // 콧구멍<br />
jutfSerial.write($1,6,375,340,10,1);<br />
jutfSerial.write(&#8220;$1,0,15,50,6#); // 콧구멍<br />
utfSerial.write(&#8220;$1,6,425,340,10,1);<br />
jutfSerial.write(&#8220;$1,3,390,0,20,100,15,80,6,225,225,225#&#8221;); // 이마<br />
jutfSerial.write($1,3 350,0 20,100,15 80,6 225 225 225#&#8221;); // 이마<br />
jutfSerial.write(&#8220;$1,3,430,0,20,100,15,80,6,225,225,225# ); // 이마<br />
nCounter++;<br />
delay(1000):</p>
</div>
<p>소스코드를 업로드 하면 아래와 같은 이미지를 얻을 수 있다.<br />
이외에도 이미지, 사운드 삽입 및 출력 등으로 여러 GUI 환경 구축이 가능하기에 활용범위는 다음과 같다.</p>
<p><span style="color: #ff6600"><strong>JUTF M-A, Application</strong></span><br />
JUTF M-A는 다양한 규모의 산업현장 외에도 소규모의 영세한 기업에 이르기까지 단말기의 기기 상태나 라인의 공정 상태를 보고 싶은 모든 작업자와 환경을 대상으로 하기에 적용범위가 넓다. 기존에 의료기기, 미용기기, 3D 프린터 등에 적용되었고 현재 스마트 산업 현장과 무인 체크인 시스템 및 시제품 테스트 등 다양한 분야의 산업 군에서 활용되고 있다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-jutf-시리즈-4.png" rel="lightbox[38953]"><img class="alignnone size-large wp-image-39038" alt="62 sr jutf 시리즈 (4)" src="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-jutf-시리즈-4-524x620.png" width="524" height="620" /></a></p>
<p>JUTF70 M-A를 적용한 ㈜티앤원의 SDC 제품은 스마트 팜 및 스마트 팩토리 등의 스마트 모니터링 및 제어 시스템에 적용이 가능하고 현재 아쿠아포닉스 및 스마트 관련 산업 다수에 적용되어 업체와 함께 프로젝트를 진행하고 있으며, 2020년 연말에는 고해상도가 지원되는 JUTF High performance 제품이 출시될 예정이다.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ntrexgo.com/archives/38953/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[62호]헬스케어, 비대면 언택트 시대에 맞게 변신하다.</title>
		<link>http://www.ntrexgo.com/archives/38950</link>
		<comments>http://www.ntrexgo.com/archives/38950#comments</comments>
		<pubDate>Thu, 22 Oct 2020 00:00:41 +0000</pubDate>
		<dc:creator>디바이스마트 매거진</dc:creator>
				<category><![CDATA[디바이스마트 매거진]]></category>
		<category><![CDATA[스페셜 컬럼]]></category>
		<category><![CDATA[62호]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[Special]]></category>
		<category><![CDATA[디바이스마트]]></category>
		<category><![CDATA[매거진]]></category>
		<category><![CDATA[스마트]]></category>
		<category><![CDATA[헬스케어]]></category>

		<guid isPermaLink="false">http://www.ntrexgo.com/?p=38950</guid>
		<description><![CDATA[디바이스마트매거진 62호 &#124; 디바이스마트에서는 스페셜 칼럼에 소개된 기술, 트렌드와 관련된 제품 소개를 통해 현재 주목받는 기술과 트렌드를 쉽게 이해해보고 흥미를 느낄 수 있는 시간을 마련해보았습니다. ]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-헬스케어-비대면-9.png" rel="lightbox[38950]"><img alt="62 sr 헬스케어 비대면 (9)" src="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-헬스케어-비대면-9-620x235.png" width="620" height="235" /></a></p>
<p><span style="font-size: x-large"><strong>헬스케어, 비대면 언택트 시대에 맞게 변신하다.</strong></span></p>
<p>글 | 디바이스마트 박진아, 김흥운</p>
<p>&nbsp;</p>
<p>디바이스마트에서는 스페셜 칼럼에 소개된 기술, 트렌드와 관련된 제품 소개를 통해 현재 주목받는 기술과 트렌드를 쉽게 이해해보고 흥미를 느낄 수 있는 시간을 마련해보았습니다.<br />
이번 스페셜 칼럼중 하나인 ‘헬스케어, 비대면 언택트 시대에 맞게 변신하다.’ 에서는 기존 질병의 치료, 예방, 건강관리 과정을 모두 아울러 말하는 헬스케어에 IT기술이 접목된 사례를 확인할 수 있었습니다.<br />
AI 스피커, 웨어러블 디바이스로 노인의 우울증, 치매와 같은 정신질환을 미리 예방하고 케어하는 돌봄 서비스, 비대면 디지털 치료법과 같이 코로나 19 확산 영향으로 ‘비대면’ 문화가 확산함에 따라 의료분야와 개인 건강관리 방법에 새바람이 불고 있습니다.<br />
대면 진료가 어려워짐에 따라 웨어러블 디바이스로 평소 심박수와 몸 상태를 체크하고 관리하는 사람들이 늘어나고 있고, 실제로 세계 각지에서 애플워치의 심전도(ECG) 기능이 심장 이상 징후를 조기에 포착하여 도움이 되었다는 사례를 종종 접할 수 있습니다.<br />
우리 일상에 깊이 들어온 헬스케어와 IT기술의 접목 사례들을 생각해보며 디바이스마트의 어떤 상품이 원격 의료 진료 시스템 또는 헬스케어 디바이스와 관련이 있을지 같이 확인해 보도록 하겠습니다.<br />
<span style="color: #ff6600"><strong>근육, 심장의 전기적인 활동을 측정하는근전도 EMG 센서</strong></span></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-헬스케어-비대면-1.png" rel="lightbox[38950]"><img class="alignnone size-full wp-image-39023" alt="62 sr 헬스케어 비대면 (1)" src="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-헬스케어-비대면-1.png" width="620" height="359" /></a></p>
<p>이번에 소개할 제품은 근전도와 심전도를 확인해볼 수 있는 AD8232 chip을 탑재한 아두이노 근전도 EMG 센서입니다.<br />
먼저 간단하게 AD8232 에 대해 알아보겠습니다.<br />
제조사 : ANALOG DEVICES, 품명 : AD8232, 설명 : 단일 리드, 심박수 모니터 프런트 엔드<br />
FDL :</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-헬스케어-비대면-2.png" rel="lightbox[38950]"><img class="alignnone size-full wp-image-39025" alt="62 sr 헬스케어 비대면 (2)" src="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-헬스케어-비대면-2.png" width="620" height="421" /></a></p>
<p>AD8232 단선 심박수 모니터 보드는 심장의 전기적인 활동을 측정하고자 할때 사용하는 제품으로 심장의 전기적인 활동은 보통 ECG(Electrocardiography) 심전도로 표시합니다.<br />
즉, 심장의 수축에 따른 활동 전류를 감지한 그래프를 심전도(ECG)라 하며 근육이 움직일때 마다 우리 인체에 흐르는 미세 전류를 감지하여 전류의 변화를 기록한 그래프를 근전도(EMG)라합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-헬스케어-비대면-3.png" rel="lightbox[38950]"><img class="alignnone size-full wp-image-39027" alt="62 sr 헬스케어 비대면 (3)" src="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-헬스케어-비대면-3.png" width="620" height="405" /></a></p>
<p>위 이미지는 정상인의 심전도(ECG)로 나타난 그래프의 구성을 간단하게 설명하자면 P는 심방의 흥분을 나타내고, QRS는 심실의 탈분극(수축), T는 심실의 재근북을 나타냅니다. 실제 심전도는 심장의 상태를 측정하거나 손상 범위 진단 시 사용되나 여기서 소개되는 제품은 실제 의료기기가 아니기 때문에 근전도, 심전도 측정을 교육 및 체험 목적으로만 사용해야 함을 명심하시길 바랍니다.<br />
심전도와 관련하여 의학적으로, 구체적으로 들어가면 너무 어려워지기 때문에 간단하게 아두이노와 AD8232을 이용해서 ECG를 측정해 위와 같은 그래프가 그려지는지 확인해 보도록 하겠습니다.<br />
근전도 EMG 센서 AD8232 사용에 앞서 EMG 모듈로 어떻게 ECG를 측정이 가능한지 의문이 들 수 있겠지만, EMG와 ECG는 근육 수축에 의한 전기적 신호를 감지하는 같은 원리로 측정이 되기 때문에 EMG 모듈로 ECG도 측정이 가능합니다.</p>
<p><span style="color: #ff6600"><strong>간단한 심전도 측정 실습</strong></span></p>
<p><span style="color: #ff9900"><strong>1.실습에 필요한 제품 소개</strong></span></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-헬스케어-비대면-4.png" rel="lightbox[38950]"><img class="alignnone size-full wp-image-39028" alt="62 sr 헬스케어 비대면 (4)" src="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-헬스케어-비대면-4.png" width="620" height="322" /></a></p>
<p><span style="color: #ff9900"><strong>2. 하드웨어 구성하기</strong></span></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-헬스케어-비대면-5.png" rel="lightbox[38950]"><img class="alignnone size-full wp-image-39029" alt="62 sr 헬스케어 비대면 (5)" src="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-헬스케어-비대면-5.png" width="620" height="518" /></a></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-헬스케어-비대면-1.jpg" rel="lightbox[38950]"><img class="alignnone size-full wp-image-39022" alt="62 sr 헬스케어 비대면 (1)" src="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-헬스케어-비대면-1.jpg" width="620" height="349" /></a></p>
<p><span style="color: #808000"><strong>젤 패드 부착 방법</strong></span></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-헬스케어-비대면-6.png" rel="lightbox[38950]"><img class="alignnone size-large wp-image-39030" alt="62 sr 헬스케어 비대면 (6)" src="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-헬스케어-비대면-6-572x620.png" width="572" height="620" /></a></p>
<p>근전도 EMG 모듈 AD8232 제품에는 젤 패드 및 케이블이 총 3개가 함께 제공되며 이미지에서 빨간색 하트 모양인 심장을 기준으로 각 케이블 색깔에 동일한 원형부위에 맞춰 부착해 보시기 바랍니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-헬스케어-비대면-2.jpg" rel="lightbox[38950]"><img class="alignnone size-full wp-image-39024" alt="62 sr 헬스케어 비대면 (2)" src="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-헬스케어-비대면-2.jpg" width="620" height="354" /></a></p>
<p>젤 패드를 교체하고 싶거나, 부착 성능이 높은 패드를 사용하고 싶다면 디바이스마트 상품번호 1280244 또는 [Pololu] Electrodes for MyoWare Muscle Sensors (6-Pack)를 추천드립니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-헬스케어-비대면-3.jpg" rel="lightbox[38950]"><img class="alignnone size-full wp-image-39026" alt="62 sr 헬스케어 비대면 (3)" src="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-헬스케어-비대면-3.jpg" width="620" height="395" /></a></p>
<p><strong style="color: #ff9900">3. 아두이노 설치 및 소스코드 업로드하기</strong></p>
<p>아두이노 IDE(Integrated Development Environment)는 아두이노 프로그램을 작성하고 컴파일 할 수 있는 통합 개발 환경으로 아두이노 공식 홈페이지(https://www.arduino.cc)에서 무료로 제공하고 있어서 편리하게 사용이 가능합니다.<br />
공식 홈페이지를 통해 아두이노 통합개발환경(IDE) 설치한 후, 아래 소스코드를 업로드 해보기 바랍니다. 코드마다 이해하기 쉽게 설명을 주석으로 첨부하였습니다.<br />
설치 방법 및 세팅은 디바이스마트 블로그 아두이노 통합개발환경(IDE) 설치 방법 및 세팅글 (https://blog.naver.com/no1_devicemart/221503319351)에 자세히 나와있으니 설치가 어려운 구독자분들은 해당 내용을 확인해 보시기 바랍니다.</p>
<p><span style="color: #808000"><strong>소스코드</strong></span></p>
<div class="symple-box gray none" style="text-align:left; width:100%;"> 
<p>void setup() {<br />
Serial.begin(9600); // 시리얼 통신의 보드레이트는 9600bps 로 설정<br />
pinMode(10, INPUT); // 아두이노 디지털 10번을 입력핀으로 지정 LO+ 와 연결<br />
pinMode(11, INPUT); // 아두이노 디지털 11번을 입력핀으로 지정 LO- 와 연결<br />
}<br />
void loop() {<br />
if((digitalRead(10) == 1)||(digitalRead(11) == 1)){<br />
// 만약 디지털 10번 핀 또는(OR) 11번 핀에 1이 입력되면<br />
Serial.println(&#8216;!&#8217;); // 시리얼포트로 ‘!’를 출력 합니다. &gt; 젤 패드가 잘 붙었는지 확인 하는 원리<br />
}<br />
else{ // 아니라면<br />
Serial.println(analogRead(A0));<br />
// 시리얼포트로 아날로그 A0에 입력되는 값을 출력합니다.</p>
<p>}<br />
delay(1); // 1ms 만큼 지연 시킨다 -&gt; 연속 동작 중 정확한 값구분을 위한 딜레이 주는 겁니다.<br />
}</p>
</div>
<p><span style="color: #ff9900"><strong>4. 동작 모니터링 및 패턴 측정</strong></span><br />
<span style="color: #ff6600"><strong>동작 모니터링</strong></span><br />
아두이노 IDE 상단 메뉴에 툴 -&gt; 시리얼 플로터 선택, 좌측 하단에 9600bps(보드레이트) 선택 후 최대한 움직임을 줄이고 측정 결과를 지켜 보았습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-헬스케어-비대면-7.png" rel="lightbox[38950]"><img class="alignnone size-full wp-image-39031" alt="62 sr 헬스케어 비대면 (7)" src="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-헬스케어-비대면-7.png" width="620" height="320" /></a></p>
<p>실제 측정한 그래프는 위와 같으며 이론에 나온 정상인의 심전도와 같이 측정됨을 확인 할 수 있었습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-헬스케어-비대면-8.png" rel="lightbox[38950]"><img class="alignnone size-full wp-image-39032" alt="62 sr 헬스케어 비대면 (8)" src="http://www.ntrexgo.com/wp-content/uploads/2020/10/62-sr-헬스케어-비대면-8.png" width="620" height="367" /></a></p>
<p>이렇게 AD8232 센서와 아두이노를 이용해서 쉽고 간단하게 심전도(ECG)를 측정해 보았는데요. 이번 근전도 EMG 모듈 AD8232 소개와 더불어 기초 실습 과정을 따라 해보며 끊임없이 변화하고 있는 헬스케어 트렌드, 웨어러블 디바이스에 활용되는 이론이나 기술에 한 발짝 다가가 이해해보는 시간이 되었으면 합니다.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ntrexgo.com/archives/38950/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[60호]주목받는 비분산적외선 가스센서란 무엇인가</title>
		<link>http://www.ntrexgo.com/archives/38522</link>
		<comments>http://www.ntrexgo.com/archives/38522#comments</comments>
		<pubDate>Tue, 30 Jun 2020 00:00:32 +0000</pubDate>
		<dc:creator>디바이스마트 매거진</dc:creator>
				<category><![CDATA[디바이스마트 매거진]]></category>
		<category><![CDATA[스페셜 컬럼]]></category>
		<category><![CDATA[60호]]></category>
		<category><![CDATA[showcase]]></category>
		<category><![CDATA[가스센서]]></category>
		<category><![CDATA[광학식]]></category>
		<category><![CDATA[디바이스마트]]></category>
		<category><![CDATA[매거진]]></category>
		<category><![CDATA[이엘티센서]]></category>

		<guid isPermaLink="false">http://www.ntrexgo.com/?p=38522</guid>
		<description><![CDATA[디바이스마트매거진 60호 &#124; 광학식 가스센서인 비분산적외선 가스센서(NDIR)의 원리 및 이를 이용한 가스센서를 소개하고자 한다.]]></description>
				<content:encoded><![CDATA[<p><span style="font-size: medium;background-color: #000080;color: #ffffff"><strong><a href="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-1.png" rel="lightbox[38522]"><img class="alignnone size-large wp-image-38739" alt="60 showcase 이엘티센서 (1)" src="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-1-620x220.png" width="620" height="220" /></a></strong></span></p>
<p><span style="font-size: medium;background-color: #000080;color: #ffffff"><strong>이엘티센서</strong></span></p>
<p><span style="font-size: x-large;color: #000080"><strong>주목받는 비분산적외선 가스센서란 무엇인가</strong></span></p>
<p style="text-align: right">글 | 이엘티센서 천동기</p>
<p><span style="font-size: small">광학식 가스센서인 비분산적외선 가스센서(NDIR)의 </span><span style="font-size: small">원리 및 이를 이용한 가스센서를 소개하고자 한다.</span></p>
<p><strong style="color: #0000ff">1. 가스 센서의 정의 및 종류</strong></p>
<p>가스 센서는 가스의 농도(concentration)를 측정하는 센서이다. 여기서 농도는 전체 가스 중에 특정 가스가 차지하는 비율을 의미하며 그 단위로는 ppm, %, %LEL 등이 있다.<br />
가스 센서의 측정방식(원리)은 다양한 분류가 있으나 가스를 검출하는 원리에 따라 분류해 보면 광학식, 접촉식, 복합식으로 나눌 수 있다. 광학식은 가스분자의 화학반응이 일어나지 않는 비접촉식이며 접촉식은 가스분자와 반응물질간에 직접 접촉되는 방식, 복합식은 광과 화학반응이 발생하는 원리이다. 다음 표1은 각 방식의 가스 센서에 대한 간략하게 비교 정리한 것이다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-2.png" rel="lightbox[38522]"><img class="alignnone size-full wp-image-38740" alt="60 showcase 이엘티센서 (2)" src="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-2.png" width="474" height="598" /></a></p>
<p><span style="color: #ff6600">(1)</span> 가스 선택성(Gas Selectivity) : 측정 목표 가스(target gas) 외의 다른 가스의 간섭없이 측정하는 특성<br />
<span style="color: #ff6600">(2)</span> 재현성(Repeatability) : 동일 환경 조건에서 가스 농도 변화 시 동일 농도 조건에서 측정되는 농도 오차<br />
<span style="color: #ff6600">(3)</span> 수명(Life Time) : 재교정(recalibration)을 포함하여 센서가 사양을 충족시키는 성능이 유지되는 시간<br />
<span style="color: #ff6600">(4)</span> 측정 한도(Lowest Detection Limit) : 0 영역에서 센서가 구분할 수 있는 최소 농도 변화 값</p>
<p>앞의 센서 대표 원리별로 간략히 특징과 장단점을 비교해 본다.<br />
<strong></strong></p>
<p><span style="color: #0000ff"><strong>2. 접촉식 센서</strong> </span><br />
<span style="color: #33cccc"><strong>2.1 반도체식 센서</strong></span><br />
접촉식센서의 대표적인 반도체식 가스센서는 감지 물질 반도체 표면에 가스가 접촉했을 때 일어나는 전기전도도의 변화를 이용하는 것이 많으며 대부분 대기 중에서 가열하여 사용하여 고온에서 안정한 금속 산화물이 주로 사용된다. 금속 산화물은 반도체의 성질을 나타내는 것이 많고, 이중 금속원자가 과잉 (산소 결핍)인 경우에는 n형 반도체, 금속원자가 결핍인 경우에는 p형 반도체가 된다. 이러한 금속 산화물 반도체 중 전기전도도가 크고 융점이 높아서 사용온도 영역에서 열적으로 안정한 성질을 가진 물질이 감지 소재로 센서에 이용되고 있다.<br />
또한 검출회로의 구성이 간단한 편이고 가격이 저렴한 편이나 표면의 금속산화물 반도체에 의해서 전기전도도가 변하기 때문에 여러 종류의 가스에 영향을 많이 받고 습도에도 반응하여 정확한 가스농도 측정에는 단점이 있으나 MEMS의 소형화가 가능하고 상대적으로 가격이 저렴하여 정확도가 크게 중요하지 않는 대량 수요처에 많이 활용되고 있다.<br />
생활속의 많이 사용되는 반도체 방식 센서는 온습도 센서가 있으며, 가스측정에는 휘발성 유기화합물(VOCs), 일산화탄소, 수소계등을 측정할 때 많이 사용된다. 다른 가스에 영향이 크고 고농도에 노출되면 수명과 측정오차가 커진다는 단점이 극복하기 쉽지 않은 과제이기도 하다.<br />
<strong></strong></p>
<p><span style="color: #33cccc"><strong>2.2 전기화학식 센서</strong></span><br />
접촉식 센서의 또다른 대표적인 방식으로 전기화학식 센서가 있다. 전기화학식은 내장된 전극의 작용에 의해 측정 대상 가스가 산화 또는 환원 반응을 일으킬 때 발생하는 전류를 측정함으로써 가스의 농도를 검지한다. 내부에 보통 3개의 전극이 있으며 산화(환원) 반응이 일어나는 검지 전극(working electrode)과 이와 동시에 환원(산화) 반응이 일어나는 대항전극(counter electrode), 그리고 산화환원 반응과 함께 변화하는 전위를 감지하고 전위를 일정하게 유지하기 위한 참조 전극(Reference electrode)이다. 사용자는 센서 외부로 노출된 3개의 전극을 회로에 연결하여 사용한다.<br />
사용자가 전기화학식의 정상작동 또는 성능평가를 위해서는 산소가 필요하기 때문에 공기중에서 실시해야 한다. 또한 표준가스를 주문할 때도 질소베이스가 아닌 공기베이스의 표준가스를 주문하여 시험해야 한다. 질소베이스의 표준가스에서 실시하면 반응량이 적어 측정치가 낮게 표시된다. 경험에 의하면 질소 환경에서 시험시 초기 실험에서는 약 10 ~20%정도 수치가 낮게 나온다.<br />
통상 산업분야에서 사용하는 전기화학식 센서의 사용은 2년 정도이나 생활속에서 사용하는 센서는 대기중에 해당가스가 거의 없기 때문에 수명이 길게는 5년이상까지도 사용 가능한 센서도 판매되고 있다.<br />
장점으로는 빠른 응답시간, 안정성, 낮은 농도도 감지 가능하고, 재현성이 우수하다. 반면 접촉식 센서의 단점인 다른 가스에 대한 반응성, 그리고 고농도에 노출시 수명이 빨리 단축된다는 단점은 원리상 나타나는 현상이다.<br />
주로 전기화학식 센서로는 일산화탄소, 산소, 황화수소, 암모니아가스등을 측정할 때 유리한 성능을 갖는다.</p>
<p><span style="color: #0000ff"><strong>3. 복합식 센서</strong></span><br />
VOCs를 측정할 때 반도체방식은 정확성에서 타방식에 비해 어려움이 있으나 광이온화(PID Photoionization detector)방식으로 측정할 때 우수한 정확성과 재현성을 가진다.<br />
PID 원리는 자외선(UV) 빛을 가스분자에 조사하여 양이온과 음이온화시키고 이를 전극으로 집전시켜 가스농도에 비례한 전류를 감지하며 광 조사와 화학적 반응을 동반한다.<br />
현재 PID 센서를 장착한 측정기로 VOCs를 ppm 이하 ppb 저농도까지 재현성있게 측정하고 있다. 하지만 경제적인 부담 없이 사용하기에는 가격이 타 방식에 비해 상대적으로 많이 고가이기 때문에 아직까지 타 방식의 센서처럼 확대되지 못하고 있고 VOC측정에는 주로 반도체방식을 많이 사용하고 있다.<br />
PID 특성으로 습도에 간섭이 적고 감도가 우수한 장점이 있다.</p>
<p><span style="color: #0000ff"><strong>4. 광학식 가스 센서</strong> </span><br />
비분산적외선(NDIR Non-Dispersive Infrared)식은 여러 종류의 가스 측정 원리중에서 비접촉식의 대표적 방식으로 가장 정확성과 신뢰성, 안정성, 긴 수명등의 장점을 많이 가지고 있다. 하지만 광학계 부품의 고가로 인해 타 방식에 비해 상대적으로 가격이 높았다. 따라서 NDIR식은 기존에는 주로 고가의 분석기에 사용되어 왔으나 지속적으로 광학센서의 사용량이 크게 늘어나면서 광학계 부품들의 가격이 낮아져 일상 생활속에서도 사용할 수 있게 되었다. 예로서 가장 대중화된 NDIR 이산화탄소센서의 경우는 전기화학식이나 반도체식에 비해서도 가격의 차이가 없어졌다. 이로 인해 시장에서 이산화탄소 센서는 거의 90%이상을 NDIR식을 사용하고 있다. 최근 코로나바이러스로 인해 음주 측정용 알콜 센서 방식도 기존에 주로 사용하는 반도체식, 전기화학식 방식에서 비접촉식인 비분산 적외선식이 확대되고 있는 것도 정확성이 높고 비접촉으로 감지하기 때문이다. 이산화탄소 센서의 경우처럼 광학식의 장점이 많아 가격이 낮아지면 기존 접촉식 센서들의 상당부분이 광학식으로 확대될 것으로 예상된다. 그리고 기존까지는 광학식 기술은 선진국에서 앞서 있었으나 국내 기술의 발전으로 상당부분 대등한 기술수준까지 오게 되었다.<br />
다음은 이엘티센서의 중점 사업 기술 분야인 NDIR센서에 대해서 구체적인 핵심 기술과 대표 신제품을 알아본다.</p>
<p><span style="color: #33cccc"><strong>4.1. 광학식 가스 센서의 기본 구성</strong></span><br />
광학식 비분산적외선(NDIR) 가스 센서는 가스 분자가 특정 파장의 광을 흡수하는 특성을 이용하여 가스 농도에 대한 광 흡수율을 측정하는 방식이다. 검지부의 중요 부품은 광원(Light Source)과 광 검출기(Light Detector), 그리고 광이 지나가는 경로와 광 효율을 결정하는 광 도파관(Optical Wave Guide 또는 Cavity &#8211; 아래 금색 부)이 있고, 광신호를 처리하는 회로부와 제어를 담당하는 펌웨어 부가 있다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-3.png" rel="lightbox[38522]"><img class="alignnone size-full wp-image-38741" alt="60 showcase 이엘티센서 (3)" src="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-3.png" width="475" height="203" /></a></p>
<p>이 중에서 광 도파관은 각 회사의 고유한 기술이며 광경로, 길이, 집광도 등의 광 효율성을 결정는 핵심기술로서 회사의 주요 특허 대상이다. 이엘티센서는 국내, 미국, 일본, 중국, 유럽등에 20여건의 특허를 등록하여 국내에서 가장 많은 비분산적외선 센서 관련 기술특허를 보유중이다.<br />
아래 그림들은 특허로 등록된 광 도파관의 광 이동 구조의 예시 들이다.<br />
통상의 타 회사의 간단한 직선형구조 보다 더 긴 광경로를 이루도록 기하학적 구조를 배치하여 정확성과 정밀성을 높일 수 있다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-4.png" rel="lightbox[38522]"><img class="alignnone size-full wp-image-38742" alt="60 showcase 이엘티센서 (4)" src="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-4.png" width="475" height="203" /></a></p>
<p>NDIR 센서 모듈의 구성 흐름을 간단히 보이면 아래 그림과 같이 광 검출기에서 출력되는 전기 신호는 증폭 회로와 아날로그-디지털 변환기(ADC)를 거쳐 처리 장치(CPU, Micro Processor)에서 가스 농도를 계산하여 출력해준다. 농도 산출은 기본적으로 비어-램버트 함수를 이용하지만 각 설계환경에 맞추어 적정하게 변형 도출되어야 한다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-5.png" rel="lightbox[38522]"><img class="alignnone size-full wp-image-38743" alt="60 showcase 이엘티센서 (5)" src="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-5.png" width="475" height="411" /></a></p>
<p><span style="color: #33cccc"><strong>4.2. NDIR로 측정하는 가스의 광학적 특징</strong> </span><br />
측정기의 크기에 제한 없이 수 미터 이상 광 경로를 길게 할 수 있다면 매우 더 낮은 농도를 측정할 수 있다. 하지만 분석기가 아닌 센서류는 크기와 관련되기 때문에 수 센티미터 크기에서는 낮은 농도를 측정할 수 있는 한계성이 있다. 현재 이산화탄소와 메탄은 수 센티 크기의 모듈로도 제작 가능한 기술이 개발 되었고 지속적으로 소형화되고 있으나 일산화탄소, 이산화질소등의 대기중에 낮은 농도까지 측정해야 하는 가스는 소형화하는데 많은 어려움이 있어 아직 정밀하게 측정할 수 있는 광학식 센서로는 연구개발 단계에 있다. 수년 안에 상품화될 것이다. 아래 표2는 대기중의 주요 가스와 흡수파장, 그리고 가스분자의 광 흡수특성에 따른 간략비교를 보여준 것이다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-6.png" rel="lightbox[38522]"><img class="alignnone size-full wp-image-38744" alt="60 showcase 이엘티센서 (6)" src="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-6.png" width="475" height="275" /></a></p>
<p>모든 분자는 광을 흡수하면 열 진동(Thermal Vibration)을 하게 되는데 흡수하는 광은 원자 간 결합의 세기에 따라 그 파장(또는 진동수)이 달라진다. 예를 들어 이산화탄소의 경우 3종의 열 진동 모드(Thermal Vibration Mode)를 갖는데 표3과 같다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-7.png" rel="lightbox[38522]"><img class="alignnone size-full wp-image-38745" alt="60 showcase 이엘티센서 (7)" src="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-7.png" width="475" height="211" /></a></p>
<p>일반적으로 단원자 분자의 결합력이 강하여 흡수하는 에너지가 더 높은 단 파장대의 광을 흡수하고 다원자 분자의 경우 결합력이 약하여 에너지가 낮은 장 파장대의 광을 흡수한다. CO2의 경우 가장 에너지가 높은 4.26㎛ 파장대를 이용하여 센서를 만들고 있다.<br />
하지만 산소와 질소 같은 단원자 분자로 되어 있는 것은 적외선 흡수율이 적어서 NDIR 센서는 만들기 어려운 한계성이 있다.</p>
<p><span style="color: #0000ff"><strong>5. 가스 센서의 개발 및 시장의 요구 동향</strong></span><br />
기술의 발전에 따라 타 산업과 마찬가지로 가스센서도 시장에서는 지속적으로 더 작은 센서, 더 낮은 소비전류 센서, 더 낮은 가격의 센서를 요구하고 있다. 정확도 또한 유지하면서 이러한 성능을 요구하기 때문에 센서 제조사들은 지속적으로 제품개발과 연구에 더 많은 비용과 시간을 투입해서 대응하고 있지만, 기술발전의 속도가 느리고 기초과학에서 출발하는 센서기술의 특성상 원천 소재와 광 부품등의 동반 발전과 지원이 반드시 필요하다.<br />
다음에는 현재 개발되어 판매되고 있는 대표적인 NDIR 가스센서(CO2, CH4)의 센서모듈의 사양과 특징을 소개한다.<br />
아래 소개한 신제품 가스센서는 디바이스마트 사이트에서 손쉽게 구입할 수 있어 편리하다.</p>
<p><span style="color: #0000ff"><strong>6. 대표적인 CO2, CH4, CO 센서 모듈, 제품</strong></span></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-8.png" rel="lightbox[38522]"><img class="alignnone size-full wp-image-38746" alt="60 showcase 이엘티센서 (8)" src="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-8.png" width="475" height="309" /></a></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-9.png" rel="lightbox[38522]"><img class="alignnone size-full wp-image-38747" alt="60 showcase 이엘티센서 (9)" src="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-9.png" width="475" height="317" /></a></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-10.png" rel="lightbox[38522]"><img class="alignnone size-full wp-image-38748" alt="60 showcase 이엘티센서 (10)" src="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-10.png" width="475" height="317" /></a></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-11.png" rel="lightbox[38522]"><img class="alignnone size-full wp-image-38749" alt="60 showcase 이엘티센서 (11)" src="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-11.png" width="475" height="332" /></a></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-12.png" rel="lightbox[38522]"><img class="alignnone size-full wp-image-38750" alt="60 showcase 이엘티센서 (12)" src="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-12.png" width="475" height="315" /></a></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-13.png" rel="lightbox[38522]"><img class="alignnone size-full wp-image-38751" alt="60 showcase 이엘티센서 (13)" src="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-이엘티센서-13.png" width="475" height="315" /></a></p>
<p><span style="color: #0000ff"><strong>7. 마무리</strong></span><br />
가스센서의 개발은 원천기술 확보를 통해 선진국으로부터 기술 독립이 가능하며 센서의 신뢰성을 검증받는데 최소 10년 이상 센서 개발 경력이 있어야 한다. 또한 전세계 수출을 위해 독자적인 센서로 인정받기 위해 국내외 다수 특허 확보가 필요하고 다양한 신모델 개발이 필요하다. 이러한 노력을 계속하고 있는 이엘티센서는 국내 센서기술이 선진국과 대등한 기술수준으로 인정받을 수 있도록 견고한 기초를 다져가고 있다.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ntrexgo.com/archives/38522/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[60호]초소형 레이더 MDR, 어떻게 제어하고 활용하나</title>
		<link>http://www.ntrexgo.com/archives/38520</link>
		<comments>http://www.ntrexgo.com/archives/38520#comments</comments>
		<pubDate>Tue, 30 Jun 2020 00:00:23 +0000</pubDate>
		<dc:creator>디바이스마트 매거진</dc:creator>
				<category><![CDATA[디바이스마트 매거진]]></category>
		<category><![CDATA[스페셜 컬럼]]></category>
		<category><![CDATA[제품 리뷰]]></category>
		<category><![CDATA[60호]]></category>
		<category><![CDATA[showcase]]></category>
		<category><![CDATA[디바이스마트]]></category>
		<category><![CDATA[레이더]]></category>
		<category><![CDATA[매거진]]></category>
		<category><![CDATA[인지니어스]]></category>
		<category><![CDATA[초소형]]></category>

		<guid isPermaLink="false">http://www.ntrexgo.com/?p=38520</guid>
		<description><![CDATA[디바이스마트매거진 60호 &#124; 인지니어스는 레이더 모듈을 개발하고 공급하기 위한 고주파 안테나 설계, RF 기판 및 회로 설계, 그리고 레이더 제어 S/W를 독자적으로 개발하고 서비스하는 전문 기업이다. ]]></description>
				<content:encoded><![CDATA[<p><span style="background-color: #000080; color: #ffffff;"><strong><a href="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-초소형레이더-7.png" rel="lightbox[38520]"><img class="alignnone size-large wp-image-38726" alt="60 showcase 초소형레이더 (7)" src="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-초소형레이더-7-620x188.png" width="620" height="188" /></a></strong></span></p>
<p><span style="background-color: #000080; color: #ffffff;"><strong>인지니어스</strong></span></p>
<p><span style="font-size: x-large;"><strong>초소형 레이더 MDR, 어떻게 제어하고 활용하나</strong></span></p>
<p>&nbsp;</p>
<p style="text-align: right;">글 | 인지니어스 라승탁</p>
<p>&nbsp;</p>
<p>인지니어스는 레이더 모듈을 개발하고 공급하기 위한 고주파 안테나 설계, RF 기판 및 회로 설계, 그리고 레이더 제어 S/W를 독자적으로 개발하고 서비스하는 전문 기업이다. 십여년의 기술 개발을 통해서 많은 수의 레이더를 상용화하였다. 이를 바탕으로 인지니어스는 산업용, 자동차용, 그리고 방산용 레이더를 개발하고 공급하고 있다.</p>
<p>현재 디바이스마트에서 판매 중인 24GHz 기반의 MDR(Motion Detect Radar) 모델은 2018년도에 상용화를 완료한 세계에서 제일 작은 크기의 초소형레이더로 다양한 응용 분야에서 사용 중이고, 현재도 지속적으로 소프트웨어를 업데이트하여 속도(방향 포함)까지 알 수 있는 버전인 MDR Ver2.0을 곧 지원한다. 이는 기존에 단순히 움직이는 사물의 존재 유무만을 감지하던 기능에서 감지된 물체가 레이더에 접근 중인지, 멀어지고 있는지를 구별할 수 있는 기능이 추가된 것이다.<br />
또한 60GHz 기반의 산업용 레이더에서는 최고 사양을 갖는 고성능 레이더도 최근에 개발을 완료하여 공급이 가능한 상태이다. 고성능 레이더는 CCTV와 연동해서 지능형 추적이 가능하고 과속 단속 카메라, 그리고 사람의 호흡이나 심박을 검출하는 바이탈 센싱 등으로 적용되고 있다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-초소형레이더-1.jpg" rel="lightbox[38520]"><img class="alignnone size-large wp-image-38727" alt="60 showcase 초소형레이더 (1)" src="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-초소형레이더-1-607x620.jpg" width="607" height="620" /></a></p>
<p><strong>MDR 특징</strong><br />
MDR 레이더 모듈은 24GHz의 K밴드 대역 전파를 이용하여 움직이는 사물의 존재 유무를 감지하는 용도로 사용한다. 다른 센서와 비교하여 환경의 영향을 적게 받기 때문에 햇빛과 같이 강한 빛, 먼지, 비, 눈, 안개, 그리고 흐린 날씨에도 사용이 가능하다.<br />
모듈은 MCU를 내장하고 있어서 전원만 공급하면 자체적으로 동작을 수행하고, 검출한 결과는 GPIO나 UART를 통해서 출력한다. 또한 IOT와도 연동이 가능하도록 패킷 통신을 지원하고, 외부에서 모듈의 기능을 설정할 수 있다.<br />
감지 각도와 범위에 따라서 mini와 micro의 두 가지 모델이 있고, 성인 남성 기준으로 7m 이상의 감지거리를 가지고 있다. 크기는 mini가 30x30x3.1mm, micro가 22.1&#215;18.1&#215;3.1mm로, 작아서 다양한 제품에 내장 시키는 것이 가능하다.</p>
<p><strong>MDR Ver2.0 사용법과 제어</strong><br />
이번 장에서는 곧 지원 예정인 속도 정보까지 알 수 있는 MDR Ver2.0의 사용법과 제어에 대해 알아보겠다.<br />
우선 아래의 핀 맵 그림에 맞게 MDR의 5개의 핀을 연결한다. 5개 핀은 VCC, GND, GPIO_OUT, UART_TX, UART_RX를 의미한다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-초소형레이더-1.png" rel="lightbox[38520]"><img class="alignnone size-full wp-image-38728" alt="60 showcase 초소형레이더 (1)" src="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-초소형레이더-1.png" width="537" height="609" /></a> <a href="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-초소형레이더-2.png" rel="lightbox[38520]"><img class="alignnone size-full wp-image-38729" alt="60 showcase 초소형레이더 (2)" src="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-초소형레이더-2.png" width="537" height="560" /></a></p>
<p>MDR의 가장 큰 장점은 사용자가 사용하기 쉽게 설계되었다는 점이다. 기본 사용법은 전원 연결 후, GPIO OUT핀의 상태로 현재 움직임이 있는가를 판단하면 된다. 기본 펌웨어의 GPIO OUT핀은 움직임이 있으면 High, 없으면 Low를 출력한다. 만약 간편한 사용만을 원한다면 UART TX, RX 핀을 제외한 VCC, GND, GPIO_OUT 3개의 핀만 사용하면 된다.<br />
MDR을 제어하기에 앞서 특정 용어를 먼저 확인해보자. 첫 번째로 DetectValue는 MDR에 감지된 움직임의 크기를 수치로 나타낸 것이며, 가까운 거리거나 큰 움직임 일수록 더 큰 수치를 나타낸다. 두 번째로 DetectLevel은 DetectValue의 Threshold값으로 DetectValue가 DetectLevel보다 크면 GPIO_OUT1로 감지신호를 출력한다. 마지막으로 MotionData는 MDR에 감지된 움직임의 DetectValue, 속도, GPIO_OUT1 상태를 통합한 용어이다.<br />
MDR은 UART 시리얼 통신으로 특정 커맨드를 이용해 제어가 가능하다. 핀 맵대로 연결한 후, Tera Term에서 아래의 그림과 같이 “MotionDataEnable 1” 커맨드를 입력 후 엔터를 누르면 MotionData가 실시간으로 출력된다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-초소형레이더-3.png" rel="lightbox[38520]"><img class="alignnone size-full wp-image-38730" alt="60 showcase 초소형레이더 (3)" src="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-초소형레이더-3.png" width="537" height="366" /></a><br />
MotionData의 표현식은 “MotionData⌴+ DetectValue⌴±속도⌴GPIO_State(0 or 1)”이다. ‘Space’(0&#215;20)는 ‘⌴’로 표현하였다. 이 상태에서 MDR에 움직임을 주게 되면 DetectValue가 상승할 것이고 설정된 DetectLevel을 넘게 되면 GPIO 상태가 1로 바뀔 것이다. 반대로 가만히 멈춘 상태가 유지되면 DetectValue가 내려갈 것이고 DetectLevel보다 낮아지기에 GPIO 상태가 0으로 바뀔 것이다.<br />
MDR을 사용하는 환경에 따라 움직임이 없는 환경에서도 기본적으로 DetectValue가 높은 경우가 있다. 예를 들면 주변에 컴퓨터 Fan이 돌고 있다거나, 환풍기 등의 움직임이 고정적으로 발생하고 있는 환경이다. 이 경우, DetectValue가 항상 DetectLevel을 넘게 된다면 MDR의 GPIO 상태는 항상 High 일 것이다.<br />
DetectValue가 항상 DetectLevel을 넘게 될 경우, MDR의 파라미터를 제어하면 문제를 해결할 수 있다. 예를 들어 설정된 DetectLevel이 1만이고, 현재 평균적으로 DetectValue가 1만이 나온다면 DetectLevel을 1만보다 높게 설정하는 커맨드를 입력하여 제어하면 된다. 아래의 그림과 같이 “DetectLevel 11000” 커맨드를 입력 후 엔터를 누르면 DetectLevel이 1.1만으로 설정된다. 추천하는 DetectLevel은 MDR을 사용하는 환경의 평균 DetectValue + 5000 정도이다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-초소형레이더-4.png" rel="lightbox[38520]"><img class="alignnone size-full wp-image-38731" alt="60 showcase 초소형레이더 (4)" src="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-초소형레이더-4.png" width="537" height="269" /></a></p>
<p><strong>MDR 활용</strong><br />
MDR은 독자적으로 동작하는 초소형 레이더라서 조명제어, 보안 시스템, 공장 자동화, 출입 감지, 비접촉 스위치 등에 활용되고 있다. 또한 MDR은 기존 PIR 센서의 단점을 대부분 극복한 고성능 센서라서 PIR을 사용할 수 없는 환경에도 사용이 가능하다. 이번 장에서는 MDR이 실제로 활용되어 제품이 된 예를 알아보겠다.</p>
<p>아래 그림과 같이 블랙박스 주차보조에 활용되었다. 주차 시간동안 항상 블랙박스를 녹화할 수는 없기에 현재 사용되고 있는 주요 센서는 충격감지 센서이다. 하지만 충격감지 센서의 단점은 이미 사고가 발생되어버린 시점부터 녹화가 진행된다는 것이다. 이를 방지하기 위해 충격감지 센서와 연계하여 MDR로 움직임을 미리 감지하여 사고 발생 전과 후의 영상을 확보하도록 하였다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-초소형레이더-5.png" rel="lightbox[38520]"><img class="alignnone size-full wp-image-38732" alt="60 showcase 초소형레이더 (5)" src="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-초소형레이더-5.png" width="537" height="269" /></a><br />
다음 MDR 활용으로는 원격 침입 감지가 있다. 아래 그림과 같이 기존의 침입 감지 시스템에 사물인터넷을 연계한 제품이다. 또한 기존의 침입 감지용 센서와 다르게 레이더 특성을 이용하여 벽을 투과한 물체의 움직임도 감지가 된다는 장점을 잘 살렸다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-초소형레이더-6.png" rel="lightbox[38520]"><img class="alignnone size-full wp-image-38733" alt="60 showcase 초소형레이더 (6)" src="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-초소형레이더-6.png" width="537" height="394" /></a></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-초소형레이더-2.jpg" rel="lightbox[38520]"><img class="alignnone size-full wp-image-38734" alt="60 showcase 초소형레이더 (2)" src="http://www.ntrexgo.com/wp-content/uploads/2020/06/60-showcase-초소형레이더-2.jpg" width="537" height="378" /></a></p>
<p>마지막으로 소개할 MDR 활용 제품은 지능형 아파트 초인종이다. 기존의 초인종을 눌러야 녹화가 되는 제품과 다르게 설정된 시간만큼의 지속적인 움직임이 감지되면 자동으로 녹화가 되도록 하였다. 요즘 같은 흉흉한 세상에 장시간 현관문 앞의 움직임은 곧 범죄로 이어질 확률이 높기 때문에 범죄 예방 차원에서 굉장히 좋은 MDR 활용이라고 볼 수 있다.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ntrexgo.com/archives/38520/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[40호]Wi-Fi를 품은 한국형 아두이노 오렌지보드WiFi</title>
		<link>http://www.ntrexgo.com/archives/33059</link>
		<comments>http://www.ntrexgo.com/archives/33059#comments</comments>
		<pubDate>Mon, 23 Jan 2017 00:00:51 +0000</pubDate>
		<dc:creator>디바이스마트 매거진</dc:creator>
				<category><![CDATA[blog-posts]]></category>
		<category><![CDATA[디바이스마트 매거진]]></category>
		<category><![CDATA[스페셜 컬럼]]></category>
		<category><![CDATA[40호]]></category>
		<category><![CDATA[aduino]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[Special]]></category>
		<category><![CDATA[wifi]]></category>
		<category><![CDATA[디바이스마트]]></category>
		<category><![CDATA[매거진]]></category>
		<category><![CDATA[아두이노]]></category>
		<category><![CDATA[오렌지보드]]></category>
		<category><![CDATA[한국형]]></category>

		<guid isPermaLink="false">http://www.ntrexgo.com/?p=33059</guid>
		<description><![CDATA[디바이스마트40호 &#124; 아두이노 제품을 조금이라도 다뤄본 독자님들이라면 언젠간 꼭 한번 도전해 보고 싶은 영역이 바로 네트워크일 것입니다. 그러나 막상 시도해 보려하면 어디서부터 어떻게 접근해야 할지 너무 막막하기도 하고 어렵사리 쉴드 보드를 장만하여 테스트 해보려 해도 그리 생각처럼 쉽지 않은 것이 현실입니다.]]></description>
				<content:encoded><![CDATA[<p><span style="font-size: x-large;"><strong><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-1.png" rel="lightbox[33059]"><img class="alignnone size-large wp-image-33263" alt="40 SR (1)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-1-620x285.png" width="620" height="285" /></a></strong></span></p>
<p><span style="font-size: x-large;"><strong>Wi-Fi를 품은 한국형 아두이노</strong></span><br />
<span style="font-size: x-large;"><strong><br />
오렌지보드WiFi</strong></span></p>
<p style="text-align: right;">글 | 금강초롱 blog.naver.com/crucian2k3</p>
<p style="text-align: right;">
<p>아두이노 제품을 조금이라도 다뤄본 독자님들이라면 언젠간 꼭 한번 도전해 보고 싶은 영역이 바로 네트워크일 것입니다. 그러나 막상 시도해 보려하면 어디서부터 어떻게 접근해야 할지 너무 막막하기도 하고 어렵사리 쉴드 보드를 장만하여 테스트 해보려 해도 그리 생각처럼 쉽지 않은 것이 현실입니다.</p>
<p>오렌지보드 시리즈로 유명한 우리나라의 코코아팹에서 따끈한 WiFi 기반의 아두이노 우노 계열의 보드를 내놓았습니다. 이 보드에는 ATmega328P와 USB FTDI 칩이 내장되어 있으므로 여느 아두이노 시리즈와 별반 다를 것은 없으나, 위즈네트에서 출시한 WiZ250 무선통신모듈이 장착되어 있어 좀 더 손쉽게 네트워크에 발을 들여 놓도록 배려해 주고 있습니다. 배려라기보다도 더 정확히는 이 보드의 핵심이라고 볼 수 있겠습니다.</p>
<p>다만 위즈네트 무선랜 모듈이 SPI 채널을 활용하고 있어 일부 핀들이 여기에 할당토록 살짝 제약이 따르긴 합니다만, 아두이노 보드에 쉴드 등을 얹는 경우에도 이와 크게 다르지 않기에 그리 민감하게 반응할 사안은 아닌 듯합니다.</p>
<p>SPI 채널을 매개체로 하여 동작되는 위즈네트 무선랜 모듈은 내부적으로는 AT 커맨드를 사용해 코어와 통신하도록 설계되어 있습니다.<br />
우선 보드가 어떠한 특징들을 포함하고 있는지 쭉~ 살펴본 후에, 코코아팹에서 준비해놓고 있는 튜토리얼과 필자가 랜 통신을 테스트할 때 약방의 감초처럼 여기는 NTP 클라이언트 모듈을 실행해 가며 이 보드를 어떻게 응용할 수 있을지 확인해 보고자 합니다. 이글은 (주)엔티렉스의 지원을 받아 작성하게 되었습니다.<br />
이번 글은 아무래도 난이도가 다소 있을 수밖에 없는 불가피성이 있으며, 적어도 아두이노 우노로 LED나 Serial 모니터, 라이브러리 등은 자유롭게 사용할 줄 안다는 전제하게 글을 써 보고자 합니다.</p>
<p>또 한 가지는 TCP/IP 네트워크, 웹기반 프로그래밍이 등장하게 되는데 이런 부분들까지 일일이 설명하는 것은, 제 지식이 얕기도 하거니와 범위가 너무 넓어질 수도 있으므로, 튜토리얼을 동작하고 이해해 보는 선에서 간략히 정리하고자 합니다.<br />
이더넷통신, IOT 체계 등에 대해서 궁금하신 사항에 대해서는 인터넷상에 충분히 제공되어 있는 정보를 습득해 보는 것도 좋은 방법이 될 것으로 봅니다.</p>
<p><strong><span style="color: #ff6600;">1. 오렌지보드 HW 구성</span></strong><br />
<span style="color: #ff9900;"><strong>1.1. 오렌지보드WiFi 상세스펙</strong></span></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-2.png" rel="lightbox[33059]"><img class="alignnone size-full wp-image-33265" alt="40 SR (2)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-2.png" width="464" height="504" /></a></p>
<p>오렌지보드에 적용된 MCU가 아두이노 우노(Uno)에도 적용된 ATmeag328P 칩셋이며 원래 제조사는 Atmel사 입니다만, 최근 PIC라는 제품으로 유명한 마이크로칩스에 인수·합병 되었습니다. 따라서 보드의 구성은 위즈네트의 Wi-Fi 모듈을 제외하면 아두이노 우노와 거의 동일하다고 볼 수 있겠습니다. 이런 경우를 일반적으로 동일한 폼펙터를 사용하고 있다고도 이야기하곤 합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-1.jpg" rel="lightbox[33059]"><img class="alignnone size-full wp-image-33289" alt="40 SR (1)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-1.jpg" width="192" height="198" /></a></p>
<p>필자는 금번에 소개하는 오렌지보드 시리즈를 사용하여 옐로우캣이라는 귀여운 로봇을 아이들과 만들어본 바가 있어 코코아팹 시리즈는 그리 낯설지 않은 편입니다.<br />
보드에 대한 더 상세한 해부는 아래에서 다뤄보기로 하고 WizFi250 Wi-Fi 모듈의 스펙에 대해서 상세히 살펴보면 아래와 같습니다.</p>
<p><span style="color: #ff9900;"><strong>1.2. 위즈넷의 대표적인 Wi-Fi 모듈</strong></span><br />
위즈네트는 사물인터넷(Internet Of Things)을 위한 인터넷 프로세서를 개발·보급하는 팹리스 벤처기업이라고 자신들을 소개하고 있습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-3.png" rel="lightbox[33059]"><img class="alignnone size-full wp-image-33267" alt="40 SR (3)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-3.png" width="464" height="611" /></a></p>
<p>필자는 수년 전부터 이더넷에 관심이 있어 마이크로칩사의 PIC18F97J60으로 인터넷 라디오 등 몇 가지 프로젝트를 진행한 바 있었으며 그때 위즈네트 초창기 발매 칩들을 검토해본 바 있습니다. 위즈네트사에서 시판 중인 임베디드형 와이파이 모듈은 현재 5종(WizFi310, WizFi250, WizFi210, WizFi220, WizFi630A)이 있으며 좌측에 이중 3종을 정리해 보았습니다. 개별칩을 구입해서 제작하기에는 이런저런 부담이 있는 경우에, 이러한 모듈형은 상당한 간편함을 제공해줄 수 있다고 봅니다.<br />
WizFi250이 특별히 눈에 띄는 부분이 있다면 제어명령어가 AT 커맨드를 사용한다는 점과 SPI 인터페이스가 구비되어 있다는 점을 들 수 있을 것 같습니다.<br />
이는 사용하기 쉬운 AT 명령어와 시리얼통신에 비해, 보다 고속의 데이터처리가 가능한 SPI를 지원하기에 ‘오렌지보드WiFi&#8217;에서 이 모듈을 채용한 것으로 짐작이 됩니다.<br />
데이터 전송 속도로는 801.11n 모드에서는 HT20 MCS0에서 6.5Mbps ~ HT20 MCS7에서 최대 65Mbps로 속도가 나올 수 있다고 하니 나쁘진 않다고 봅니다.</p>
<p><span style="color: #ff9900;"><strong>1.3. 제품 핀 구성</strong></span><br />
다음으로 핀 구성을 살펴보면 USB Type-B로 구성된 아두이노 우노에 비해 MicroUSB 잭을 사용해 보드 공간을 좀 더 효과적으로 사용하려 노력한 점이 돋보입니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-2.jpg" rel="lightbox[33059]"><img class="alignnone size-large wp-image-33264" alt="40 SR (2)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-2-620x370.jpg" width="620" height="370" /></a><br />
그 다음으로 눈에 띄는 부분이 있다면 WizFi250과의 연동을 위해 SPI통신을 위한 핀들이 결선되어 있다는 점을 들 수 있을 것 같습니다.<br />
이는 ATmega328이 갖고 있는 한정된 핀 개수에 비춰볼 때 선택의 여지가 없는 사안으로 보이며, 원래 SPI 포트는 보드 하단에 ISP 커넥터와도 연결되어 있어 AVR MK-II 등 프로그래머를 통해 직접 프로그래밍을 하는 용도로도 사용되던 핀이었습니다.<br />
만일 핀 때문이라면 I2C등도 고려해 볼 수도 있을 듯 합니다만, 위즈네트 임베디드 모듈은 I2C를 지원하지 않기에 선택의 여지는 없어 보입니다.<br />
SCK, MISO, MOSI 이 3개의 핀은 다른 SPI 디바이스들과 병렬로 사용하게 되나 SS, DATA_Ready, WIFI_RESET 핀 등 3개는 WizFi250을 사용하는 조건에서는 꼼짝없이 여기에 연결되어야 하는 상황에 놓이게 됩니다. 또한 흔히 On Board LED가 연결되는 D13 핀이 SPI_CLK 핀에 연결되어 있기에 간단한 테스트를 해보고자 해도, 별도의 LED를 연결해야 하는 점이 유의점이라면 유의점에 해당됩니다.</p>
<p><span style="color: #ff9900;"><strong>1.4. 회로설계</strong></span><br />
<span style="color: #f2cd0c;"><strong>1.4.1. USB to Serial 부문</strong></span><br />
PC와 연결되는 마이크로USB 접속부분이 아두이노 우노 R3 와는 다소 다릅니다.<br />
그냥 널리 사용되는 FT232RL로 간단히 USB to Serial을 구현한 것을 알 수 있습니다. 이 칩은 너무나도 유명한 칩으로서 어지간한 USB2SERIAL에는 거의 다 사용되고 있다고 봅니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-4.png" rel="lightbox[33059]"><img class="alignnone size-large wp-image-33290" alt="40 SR (4)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-4-620x399.png" width="620" height="399" /></a></p>
<p>&nbsp;</p>
<p><span style="color: #f2cd0c;"><strong>1.4.2. SPI 인터페이스 부문</strong></span><br />
ATmega328은 5V로 동작되나 WizFi250은 3.3V에서 동작되므로 레벨시프터가 필요합니다. 총 6개 핀이 WizFi250에 연결되어야 하기에 TXB0106PWR을 사용해 정확히 맞춰주도록 설계가 되어 있습니다.<br />
D4, D2, D3, D11, D13, D12 이렇게 핀 6개는 WiZFI250에 연결되어야 하기에, 적어도 오렌지보드WiFi에서는 다른 용도로 사용하지 않는 것이 좋을 것으로 봅니다.</p>
<p>■ SPI 채널 핀 할당</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-5.png" rel="lightbox[33059]"><img class="alignnone size-full wp-image-33271" alt="40 SR (5)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-5.png" width="464" height="201" /></a></p>
<p><span style="color: #f2cd0c;"><strong>1.4.3. WizFi250 주변부</strong></span><br />
WiFi Upgrade를 위한 핀은 별도의 커넥터 없이 랜드 4개가 일렬로 되어 있는 부분으로, 이곳이 회로도상 J9에 해당됩니다.<br />
MCU와 인터페이스를 위한 핀 중 UART2는 미사용 상태이며 SPI 측만 연결되도록 설계되어 있음을 알 수 있습니다.</p>
<p>■ 레벨시프터 칩 주변 부</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-6.png" rel="lightbox[33059]"><img class="alignnone size-full wp-image-33273" alt="40 SR (6)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-6.png" width="464" height="211" /></a></p>
<p>■ WizFi250 칩 주변부</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-7.png" rel="lightbox[33059]"><img class="alignnone size-full wp-image-33275" alt="40 SR (7)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-7.png" width="492" height="521" /></a></p>
<p>WizFi250 모듈은 필자의 주관적인 생각이긴 합니다만, ARM M3 계열을 코어프로세서로 사용한 것처럼 보입니다.<br />
느낌에 따라서는 ATmega328P와는 주객이 전도된 것 같기도 합니다.</p>
<p><span style="color: #f2cd0c;"><strong>1.4.4. 기타 특수용도 버튼 및 스위치</strong></span><br />
SW3 Dip 스위치는 오렌지보드 내 WiFi 기능을 꺼버리게 하거나 펌웨어 문제시 초기화하는 기능을 수행 할 수 있도록 설계되어 있습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-8.png" rel="lightbox[33059]"><img class="alignnone size-full wp-image-33277" alt="40 SR (8)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-8.png" width="450" height="296" /></a></p>
<p>■ DIP 스위치 기능 정리</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-9.png" rel="lightbox[33059]"><img class="alignnone size-full wp-image-33279" alt="40 SR (9)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-9.png" width="464" height="175" /></a><br />
오렌지보드WiFi의 HW 부문은 이 정도로 마무리하고 다음은 SW 부문을 살펴보도록 하겠습니다.</p>
<p><span style="color: #ff6600;"><strong>2. 오렌지보드WiFi에 WizFi250 라이브러리 설치하기</strong></span></p>
<p>■ 오렌지보드WiFi HW모델 : 아두이노 IDE &gt; 도구 &gt; 보드 &gt; Arduino/Genuino Uno</p>
<p>■ 라이브러리 확보 : 아두이노 IDE 실행 &gt; 스케치 &gt; 라이브러리추가 &gt; 라이브러리 관리</p>
<p>라이브러리관리자&gt; 검색조건설정 &gt; wizfi250를 입력하면 다음과 같이 WizFi250 by DongEun Koak 가 나옵니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-3.jpg" rel="lightbox[33059]"><img class="alignnone size-full wp-image-33266" alt="40 SR (3)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-3.jpg" width="461" height="186" /></a></p>
<p>설치를 누르면 자동으로 설치가 진행되며 아래와 같은 INSTALLED가 나오는 화면을 볼 수 있습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-4.jpg" rel="lightbox[33059]"><img class="alignnone size-full wp-image-33268" alt="40 SR (4)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-4.jpg" width="461" height="186" /></a></p>
<p>필자의 경우 라이브러리가 설치된 이후 화면은 아래와 같습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-5.jpg" rel="lightbox[33059]"><img class="alignnone size-full wp-image-33270" alt="40 SR (5)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-5.jpg" width="404" height="285" /></a></p>
<p>참고로 아두이노 IDE의 환경설정은 아래와 같습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-6.jpg" rel="lightbox[33059]"><img class="alignnone size-full wp-image-33272" alt="40 SR (6)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-6.jpg" width="404" height="285" /></a></p>
<p>사실 오렌지보드WiFi는 HW적으로나 SW적으로나 워낙 깔끔하고 군더더기가 없어 접근하는데 큰 어려움은 없다고 봅니다.<br />
다만 가장 큰 즐길 거리이자 난관은 SW 부문에서 기다리고 있으며 TCP/IP라고 하는 커다란 언덕을 올라야 뭐라도 하나 해볼 수 있을 것으로 봅니다. 이왕 손에 오렌지보드WiFi를 쥔 만큼 과감히 첫발을 내디뎌보려 합니다.</p>
<p><span style="color: #ff6600;"><strong>3. 코코아팹 튜토리얼 따라해 보기</strong></span><br />
<span style="color: #ff9900;"><strong>3.1. WebClient</strong></span><br />
<span style="color: #f2cd0c;"><strong>3.1.1. 개요</strong></span><br />
아두이노 보드를 통해 이제 막 컴퓨터를 배우는 용도 등으로 사용할 것을 생각해 본다면 아두이노 우노나 메가 시리즈 정도는 큰 무리가 없으리라 봅니다.<br />
IDE상에서 digitalWrite() 함수 정도만 다뤄도 뭔가 그럴싸한 일을 해볼 수 있기 때문이고, 이점이 아두이노의 가장 큰 매력이라는 점에 대해서도 인정 안 할 수가 없습니다.<br />
한편 아두이노의 이면에는 이렇게 쉽게 사용할 수 있도록 배려해 놓은 정말 주도면밀한 기술적 완성도가 곳곳에 숨겨져 있습니다.</p>
<p>다시 우리가 다루고 있는 오렌지보드WiFi 보드를 살펴보면, 아두이노 우노의 ATmega328P와는 비교가 불가능한 막강한 성능을 가진 WizFi250 와이파이 모듈이 보드상에 탑재되어 있고, 이 모듈을 통해 인터넷상의 구성원이 되도록 해주고 있는 것입니다.<br />
자 그렇다면 구성원으로서 오렌지보드WiFi가 되기 위해서는 소정의 약속을 지킬 필요가 있고, 이를 코코팹사에서 라이브러리 형태로 배포를 하고 있으며 그 라이브러리 사용법을 예제를 통해 설명하고 있습니다.</p>
<p>우선은 예제대로 실행을 해본 후 어떤 결과가 나오는지를 먼저 보도록 하겠습니다.<br />
우리의 아두이노는 예제부터 일단 돌려보는 것이 최곱니다.</p>
<p>이 예제는 WebClient로 오렌지보드WiFi​가 Client가 되어 웹에 있는 서버에서 데이터를 받아 아두이노의 시리얼 모니터창에 뿌리는 것입니다. 처음부터 생소한 용어가 살짝 등장하긴 합니다만, 일단 아래 위치로 가서 WebClient를 내려받아 실행합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-7.jpg" rel="lightbox[33059]"><img class="alignnone size-full wp-image-33274" alt="40 SR (7)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-7.jpg" width="408" height="425" /></a></p>
<p>이때 SSID와 PASSWORD는 이글을 읽는 독자님들의 무선공유기(AP)에 접근이 될 수 있는 이름으로 올바르게 넣어줍니다. 그러면 3.1.3의 그림과 같은 화면을 볼 수 있게 될 것입니다.<br />
코드를 업로드하기 전에 아래 소스코드에 빨간 색깔로 표시된 부분을 반드시 제대로 입력해야 에러없이 동작될 것입니다. SSID에는 접속할 AP의 ID를 작성하고 PASSWORD부분에는 WPA/PSK 패스워드를 작성하시면 됩니다.</p>
<p><span style="color: #f2cd0c;"><strong>3.1.2. webclient 소스코드</strong></span></p>
<div class="symple-box gray none" style="text-align:left; width:100%;"> 
<p>#include &lt;SPI.h&gt;<br />
#include &#8220;WizFi250.h&#8221;</p>
<p>char ssid[] = &#8220;myLivngRoom(2.4GHz)&#8221;; // 접속코자하는 무선공유기의 SSID<br />
char pass[] = &#8220;??????????&#8221;; // 공유기에 설정된 암호<br />
int status = WL_IDLE_STATUS; // 와이파이 상태변수의 초기 값</p>
<p>char targetServer[] = &#8220;arduino.cc&#8221;;</p>
<p>// 이더넷 클라이언트 오브젝트 초기화<br />
WiFiClient client;<br />
void printWifiStatus();</p>
<p>void setup()<br />
{<br />
Serial.begin(115200);<br />
WiFi.init();</p>
<p>// WizFi250 와이파이모듈이 잘 동작될 수 있는지 검사해 본다.<br />
if (WiFi.status() == WL_NO_SHIELD) {<br />
Serial.println(&#8220;WiFi shield not present&#8221;);<br />
// 만일 문제가 있다면 여기서 홀딩한다.<br />
while (true);<br />
}</p>
<p>// 와이파이 망으로 연결을 시도한다.<br />
// 연결이 성공적으로 되어야 루프를 벗어날 수 있다.<br />
while ( status != WL_CONNECTED) {<br />
Serial.print(&#8220;Attempting to connect to WPA SSID: &#8220;);<br />
Serial.println(ssid);<br />
// 암호방식이 WPA/WPA2인 망에 연결이 진행중인 상태값<br />
status = WiFi.begin(ssid, pass);<br />
}</p>
<p>// 와이파이망에 성공적으로 연결이 됨<br />
Serial.println(&#8220;You&#8217;re connected to the network&#8221;);<br />
printWifiStatus();<br />
Serial.println();<br />
Serial.println(&#8220;Starting connection to server&#8230;&#8221;);</p>
<p>// 목적지 서버인 arduino.cc에 80번 포트로 연결을 시도하고 결과를<br />
// 시리얼모니터로 출력한다.<br />
if (client.connect(targetServer, 80)) {<br />
Serial.println(&#8220;Connected to server&#8221;);<br />
// 나에게 asciilogo.txt를 보내 달라고 요청한다.<br />
client.println(&#8220;GET /asciilogo.txt HTTP/1.1&#8243;);<br />
client.println(&#8220;Host: arduino.cc&#8221;);<br />
client.println(&#8220;Connection: close&#8221;);<br />
client.println();<br />
}<br />
}</p>
<p>void loop()<br />
{<br />
// 타겟서버와 연결이 이뤄졌고 asciilogo.txt을 보내달라고 요청을 setup()에서<br />
// 하였으므로 보내오는 값을 시리얼모니터창에 뿌리는 작업을 한다.<br />
while (client.available()) {<br />
char c = client.read();<br />
Serial.write(c);<br />
}</p>
<p>// if the server&#8217;s disconnected, stop the client<br />
// 타켓서버와 연결이 끊어진 상태라면 Disconnecting from server&#8230;라는 메시지를 뿌리고 홀딩한다.<br />
if (!client.connected()) {<br />
Serial.println();<br />
Serial.println(&#8220;Disconnecting from server&#8230;&#8221;);<br />
client.stop();</p>
<p>// 여기서 부터는 아무것도 할 수 없는 상태에 접어든다.<br />
while (true);<br />
}<br />
}<br />
void printWifiStatus()<br />
{<br />
// 방금 내가 연결한 와이파이망의 SSID를 읽어와 시리얼 모니터로 출력 한다.<br />
Serial.print(&#8220;SSID: &#8220;);<br />
Serial.println(WiFi.SSID());<br />
// 방금 내가 연결한 공유기로부터 할당 받은 IP주소를 시리얼 모니터로 출력한다.<br />
IPAddress ip = WiFi.localIP();<br />
Serial.print(&#8220;IP Address: &#8220;);<br />
Serial.println(ip);<br />
// 나와 공유간의 무선전송구간 수신강도를 표출 한다.<br />
long rssi = WiFi.RSSI();<br />
Serial.print(&#8220;Signal strength (RSSI):&#8221;);<br />
Serial.print(rssi);<br />
Serial.println(&#8221; dBm&#8221;);<br />
}<br />
</div>
<p><span style="color: #f2cd0c;"><strong>3.1.3. 시리얼모니터창에 출력된 결과 값</strong></span></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-8.jpg" rel="lightbox[33059]"><img class="alignnone size-full wp-image-33276" alt="40 SR (8)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-8.jpg" width="408" height="368" /></a></p>
<p><span style="color: #f2cd0c;"><strong>3.1.4. 예제 설명</strong></span><br />
사실 우리는 그냥 예제코드를 복사하여 붙여넣은 후 업로드 시키면 동작되는 정말 편리한 상황에서 이 제품을 사용 중에 있기는 합니다만, 보다 심도있는 학습을 해보고자 한다면 아주 기초적인 것 몇 가지 정도는 짚어볼 필요가 있다고 봅니다.<br />
우선적으로 네트워크가 어떻게 돌아가는지 간단하게 살펴보도록 하겠습니다. 그냥 넘어가려니 너무도 막막해 여기저기 글들을 참고하여 꼭 필요한 정보만 서술해보려 합니다.</p>
<p>■ tcp/ip의 동작과정</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-10.png" rel="lightbox[33059]"><img class="alignnone size-full wp-image-33281" alt="40 SR (10)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-10.png" width="408" height="167" /></a><br />
아래 그림은 네트웍 관련 서적이나 인터넷상에서 자주 언급되는 흔한 내용입니다.<br />
앞의 예제에서 우리는 <span style="color: #ff0000;">「char targetServer[] = &#8220;arduino.cc&#8221;;」</span>라는 라인을 서두에 적었습니다. 호스트A는 오렌지보드WiFi가 되고 호스트B는 arduino.cc가 된 것입니다.<br />
응용계층에 해당되는 것은 정확히는 <span style="color: #ff0000;">「client.println(&#8220;GET /asciilogo.txt HTTP/1.1&#8243;);」</span>라인에 해당되는 것으로써 호스트B인 arduino.cc라는 서버에게 asciilogo.txt라는 파일을 열어 보내라는 응용프로그램(응용계층 = 소프트웨어)을 돌린 것이 됩니다.</p>
<p>arduino.cc는 잘 아시는 바와 같이 이탈리아에서 운영 중인 서버고 우리는 대한민국에 있으므로, 매우 많은 라우터를 거치고 또 거쳐서 그곳까지 가는 것이며 인터넷 세상이 그러한 연결을 도맡아 해주고 있는 것입니다.<br />
그런데 응용계층 말고도 전송계층이라는 것이 위 그림에 적시되어 있습다. 영어로는 Transport Layer라고 합니다만 TCP 몇 번 포트, UDP 몇 번 포트 등으로 우리는 일상적으로 부르곤 합니다.</p>
<p>위 예제에서 <span style="color: #ff0000;">「if (client.connect(targetServer, 80))」</span>라는 라인에서 arduino.cc라는 서버 주소로 연결을 하되 80번 포트번호를 사용하는 의미가 되며, 이 80번 포트를 HTTP(HyperText Transfer Protocol) 서비스라고 부릅니다. 아주 원론적으로 이를 명기한다면 「http://www.arduino.cc:80」이 되는 것이며, 실제로 인터넷익플로러 등 웹브라우저의 주소에 이렇게 쳐도 아무런 에러 없이 페이지가 잘 열리게 됩니다.<br />
네트워크계층은 IP주소와 연관되어 있는 부분입니다.</p>
<p>우리는 이따금씩 언론에서 “중국의 해커, 북한 등으로부터 공격이 있었다.” 라는 말을 듣곤 합니다. 이는 전세계의 IP주소를 할당하고 관리하는 기관이 있으며 이 기관을 통해 각 국가가 사용하는 IP주소가 명확히 설정이 되어 있으며 각 국가는 정부에서 관리하는 자국의 IP주소관리 정책에 따라 사용할 수 있는 IP주소가 제한되게 됩니다.<br />
우선 인터넷 통신이 되게 하기 위해서는 기본적으로 내 IP주소와 상대방의 IP주소가 필요합니다.<br />
내 IP주소를 받는 방법은 몇 가지가 있으나 우리가 테스트하고 있는 WizFi250은 Wi-Fi를 기반으로 동작되므로 접속되는 AP 장치 즉, 공유기로부터 받아야만 합니다. 이때 IP를 받는 방법 중 AP가 일정한 룰에 의해 자동으로 부여해 주는 방식을 DHCP(Dynamic Host Configuration Protocol)라하며, 이렇게 받은 IP주소를 우리의 예제코드에서는 아래와 같이 보여주고 있습니다.</p>
<p>■ IP 주소를 출력하는 소스코드</p>
<div class="symple-box gray none" style="text-align:left; width:100%;"> 
<p>IPAddress IP = WiFi.localIP(); // IPAddress라는 타입으로 된 변수 IP에 주소값을 담아라<br />
Serial.print(&#8220;IP Address: &#8220;); // 시리얼모니터 창에 IP Address:를 출력하라<br />
Serial.println(ip); // 시리얼모니터 창에 IP 값을 출력하고 줄바꿈을 하라</p>
</div>
<p>■ 위 소스에 대한 실제 출력 값</p>
<div class="symple-box gray none" style="text-align:left; width:100%;"> 
<p>SSID: myLivngRoom(2.4GHz)<br />
IP Address: 172.30.1.41<br />
Signal strength (RSSI):-32 dBm</p>
</div>
<p>□ 웹서버와 통신<br />
위 예제는 Arduino사이트에서 asciilogo.txt라는 데이터를 읽어오는 예제로, 코드를 보시면 Server에 arduino.cc가 작성되어 있는 것을 볼 수 있습니다.<br />
Arduino.cc에 접속한 다음 GET 명령어로 asciilogo.txt라는 데이터를 아두이노로 가져오게 됩니다. 정말로 이런 데이터를 가져오는지 확인하고 싶다면 웹브라우저를 연 후에 http://Arduino.cc/asciilogo.txt를 주소창에 입력하면 똑같은 데이터가 웹브라우저에 출력되는 것을 확인할 수 있습니다.<br />
이렇게 웹서버와 통신하는 가장 간단한 방법이 GET이라는 방법이 있으며 보안성 측면에서는 매우 취약하나 어떻게 동작이 일어나는지 학습해 보는 것이 목적이므로 크게 문제되지는 않는다고 봅니다. 유사한 방법으로 POST라는 방식으로도 원하는 명령을 보낼 수 있습니다.</p>
<p>■ 웹서버와 통신하는 GET 방식과 POST방식의 차이점</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-11.png" rel="lightbox[33059]"><img class="alignnone size-full wp-image-33283" alt="40 SR (11)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-11.png" width="408" height="486" /></a></p>
<p>어떠신가요? 아마도 이글을 읽는 독자님들은 인터넷에 접속하여 데이터 한 번 받아오기가 이리도 힘든가라고 여길 수도 있을 것입니다. 순전히 제 개인적인 생각입니다만, 오늘날의 인터넷서비스는 그간 인류가 쌓아온 지식, 지혜의 꽃이라고 저는 생각합니다. 그러니 어찌 단순하고 쉽게 돌아가겠습니까?<br />
사실 그런 깊숙한 상황을 잘 몰라도 우리의 WizFi250 제작자들은 매우 쉽게 접할 수 있도록 배려해 놓았으므로 별로 길지 않은 코드로 인터넷에 접속해 데이터를 받아와 시리얼 모니터에 뿌리는 것 까지를 쉽게 해볼 수 있었습니다.<br />
다음으로는 오렌지보드WiFi에 내장된 A/D 변환기능을 활용하여 조도값을 웹상에서 읽어보는 기능을 실험해 보고자 합니다.<br />
이번 예제에서는 WiFi보드를 Client로 사용해봤으니 다음 예제에서는 반대로 WiFi보드를 Server로 사용해보는 예제를 돌려 보겠습니다.<br />
※ 참고 : http://kocoafab.cc/tutorial/view/649</p>
<p><span style="color: #ff9900;"><strong>3.2. 조도센서 값을 내PC 웹 브라우저로 출력하기</strong></span><br />
<span style="color: #f2cd0c;"><strong>3.2.1. 개요</strong></span><br />
코코아팹에서 2번째 튜토리얼로 오렌지보드WiFi에 조도센서를 장착한 후 PC에서 보드에 접근하여 조도 값을 보여주는 예제를 제시하고 있습니다.<br />
첫 번째 예제가 오렌지보드WiFi의 WiFi 기능이 동작되는 것을 간단히 테스트 해보는 것이 목적이라면, 이번 예제는 실제로 아주 간단한 응용을 통해 웹서버의 개념에 대해 이해하는 과정이라고 보면 되겠습니다.</p>
<p>■ 회로도<br />
회로도는 매우 단순해 아두이노의 A0에 CdS와 10K 저항으로 분압 된 결과 값이 들어가도록 구성하면 됩니다.<br />
ATmega328P는 5V에서 동작되는 칩이므로 전원도 10KR의 반대편은 3.3V가 아니라 5V에 꽂아 주어야 합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-9.jpg" rel="lightbox[33059]"><img class="alignnone size-full wp-image-33278" alt="40 SR (9)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-9.jpg" width="408" height="557" /></a></p>
<p>■ 필요한 부품명 수량 상세 설명<br />
1 오렌지보드WiFi x 1 (WizFi250을 사용한 WiFi보드)<br />
2 조도 센서 x 1 (CdS)<br />
3 저항 10Kohm x 1</p>
<p><span style="color: #f2cd0c;"><strong>3.2.2. 시리얼 모니터 실행</strong></span><br />
우선 소스코드를 http://kocoafab.cc/tutorial/view/650에서 받아 업로드해 봅니다. 위와 같은 회로를 꾸미지 않아도 동작 되긴 합니다만, 이 경우 제대로 된 조도값을 얻어 올 수는 없게 됩니다. 제대로 업로드가 되었다면 시리얼 모니터를 실행 시켰을 때 아래와 같은 화면을 볼 수가 있을 것입니다.</p>
<div class="symple-box gray none" style="text-align:left; width:100%;"> 
<p>Opening port<br />
Port open<br />
[WizFi250] Initializing WizFi250<br />
Attempting to connect to WPA SSID: myLivngRoom(2.4GHz)<br />
[WizFi250] Connected to myLivngRoom(2.4GHz)<br />
You&#8217;re connected to the network<br />
SSID: myLivngRoom(2.4GHz)<br />
IP Address: 172.30.1.22</p>
<p>To see this page in action, open a browser to http://172.30.1.22</p>
[WizFi250] Server started on port 80<br />
[WizFi250] New client<br />
New client Start!&#8212;&#8211;&gt;</p>
<p>Sending response<br />
&lt;&#8212;&#8212;&#8212;-Client disconnected<br />
[WizFi250] New client<br />
New client Start!&#8212;&#8211;&gt;<br />
HTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36<br />
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8<br />
Accept-Encoding: gzip, deflate, sdch<br />
Accept-Language: ko-KR,ko;q=0.8,en-US;q=0.6,en;q=0.4</p>
<p>Sending response<br />
&lt;&#8212;&#8212;&#8212;-Client disconnected<br />
[WizFi250] New client<br />
New client Start!&#8212;&#8211;&gt;</p>
<p>Sending response<br />
&lt;&#8212;&#8212;&#8212;-Client disconnected<br />
[WizFi250] New client<br />
New client Start!&#8212;&#8211;&gt;<br />
hrome/55.0.2883.87 Safari/537.36<br />
Accept: image/webp,image/*,*/*;q=0.8<br />
Referer: http://172.30.1.22/<br />
Accept-Encoding: gzip, deflate, sdch<br />
Accept-Language: ko-KR,ko;q=0.8,en-US;q=0.6,en;q=0.4</p>
<p>Sending response<br />
&lt;&#8212;&#8212;&#8212;-Client disconnected</p>
</div>
<p>시리얼 모니터를 통해 웹서버의 IP주소가 172.30.1.22란 것을 알 수 있습니다.<br />
크롬 웹브라우저 등을 활용하여 주소창에 HTTP://172.30.1.22를 치면 아래와 같은 결과 화면을 볼 수 있을 것입니다.<br />
<strong></strong></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-10.jpg" rel="lightbox[33059]"><img class="alignnone size-full wp-image-33280" alt="40 SR (10)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-10.jpg" width="408" height="275" /></a></p>
<p><span style="color: #f2cd0c;"><strong>3.2.3. 소스코드</strong></span></p>
<div class="symple-box gray none" style="text-align:left; width:100%;"> 
<p>#include &lt;SPI.h&gt;<br />
#include &#8220;WizFi250.h&#8221;<br />
char ssid[] = &#8220;myLivngRoom(2.4GHz)&#8221;; // 접속코자하는 무선공유기의 SSID<br />
char pass[] = &#8220;???????????&#8221;; // 공유기에 설정된 암호<br />
int status = WL_IDLE_STATUS; // 와이파이 상태변수의 초기 값<br />
int reqCount = 0; // 수신 재전송 횟수용 카운터<br />
WiFiServer server(80);<br />
void printWifiStatus();<br />
void setup()<br />
{<br />
// 디버깅을 위한 시리얼 모니터포트 초기화<br />
Serial.begin(115200);<br />
// 와이파이모듈 초기화<br />
WiFi.init();<br />
// 와이파이모듈과 통신이 가능한 상태인지 검사<br />
if (WiFi.status() == WL_NO_SHIELD) {<br />
Serial.println(&#8220;WiFi shield not present&#8221;);<br />
// 통신이 가능한 상태가 아니라면 여기서 홀딩하라<br />
while (true);<br />
}<br />
// 와이파이망에 연결을 시도한다.<br />
while (status != WL_CONNECTED) {<br />
Serial.print(&#8220;Attempting to connect to WPA SSID: &#8220;);<br />
Serial.println(ssid);<br />
// 연결에 대한 상태값을 받아 온다.<br />
status = WiFi.begin(ssid, pass);<br />
}<br />
Serial.println(&#8220;You&#8217;re connected to the network&#8221;);<br />
printWifiStatus();<br />
// 80번 포트로 리슨하는 웹서버를 구동하라.<br />
server.begin(); // Serial Monitor out: [WizFi250] Server started on port 80<br />
}</p>
<p>void loop()<br />
{<br />
// 클라이언트에서 연결을 해 오는 것에 대해 수신대기를 합니다.<br />
WiFiClient client = server.available();<br />
// Serial Monitor out : [WizFi250] New client</p>
<p>if (client) {<br />
Serial.println(&#8220;New client Start!&#8212;&#8211;&gt;&#8221;);<br />
// http 요청은 빈 줄로 끝납니다.<br />
boolean currentLineIsBlank = true;<br />
while (client.connected())<br />
{<br />
if (client.available()) {<br />
// 클라이언트로부터 1문자를 수신합니다.<br />
char c = client.read();<br />
Serial.write(c);<br />
// 줄 바꿈 문자 (줄 바꿈 문자 수신)가 있고 줄이 비어 있으면<br />
//http 요청이 끝났기 때문에 회신을 보낼 수가 있습니다.<br />
if (c == &#8216;\n&#8217; &amp;&amp; currentLineIsBlank) {<br />
Serial.println(&#8220;Sending response&#8221;);<br />
// 표준 http 응답 헤더를 보내려면 많은 println 문 대신<br />
//\r\n을 사용하여 데이터 전송 속도를 높입니다.<br />
client.print(<br />
&#8220;HTTP/1.1 200 OK\r\n&#8221;<br />
&#8220;Content-Type: text/html\r\n&#8221;<br />
&#8220;Connection: close\r\n&#8221; // 응답이 완료되면 연결이 닫힙니다.<br />
&#8220;Refresh: 20\r\n&#8221; // 20초마다 자동으로 페이지를 새로 고칩니다.<br />
&#8220;\r\n&#8221;);<br />
client.print(&#8220;&lt;!DOCTYPE HTML&gt;\r\n&#8221;);<br />
client.print(&#8220;&lt;html&gt;\r\n&#8221;);<br />
client.print(&#8220;&lt;h1&gt;Hello World!&lt;/h1&gt;\r\n&#8221;);<br />
client.print(&#8220;Requests received: &#8220;);<br />
client.print(++reqCount);<br />
client.print(&#8220;&lt;br&gt;\r\n&#8221;);<br />
client.print(&#8220;Analog input A0: &#8220;);<br />
client.print(analogRead(0));<br />
client.print(&#8220;&lt;br&gt;\r\n&#8221;);<br />
client.print(&#8220;&lt;/html&gt;\r\n&#8221;);<br />
break;<br />
}<br />
if (c == &#8216;\n&#8217;) {<br />
// 새라인을 시작한다.<br />
currentLineIsBlank = true;<br />
} else if (c != &#8216;\r&#8217;) {<br />
// 현재 라인에 어떤 문자가 들어 옴<br />
currentLineIsBlank = false;<br />
}<br />
}<br />
} // while<br />
// 웹 브라우저가 데이터를 받을 시간을 줍니다.<br />
delay(10);<br />
// 연결을 종료한다:<br />
client.stop();<br />
Serial.println(&#8220;&lt;&#8212;&#8212;&#8212;-Client disconnected&#8221;);<br />
}<br />
}<br />
void printWifiStatus()<br />
{<br />
// 방금 내가 연결한 와이파이망의 SSID를 읽어와 시리얼 모니터로 출력 한다.<br />
Serial.print(&#8220;SSID: &#8220;);<br />
Serial.println(WiFi.SSID());<br />
// 방금 내가 연결한 공유기로부터 할당 받은 IP주소를 시리얼 모니터로 출력한다.<br />
IPAddress ip = WiFi.localIP();<br />
Serial.print(&#8220;IP Address: &#8220;);<br />
Serial.println(ip);<br />
// 브라우져에 어디서부터 접속을 시도 했는지를 표출한다.<br />
Serial.println();<br />
Serial.print(&#8220;To see this page in action, open a browser to http://&#8221;);<br />
Serial.println(ip);<br />
Serial.println();<br />
}</p>
</div>
독자님들의 이해를 돕도록 최대한 한글 주석을 최대한 달아 보았습니다. 이 소스코드에서 관심이 가는 부분 몇 군데만 살펴보겠습니다.<br />
이 부분이 WizFi250 모듈을 웹서버로 만들어주는 부분이 됩니다.</p>
<div class="symple-box gray none" style="text-align:left; width:100%;"> 
<p>// 80번 포트로 리슨하는 웹서버를 구동하라.<br />
server.begin(); // Serial Monitor out: [WizFi250] Server started on port 80</p>
</div>
웹브라우저를 통해 이 서버로 접속을 시작하면 받아줄 준비를 하는 것입니다.</p>
<div class="symple-box gray none" style="text-align:left; width:100%;"> 
<p>// 클라이언트에서 연결을 해 오는 것에 대해 수신대기를 합니다.<br />
WiFiClient client = server.available();<br />
// Serial Monitor out : [WizFi250] New client</p>
</div>
<p>이 부분은 웹브라우저로부터 접속을 시도해 오면 시리얼 모니터에 [WizFi250] New client를 뿌린 후 실려오는 데이터를 실제로 받을 준비를 합니다.</p>
<p><span style="color: #ff9900;"><strong>3.3. OpenWeatherMap API를 사용하여 날씨 데이터 받아오기</strong></span><br />
<span style="color: #f2cd0c;"><strong>3.3.1. 개요</strong></span><br />
이번에는 난이도를 좀 더 올려서 API를 사용해 WiFi 쉴드로 날씨정보를 가져오는 예제를 실행해봅니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-11.jpg" rel="lightbox[33059]"><img class="alignnone size-full wp-image-33282" alt="40 SR (11)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-11.jpg" width="412" height="264" /></a></p>
<p>이 튜토리얼 역시 코코아팹 웹사이트에 올려져 있는 내용을 참고삼아 진행해 보도록 하겠습니다. 이 튜토리얼을 성공적으로 따라하시면 인터넷 세상이 돌아가는 것에 대해 어렴풋하게나마 이해가 되시리라 봅니다.<br />
코코아팹 웹싸이트에서도 소개하고 있듯이 API란 Application Programming Interface의 약자로 프로그램이나 어플리케이션이 정보처리를 위해 운영체제에 호출하는 함수나 서브루틴의 집합을 말합니다. WebServer는 API를 통해 사용하기 쉬운 인터페이스를 Client에게 제공하고, Client는 API를 가져와서 사용함으로써 손쉽게 원하는 정보에 접근할 수 있습니다.<br />
이번에 실행할 OpenWaetherMap 또한 날씨정보 API를 제공하는 사이트로서, API를 가져온다면 아두이노에서도 WiFi로 날씨정보를 받아올 수 있습니다.</p>
<p><span style="color: #f2cd0c;"><strong>3.3.2. OpenWeatherMap에서 API key받아오기</strong></span><br />
먼저 http://openweathermap.org/에 접속해 아이디가 없을 경우 회원가입을 하여 로그인을 합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-12.jpg" rel="lightbox[33059]"><img class="alignnone size-full wp-image-33284" alt="40 SR (12)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-12.jpg" width="412" height="279" /></a><br />
API keys 탭에 들어가면 자신만이 사용가능한 고유한 API key 값을 확인할 수 있습니다. API key 값은 API에서 정보를 가져오기 위한 필수 정보이니 따로 복사를 합니다.</p>
<p><span style="color: #f2cd0c;"><strong>3.3.3. 아두이노 코드 업로드 하기</strong></span><br />
다시 아두이노로 돌아와서, 아래 코드를 복사 후 오렌지보드WiFi에 업로드시킵니다.<br />
<strong></strong></p>
<div class="symple-box gray none" style="text-align:left; width:100%;"> 
<p>#include &lt;SPI.h&gt;<br />
#include &lt;WizFi250.h&gt;<br />
int getInt(String input);<br />
#define VARID &#8220;??????????????????????????????????&#8221;</p>
<p>char ssid[] = &#8220;myLivngRoom(2.4GHz)&#8221;; // 접속코자하는 무선공유기의 SSID<br />
char pass[] = &#8220;??????????&#8221;; // 공유기에 설정된 암호<br />
int status = WL_IDLE_STATUS; // 와이파이 상태변수의 초기 값<br />
char server[] = &#8220;api.openweathermap.org&#8221;;<br />
unsigned long lastConnectionTime = 0; // 마지막으로 서버에 연결한 시간<br />
const unsigned long postingInterval = 1000L; // 업데이트 간격 (밀리 초).</p>
<p>boolean readingVal;<br />
boolean getIsConnected = false;<br />
//String valString;<br />
int val, temp;<br />
float tempVal;<br />
String rcvbuf;</p>
<p>// 이더넷 클라이언트 오브젝트를 초기화 한다.<br />
WiFiClient client;</p>
<p>void httpRequest();<br />
void printWifiStatus();</p>
<p>void setup()<br />
{<br />
// 디버깅을 위한 시리얼 포트 초기화<br />
Serial.begin(115200);<br />
Serial.println(F(&#8220;\r\nSerial Init&#8221;));<br />
WiFi.init();</p>
<p>// 와이파이모듈이 정상인지 확인<br />
if (WiFi.status() == WL_NO_SHIELD) {<br />
Serial.println(&#8220;WiFi shield not present&#8221;);<br />
// don&#8217;t continue<br />
while (true);<br />
}</p>
<p>// 와이파이망에 연결 시도<br />
while (status != WL_CONNECTED) {<br />
Serial.print(&#8220;Attempting to connect to WPA SSID: &#8220;);<br />
Serial.println(ssid);<br />
// Connect to WPA/WPA2 network<br />
status = WiFi.begin(ssid, pass);<br />
}</p>
<p>Serial.println(&#8220;You&#8217;re connected to the network&#8221;);<br />
printWifiStatus();<br />
}</p>
<p>void loop()<br />
{<br />
// 인터넷 연결에서 들어오는 데이터에 대해 파싱작업을 한다.<br />
String valString;<br />
while (client.available())<br />
{<br />
if (rcvbuf.endsWith(&#8220;\&#8221;temp\&#8221;:&#8221;)) { //서버로 부터 보내져 오는 문자열에 temp:을 찾는다.<br />
readingVal = true;<br />
valString = &#8220;&#8221;;<br />
}<br />
char c = client.read();<br />
if (c != NULL) {<br />
if (rcvbuf.length() &gt; 30)<br />
rcvbuf = &#8220;&#8221;;<br />
rcvbuf += c;<br />
Serial.write(c);// DEBUG<br />
}</p>
<p>if (readingVal) {<br />
if (c != &#8216;,&#8217;) {<br />
valString += c; // &#8216;temp:&#8217; 다음에 콤마(,)가 나타날때 까지 valstring에 담는다.<br />
Serial.write(c); // DEBUG<br />
}<br />
else {<br />
readingVal = false;<br />
//Serial.println(valString); // DEBUG<br />
// 절대온도를 상대온도로 변환시키기 위해 273을 뺌<br />
tempVal = valString.toFloat() &#8211; 273.0;<br />
//Serial.println(tempVal); // DEBUG<br />
}<br />
}<br />
}</p>
<p>if (millis() &#8211; lastConnectionTime &gt; (postingInterval * 5))<br />
{<br />
if (getIsConnected) {<br />
Serial.println(valString);<br />
Serial.println(F(&#8220;===================&#8221;));<br />
Serial.print(F(&#8220;Temperature : &#8220;));<br />
Serial.println(tempVal);<br />
Serial.println(F(&#8220;===================&#8221;));<br />
}<br />
httpRequest();<br />
}<br />
rcvbuf = &#8220;&#8221;;<br />
}</p>
<p>// 이 메서드는 서버로 HTTP 연결을 진행합니다.<br />
void httpRequest() {<br />
Serial.println();</p>
<p>// 새로운 요청을 하기전에 연결을 일단 닫는다.<br />
// 이 작업으로 와이파이모듈의 소켓이 해제된다.<br />
client.stop();</p>
<p>// 성공적으로 날씨정보 서버에 접속이 되는지 점검해 본다.<br />
if (client.connect(server, 80)) {<br />
Serial.println(&#8220;Connecting&#8230;&#8221;);<br />
// 날씨정보를 얻고 싶은 도시명, 국가 정보를 웹서버로 보낸다.<br />
client.print(&#8220;GET /data/2.5/weather?q=Anyang,kr&amp;appid=&#8221;);<br />
client.print(VARID);<br />
client.println(&#8221; HTTP/1.1&#8243;);<br />
client.println(&#8220;Host: api.openweathermap.org&#8221;);<br />
client.println(&#8220;Connection: close&#8221;);<br />
client.println();<br />
// 연결이 만들어진 마지막 시각을 기록해 둔다.<br />
lastConnectionTime = millis();<br />
getIsConnected = true;<br />
}<br />
else {<br />
// 연결이 성공적이지 못할 경우 에러처리를 한다.<br />
Serial.println(&#8220;Connection failed&#8221;);<br />
getIsConnected = false;<br />
}<br />
}</p>
<p>void printWifiStatus() {<br />
// 연결된 SSID를 표출한다.<br />
Serial.print(&#8220;SSID: &#8220;);<br />
Serial.println(WiFi.SSID());</p>
<p>// IP주소를 표출한다.<br />
IPAddress ip = WiFi.localIP();<br />
Serial.print(&#8220;IP Address: &#8220;);<br />
Serial.println(ip);<br />
// 수신강도 인쇄<br />
long rssi = WiFi.RSSI();<br />
Serial.print(&#8220;Signal strength (RSSI):&#8221;);<br />
Serial.print(rssi);<br />
Serial.println(&#8221; dBm&#8221;);<br />
}</p>
<p>// 스트링을 정수형으로 변환 시킨다.<br />
int getInt(String input) {<br />
char carray[20];<br />
//Serial.println(input);<br />
input.toCharArray(carray, sizeof(carray));<br />
//Serial.println(carray);<br />
temp = atoi(carray);<br />
return temp;<br />
}<br />
</div>
<p><span style="color: #f2cd0c;"><strong>3.3.4. 결과 화면</strong></span><br />
위 코드를 실행시킨 결과는 아래와 같이 주기적으로 필자의 거주지인 경기도 안양시의 현재 온도값이 시리얼 모니터상에 출력됩니다.<br />
지역을 변경하고 싶다면?! 코드에서는 기본적으로 Anyang으로 되어 있지만 지역을 변경할 경우 다른 지역의 온도값을 출력해볼 수 있습니다.</p>
<div class="symple-box gray none" style="text-align:left; width:100%;"> 
<p>Opening port<br />
Port open<br />
Attempting to connect to WPA SSID: myLivngRoom(2.4GHz)<br />
[WizFi250] Connected to myLivngRoom(2.4GHz)<br />
You&#8217;re connected to the network<br />
SSID: myLivngRoom(2.4GHz)<br />
IP Address: 172.30.1.22<br />
Signal strength (RSSI):-42 dBm</p>
[WizFi250] Connecting to api.openweathermap.org<br />
Connecting&#8230;<br />
HTTP/1.1 200 OK<br />
Server: openresty<br />
Date: Mon, 02 Jan 2017 13:34:27 GMT<br />
Content-Type: application/json; charset=utf-8<br />
Content-Length: 552<br />
Connection: close<br />
X-Cache-Key: /data/2.5/weather?q=anyang,kr<br />
Access-Control-Allow-Origin: *<br />
Access-Control-Allow-Credentials: true<br />
Access-Control-Allow-Methods: GET, POST<br />
{&#8220;coord&#8221;:{&#8220;lon&#8221;:126.93,&#8221;lat&#8221;:37.39},&#8221;weather&#8221;:[{"id":701,"main":"Mist","description":"mist","icon":"50n"},{"id":721,"main":"Haze","description":"haze","icon":"50n"},{"id":741,"main":"Fog","description":"fog","icon":"50n"}],&#8221;base&#8221;:&#8221;stations&#8221;,&#8221;main&#8221;:{&#8220;temp&#8221;:227755..1166,&#8221;pressure&#8221;:1022,&#8221;humidity&#8221;:83,&#8221;temp_min&#8221;:273.15,&#8221;temp_max&#8221;:277.15},<br />
&#8220;visibility&#8221;:1200,&#8221;wind&#8221;:{&#8220;speed&#8221;:1,&#8221;deg&#8221;:180},&#8221;clouds&#8221;:{&#8220;all&#8221;:75},&#8221;dt&#8221;:1483363200,&#8221;sys&#8221;:{&#8220;type&#8221;:1,&#8221;id&#8221;:8519,&#8221;message&#8221;:0.0089,&#8221;country&#8221;:&#8221;KR&#8221;,&#8221;sunrise&#8221;:1483310810,<br />
&#8220;sunset&#8221;:1483345579},&#8221;id&#8221;:1846898,&#8221;name&#8221;:&#8221;Anyang&#8221;,&#8221;cod&#8221;:200}<br />
[DISCONNECT 0]ÿ<br />
===================<br />
Temperature : 2.16<br />
===================</p>
</div>
<p>날씨에 관한 다른 정보를 추출하고 싶다면?! 현재는 코드상에서 온도 값만을 가져와서 출력해주고 있습니다. 다른 정보를 출력하기 위해서 API에서 전달해주는 데이터를 먼저 분석해 볼 필요가 있습니다. 데이터를 요청하면 XML 형식으로 전달해주며, 우리는 코드상에서 파싱을 통해 원하는 정보만 추출하게 됩니다.<br />
온도의 경우 &#8220;temp&#8221;라는 글 뒤에 절대온도로 306.15와 같이 보여집니다.<br />
위에 보여드린 코드가 API에서 요청받은 XML 데이터에서 온도 값을 추출하는 코드입니다. 데이터를 차근차근 읽어오면서 &#8220;temp&#8221;: 라는 값이 오면 그 뒤에 값을 읽어서 온도로 저장하는 형식입니다. 만일 다른 데이터를 가지고 오고 싶다면 temp 대신에 pressure나 humidity를 넣어 파싱을 한다면 다른 데이터를 읽어올 수 있겠죠? 물론 온도의 경우 절대온도로 받아왔기 때문에 -273을 해주었지만, 다른 데이터는 그 데이터 타입에 맞게 값을 조절해 주어야 합니다.</p>
<p><span style="color: #ff9900;"><strong>3.4. 인터넷시간 동기화(NTP) 서비스</strong></span><br />
<span style="color: #f2cd0c;"><strong>3.4.1. 개요</strong></span><br />
임베디드 장치를 활용해서 정확한 시간을 얻을 수만 있다면 그것 하나만으로도 모든 것이 용서가 되고도 남음이 있다고 봅니다. 오렌지보드WiFi도 당연히 인터넷접속이 가능한 기기이므로 가능하리라 생각되기에, 마지막 테스트로 인터넷시간 동기화에 대해서 다뤄보고자 합니다.<br />
우선 아래와 같은 코드를 업로드합니다. 이 코드는 필자가 상당부분을 직접 작성한 것으로 NTP를 활용해 실제 어떻게 이용할 수 있는가를 가늠해 볼 수 있는 중요한 예제에 해당된다고 봅니다.</p>
<p><span style="color: #f2cd0c;"><strong>3.4.2. 시리얼모니터 실행 결과</strong></span><br />
프로그램이 복잡해지고 분량이 많아지면 아두이노 IDE에서는 아무래도 작업하기가 힘들어집니다.</p>
<p>■ 시리얼 모니터 창</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-13.jpg" rel="lightbox[33059]"><img class="alignnone size-full wp-image-33286" alt="40 SR (13)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-13.jpg" width="351" height="261" /></a><br />
필자는 간단한 프로그래밍이나 예제코드 등은 아두이노 IDE를 활용하나 본격적인 프로그래밍을 할 때는 Microsoft Visual Studio상에서 작업을 하곤 합니다.<br />
위 시리얼 모니터 창은 비주얼 스튜디오상에서 뿌려지고 있는 모습입니다. 여기서 주목해야하는 부분이 아래의 문자열이며 NMEA형식으로 epoch타임값이 출력되고 있음을 알 수 있습니다.</p>
<p>■ Microsoft Visual Studio상 개발환경</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-14.jpg" rel="lightbox[33059]"><img class="alignnone size-full wp-image-33287" alt="40 SR (14)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-14.jpg" width="409" height="304" /></a></p>
<p>■ Sample 전문</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-12.png" rel="lightbox[33059]"><img class="alignnone size-full wp-image-33285" alt="40 SR (12)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-12.png" width="409" height="189" /></a><br />
$Wi-Fi,1483423819,myLivngRoom(2.4GHz),pppppppp,203.248.240.103*33</p>
<p><span style="color: #f2cd0c;"><strong>3.4.3. NTP 서버(zero.bora.net) 접속용 소스코드</strong></span></p>
<p>&nbsp;</p>
<div class="symple-box gray none" style="text-align:left; width:100%;"> 
<p>********************************************************************** 코코아팹 오렌지보드WiFi를 활용한 NTP(Network Time Protocol) 프로그램<br />
***********************************************************************<br />
* ProjectName: myUDPNTPclient2_OrangeWiFi_ATmega328P<br />
* Dependencies: &lt;SPI.h&gt;,&#8221;WizFi250.h&#8221;,&#8221;WizFi250Udp.h&#8221;, &lt;TimeLib.h&gt;<br />
* Processor: ATmega328P(28pin QFP)<br />
* Complier: arduino.cc-1.6.9<br />
* Microsoft Visual Studio vMicro<br />
* Company:<br />
* Author: 금강초롱(blog.naver.com/crucian2k3)<br />
* History<br />
* Date Version Description<br />
* 2017-01-03 v1.0 최초작성<br />
* 이크로칩사의 NTP 클라이언트 동작방식과 ESP8266기반의<br />
* NTP클라이언트 동작방식을 참고하여 오렌지보드WiFi에 적합토록<br />
* 전면 재작성 됨<br />
***********************************************************************<br />
***********************************************************************<br />
* 동작내용:<br />
* SSID, PASSWORD 등이 제대로 설정된 상황이라면 오렌지보드WiFi가 인터넷에 접속하여 일정한 간격으로 표준시간을 얻어와 자신이 사용하거나 다른 기계장치로 NMEA 전문규격에 부합토록 보내줄 수 있음<br />
* 활용방법:<br />
*전문을 수신하는 측에서는 &#8216;$Wi-Fi&#8217; 문자열이 오면 버퍼에 저장을 시작하여 crlf가 나타나면 저장을 종료한다.<br />
* *가 나타난후 2개의 문자는 2의 보수형으로 되어있는 체크섬이며, 계산하여 문제가 없다면 해당 전문에 실려 있는 epoc값을 바탕으로 9시간을 더해 한국시간에 맞게 활용하면 된다.<br />
* Notes: 사용포트<br />
* &#8211; D8 : LED0 Anode 연결<br />
***********************************************************************<br />
#include &lt;SPI.h&gt; // WizFi250 모듈과 ATmega328간 통신방식이 SPI<br />
#include &#8220;WizFi250.h&#8221;<br />
#include &#8220;WizFi250Udp.h&#8221;<br />
#include &lt;TimeLib.h&gt; // EPOCH타임을 처리하기 위한 라이브러리</p>
<p>#define KOREA_TIME_ZONE 9 // 기준시에 비해 우리나라가 9시간 빠름<br />
#define KOREA_TIME_ZONE_SEC (3600ul * KOREA_TIME_ZONE)<br />
#define STATUSLED 8 // 동작상태 표출용 LED 출력포트(1초 간격 점멸시 정상 동작 중)<br />
#define NTP_REFRESH_SECS 10</p>
<p>#define TICKS_PER_SECOND (1000L)<br />
#define TICK_SECOND ((TICK)TICKS_PER_SECOND)<br />
#define TICK_1000mS ((TICK)TICK_SECOND) // 1000ms 간격으로 실행 시<br />
#define TICK_100mS ((TICK)TICK_SECOND / 10UL) // 100ms 간격으로 실행 시<br />
#define TICK_10mS ((TICK)TICK_SECOND / 100UL) // 10ms 간격으로 실행 시<br />
#define TICK_1mS ((TICK)TICK_SECOND / 1000UL) // 1ms 간격으로 실행 시</p>
<p>typedef unsigned long TICK; // TICK타입을 unsigned long으로 설정</p>
<p>char ssid[] = &#8220;myLivngRoom(2.4GHz)&#8221;; // 접속코자하는 AP의 SSID<br />
char pass[] = &#8220;??????????&#8221;; // 패스워드<br />
int status = WL_IDLE_STATUS; // AP의 상태값을 나타내는 변수<br />
char wi_fiHeader[] = &#8220;$Wi-Fi&#8221;; // NTP 시각 외부 전송용 헤더<br />
char timeServer[] = &#8220;zero.bora.net&#8221;; // NTP(Network Time Protocol) 서버주소<br />
unsigned int localPort = 2390; // UDP 패킷 수신을 위한 로컬포트 지정<br />
IPAddress timeServerIP; // 원격 NTP 서버의 IP주소<br />
const int NTP_PACKET_SIZE = 48; // 메시지의 첫 48바이트에 NTP 정보가 담겨짐<br />
uint8_t packetBuffer[NTP_PACKET_SIZE]; // 입출력이 일어나는 데이터에 대한 버퍼<br />
String stringOne;<br />
char LineBuffer[100];<br />
int ledState = LOW;<br />
int hours = 12; // 아날로그 모양의 시계를 움직이기 위한 초기 시간값<br />
int minutes = 0;<br />
int seconds = 0;<br />
// UDP 인스턴스를 통해 udp데이터 수수가 일어난다.<br />
WiFiUDP Udp;<br />
unsigned long sendNTPpacket(char *ntpSrv);<br />
unsigned long TickGet(); // 마이크로칩 라이브러리 스타일 명칭으로 호출</p>
<p>void setup()<br />
{<br />
Serial.begin(115200); // 디버깅을 위한 시리얼포트 초기화<br />
pinMode(STATUSLED, OUTPUT); // 아두이노:D8<br />
WiFi.init();<br />
// 와이파이모듈과 오렌지보드간 SPI 통신이 가능한지 검사<br />
if (WiFi.status() == WL_NO_SHIELD) {<br />
Serial.println(&#8220;WiFi shield not present&#8221;);<br />
// don&#8217;t continue<br />
while (true);<br />
}<br />
}</p>
<p>void loop()<br />
{<br />
static enum<br />
{<br />
SM_HOME = 0,<br />
SM_ATTEMPT_CONNECTION,<br />
SM_WAIT_WL,<br />
SM_WL_CONNECTED,<br />
SM_SEND_NTP,<br />
SM_WAIT_NTP_RECV,<br />
SM_RCVCHECK,<br />
SM_READPACKET,<br />
SM_WAIT10SEC,<br />
SM_NEXT,<br />
SM_WAIT<br />
} TASKState = SM_HOME;</p>
<p>static TICK myTimer0 = 0;<br />
static int cycleCounter = 0;<br />
int cb;<br />
// 1900년부터 시작하는 NTP 타임체계를 1970년부터 시작하는 epoc 타임체계로 변환하기 위한 상수값<br />
const unsigned long seventyYears = 2208988800UL;<br />
unsigned long highWord;<br />
unsigned long lowWord;<br />
unsigned long secsSince1900;<br />
unsigned long epoch;</p>
<p>// NTP 전문 생성용 변수<br />
unsigned char calcchksum = 0;<br />
unsigned char sl = 0;<br />
unsigned char ct = 0;<br />
unsigned char pl = 0;<br />
int i;</p>
<p>switch (TASKState)<br />
{<br />
case SM_HOME:<br />
// Wi-Fi망에 연결을 위한 사전 준비작업을 한다.<br />
Serial.print(&#8220;Attempting to connect to WPA SSID: &#8220;);<br />
Serial.println(ssid);</p>
<p>cycleCounter = 0;<br />
myTimer0 = TickGet();<br />
TASKState = SM_ATTEMPT_CONNECTION;<br />
break;</p>
<p>case SM_ATTEMPT_CONNECTION:<br />
// WPA/WPA2 망에 연결을 개시 한다.<br />
status = WiFi.begin(ssid, pass);<br />
if (status == WL_CONNECTED) {<br />
// 연결에 성공되었음이 획인되면 다음 작업을 속행한다.<br />
TASKState = SM_WL_CONNECTED;<br />
}<br />
else {<br />
// 일단 연결에 실패하면&#8230;.<br />
// STATUSLED가 0.1초마다 한번씩 빠르게 점멸이 된다면 wi-fi를<br />
// 찾지 못해 헤매는 중. 단, 오렌지보드wifi에서는 WizFi250모듈 내부<br />
// 적으로 재전송 체계가 돌고 있는 것 같음 이로 인해 상태정보 응답<br />
// 에 지연이 발생함<br />
// ESP8266 등에서는 문제가 없는 코드이며, 오렌지보드에서도 큰 문<br />
// 제는 없이 동작된다.<br />
if (TickGet() &#8211; myTimer0 &gt;= TICK_10mS * 10) {<br />
myTimer0 = TickGet();<br />
if (ledState == LOW)<br />
ledState = HIGH; // LED on data<br />
else<br />
ledState = LOW; // LED off data</p>
<p>digitalWrite(STATUSLED, ledState);// LED action<br />
// 만일 AP에 5초동안 연결을 반복 시도하였음에도 실패하면 에러처리 로직으로<br />
cycleCounter++;<br />
if (cycleCounter &gt; 50) TASKState = SM_WAIT_WL;<br />
}<br />
}<br />
break;<br />
case SM_WAIT_WL:<br />
// 5초 경과 후에도 여전히 연결이 되지 않은 경우 에러처리<br />
if (WiFi.status() != WL_CONNECTED) {<br />
// 5초가 경과되어도 여전히 접속되지 않으면 .을 한 개 출력한 후 처음부터 다시<br />
Serial.print(&#8220;.&#8221;);<br />
TASKState = SM_ATTEMPT_CONNECTION;<br />
}<br />
else {<br />
// 만일 연결에 성공하면 retry counter를 찍은 후 다음 작업을 속행한다.<br />
Serial.println(cycleCounter);<br />
TASKState = SM_WL_CONNECTED;<br />
}<br />
break;<br />
case SM_WL_CONNECTED:<br />
// 성공적으로 wi-fi망에 연결되면 ip주소와 포트 번호를 표출한다.<br />
Serial.println(&#8220;&#8221;);<br />
Serial.println(&#8220;WiFi connected&#8221;);<br />
Serial.print(&#8220;IP address: &#8220;);<br />
Serial.println(WiFi.localIP());<br />
Serial.println(&#8220;Starting UDP&#8221;);<br />
Udp.begin(localPort);<br />
Serial.print(&#8220;Local port: &#8220;);<br />
Serial.println(localPort);<br />
cycleCounter = 0;<br />
TASKState = SM_SEND_NTP; // TIME 서버로 SNTP 패킷을 날린 후 응답을 기다린다.<br />
break;<br />
case SM_SEND_NTP:<br />
// TIME 서버로 NTP 패킷을 전송한다.<br />
//WiFi.hostByName(timeServer, timeServerIP);// ESP8266일 때 사용<br />
Serial.println(&#8220;&#8221;); // 새로운 전문의 시작이 개시됨을 알리는 개행 작업<br />
sendNTPpacket(timeServer); // time server로 NTP 패킷을 전송한다.<br />
Serial.print(&#8220;Send NTP: &#8220;);<br />
Serial.println(timeServer);<br />
TASKState = SM_WAIT_NTP_RECV;<br />
break;<br />
case SM_WAIT_NTP_RECV:<br />
// 타임서버로부터 응답이 왔는지를 검사하여 0.2초 후에도 수신이 되지<br />
//않으면 한 번 더 요청을 해보고 그래도 응답이 1초 동안 없으면 wi-fi망에<br />
//처음부터 다시 접속<br />
cb = Udp.parsePacket();<br />
if (!cb) {<br />
// 정상적인 응답이 아닌 상태에 대한 처리<br />
Serial.print(&#8220;*&#8221;);<br />
cycleCounter++;<br />
delay(100);<br />
if (cycleCounter == 2) {<br />
// TIME 서버로 NTP 패킷이 보내졌으나 0.2초를 기다려도<br />
// 답신이 없으면 한 번 더 보내본다.<br />
Serial.println(cycleCounter);<br />
TASKState = SM_SEND_NTP;<br />
}<br />
else if (cycleCounter &gt;= 10) {<br />
// 답신이 없어 한 번 더 보내고도 1초가 또 경과되면 wi-fi망에<br />
//이상이 있을 가능성이 높으므로 wi-fi 재접속을 시도해본다.<br />
Serial.println(cycleCounter);<br />
cycleCounter = 0;<br />
TASKState = SM_WAIT_NTP_RECV;<br />
}<br />
}<br />
else {<br />
// 제대로 된 값이 온 것 같으면 데이터 파싱 단계를 진행한다.<br />
Serial.println(cycleCounter);<br />
cycleCounter = 0;<br />
TASKState = SM_READPACKET;<br />
}<br />
break;<br />
case SM_READPACKET:<br />
// TIME 서버로 부터 NTP 패킷이 들어왔으므로 파싱 작업을 한다.<br />
// Serial.print(&#8220;packet received, length=&#8221;);<br />
// Serial.println(cb);<br />
Udp.read(packetBuffer, NTP_PACKET_SIZE); // 일단 버퍼로 패킷을 옮긴다.<br />
// 타임 스탬프는 수신된 패킷의 바이트 40에서 시작해 4바이트 또는<br />
// 2 워드 길이이다. 먼저 두 워드구간을 추출해낸다.<br />
highWord = word(packetBuffer[40], packetBuffer[41]);<br />
lowWord = word(packetBuffer[42], packetBuffer[43]);<br />
// 4 바이트 (두 워드)를 롱타입 정수로 머지합니다.<br />
// 이것은 NTP 시간이 됩니다. (1900.1.1일 이후부터 현재까지의 초 값).<br />
secsSince1900 = highWord &lt;&lt; 16 | lowWord;<br />
// Serial.print(&#8220;Seconds since Jan 1 1900 = &#8221; );<br />
// Serial.println(secsSince1900);<br />
// 이제 NTP 시간을 우리가 일상적으로 사용하는 매일 시간형식(Unix Time)으로 변환합니다.<br />
// Unix Time은 1970.1.1부터 시작합니다. 70년간을 초로 환산하면 2208988800:<br />
// 즉, Unix Time을 얻기 위해 70년을 감해줍니다.<br />
// 또한 이 시간을 epoch라고도 합니다.<br />
epoch = secsSince1900 &#8211; seventyYears;<br />
//Serial.print(&#8220;Unix time = &#8220;);<br />
//Serial.println(epoch);<br />
// stringOne에는 타임서버로부터 받은 unix epoch 타임 값이 들어가있다.<br />
stringOne = String(epoch, DEC); // using a long and a base<br />
************************************************************************<br />
# NTP 타임 전문 생성 루틴:<br />
1. 전문 생성목적<br />
타임서버로부터 받아온 시간을 외부장치(전자시계, 서버 등등)에게 시리얼라인<br />
으로 전송해주기 위해 GPS 수신기 등에서 사용하는 NMEA 전문 형태로 생상<br />
하는 부분이다.<br />
2. 전문의 형식 예(GPS신호와 매우 유사함)<br />
$Wi-Fi,1470050489,myKT_WLAN,password,203.248.240.103*3A<br />
[step1] [step2] [step3] [step4] [step5] [step6]
************************************************************************<br />
// STEP1: 시리얼 버퍼에 &#8220;$Wi-Fi,&#8221; 를 시작 문자열로 발신하여 파싱이 일어나도록 한다.<br />
sl = sizeof(wi_fiHeader) &#8211; 1; // null문자 위치 제거<br />
pl = 0;<br />
for (i = 0; i&lt; sl; i++) {<br />
LineBuffer[pl] = wi_fiHeader[i]; // copy to buffer : &#8220;$Wi-Fi,&#8221;<br />
pl++;<br />
}<br />
LineBuffer[pl] = &#8216;,&#8217;; // 구분자를 추가한다.<br />
pl++;<br />
// STEP2: 시리얼버퍼에 &#8220;unix epoch 타임&#8221;을 어펜드한다.<br />
sl = stringOne.length();<br />
ct = 0;<br />
while (sl) {<br />
LineBuffer[pl] = stringOne[ct];<br />
pl++; ct++;<br />
sl&#8211;;<br />
}<br />
LineBuffer[pl] = &#8216;,&#8217;; // 구분자를 추가한다.<br />
pl++;<br />
// STEP3: 시리얼 버퍼에 SSID를 어펜드한다.<br />
sl = sizeof(ssid) &#8211; 1; // null문자 위치 제거<br />
for (i = 0; i&lt; sl; i++) {<br />
LineBuffer[pl] = ssid[i]; // copy to buffer : &#8220;ssid,&#8221;<br />
pl++;<br />
}<br />
LineBuffer[pl] = &#8216;,&#8217;; // 구분자를 추가한다.<br />
pl++;<br />
// STEP4: 시리얼 버퍼에 wi-fi PASSWORD를 어펜드한다.<br />
sl = sizeof(pass) &#8211; 1; // null문자 위치 제거<br />
for (i = 0; i&lt; sl; i++) {<br />
LineBuffer[pl] = pass[i]; // copy to buffer : &#8220;pass,&#8221;<br />
pl++;<br />
}<br />
LineBuffer[pl] = &#8216;,&#8217;; // 구분자를 추가한다.<br />
pl++;<br />
// STEP5: NTP 서버 IP주소를 파싱하여 어펜드한다.<br />
timeServerIP = Udp.remoteIP();<br />
for (i = 0; i&lt;4; i++) {<br />
//stringOne = String(timeServerIP[i], DEC);<br />
stringOne = timeServerIP[i];<br />
sl = stringOne.length();<br />
ct = 0;<br />
while (sl) {<br />
LineBuffer[pl] = stringOne[ct];<br />
pl++; ct++; sl&#8211;;<br />
}<br />
LineBuffer[pl] = &#8216;.&#8217;; pl++;<br />
}<br />
pl&#8211;; // IP주소의 맨 끝에 붙어있는 .은 제거 시켜 준다.<br />
// STEP6: 체크섬을 계산한다.<br />
calcchksum = 0;<br />
for (i = 1; i &lt; pl; i++) {<br />
calcchksum = calcchksum ^ LineBuffer[i]; // USART 수신데이터로 직접 체크섬 계산<br />
}<br />
LineBuffer[pl] = &#8216;*&#8217;; pl++;<br />
stringOne = String(calcchksum, HEX);<br />
stringOne.toUpperCase();<br />
LineBuffer[pl] = stringOne[0]; pl++;<br />
LineBuffer[pl] = stringOne[1]; pl++;<br />
// STEP7: 외부로 실제 전송을 단행한다.<br />
for (i = 0; i&lt; pl; i++) {<br />
Serial.print(LineBuffer[i]);<br />
}<br />
Serial.println(&#8220;&#8221;);<br />
//////////////////////////////////////////////////////////////////////////////////////<br />
// DEBUG Code<br />
// 아래는 이렇게 만들어진 시간값이 정말로 제대로 만들어 졌는지를 검증해보는 코드<br />
// UTC시각은 그리니치천문대(Greenwich Meridian) 기준 시각이다. (GMT)<br />
Serial.print(&#8220;The Local(Seoul, +9Hr) time is &#8220;);<br />
setTime(epoch);<br />
adjustTime(KOREA_TIME_ZONE_SEC); // 대한민국 시간대로 보정<br />
Serial.print(year()); Serial.print(&#8220;/&#8221;);<br />
Serial.print(monthStr(month())); Serial.print(&#8220;/&#8221;);<br />
Serial.print(day());<br />
Serial.print(&#8220;[");<br />
Serial.print(hour()); Serial.print(":");<br />
Serial.print(minute()); Serial.print(":");<br />
Serial.print(second());<br />
Serial.println("]&#8220;);<br />
hours = hour();<br />
minutes = minute();<br />
seconds = second();<br />
//////////////////////////////////////////////////////////////////////////////////////</p>
<p>cycleCounter = 0;<br />
myTimer0 = TickGet();<br />
TASKState = SM_NEXT;<br />
break;<br />
case SM_NEXT:<br />
// 10초 간격으로 한번씩 동기화를 시도한다.<br />
// STATUSLED가 1초마다 한번씩 점멸이 된다면 여기까지의 루프가 잘 돌고 있음을 의미<br />
if (TickGet() &#8211; myTimer0 &gt; TICK_100mS * 5UL) {<br />
myTimer0 = TickGet();<br />
if (ledState == LOW)<br />
ledState = HIGH; // Note that this switches the LED *off*<br />
else<br />
ledState = LOW; // Note that this switches the LED *on*<br />
digitalWrite(STATUSLED, ledState);<br />
cycleCounter++;<br />
// 타임서버로 부터 시간을 받아오는 주기를 설정한다.<br />
// *2를 한것은 cycleCounter가 0.5초 단위로 증가하기 때문이다.<br />
if (cycleCounter &gt; NTP_REFRESH_SECS * 2) {<br />
cycleCounter = 0;<br />
// 연결이 성공적으로 잘되어 있는지 재검사하여 이상없으면 다음 작업을 속행<br />
if (WiFi.status() == WL_CONNECTED) {<br />
TASKState = SM_SEND_NTP;<br />
}else {<br />
// 만일 연결에 문제가 생기면 재접속 프로세스 진행<br />
TASKState = SM_HOME;<br />
}<br />
}<br />
}<br />
break;<br />
}<br />
}</p>
<p>// send an NTP request to the time server at the given address<br />
unsigned long sendNTPpacket(char *ntpSrv)<br />
{<br />
// set all bytes in the buffer to 0<br />
memset(packetBuffer, 0, NTP_PACKET_SIZE);<br />
// Initialize values needed to form NTP request<br />
// (see URL above for details on the packets)<br />
packetBuffer[0] = 0b11100011; // LI, Version, Mode<br />
packetBuffer[1] = 0; // Stratum, or type of clock<br />
packetBuffer[2] = 6; // Polling Interval<br />
packetBuffer[3] = 0xEC; // Peer Clock Precision<br />
// 8 bytes of zero for Root Delay &amp; Root Dispersion<br />
packetBuffer[12] = 49;<br />
packetBuffer[13] = 0x4E;<br />
packetBuffer[14] = 49;<br />
packetBuffer[15] = 52;</p>
<p>// all NTP fields have been given values, now<br />
// you can send a packet requesting a timestamp:<br />
Udp.beginPacket(ntpSrv, 123); //NTP requests are to port 123<br />
Udp.write(packetBuffer, NTP_PACKET_SIZE);<br />
Udp.endPacket();<br />
return 1;<br />
}</p>
<p>unsigned long TickGet()<br />
{<br />
return millis();<br />
}<br />
</div>
<p><span style="color: #f2cd0c;"><strong>3.4.4. 소스설명</strong></span><br />
이 프로그램은 NTP 프로토콜로 타임서버에 접속하기 위해 UDP를 사용한 점이 이전의 튜토리얼과는 다소 차이가 있는 점에 해당됩니다. 저는 제대로 동작되는 프로그램을 만들기 위해서는 에러처리가 중요한 부분에 해당된다고 봅니다.<br />
이 프로그램에서는 AP에 접속하고자 하였으나 이미 에러가 난 경우 재접속하는 방안과 AP에 접속하여 한참 통신을 하는 과정에서 갑자기 AP가 사라지는 경우에 대한 대비가 되어 있습니다. 또한 다른 기기에게 타임 값을 넘겨줄 때 상대방에서 에러에 대한 부분을 검증해 볼 수 있도록 체크섬이 부가되어 있습니다.<br />
비교적 상세히 한글 주석을 달아 놓았으므로 추가적인 설명은 생략하겠습니다.<br />
거의 1주일 가량을 연속 가동해본 결과 짜여진 각본대로 잘 동작함을 확인했습니다.<br />
이 기능을 활용해 실제로 디지털시계를 구현한다면 오렌지보드WiFi 만으로도 충분히 가치있는 프로젝트가 되지 않을까 조심스럽게 예상해 봅니다.</p>
<p><span style="color: #ff6600;"><strong>4. 총평</strong></span><br />
이번에는 한국형 아두이노 보드인 오렌지보드에 WiFi 쉴드를 온보드화 시킨 오렌지보드WiFi에 대해 살펴봤습니다. 필자가 가장 관심을 두었던 부분은 WizFi250 와이파이모듈과 ATmega328이 안정적으로 통신을 수행하며 동작이 잘 될 수 있을까 하는 점이었습니다. 위에서 언급된 바와 같이 여러 형태를 실험하는 내내 단 한 번도 양단간의 통신문제는 발생되지 않았습니다.</p>
<p>일단 안정적으로 동작이 된다는 것에 대해서는 이론의 여지가 없을 듯합니다. 이정도의 안정성을 보여주기 위해서는 무척 다양한 종류의 테스트를 수행했고 무난히 통과된 결과가 아닐까 예상해 봅니다.</p>
<p>다음으로 관심을 두었던 분야가 과연 이 보드로 무엇을 할 수 있을지에 대한 가이드와 관련된 부분이었습니다. 코코아팹 웹 싸이트에는 다음과 같은 예제가 기본적으로 10종 제시되어 있으며, 자세한 설명과 동작하는 장면에 대한 동영상까지 제시하고 있음을 보았을 때 기우였다는 것을 금방 알 수 있었습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-15.jpg" rel="lightbox[33059]"><img class="alignnone size-full wp-image-33288" alt="40 SR (15)" src="http://www.ntrexgo.com/wp-content/uploads/2017/01/40-SR-15.jpg" width="409" height="389" /></a></p>
<p>사실 LED가 동작되는 원리 하나만 갖고도 매우 어려운 학습에 해당 될 수 있으며, 아두이노 학습의 기초 중에 기초인 Blink만 배우는데도 어려워서 쩔쩔맬 수도 있습니다. 여기에다 PWM, ADC, UART, SPI, I2C 등으로 넘어가면 지레 질려버릴 수도 있을 듯합니다.</p>
<p>오렌지보드WiFi 에 장착된 WizFi250 모듈은 정확히는 무선랜 모듈이며 이더넷 통신을 지원하는 첨단기술이 집약된 제품이자 통신장치에 해당된다고 봅니다. 이 모듈을 제대로 활용하기 위해서는 TCP/IP 등 네트워크에 관련된 지식을 필요로 하며 웹이나 모바일을 기반으로 영역을 확대코자 한다면 CGI(Common Gateway Interface)에 대한 깊이있는 지식도 필요하다고 봅니다. 덧붙여 C, C++ 등 프로그래밍 언어에 대한 스킬도 상당한 수준으로 요구될 수 있습니다.<br />
이 보드는 WiFi 통신기능과 아두이노 우노 보드의 접근 용이성이 결합되어 대학생 이상의 교육현장 등에서 인터넷, TCP/IP, IOT, 원격제어 등 이론과 실습과정에 매우 유용한 교재로 쓰일 수 있을 것으로 보이며 일렉트로닉스 분야에 취미를 가진 전 세계인들에게는 보다 저렴한 가격으로, 보다 완성도 있는 IOT 세계를 열어주는데 부족함이 없을 것으로 봅니다. 감사합니다.</p>
<p><strong>자료참고</strong><br />
1. 위즈넷 홈페이지 제품소개 페이지<br />
<a href="http://www.wiznet.co.kr/product/wifi-module/" target="_blank">http://www.wiznet.co.kr/product/wifi-module/</a><br />
2. 오렌지보드 튜토리얼<br />
<a href="http://www.kocoafab.cc/product/orangewifi" target="_blank">http://www.kocoafab.cc/product/orangewifi</a><br />
3. 옐로우캣 소개<br />
<a href="http://www.kocoafab.cc/product/yellowcat" target="_blank">http://www.kocoafab.cc/product/yellowcat</a><br />
4. 코코아팹 오렌지보드 핀아웃<br />
<a href="//kocoafab.cc/data/docs/orangeboard-wifi/orangeboard_wifi_pinout.pdf" target="_blank">http://kocoafab.cc/data/docs/orangeboard-wifi/orangeboard_wifi_pinout.pdf</a></p>
<p>&nbsp;</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-17.png" rel="lightbox[33059]"><img class="alignnone  wp-image-32826" alt="40 sr lattepanda  (17)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-17.png" width="300" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ntrexgo.com/archives/33059/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[39호]아두이노 레오나르도를 품은 윈도우10 컴퓨터 LattePanda(라테판다)</title>
		<link>http://www.ntrexgo.com/archives/32475</link>
		<comments>http://www.ntrexgo.com/archives/32475#comments</comments>
		<pubDate>Fri, 25 Nov 2016 00:00:28 +0000</pubDate>
		<dc:creator>디바이스마트 매거진</dc:creator>
				<category><![CDATA[디바이스마트 매거진]]></category>
		<category><![CDATA[스페셜 컬럼]]></category>
		<category><![CDATA[39호]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[Special]]></category>
		<category><![CDATA[디바이스마트]]></category>
		<category><![CDATA[라테판다]]></category>
		<category><![CDATA[레오나르도]]></category>
		<category><![CDATA[매거진]]></category>
		<category><![CDATA[아두이노]]></category>
		<category><![CDATA[윈도우10]]></category>
		<category><![CDATA[컴퓨터]]></category>

		<guid isPermaLink="false">http://www.ntrexgo.com/?p=32475</guid>
		<description><![CDATA[디바이스마트 매거진 39호 &#124; 윈도우10이 구동되는 초소형 PC에 ATmega32u4로 구성된 아두이노 레오나르도 칩이 코프로세서로 설치되어 있어 뭔가 재미난 일을 하게 해줄 수 있을 것 같은 기대감이 들기에 충분합니다. ]]></description>
				<content:encoded><![CDATA[<p>&nbsp;</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-1.jpg" rel="lightbox[32475]"><img class="alignnone size-large wp-image-32793" alt="40 sr lattepanda  (1)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-1-620x294.jpg" width="620" height="294" /></a></p>
<p><span style="font-size: x-large"><strong>아두이노 레오나르도를 품은 윈도우10 컴퓨터</strong></span></p>
<p><span style="font-size: xx-large"><strong>LattePanda(라테판다)</strong></span></p>
<p>&nbsp;</p>
<p style="text-align: right">글 | 금강초롱(blog.naver.com/crucian2k3)</p>
<p>&nbsp;</p>
<p>임베디드 세계에 절대강자가 등장한 것으로 보입니다. 팬더곰 눈을 연상시키는 로고가 선명한 라테판다라는 보드인데요 널리 알려진 라즈베리파이를 통해 무언가를 해보려 하면 늘 상 아쉬운 것이 A/D컨버터가 없다는 점이며 아두이노 보드로 좀 근사한 무엇인가를 해보려고 한다면 성능에 대한 갈증을 느끼게 된다는 점입니다. 이러한 시장 상황에 따라 32비트 MCU를 장착하기도 하고 Wi-Fi, BT4.0 등으로 중무장한 보드가 이미 출시되어 있기는 합니다만 모두 PC 혹은 리눅스 운영체제와 연동하여 동작한다는 특성이 있습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-2.jpg" rel="lightbox[32475]"><img class="alignnone size-full wp-image-32795" alt="40 sr lattepanda  (2)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-2.jpg" width="560" height="323" /></a></p>
<p>금번에 소개하는 라테판다는 윈도우10이 구동되는 초소형 PC에 ATmega32u4로 구성된 아두이노 레오나르도 칩이 코프로세서로 설치되어 있어 뭔가 재미난 일을 하게 해줄 수 있을 것 같은 기대감이 들기에 충분합니다.</p>
<p>PC로서의 성능은 인터넷 웹서핑을 하거나, 유튜브 동영상을 보거나, 지금 작성 중인 한글워드프로세서를 사용하는데 거의 불편함이 없는 수준입니다. 그냥 느끼는 피상적 성능은 넷북급 PC 내지는 이동성을 중시하는 저가형의 윈도기반의 태블릿PC 정도를 다루는 느낌 정도입니다.</p>
<p>개발환경은 PC 인지라 무엇을 설치하던 크게 상관이 없을 수 있습니다만 제작사 권장으로는 Visual Studio 2015를 설치하고 firmata라고 하는 프로토콜로 PC와 아두이노를 연결하여 여러가지 재미있는 실험을 해볼 수 있도록 제시하고 있습니다.</p>
<p>여기서 미리 언급해 두고 싶은 사항은 라테판다는 일반 고성능 PC가 아니므로 화려한 그래픽작업이나 3D게임 등을 염두해 두셨다면 재고해 보시라 하고 싶습니다.<br />
이제 Windows10 + 무선랜 + 블루투스4.0 + USB3.0 + 아두이노 레오나르도로 탄탄하게 준비된 라테판다의 매력 속으로 빠져 들어가 보겠습니다. 여기에 덧붙여 7인치 IPS DISPLAY와 터치스크린을 장착하면 차량 등에서도 자유롭게 사용가능한 상태가 되며 이 제품을 활용하여 HMI(Human Machine Interface) 등 제어판넬 등으로도 손쉽게 적용을 수 있을 것으로 보입니다.<br />
본 리뷰는 (주)엔티렉스의 지원을 받아 작성 하였습니다.</p>
<p><span style="color: #ff6600;font-size: small"><strong>1. 개봉 및 Wi-Fi 안테나 설치하기</strong></span></p>
<p>박스 외관은 라즈베리파이와 별반 다르지 않은 듯 합니다만 내용물은 많은 차이가 보입니다. 가장 눈에 띄는 부분이 금속 쉴드판이며 3핀 몰렉스 커넥터가 일렬로 쭉 늘어져 있어서 실험을 쉽게 해보라고 만들었구나 하는 생각이 들게 합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-3.jpg" rel="lightbox[32475]"><img class="alignnone size-full wp-image-32797" alt="40 sr lattepanda  (3)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-3.jpg" width="560" height="435" /></a></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-4.jpg" rel="lightbox[32475]"><img class="alignnone size-full wp-image-32799" alt="40 sr lattepanda  (4)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-4.jpg" width="560" height="317" /></a> <a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-5.jpg" rel="lightbox[32475]"><img class="alignnone size-full wp-image-32801" alt="40 sr lattepanda  (5)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-5.jpg" width="560" height="317" /></a> <a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-6.jpg" rel="lightbox[32475]"><img class="alignnone size-full wp-image-32803" alt="40 sr lattepanda  (6)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-6.jpg" width="560" height="317" /></a></p>
<p>제일 먼저 할 일은 Wi-Fi 안테나를 연결하는 작업입니다.<br />
이러한 류의 보드는 인터넷에 연결되지 않으면 거의 정상적으로 사용하기 힘듭니다. 라테판다 박스를 열면 Wi-Fi 안테나용의 매우 작은 금도금커넥터가 붙은 안테나가 보이며 USB커넥터 부근에 붙이면 됩니다.</p>
<p><span style="color: #ff6600;font-size: small"><strong>2. 윈도우10 인스톨</strong></span></p>
<p><span style="color: #ff9900"><strong>2.1. 라테판다용 파워서플라이 관련 사항</strong></span><br />
라테판다에 전원을 안정적으로 공급하기 위해서는 DC5V/2A 이상의 전원이 필요합니다. PC와 같은 수준의 능력을 발휘하는 제품이므로 안정적인 동작을 기대한다면 당연히 전원도 충분한 것으로 준비해야 합니다.<br />
필자가 라즈베리파이 보드 테스트 등에 주로 사용하는 S사의 DC5V2A충전기는 라테판다보드에서는 적절하지 않았습니다. 잘 동작하는 듯 보이다가도 일순간 재부팅을 유발하더군요. 하는 수 없이 아래와 같은 자작 전원을 연결해 실험을 진행 하였습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-7.jpg" rel="lightbox[32475]"><img class="alignnone size-full wp-image-32805" alt="40 sr lattepanda  (7)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-7.jpg" width="560" height="290" /></a></p>
<p>이 글을 읽는 독자님들 중 라테판다보드가 재부팅하는 증상이 있다면 우선 견실한 전원으로 교체해 보실 것을 권합니다.</p>
<p><span style="color: #ff9900"><strong>2.2 라테판다 켜는 방법</strong></span></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-8.jpg" rel="lightbox[32475]"><img class="alignnone size-full wp-image-32807" alt="40 sr lattepanda  (8)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-8.jpg" width="560" height="290" /></a></p>
<p>위에서 언급한 바와 같이 안정적인 전력을 공급하는 직류전원을 라테판다에 연결합니다.<br />
· 권장 : DC5V/2.5A<br />
추가적으로 무선키보드&amp;마우스 및 HDMI 케이블 연결 등을 해두어야 윈도우10 초기화를 원활히 진행할 수 있습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-9.jpg" rel="lightbox[32475]"><img alt="40 sr lattepanda  (9)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-9.jpg" width="560" height="290" /></a></p>
<p>약 5초 동안 적색램프가 켜졌다가 꺼집니다.<br />
보드 초기화가 일어나는 과정으로 전원이 투입된 직후 단 한번 일어납니다. 이때는 다른 버튼 등은 만지지 마시고 적색램프가 꺼질때 까지 잠시만 기다려 줍니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-10.jpg" rel="lightbox[32475]"><img alt="40 sr lattepanda  (10)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-10.jpg" width="560" height="290" /></a></p>
<p>적색램프가 꺼진 것을 확인한 후 약 1초간 파워버튼을 눌러주면 부팅이 진행됩니다.<br />
만일 HDMI포트에 모니터가 연결된 경우나 LCD 디스플레이를 이미 끼워 두었다면 부팅장면을 보실 수 있습니다.</p>
<p><span style="color: #ff9900"><strong>2.3. 지역정보 등 초기화</strong></span><br />
라테판다 32G 버전은 이미 Windows10이 라이센싱 되어 있습니다.<br />
그렇다 하더라도 최초 설치는 필수 사항입니다. HDMI케이블, USB키보드, 마우스 등을 연결하고 전원을 투입합니다.<br />
표준시, 국가 등 로케일 정보를 적절히 맞춰줍니다.<br />
(대한민국 : Korea, Korean(Korea), Microsoft IME, (UTC+09:00)Seoul)</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-11.jpg" rel="lightbox[32475]"><img class="alignnone size-full wp-image-32813" alt="40 sr lattepanda  (11)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-11.jpg" width="560" height="290" /></a></p>
<p>부팅하는 과정에서 무선랜 설정작업과 인터넷 접속이 진행됩니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-12.jpg" rel="lightbox[32475]"><img class="alignnone size-full wp-image-32815" alt="40 sr lattepanda  (12)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-12.jpg" width="560" height="290" /></a></p>
<p>라테판다를 사용할 유저 계정을 생성하면 일단 끝이 납니다.<br />
아마도 한 이틀쯤 지나면 윈도우 업그레이드 안내창이 나올 것입니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-13.jpg" rel="lightbox[32475]"><img class="alignnone size-full wp-image-32817" alt="40 sr lattepanda  (13)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-13.jpg" width="560" height="267" /></a></p>
<p><span style="color: #ff6600;font-size: small"><strong>3. 라테판다의 기술적 특성</strong></span></p>
<p><span style="color: #ff9900"><strong>3.1 라즈베리파이 재단의 최신 제품과 스펙 비교</strong></span></p>
<table style="width: 500px" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><img class="alignnone  wp-image-32828" alt="40 sr lattepanda  (18)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-18-452x620.png" width="500" /></td>
</tr>
<tr>
<td style="text-align: right">참고 : www.dfrobot.com/index.php?route=product/product&amp;product_id=1404</td>
</tr>
</tbody>
</table>
<p>대표적인 차별점</p>
<p>· Co-Processor 장착 : Atmega32u4(아두이노 레오나르도 호환)<br />
· 운영체제 설치 : 라이센싱 된 Windows10이 내장 출고됨(32G 버전)<br />
· USB3.0 Port 지원 : 라테판다를 NAS 용도 등으로 활용시 위력 발휘 예상<br />
· 고해상도 LCD DISPLAY 지원 : 1024&#215;600의 고해상도 지원</p>
<p><span style="color: #ff9900"><strong>3.2. 체리트레일 vs 베이트레일 CPU성능 비교</strong></span><br />
필자가 가끔 사용하는 10.1인치 윈도기반 태블릿 PC와 비교를 해봤습니다. DRAM의 용량이 1,947MB와 1,492MB로 라테판다가 약 500MB가 더 크며 그 외에는 별 차이가 없었습니다. 벤치마크 테스트에서는 수치상으로 약간 낮아 보이기도 합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-14.jpg" rel="lightbox[32475]"><img class="alignnone size-large wp-image-32819" alt="40 sr lattepanda  (14)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-14-402x620.jpg" width="402" height="620" /></a></p>
<p><span style="color: #ff6600;font-size: small"><strong>4. 개발환경 준비하기</strong></span></p>
<p><span style="color: #ff9900"><strong>4.1. Visual Studio2015 Community 설치하기</strong></span><br />
아래 주소에서 Visual Studio2015 Community를 다운받아 설치를 합니다.<br />
www.visualstudio.com/downloads<br />
이 글을 읽는 독자님들께서 좀 의아해 하실 수도 있습니다만 라테판다 자체가 PC이므로 PC기반의 각종 기능 구현을 위해서는 개발환경 중 무상으로 다양한 개발언어를 지원해주는 비주얼스튜디오2015커뮤니티 설치는 필수 불가결한 요소에 해당됩니다.<br />
Free download를 누르면 아래와 같이 진행됩니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-15.jpg" rel="lightbox[32475]"><img class="alignnone size-full wp-image-32821" alt="40 sr lattepanda  (15)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-15.jpg" width="567" height="258" /></a></p>
<p>여기에서 중요한 것이 좌측편의 위 그림과 같이 “Custom”을 선택하여 개발환경이 모두 설치 되도록 선택하여야 번거로움을 덜 수 있습니다.<br />
프로그램을 완전히 설치하는데 수 시간이 걸리므로 느긋하게 진행합니다.</p>
<p><span style="color: #ff9900"><strong>4.2. 코프로세서(아두이노 레오나르도) 기본 기능 점검</strong></span></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-16.jpg" rel="lightbox[32475]"><img class="alignnone size-full wp-image-32823" alt="40 sr lattepanda  (16)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-16.jpg" width="567" height="258" /></a></p>
<p>보드에 있는 LED의 Blink테스트를 통해 기본적인 소통을 해 봅니다.<br />
· 라테판다 바탕화면에 기본적으로 설치되어 있는 아두이노 아이콘을 더블클릭합니다.<br />
· Blink 프로그램 예제를 files ▶ Examples ▶ 01.Basics에서 open 합니다.<br />
· 시리얼포트를 Tools ▶ Serial Port에서 선택합니다.<br />
· Upload를 합니다.<br />
· 프로그램이 제대로 내려가면 청색 LED가 점멸하는 것을 볼 수 있습니다.</p>
<p><span style="color: #ff6600;font-size: small"><strong>5. 보드 레이아웃</strong></span></p>
<p><span style="color: #ff9900"><strong>5.1. 각 핀의 특별한 기능 정리</strong></span><br />
· U1 : X-Z8300 코어<br />
· U2 : ATmega32u4 코어<br />
· 20핀 디지털 핀<br />
· A0-A5, D0-D13, U2에 연결됨<br />
· 5V신호체계, 40mA 입출력, 20k~50kΩ<br />
· 풀업저항 내장 (기본 off)</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-17.jpg" rel="lightbox[32475]"><img class="alignnone size-full wp-image-32825" alt="40 sr lattepanda  (17)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-17.jpg" width="567" height="420" /></a></p>
<p><strong><span style="color: #ff9900">5.2. 각 핀 기능</span></strong><br />
<strong></strong></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-1.png" rel="lightbox[32475]"><img class="alignnone  wp-image-32794" alt="40 sr lattepanda  (1)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-1.png" width="500" /></a></p>
<p><strong><span style="color: #ff9900">5.3. 보드 내 커넥터 정의</span></strong></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-18.jpg" rel="lightbox[32475]"><img class="alignnone  wp-image-32827" alt="40 sr lattepanda  (18)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-18.jpg" width="500" /></a></p>
<p><span style="color: #ff6600;font-size: small"><strong>6. Visual Studio에서 아두이노 핀 제어하기</strong></span></p>
<p><span style="color: #ff9900"><strong>6.1. Firmata(퍼마타) protocol 환경 구성</strong></span><br />
라테판다에서는 기본적으로 c#상에서 돌려볼 수 있는 예제를 제시하고 있습니다.<br />
여기에서 보드 내에 실장된 아두이노와 Windows10을 서로 소프트웨어적으로 연결해야 하는데 Firmata 프로토콜을 활용하고 있습니다.<br />
Firmata 프로토콜은 원래 MIDI라는 전자악기에 사용된 시리얼 통신 프로토콜로 이를 변형시켜 PC와 아두이노 간에 데이터를 주거니 받거니 할 수 있도록 만들어진 것입니다. 이 Firmata를 사용하면 Visual C++와 같은 컴퓨터프로그램에서 아두이노의 I/O를 제어할 수 있게 됩니다. 이렇듯 아두이노와 PC가 연결되면 PC의 강력한 성능과 친근한 UI를 기반으로 사용하기 편리한 아두이노를 마음대로 제어할 수 있으므로 원격제어 원격모니터링 등을 매우 쉽게 소화해 낼 수 있을 것으로 봅니다.<br />
에러처리를 위한 체크섬이나 CRC 등 검증바이트는 없는 방식이며 간편함과 단순함, 빠른 속도에 포커스를 두고 개발된 프로토콜로 보입니다.</p>
<p><span style="color: #ff9900"><strong>6.2. 아두이노에 Firmata프로토콜 올리기</strong></span><br />
아두이노IDE ▶ 파일 ▶ 예제 ▶ Firmata ▶ StandardFirmata를 선택한 후 업로드를 합니다. 이 작업을 하면 아두이노와 PC가 Firmata 프로토콜로 서로 연결되게 됩니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-19.jpg" rel="lightbox[32475]"><img class="alignnone  wp-image-32829" alt="40 sr lattepanda  (19)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-19.jpg" width="500" /></a></p>
<p>잘 동작되는지 기본적인 테스트는 뒤에서 설명되는 BlinkYourBoard 프로그램으로 해보기로 합니다. 살짝 복잡해 보일 수도 있습니다.</p>
<p><span style="color: #ff9900"><strong>6.3. C# 기반의 라테판다 제어용 라이브러리 살펴보기</strong></span><br />
<span style="color: #edb44e"><strong>6.3.1. 생성자(Constructor)</strong></span><br />
생성자는 아래와 같이 4가지 종류가 있습니다.<br />
필요에 따라 적절한 것 하나를 선택할 수 있습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-2.png" rel="lightbox[32475]"><img class="alignnone  wp-image-32796" alt="40 sr lattepanda  (2)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-2.png" width="500" /></a></p>
<p><span style="color: #edb44e"><strong>6.3.2. 환경설정(Configuration)</strong></span><br />
핀 동작 환경을 설정합니다.<br />
윈도우10 쪽에서 이 명령이 아두이노로 넘어가면 해당 핀이 적절히 초기화 됩니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-3.png" rel="lightbox[32475]"><img class="alignnone  wp-image-32798" alt="40 sr lattepanda  (3)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-3.png" width="500" /></a></p>
<p><span style="color: #edb44e"><strong>6.3.3. 디지털 제어신호</strong></span><br />
□ 디지털 출력 : pinMode 메소드와 결합하여 디지털 신호를 토글링 합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-4.png" rel="lightbox[32475]"><img class="alignnone  wp-image-32800" alt="40 sr lattepanda  (4)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-4.png" width="500" /></a></p>
<p>□ 디지털 입력 : 디지털 핀의 최종 상태가 읽혀져 반환됩니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-5.png" rel="lightbox[32475]"><img class="alignnone  wp-image-32802" alt="40 sr lattepanda  (5)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-5.png" width="500" /></a></p>
<p>□ 디지털 입력 : 입력 핀으로 설정된 핀의 값이 업데이트 됩니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-6.png" rel="lightbox[32475]"><img class="alignnone  wp-image-32804" alt="40 sr lattepanda  (6)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-6.png" width="500" /></a></p>
<p><span style="color: #edb44e"><strong>6.3.4. 아날로그</strong></span><br />
□ PWM 출력 : 8비트 펄스폭변조(PWM) 기능을 활용하여 아날로그 신호를 내보낼 수 있는 기능을 제공합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-7.png" rel="lightbox[32475]"><img class="alignnone  wp-image-32806" alt="40 sr lattepanda  (7)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-7.png" width="500" /></a></p>
<p>□ 아날로그 신호 입력 : 10비트의 분해능을 가진 신호 6개를 받을 수 있습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-8.png" rel="lightbox[32475]"><img class="alignnone  wp-image-32808" alt="40 sr lattepanda  (8)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-8.png" width="500" /></a></p>
<p>□ 아날로그 신호 입력 : 아날로그 입력을 새롭게 받을 수 있습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-9.png" rel="lightbox[32475]"><img class="alignnone  wp-image-32810" alt="40 sr lattepanda  (9)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-9.png" width="500" /></a></p>
<p><span style="color: #edb44e"><strong>6.3.5. 서보제어</strong></span><br />
서보를 제어하기 위한 각도 값을 지정된 핀으로 출력합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-10.png" rel="lightbox[32475]"><img class="alignnone  wp-image-32812" alt="40 sr lattepanda  (10)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-10.png" width="500" /></a></p>
<p><strong><span style="color: #ff9900">6.3.6. I2C(TWI)</span></strong><br />
□ I2C통신초기화 : I2C버스를 마스터로 초기화를 합니다. 최초에 1회만 수행합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-11.png" rel="lightbox[32475]"><img class="alignnone  wp-image-32814" alt="40 sr lattepanda  (11)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-11.png" width="500" /></a></p>
<p>□ I2C통신요구 : I2C 디바이스 쪽으로 데이터를 내보내거나 받을 수 있으며 만일 수신시 내부적으로 didI2CDataReveive()가 호출됩니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-12.png" rel="lightbox[32475]"><img class="alignnone  wp-image-32816" alt="40 sr lattepanda  (12)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-12.png" width="500" /></a></p>
<p>□ I2C통신 이벤트</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-13.png" rel="lightbox[32475]"><img class="alignnone  wp-image-32818" alt="40 sr lattepanda  (13)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-13.png" width="500" /></a></p>
<p><span style="color: #ff6600;font-size: small"><strong>7. C# 기반의 프로그래밍 테스트</strong></span></p>
<p><span style="color: #ff9900"><strong>7.1. 프로그래밍 절차 정리</strong></span><br />
필자가 라테판다를 접하며 가장 난해하였던 부분입니다만 이 부분을 나름대로 이해하고 정리하여 아래에 서술해 보았습니다.<br />
일반적으로 아두이노향 체계에서 테스트하는 것과 약간의 차이가 있으며, 더군다나 c# 환경에서 코드가 만들어지고 실행되므로 초심자는 좀 어려워 할 수도 있습니다만 아래를 따라서 차근차근 해볼 수 있도록 최대한 자세히 언급해보고자 합니다.<br />
○ Intel CPU : GUI 제공<br />
○ ATmega32u4 : 실제 실행 액션<br />
○ 상호연동 : Serial, 57600bps</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-14.png" rel="lightbox[32475]"><img class="alignnone  wp-image-32820" alt="40 sr lattepanda  (14)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-14-533x620.png" width="500" /></a></p>
<p><span style="color: #ff9900"><strong>7.2 디지털 출력 함수(digitalWrite) 테스트</strong></span><br />
디지털 출력함수 동작을 통해서 아두이노의 온보드 빌트인 LED인 D13을 점멸시켜 보도록 합니다. 아두이노를 맨 처음 배우면 테스트해보는 LEDBlink의 라테판다 버전이라고 생각하시면 됩니다.<br />
이 짧은 예제 하나를 성공시키면 라테판다, Visual Studio c#, Firmata, Arduino를 두루두루 섭렵해보게 되는 것입니다.</p>
<p>□ 회로구성<br />
아두이노 우노 R3 버전의 제품은 기본적으로 D13핀에 LED가 연결되어 있는 전통에 따라 아두이노 레오나르도 향으로 설계된 라테판다에서도 D13에 LED가 연결되어 간단한 테스트를 해볼 수 있습니다.( D13의 출력 ▶ High : LED On, Low : LED Off)</p>
<p>□ 소스코드 구조</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-15.png" rel="lightbox[32475]"><img class="alignnone  wp-image-32822" alt="40 sr lattepanda  (15)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-15.png" width="500" /></a></p>
<p>□ blinkYourBoard의 소스코드 (Program.cs)</p>
<div class="symple-box gray none" style="text-align:left; width:100%;"> 
<p>using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Text;<br />
using System.Threading.Tasks;<br />
using System.Threading;<br />
using LattePanda.Firmata;<br />
namespace blinkYourBoard<br />
{<br />
class Program<br />
{<br />
static void Main(string[] args)<br />
{<br />
Arduino arduino = new Arduino();<br />
arduino.pinMode(13, Arduino.OUTPUT);//Set the digital pin 13 as output<br />
Console.WriteLine(“Blink Your Board.”); // 라테판다 화면에 메시지 출력</p>
<p>while (true)<br />
{<br />
// ==== set the led on or off<br />
Console.WriteLine(“set the LED　on”);<br />
arduino.digitalWrite(13, Arduino.HIGH); //라테판다보드의 D13 LED　on<br />
Thread.Sleep(1000);//delay a seconds</p>
<p>Console.WriteLine(“set the LED　off”);<br />
arduino.digitalWrite(13, Arduino.LOW); //라테판다보드의 D13 LED off<br />
Thread.Sleep(1000);//delay a seconds<br />
}<br />
}<br />
}<br />
}<br />
</div>
<p>□ blinkYourBoard 콘솔화면(도스창)</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-20.jpg" rel="lightbox[32475]"><img class="alignnone  wp-image-32830" alt="40 sr lattepanda  (20)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-20.jpg" width="500" /></a></p>
<p>□ blinkYourBoard 프로젝트 소스코드 편집</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-21.jpg" rel="lightbox[32475]"><img class="alignnone  wp-image-32831" alt="40 sr lattepanda  (21)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-21.jpg" width="500" /></a></p>
<p><span style="color: #ff9900"><strong>7.3 디지털 입력 함수(digitalRead) 테스트</strong></span><br />
라테판다에 푸시버튼을 1개 연결하여 테스트를 해보기로 합니다.<br />
본 리뷰의 주최 측에서 테스트를 위한 센서 세트를 배려해 주었으므로 지금부터는 여기에 담겨진 센서 등을 사용해서 간단한 테스트를 해 보도록 하겠습니다.</p>
<p>□ 회로구성</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-22.jpg" rel="lightbox[32475]"><img class="alignnone  wp-image-32832" alt="40 sr lattepanda  (22)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-22.jpg" width="500" /></a></p>
<p>□ 소스코드 : digitalRead &gt; Program.cs<br />
새로운 솔루션을 하나 만든 후 아래 소스코드를 Program.cs에 부어 넣습니다. 또한 이전 예제에서 사용한 Arduino.cs도 솔루션에 포함시켜 컴파일 하여야 에러가 없이 정상적으로 컴파일이 됩니다.</p>
<div class="symple-box gray none" style="text-align:left; width:100%;"> 
<p>using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Text;<br />
using System.Threading.Tasks;<br />
using System.Threading;<br />
using LattePanda.Firmata;<br />
namespace buttonDemo//your project name<br />
{<br />
class Program<br />
{<br />
// 인스턴스를 생성하고 기본 파라메터들을 초기화 한다.<br />
static Arduino arduino = new Arduino();<br />
static void Main(string[] args)<br />
{<br />
// pin9를 디지털 입력포트로 초기화 한다.<br />
arduino.pinMode(9, Arduino.INPUT);<br />
// 핀9를 한번 읽어 상태를 저장해 둔다.<br />
int Value = arduino.digitalRead(9);<br />
Console.WriteLine(Value);<br />
// 이벤트 리스너를 등록해 입력으로 설정한 핀에 변화가 있거든 이벤트가 생기도록 한다.<br />
// 즉, 계속하여 해당 포트의 상태가 변하였는지를 읽는(폴링) 하는 행위를 하지 않아도 된다.<br />
arduino.digitalPinUpdated += Arduino_digitalPinUpdated;<br />
while (true);<br />
}<br />
// 해당 핀에 업데이트가 발생하면 이 함수가 자동으로 호출이 된다.<br />
private static void Arduino_digitalPinUpdated(byte pin, byte state)<br />
{<br />
Console.Write(pin);<br />
Console.Write(“: “);<br />
Console.WriteLine(state);<br />
}<br />
}<br />
}<br />
</div>
<p><span style="color: #ff9900"><strong>7.4  PWM(Pulse Width Modulation) 테스트</strong></span><br />
D3, D5, D6, D9, D10, D11은 PWM 기능을 지원하며 이 핀에 고휘도 LED를 연결하면 디밍 동작을 관찰해 볼 수 있습니다.</p>
<p>□ 회로구성</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-23.jpg" rel="lightbox[32475]"><img class="alignnone  wp-image-32833" alt="40 sr lattepanda  (23)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-23.jpg" width="500" /></a></p>
<p>□ 소스코드 : pwm</p>
<div class="symple-box gray none" style="text-align:left; width:100%;"> 
<p>using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Text;<br />
using System.Threading.Tasks;<br />
using System.Threading;<br />
using LattePanda.Firmata;<br />
namespace analogWriteExample<br />
{<br />
class Program<br />
{<br />
// 인스턴스를 생성하고 기본 파라메터들을 초기화 한다.<br />
static Arduino arduino = new Arduino();<br />
static void Main(string[] args)<br />
{<br />
arduino.pinMode(9, Arduino.PWM);<br />
while (true)<br />
{<br />
for (int i = 0; i &lt;= 255; i++)<br />
{<br />
arduino.analogWrite(9, i);<br />
Thread.Sleep(4);//delay 4ms<br />
Console.WriteLine(i);<br />
}<br />
for (int i = 255; i &gt;= 0; i&#8211;)<br />
{<br />
arduino.analogWrite(9, i);<br />
Thread.Sleep(4);//delay 4ms<br />
Console.WriteLine(i);<br />
}<br />
}<br />
}<br />
}<br />
}<br />
</div>
<p><span style="color: #ff9900"><strong>7.5 analogRead 테스트</strong></span></p>
<p>아날로그 입력은 A0에서 A5까지에서 받을 수 있습니다.</p>
<p>□ 회로구성</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-24.jpg" rel="lightbox[32475]"><img class="alignnone  wp-image-32834" alt="40 sr lattepanda  (24)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-24.jpg" width="500" /></a></p>
<p>□ 소스코드 : analogRead</p>
<div class="symple-box gray none" style="text-align:left; width:100%;"> 
<p>using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Text;<br />
using System.Threading.Tasks;<br />
using System.Threading;<br />
using LattePanda.Firmata;<br />
namespace analogReadExample<br />
{<br />
class Program<br />
{<br />
// 인스턴스를 생성하고 기본 파라메터들을 초기화 한다.<br />
static Arduino arduino = new Arduino();<br />
static void Main(string[] args)<br />
{<br />
int Value = arduino.analogRead(0); // A0를 읽는다.<br />
Console.WriteLine(Value);<br />
// 아날로그 입력에 변화가 생기면 이벤트 핸들러가 실행 된다.<br />
arduino.analogPinUpdated += Arduino_analogPinUpdated;<br />
while (true) ;<br />
}<br />
private static void Arduino_analogPinUpdated(int pin, int value)<br />
{<br />
if (pin == 0)<br />
{<br />
Console.Write(pin);<br />
Console.Write(“: “);<br />
Console.WriteLine(value);<br />
}<br />
}<br />
}<br />
}<br />
</div>
□ 콘솔창 출력화면</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-25.jpg" rel="lightbox[32475]"><img class="alignnone  wp-image-32835" alt="40 sr lattepanda  (25)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-25.jpg" width="500" /></a></p>
<p><span style="color: #ff9900"><strong>7.6 Servo 테스트</strong></span><br />
D9에 연결된 서보모터를 0도에서 180도까지 제어를 해봅니다. 실험에 사용된 서보는 RBD-702MG로 금속기어가 들어간 제품입니다.<br />
어떤 서보를 사용하여도 실험은 문제가 없을 것입니다.</p>
<p>□ 회로구성</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-26.jpg" rel="lightbox[32475]"><img class="alignnone  wp-image-32836" alt="40 sr lattepanda  (26)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-26.jpg" width="500" /></a></p>
<p>□ 소스코드 : servo</p>
<div class="symple-box gray none" style="text-align:left; width:100%;"> 
<p>using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Text;<br />
using System.Threading.Tasks;<br />
using System.Threading;<br />
using LattePanda.Firmata;<br />
namespace analogWriteExample<br />
{<br />
class Program<br />
{<br />
//<br />
static Arduino arduino = new Arduino();<br />
static void Main(string[] args)<br />
{<br />
arduino.pinMode(9, Arduino.SERVO);<br />
while (true)<br />
{<br />
arduino.servoWrite(9, 170);//tell the servo motor go to the position in 180 degrees<br />
Console.WriteLine(“&#8211;&gt;servo motor go to the position in 180 degrees”);<br />
Thread.Sleep(2000);//delay a seconds</p>
<p>arduino.servoWrite(9, 10);//tell the servo motor go to the position in 0 degrees<br />
Console.WriteLine(“&lt;&#8211;servo motor go to the position in 0 degrees”);<br />
Thread.Sleep(2000);//delay a seconds<br />
}<br />
}<br />
}<br />
}<br />
</div>
<p><span style="color: #ff6600;font-size: small"><strong>8. 7인치 디스플레이와 터치패널</strong></span></p>
<p>라테판다는 외부에 7인치 IPS LCD와 10점 정전용량 감지방식(정전식) 터치패널을 연결할 수 있습니다.<br />
외부에 HDMI를 통해 모니터가 연결되면 클론모드 혹은 확장모드로 운영할 수 있습니다. 이정도 가격의 제품에서 보여주는 이러한 기능은 놀라울 따름입니다.<br />
해상도는 1024*600으로 매우 뛰어나며 터치 반응도 나쁘지 않다고 생각됩니다.</p>
<p><span style="color: #ff9900"><strong>8.1 외관 살펴보기</strong></span><br />
□ 박스외관<br />
박스는 7인치 LCD와 멀티터치 패널이 별도로 되어 있으며 커넥터가 매우 약하므로 주의하여 다뤄야 합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-27.jpg" rel="lightbox[32475]"><img class="alignnone  wp-image-32837" alt="40 sr lattepanda  (27)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-27.jpg" width="500" /></a></p>
<p>□ 장착전 사진<br />
버니어캘리퍼스로 측정해 본 결과 디스플레이면은 약 7.1인치가 나옵니다. 아직 시중에는 터치패널을 수납할 수 있는 case가 출시되지 않은 것으로 보여 집니다. 약간의 부주의로도 플랫 케이블이 손상 될 수 있으므로 주의하여야 합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-28.jpg" rel="lightbox[32475]"><img class="alignnone  wp-image-32838" alt="40 sr lattepanda  (28)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-28.jpg" width="500" /></a></p>
<p><span style="color: #ff9900"><strong>8.2. 라테판다 바탕화면 변경(테블릿모드)</strong></span><br />
Windows8.x 부터는 데스크탑과 태블릿모드가 동시에 지원되고 있습니다. 라테판다에 설치된 Windows10도 당연히 태블릿 모드가 되며 태블릿모드에서 어떻게 보여지는 지를 살펴보겠습니다.</p>
<p>□ 디스플레이 설정 변경하기<br />
라테판다에 LCD패널이 연결되면 듀얼모니터 모드가 됩니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-29.jpg" rel="lightbox[32475]"><img class="alignnone  wp-image-32839" alt="40 sr lattepanda  (29)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-29.jpg" width="500" /></a></p>
<p>바탕화면&gt;그래픽속성을 선택한 후 다중디스플레이에서 클론디스플레이를 선택하면 HDMI쪽 영상과 7인치 패널에서 동시에 화면을 볼 수 있습니다.<br />
만일 7인치 LCD패널을 위주로 사용코자 한다면 태블릿 모드까지 변경해주는 것이 좋습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-31.jpg" rel="lightbox[32475]"><img class="alignnone  wp-image-32841" alt="40 sr lattepanda  (31)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-31.jpg" width="500" /></a></p>
<p>전자액자와 유튜브 동영상을 돌려보고 있는 장면입니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-32.jpg" rel="lightbox[32475]"><img class="alignnone  wp-image-32842" alt="40 sr lattepanda  (32)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-32.jpg" width="500" /></a></p>
<p>커넥터가 매우 약하므로 실험 시 극도의 주의를 요합니다.<br />
단 한번의 실수가 영구적 손상을 불러옵니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-33.jpg" rel="lightbox[32475]"><img class="alignnone  wp-image-32843" alt="40 sr lattepanda  (33)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-33.jpg" width="500" /></a></p>
<p><span style="color: #ff6600;font-size: small"><strong>9. 스타터 센서 셋</strong></span></p>
<p>라테판다는 6개의 3핀 몰렉스 커넥터를 실장하고 있습니다.<br />
이 커넥터를 이용하여 디지털 3포트, 아날로그 3포트의 실험을 진행할 수 있으며 대체적으로 라테판다 및 아두이노 초심자를 타겟으로 한 센서들로 구성되어져 있습니다.<br />
초등학생부터 중학생 정도의 학생들에게 아두이노의 개념을 설명하고 학습하는 데는 사용할만한 듯합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-34.jpg" rel="lightbox[32475]"><img class="alignnone  wp-image-32844" alt="40 sr lattepanda  (34)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-34.jpg" width="500" /></a></p>
<p>신제품을 출시하면서 제품을 테스트해 볼 수 있는 센서키트까지 고려한 것을 보면 상당히 착실한 준비를 한 것으로 여겨집니다.<br />
센서는 아두이노 진영이나 라즈베리파이 진영에서도 유명한 DFROBOT사 제품입니다.</p>
<table style="width: 500px" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><img class="alignnone  wp-image-32824" alt="40 sr lattepanda  (16)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-16.png" width="500" /></td>
</tr>
<tr>
<td style="text-align: right">참조 : https://www.dfrobot.com/index.php?route=product/category&amp;path=36</td>
</tr>
</tbody>
</table>
<p>다만 한 가지 유의사항이 있다면 몰렉스 3핀 커넥터는 5V전원이 인가되어 있으며 이 파워는 라테판다의 CPU에도 똑같이 사용되고 있습니다.</p>
<p>만일 DC모터, 서보 등 돌입전류가 큰 부하를 사용하는 경우 시스템이 재부팅하는 불상사가 생길 수 있습니다.<br />
돌입전류가 큰 부하는 라테판다와 분리된 파워를 사용하는 것이 바람직해 보입니다.</p>
<p><span style="color: #ff6600;font-size: small"><strong>10. 응용해 보기</strong></span></p>
<p>라테판다는 윈도우기반 컴퓨터이므로 PC의 사용법에 익숙한 유저를 위한 GUI체계가 지원된다는 것은 매우 큰 강점이 아닐까 합니다.<br />
열심히 구글링을 한 결과 github에 올려진 충분히 응용 가능성이 있는 Sample Code를 발견하였고 이를 바탕으로 실험 해본 결과물을 올려 봅니다.<br />
우선 다음 주소에서 데모코드를 다운 받습니다.<br />
<a href="github.com/LattePandaTeam/LattePanda-Development-Support" target="_blank">github.com/LattePandaTeam/LattePanda-Development-Support</a></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-35.jpg" rel="lightbox[32475]"><img class="alignnone  wp-image-32845" alt="40 sr lattepanda  (35)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-35.jpg" width="500" /></a></p>
<p>github에 올려진 파일을 윈도우 상에서 받는 방법은 동일합니다.<br />
‘Clone or Download’를 클릭하면 zip 파일을 다운 받을 수 있습니다.<br />
이렇게 다운받은 파일을 적당한 폴더에 풀은 후 Visual Studio에서 불러옵니다.<br />
일전에 실험한 프로그램은 윈도우 콘솔상에서 I/O가 일어나는 프로그램이었으나 이 프로그램은 윈도우 상에서 라테판다의 UI를 구상하는 방법으로 구동이 됩니다.<br />
보드에 실장된 D13 LED를 원격 제어해 ON/OFF 시킬 수 있으며 슬라이딩 바를 움직여 원하는 만큼 서보모터를 구동시킬 수도 있습니다.<br />
또한 PWM을 활용하여 디밍 기능을 테스트해볼 수도 있으며 D11에 연결된 고휘도 LED의 밝기가 원격 제어됨을 확인할 수 있습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-36.jpg" rel="lightbox[32475]"><img class="alignnone  wp-image-32846" alt="40 sr lattepanda  (36)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-36.jpg" width="500" /></a></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-37.jpg" rel="lightbox[32475]"><img class="alignnone  wp-image-32847" alt="40 sr lattepanda  (37)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-37.jpg" width="500" /></a></p>
<p>□ 소스코드 : 윈도기반의 전형적인 프로그램 구조답게 Form파일과 어플리케이션이 혼합되어 있어 분량이 상당히 크므로 위 웹사이트에서 확인하거나 필자의 블로그(blog.naver.com/crucian2k3)에서 확인이 가능합니다.</p>
<p><span style="color: #ff6600;font-size: small"><strong>11. 총평</strong></span></p>
<p>한마디로 라즈베리파이의 장점과 아두이노의 장점만을 뽑아서 잘 다듬어 놓은 보드란 생각이 듭니다. PC로 무엇인가를 계획하고 있는 상황이고 가격과 사이즈가 걸림돌인 상황이라면 라테판다는 충분히 고려해 볼 만한 제품이 아닌가 생각됩니다. 또한 교육현장에서 아두이노를 비롯하여 IOT과목을 가르치는 상황에서 좀 더 고수준의 임베디드 프로그래밍을 목표로 하고자 한다면 이 역시 고려해볼 만하다고 봅니다. 즉, PC와 아두이노가 한 몸에 있으므로 매우 낮은 비용으로 효과적인 교육환경을 구성할 수 있게 됩니다. 외부에 5V/2.5A전원, 키보드, 마우스 그리고 와이드모니터가 한 대 있다면 훌륭한 교육장비가 완성됩니다.<br />
이번 리뷰의 전 과정을 라테판다 상에서 작성해 본 결과 워드작업이나 웹서핑을 하는데 아무런 걸림돌이 없음을 알 수 있었습니다. 전자앨범, 동영상플레이어, 원격제어장치, 웹서버, NAS, GAME 머신 등의 용도는 실로 무궁무진할 것으로 봅니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-38.jpg" rel="lightbox[32475]"><img class="alignnone size-full wp-image-32848" alt="40 sr lattepanda  (38)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-38.jpg" width="320" height="224" /></a></p>
<p>필자가 금번에 사용한 모델은 2GB 모델로 다중작업이 아닌 상황에서는 크게 문제가 되지 않았으나 여러 창을 열고 작업을 하는 경우에는 램 부족에 따른 랙 현상이 간혹 보이는 것을 확인 하였습니다. 좀 더 쾌적한 윈도 환경을 원한다면 4GB램에 64GB모델을 검토해 보는 것이 바람직해 보입니다.<br />
퓨전이라는 말을 현대사회에서는 자주 쓰곤 합니다만 금번에 출시된 라테판다는 진정한 퓨전 IOT기기가 맞겠다고 생각합니다. 출시와 동시에 발표된 7인치 IPS LCD와 정전식 10점 터치패널의 색상과 감도는 매우 우수하여 원한다면 태블릿 기기로의 전환도 어렵지 않게 꾸밀 수 있을 것으로 생각되었습니다. 라테판다가 아두이노를 기반으로 하는 IOT세계에 신선한 기폭제가 되기를 바라며 이번 리뷰를 마칩니다. 감사합니다.</p>
<p><span style="color: #ff6600;font-size: small"><strong>자료참고</strong></span></p>
<p>1. 라테판다 공식홈페이지 : <a href="www.lattepanda.com/docs/" target="_blank">www.lattepanda.com/docs/</a><br />
2. DFROBOT 센서 : <a href="www.dfrobot.com/index.php?route=product/category&amp;path=36" target="_blank">www.dfrobot.com/index.php?route=product/category&amp;path=36</a><br />
3. 성능 비교검증 <a href="www.dfrobot.com/index.php?route=product/product&amp;product_id=1404" target="_blank">www.dfrobot.com/index.php?route=product/product&amp;product_id=1404</a><br />
4. 임베디드 공작소 : <a href="cafe.naver.com/embeddedworkshop/book4866534/1320" target="_blank">cafe.naver.com/embeddedworkshop/book4866534/1320</a><br />
5. 뚝뚝이파파님의 블로그(c#에 대한 정보) : <a href="blog.naver.com/ambidext/220210257499" target="_blank">blog.naver.com/ambidext/220210257499</a><br />
6. 가스센서에 대한 정보 : <a href="deneb21.tistory.com/279" target="_blank">deneb21.tistory.com/279</a><br />
7. PIR센서에 대한 정보 : <a href="fribot.blog.me/60203002180" target="_blank">fribot.blog.me/60203002180</a></p>
<p>&nbsp;</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-17.png" rel="lightbox[32475]"><img class="alignnone  wp-image-32826" alt="40 sr lattepanda  (17)" src="http://www.ntrexgo.com/wp-content/uploads/2016/11/40-sr-lattepanda-17.png" width="500" /></a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ntrexgo.com/archives/32475/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[37호]Genuino 101 Review</title>
		<link>http://www.ntrexgo.com/archives/31462</link>
		<comments>http://www.ntrexgo.com/archives/31462#comments</comments>
		<pubDate>Mon, 18 Jul 2016 00:55:12 +0000</pubDate>
		<dc:creator>디바이스마트 매거진</dc:creator>
				<category><![CDATA[디바이스마트 매거진]]></category>
		<category><![CDATA[스페셜 컬럼]]></category>
		<category><![CDATA[37호]]></category>
		<category><![CDATA[genuino]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[Special]]></category>
		<category><![CDATA[디바이스마트]]></category>
		<category><![CDATA[리뷰]]></category>
		<category><![CDATA[매거진]]></category>

		<guid isPermaLink="false">http://www.ntrexgo.com/?p=31462</guid>
		<description><![CDATA[디바이스마트매거진 37호 &#124; Genuino101 보드는 그간의 ATMEL사 MCU를 기반으로 하는 여러 보드들과는 다르게 인텔사의 Curie칩을 사용하여 보드가 설계되었습니다. 그 뿐만이 아니라 그간 쉴드 형태로 연결해 사용하던 블루투스 모듈과 6축 모션센서가 온보드에 장착이 되었습니다.]]></description>
				<content:encoded><![CDATA[<p><strong><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-0.jpg" rel="lightbox[31462]"><img alt="37 special review (0)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-0.jpg" width="620" /></a></strong></p>
<p><strong style="font-size: large">IOT 세계의 다크호스</strong></p>
<p><span style="font-size: xx-large"><strong>Genuino 101 Review</strong></span></p>
<p style="text-align: right">글 | 금강초롱 blog.naver.com/crucian2k3</p>
<p>  Genuino101(이하 제누이노101) 보드는 그간의 ATMEL사 MCU를 기반으로 하는 여러 보드들과는 다르게 인텔사의 Curie칩을 사용하여 보드가 설계되었습니다. 그 뿐만이 아니라 그간 쉴드 형태로 연결해 사용하던 블루투스 모듈과 6축 모션센서가 온보드에 장착이 되었습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-1.jpg" rel="lightbox[31462]"><img class="alignnone size-full wp-image-31754" alt="37 special review (1)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-1.jpg" width="620" height="384" /></a></p>
<p>그것도 그냥 있는 것이 아니라 본체 내 MCU 안에 완전히 녹아 들어가 있어 한 몸을 이루고 있기에 내장 라이브러리를 통해 손쉽게 접근이 가능한 측면이 있기는 합니다만 세상 모든 일이 그렇듯 눈여겨볼 대목도 있는 듯합니다. 즉, 온 보드에 실장 된 블루투스 모듈과 모션센서를 기반으로 만들어진 코드는 너무도 독자적이라 이식성에 문제를 야기할 수밖에 없게 됩니다. 이는 아두이노 우노 기반에서 만들어진 코드는 큰 어려움 없이 이 보드로 포팅이 될 것으로 봅니다만, 그 반대는 거의 불가능한 측면이 있게 됩니다. 한마디로 비가역적입니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-2.jpg" rel="lightbox[31462]"><img class="alignnone size-full wp-image-31755" alt="37 special review (2)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-2.jpg" width="620" height="407" /></a></p>
<p>그러함에도 이러한 보드가 출시된 것은 신선한 충격이며 이 보드를 기반으로 하는 원대한 생태계를 꿈꾸는 이들이 있음을 느끼기에 부족함이 없습니다. 블루투스 4.0 LE 기술이 내장되어 있다는 의미는 외부와 소통함을 목적으로 한다는 말과 일맥상통하며 스마트폰과 연계되어 다양한 실험을 해 볼 수 있는 환경을 만들어 준다는 의미가 되기도 합니다. 아두이노와 인텔에서 제공하는 다양한 예제 프로그램을 직접 실행 시켜 보며 어떤 특성이 있는지 살펴보고, 보드 활용을 위한 기본적인 사항들을 차근차근 더듬어 보도록 하겠습니다. 본 리뷰의 마지막 실험으로 제누이노101 보드를 비콘(BT Beacon)으로 만들고 스마트폰에 비콘을 인식할 수 있는 앱을 설치하여 제누이노101 근처에 다가가면 본 리뷰 후원사 홈페이지가 열리는 것을 시연해 보고자 합니다. 물론 얼마나 근처로 다가가면 동작되게 할 것인지? 어느 웹사이트가 열리게 할 것인지? 등등은 독자님들 마음대로 설정할 수가 있습니다. 이 글을 접하는 독자님들이 이 실험 하나만으로도 제누이노101 보드가 갖고 있는 뛰어난 하드웨어의 특성을 충분히 맛 보고도 남지 않을까 예상해 봅니다. 제누이노101 보드는 출시된 지 얼마 되지 않았을뿐더러 국내에 소개도 거의 되지 않아 해외 자료들을 다수 참고삼았습니다. 본 리뷰보고서는 (주)엔티렉스-디바이스마트의 지원을 받아 작성하게 되었습니다.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="font-size: medium;color: #ff6600"><strong>1. 개요</strong></span></p>
<p>제누이노101 보드는 인텔®큐리™칩을 기반으로 하는 보드입니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-3.jpg" rel="lightbox[31462]"><img class="alignnone size-full wp-image-31756" alt="37 special review (3)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-3.jpg" width="286" height="296" /></a></p>
<p>흔히 사용되는 ATmega328을 사용하는 아두이노 우노 계열의 보드나 ATmega 32U4를 사용하는 레오나르도 계열의 보드와는 완전히 다른 칩셋입니다. 최근에 선보인 32비트MCU가 탑재된 아두이노M0에는 SAM32D계열로서 이 역시 Atmel사 칩입니다. 인텔®큐리™칩은 기본적으로 블루투스 4.0 LE와 6축 모션센싱 기능을 원칩에 내장하고 있는 다소 독특한 칩이라고 봅니다. 이 칩에는 x86(쿼크)코어와 ARC코어를 단일화한 것으로 32Mhz의 클럭이 공급되며 연산능력은 타의 추종을 불허하는 수준으로 생각됩니다. 여기서 x86이 시사하는 바가 있습니다. 즉, 제누이노101 보드는 백그라운드에 x86을 기반으로 하는 모디파이드 된 리눅스운영체제 (RTOS)를 깔고 있으며 그 위에 아두이노 폼펙터에 충실한 하드웨어를 갖추고 있는 형상입니다. 사용자는 이 부분을 그저 블랙박스로 취급하고 아두이노향 각종 명령어들로 제누이노와 친하게 지내면 그만인 것입니다. 독자님들이 원한다면 우분투 환경에서 제누이노 펌웨어를 수정한 후 다시 업로드를 할 수도 있도록 인텔사에서는 준비를 해놓았습니다. (http://blog.naver.com/jjy0501/220235133315) 아두이노라는 브랜드는 미국에서만 사용이 가능하며 미국 이외의 국가서는 제누이노라는 상표명으로 통용이 됩니다. 두 제품명간 특성에 차이는 없습니다.</p>
<p><span style="color: #ff9900"><strong>1.1. 제누이노101 vs 아두이노M0 스펙 비교</strong></span></p>
<table style="width: 620px;background-color: #ffffff" border="1" cellspacing="0" cellpadding="3">
<tbody>
<tr>
<td style="text-align: center" rowspan="2">구분</td>
<td style="text-align: center" colspan="2">기술적 사양</td>
</tr>
<tr>
<td style="text-align: center">제누이노101(32bit MCU)</td>
<td style="text-align: center">아두이노M0(32bit MCU)</td>
</tr>
<tr>
<td style="text-align: center">마이크로컨트롤러</td>
<td style="text-align: center">인텔큐리( Intel® Curie™) 칩</td>
<td style="text-align: center">AT-SAMD21G18, 48pins LQFP</td>
</tr>
<tr>
<td style="text-align: center">작동전압</td>
<td style="text-align: center">3.3V (5V 톨러런트 I/O)</td>
<td style="text-align: center">좌동</td>
</tr>
<tr>
<td style="text-align: center">입력전압(권장)</td>
<td style="text-align: center">7 &#8211; 12V</td>
<td style="text-align: center">6 &#8211; 15 V</td>
</tr>
<tr>
<td style="text-align: center">입력전압(제한)</td>
<td style="text-align: center">7 &#8211; 20V</td>
<td style="text-align: center">4.5 &#8211; 20 V</td>
</tr>
<tr>
<td style="text-align: center">디지털 I/O핀</td>
<td style="text-align: center">20개, Digital IO 4개의 PWM 출력 and UART</td>
<td style="text-align: center">20개, Digital IO 12개의 PWM and UART</td>
</tr>
<tr>
<td style="text-align: center">아날로그 입력 핀</td>
<td style="text-align: center">6개</td>
<td style="text-align: center">좌동</td>
</tr>
<tr>
<td style="text-align: center">I/O 핀 당 DC 전류</td>
<td style="text-align: center">20mA</td>
<td style="text-align: center">7mA</td>
</tr>
<tr>
<td style="text-align: center">플래시 메모리</td>
<td style="text-align: center">196KB</td>
<td style="text-align: center">256KB(Bootloader 4KB)</td>
</tr>
<tr>
<td style="text-align: center">SRAM</td>
<td style="text-align: center">24KB</td>
<td style="text-align: center">32KB</td>
</tr>
<tr>
<td style="text-align: center">CLOCK SPEED</td>
<td style="text-align: center">32MHz</td>
<td style="text-align: center">48MHz</td>
</tr>
<tr>
<td style="text-align: center">특별기능</td>
<td style="text-align: center">블루투스 4.0 LE, 6축 가속도센서/자이로센서</td>
<td style="text-align: center">10bit DAC 1개</td>
</tr>
<tr>
<td style="text-align: center">길이</td>
<td style="text-align: center">68.6 mm</td>
<td style="text-align: center">좌동</td>
</tr>
<tr>
<td style="text-align: center">폭</td>
<td style="text-align: center">53.4 mm</td>
<td style="text-align: center">좌동</td>
</tr>
</tbody>
</table>
<p><strong><span style="color: #ff9900">1.2. 프로그램 작성</span></strong></p>
<p>제누이노101은 아두이노 IDE 1.6.7 이상에서 다른 보드들과 마찬가지로 프로그래밍이 가능합니다. 아마도 대부분의 IDE에서는 제누이노101이 기본적으로 설정되어 있지 않을 것입니다. 아래와 같이 간단하게 신규보드를 등록할 수 있습니다. ■ Arduino IDE ▶ 도구 ▶ 보드 ▶ 보드관리자로 진입해 들어갑니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-4.jpg" rel="lightbox[31462]"><img class="alignnone size-full wp-image-31757" alt="37 special review (4)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-4.jpg" width="620" height="340" /></a></p>
<p>조금 아래로 내려보면 Intel Curie Boards by Intel 버전 1.0.6이 보이며 선택을 한 후에 설치를 누르면 간단히 인텔 큐리칩이 장착된 제누이노101을 사용할 수 있게 됩니다. 다른 보드도 사용하고자 한다면 이와 같은 방법으로 간단히 등록이 가능합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-5.jpg" rel="lightbox[31462]"><img class="alignnone size-full wp-image-31758" alt="37 special review (5)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-5.jpg" width="620" height="447" /></a></p>
<p>보드와 PC간의 연결은 아두이노 우노에서와 마찬가지로 USB-B타입의 케이블로 연결되며 제누이노101은 내부에 우분투 기반의 RTOS가 돌고 있다는 점이 차이점이라면 차이점이며 그 이외는 아두이노 우노와 대동소이하다고 보면 틀림이 없습니다. 한 가지 유의할 사항이 있다면 이 보드는 3.3V 기반이므로 5V 신호를 인가하는 경우 보드에 데미지가 가해질 수 있으므로 주의를 해야 합니다.</p>
<p><span style="color: #ff9900"><strong>1.3. 전원공급</strong></span></p>
<p>제누이노101보드 역시 다른 시리즈의 아두이노와 마찬가지로 외부전원과 USB 커넥터를 통한 전원을 모두 받을 수 있으며 자동으로 선택이 됩니다. 외부전원용 커넥터는 2.1mm DC어댑터용 플러그로 구성되어 있으며 중심축이 +전원입니다. 필자의 경험상 아두이노 계열의 보드를 사용하면서 정말로 주의해야하는 사항이 있습니다. 바로 보드에 나와 있는 Vin, 5V, 3.3V 핀과 관련된 사항으로 이 단자는 반드시 출력용으로만 사용이 되어져야 합니다. USB 커넥터를 꽂거나 혹은 외부전원을 DC 플러그를 통해 연결하면 위 3개의 단자에는 5V와 3.3V가 나오게 됩니다. 이 전원은 다른 보드를 동작시키기 위해 보드 내부의 레귤레이터에서 생산한 전기이며, 만일 외부에서 이 전압을 만들어 역으로 인가하게 되면 보드내부의 소자에 심각한 데미지를 입히게 됩니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-6.jpg" rel="lightbox[31462]"><img class="alignnone size-full wp-image-31759" alt="37 special review (6)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-6.jpg" width="226" height="335" /></a></p>
<p>전기와 관련된 사항을 부주의하게 여기면 당장 보드손상이라는 낙심은 물론이고 화재 등과도 연결될 수 있는 중요한 사안이라고 생각합니다. 내장된 3.3V 레귤레이터는 최대 1.5A까지를 흘릴 수 있으며 IOREF 핀을 통해 보드의 I/O가 몇 볼트의 전압에서 동작되고 있는지를 감지하여 적절한 목적으로 운영될 수 있도록 정보를 제공해 줍니다. 이 핀에서는 당연히 3.3V가 나옵니다.</p>
<p><span style="color: #ff9900"><strong>1.4. 메모리</strong></span></p>
<p>내장된 메모리는 2개의 마이크로컨트롤러에서 공유하여 사용되며 플래시메모리는 총 384KB이나, 스케치에서 196KB만 사용이 가능합니다. 없어진 188KB는 백그라운드에서 리눅스기반의 RTOS가 점유하고 있습니다. 다음으로 SRAM은 총 80KB가 내장되어 있으나 스케치를 위해서는 4KB가 사용이 가능합니다. 나머지 역시 내장 OS에서 점유되어 사용되고 있습니다. 제누이노101은 인텔사에서 아주 작정을 하고 많은 투자가 있었음을 알 수 있는 대목입니다. 이 보드를 위해 운영체제까지 새롭게 디자인 한 것으로 보입니다.</p>
<p><span style="color: #ff9900"><strong>1.5. 시그널 입·출력</strong></span></p>
<p>제누이노101은 아두이노 우노 기반의 폼팩터를 그대로 계승하여 총 20개의 GPIO(General Purpose I/O)핀을 제공하고 있습니다. 다른 보드들과 마찬가지로 pinMode(), digitalWrite(), digitalRead() 함수를 통해 기본적인 신호 입출력이 이뤄집니다. 또한 핀 3, 5, 6, 9 등 4개는 analogWrite()함수를 통해 PWM출력을 내보낼 수 있으며 모든 핀들은 3.3V에 최대 20mA를 입출력(source or sink)할 수 있습니다.</p>
<p><strong>■ 각 핀들의 기능 정리</strong></p>
<table style="width: 620px" border="1" cellspacing="0" cellpadding="3">
<tbody>
<tr>
<td style="text-align: center">포트</td>
<td style="text-align: center">세부사항</td>
</tr>
<tr>
<td style="text-align: center">Serial 포트</td>
<td>■ 아두이노 우노의 폼팩터를 그대로 계승하여 D0이 RX, D1이 TX이며 TTL 시리얼데이터를 송수신 할 수 있음 ■ Serial1 클래스를 사용하면 pin0(Rx), pin1(Tx)를 사용할 수 있음 ■ 기본적으로 USB CDC채널을 통한 가상 시리얼 통신은 물론 UART 타입의 Serial도 동시에 사용할 수 있음. 이는 제누이노101, 아두이노 M0 등에서는 공통으로 제공되는 기능으로 보드의 유용함을 배가시켜 줌</td>
</tr>
<tr>
<td style="text-align: center">External Interrupt</td>
<td>■ 모든 핀에서 외부 인터럽트 소스를 처리할 수 있습니다만 CHANGE인터럽트를 쓰고자 한다면 핀 2, 5, 7, 8, 10, 11, 12, 13을 사용해야 함 ■ 인터럽트는 attachInterrupt() 함수를 통해 사용할 수 있음</td>
</tr>
<tr>
<td style="text-align: center">SPI</td>
<td>■ 보드 하부에 위치한 2.54mm 헤더핀에 SPI 관련 신호가 나와 있으며 SS, MOSI, MISO, SCK 핀 등으로 구성되어 있음 ■ 고속으로 I/O가 필요한 SD메모리카드, Color TFT LCD제어 등에 유용하게 사용될 수 있음</td>
</tr>
<tr>
<td style="text-align: center">LED</td>
<td>■ 녹색LED가 D13에 연결되어 있으며 High에서 ON, Low에서 OFF됨 ■ 보드의 동작 상태를 모니터링 하거나 간단한 실험에 사용됨</td>
</tr>
<tr>
<td style="text-align: center">Analog</td>
<td>■ 아나로그 입력핀은 A0~A5까지 총 6개가 구비되어 있으며 10비트 해상도를 갖고 있음. 따라서 0~1023까지 총 1024스탭으로 아날로그 시그널을 분해할 수 있음 ■ 레퍼런스 전압은 기본적으로 3.3V</td>
</tr>
<tr>
<td style="text-align: center">TWI</td>
<td>■ I2C라고도 부르는 TWI는 SDA 핀과 SCL 핀을 사용하며 Wire 라이브러리를 통해 손쉽게 이용이 가능함</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><span style="font-size: medium;color: #ff6600"><strong>2. 아두이노 / Genuino 101 시작하기</strong></span></p>
<p>이제 제누이노101보드를 사용하여 실제로 동작을 시켜보면서 어떤 특성이 있는지 하나하나 살펴보도록 하겠습니다. 인텔 큐리칩의 최대 장점은 저소비전력과 블루투스 4.0 LE, 6축 모션센서가 단일칩에 내장된 것이라고 할 수 있겠습니다. 얼핏 생각해봐도 스마트폰과 연계하여 재미난 것들을 많이 해볼 수 있을 것 같습니다. 아두이노 본사 홈페이지, 인텔사 홈페이지와 포럼에 올라와 있는 여러 가지 예제와 사례들을 참조하여 이렇게 갖고 놀 수 있겠구나 하는 것을 본격적으로 보여 드리고자 합니다. 이 제품이 갖는 한 가지 유의사항은 스케치가 로딩되고 난 후에 곧장 실행되는 것이 아니라 약간의 뜸 들이는 시간이 걸린다는 것입니다. (약 10초) 지금부터 다룰 내용들은 처음 아두이노를 접하는 분들은 좀 난이도가 있을 수도 있을 듯합니다. 아두이노 세계를 완전히 처음 접하는 독자님들은 아두이노 우노 시리즈부터 시작하시길 권장합니다.</p>
<p><span style="color: #ff9900"><strong>2.1. 제누이노101과 우노의 간략 차이점 비교</strong></span></p>
<table style="width: 620px" border="1" cellspacing="0" cellpadding="3">
<tbody>
<tr>
<td style="text-align: center">구분</td>
<td style="text-align: center">아두이노 우노</td>
<td style="text-align: center">제누이노 101</td>
</tr>
<tr>
<td style="text-align: center">마이크로컨트롤러</td>
<td style="text-align: center">ATmega328</td>
<td style="text-align: center">Intel® Curie™</td>
</tr>
<tr>
<td style="text-align: center">동작전압</td>
<td style="text-align: center">5V</td>
<td style="text-align: center">3.3V</td>
</tr>
<tr>
<td style="text-align: center">USB 가상시리얼포트</td>
<td style="text-align: center" rowspan="2">Serial class</td>
<td style="text-align: center">Serial class (USB To Serial 회로 불필요)</td>
</tr>
<tr>
<td style="text-align: center">H/W 시리얼포트</td>
<td style="text-align: center">Serial1 class</td>
</tr>
<tr>
<td style="text-align: center">SoftWare 시리얼 장치</td>
<td style="text-align: center">최고속도 38,400bps</td>
<td style="text-align: center">최고속도 57,600bps</td>
</tr>
<tr>
<td style="text-align: center">온보드 주변장치</td>
<td style="text-align: center">-</td>
<td style="text-align: center">블루투스 4.0 LE 6축 모션센서 (자이로스코프 3축, 가속도센서 3축)</td>
</tr>
<tr>
<td style="text-align: center">특별 라이브러리</td>
<td style="text-align: center">-</td>
<td style="text-align: center">CurieBLE (Bluetooth Low Energy module 제어) CurieIMU(6-axis 가속도센서, 자이로센서 제어) Curie Timer One (Timer 함수)</td>
</tr>
</tbody>
</table>
<p><strong style="color: #ff9900">2.2. 업로드 절차</strong></p>
<p>스케치가 보드에 업로드 후 실행을 시작하기 전에, 몇 초 정도의 지연이 있습니다. 전원이 새롭게 인가되거나 ResetM 버튼을 누를 때도 똑같습니다. 이때는 시리얼 모니터를 열어도 열리지 않게 됩니다. 이 시간은 넉넉잡아 10초 가량 됩니다. 제누이노101 내부적으로 RTOS가 돌고 있음에 따라 발생되는 현상으로 생각됩니다. 이는 제조사에서 이러한 특성을 보인다고 공개한 사항이므로 특별히 문제가 있는 것은 아니라고 봅니다. 프로그램이 시리얼창이 열린 후 구동되게 하고자 할 때는 setup()에 다음 코드를 추가 한다.</p>
<div class="symple-box gray none" style="text-align:left; width:100%;"> 
<p>while (!Serial) ;</p>
</div>
<p><span style="color: #ff6600;font-size: medium"><strong>3. 제누이노101을 활용한 실험환경 구성하기</strong></span></p>
<p>제조사에서 예제로 제시해 준 프로그램을 중심으로 특수한 주변기기인 모션센서, 블루투스 4.0 LE 모듈 등을 테스트 해보기로 하겠습니다. 이 예제를 따라해 보시면 이렇게 할 수 있겠구나 하는 생각이 드실 것으로 봅니다.</p>
<p><span style="color: #ff9900"><strong>3.1. CurieIMU 라이브러리 기반 모션센서 움직임 표출하기</strong></span></p>
<p>모션센서하면 MPU6050을 떠올릴 수 있습니다만 이 센서를 능가하는 모션센서가 우리의 제누이노101 보드상 큐리칩에는 내장을 하고 있습니다. 이 데모는 제누이노101보드의 큐리칩에 기본적으로 내장되어 있는 6축 가속도, 자이로센서의 값을 읽어 표출하는 것입니다. 여기서 가속도계는 보드의 움직이는 방향정보를 제공하고, 자이로센서는 각속도를 제공해 줍니다. 이 가속도계와 자이로센서를 융합하여 IMU(Intertial Monitoring Unit : 관성측정장치)를 형성하게 됩니다. 예제에 사용된 Madgwick 필터 알고리즘은 6축의 값에서 쿼터니언(4원수) 계산에 사용되게 됩니다. 쿼터니언은 Pitch, Roll, Yaw 등 각도 계산에 사용되며 결국은 X, Y, Z축 주위의 물체 회전이 일어난 정도를 알 수 있게 해 줍니다.</p>
<table style="width: 620px" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-7.jpg" rel="lightbox[31462]"><img class="size-full wp-image-31760 aligncenter" alt="37 special review (7)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-7.jpg" width="357" height="226" /></a></td>
</tr>
<tr>
<td style="text-align: center">[MPU-6050 가속도 자이로센서 모듈</td>
</tr>
</tbody>
</table>
<p><span style="color: #ff9900"><strong>3.2. 실험절차</strong></span></p>
<p>제누이노101보드를 준비한 다음 라이브러리 관리자에서 Madgwick 라이브러리를 설치합니다. (아두이노IDE &gt; 스케치 &gt; 라이브러리추가 &gt; 라이브러리관리) 다음으로 PC에서 눈으로 볼 수 있도록 프로세싱 프로그램을 설치해야 합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-8.jpg" rel="lightbox[31462]"><img class="alignnone size-full wp-image-31761" alt="37 special review (8)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-8.jpg" width="620" height="396" /></a></p>
<p>프로세싱 프로그램은 https://processing.org/download/에서 다운받으면 됩니다. 제누이노101 라이브러리는 https://github.com/01org/corelibs-arduino101에서 다운받아 라이브러리에 등록하면 됩니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-9.jpg" rel="lightbox[31462]"><img class="alignnone size-full wp-image-31762" alt="37 special review (9)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-9.jpg" width="620" height="338" /></a>   <a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-10.jpg" rel="lightbox[31462]"><img class="alignnone size-full wp-image-31763" alt="37 special review (10)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-10.jpg" width="620" height="319" /></a></p>
<p><span style="color: #ff6600;font-size: medium"><strong>4. (예제1) 모션센서 시각화</strong></span></p>
<p><strong><span style="color: #ff9900">4.1. 제누이노101용 소스코드</span></strong></p>
<p>Madgwick 필터를 사용하여 프로세싱 상에서 동작 상태를 모니터링 하는 예제입니다.</p>
<p><strong>ㅇ 파일명 : IMU_OrientationVisualiser.ino</strong></p>
<div class="symple-box gray none" style="text-align:left; width:100%;"> 
<p>===============================================<br />
Example sketch for CurieIMU library for Intel(R) Curie(TM) devices.<br />
Copyright (c) 2015 Intel Corporation. All rights reserved.</p>
<p>Based on I2C device class (I2Cdev) demonstration Arduino sketch for MPU6050<br />
class by Jeff Rowberg: https://github.com/jrowberg/i2cdevlib</p>
<p>===============================================<br />
I2Cdev device library code is placed under the MIT license<br />
Copyright (c) 2011 Jeff Rowberg</p>
<p>Permission is hereby granted, free of charge, to any person obtaining a copy<br />
of this software and associated documentation files (the “Software”), to deal<br />
in the Software without restriction, including without limitation the rights<br />
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell<br />
copies of the Software, and to permit persons to whom the Software is<br />
furnished to do so, subject to the following conditions:</p>
<p>The above copyright notice and this permission notice shall be included in<br />
all copies or substantial portions of the Software.</p>
<p>THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br />
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br />
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE<br />
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br />
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,<br />
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN<br />
THE SOFTWARE.<br />
===============================================</p>
<p>Genuino 101 CurieIMU Orientation Visualiser<br />
Hardware Required:<br />
* Arduino/Genuino 101</p>
<p>Modified Nov 2015<br />
by Helena Bisby &lt;support@arduino.cc&gt;<br />
This example code is in the public domain</p>
<p>http://arduino.cc/en/Tutorial/Genuino101CurieIMUOrientationVisualiser</p>
<p>*/</p>
<p>#include &lt;CurieIMU.h&gt;<br />
#include &lt;MadgwickAHRS.h&gt;</p>
<p>Madgwick filter; // Madgwick 객체를 생성해 냅니다.<br />
int ax, ay, az;<br />
int gx, gy, gz;<br />
float yaw;<br />
float pitch;<br />
float roll;<br />
int factor = 800; // 감도 조절을 위해 자이로스코프의 원래 값을 나눠준다.<br />
// 시리얼 보레이트를 올리면 이 값도 변경시킨다.</p>
<p>int calibrateOffsets = 1; // 캘리브레이션을 할지 말지 설정</p>
<p>void setup() {<br />
Serial.begin(9600); // 시리얼 통신 초기화</p>
<p>CurieIMU.begin(); // 장치 초기화</p>
<p>if (calibrateOffsets == 1) {<br />
//자이로와 가속도센서의 오프셋을 설정하는 기능<br />
Serial.println(“Internal sensor offsets BEFORE calibration&#8230;”);<br />
Serial.print(CurieIMU.getAccelerometerOffset(X_AXIS)); Serial.print(“\t”);<br />
Serial.print(CurieIMU.getAccelerometerOffset(Y_AXIS)); Serial.print(“\t”);<br />
Serial.print(CurieIMU.getAccelerometerOffset(Z_AXIS)); Serial.print(“\t”);<br />
Serial.print(CurieIMU.getGyroOffset(X_AXIS)); Serial.print(“\t”);<br />
Serial.print(CurieIMU.getGyroOffset(Y_AXIS)); Serial.print(“\t”);<br />
Serial.print(CurieIMU.getGyroOffset(Z_AXIS)); Serial.print(“\t”);<br />
Serial.println(“”);</p>
<p>// To manually configure offset compensation values, use the following methods instead of the autoCalibrate&#8230;() methods below<br />
// CurieIMU.setGyroOffset(X_AXIS, 220);<br />
// CurieIMU.setGyroOffset(Y_AXIS, 76);<br />
// CurieIMU.setGyroOffset(Z_AXIS, -85);<br />
// CurieIMU.setAccelerometerOffset(X_AXIS, -76);<br />
// CurieIMU.setAccelerometerOffset(Y_AXIS, -235);<br />
// CurieIMU.setAccelerometerOffset(Z_AXIS, 168);</p>
<p>// 올바로 오프셋이 설정되기 위해서는 제누이노보드가 수평으로 유지되어 있어야 한다.<br />
Serial.print(“Starting Gyroscope calibration&#8230;”);<br />
CurieIMU.autoCalibrateGyroOffset();<br />
Serial.println(“ Done”);<br />
Serial.print(“Starting Acceleration calibration&#8230;”);<br />
CurieIMU.autoCalibrateAccelerometerOffset(X_AXIS, 0);<br />
CurieIMU.autoCalibrateAccelerometerOffset(Y_AXIS, 0);<br />
CurieIMU.autoCalibrateAccelerometerOffset(Z_AXIS, 1);<br />
Serial.println(“ Done”);</p>
<p>Serial.println(“Internal sensor offsets AFTER calibration&#8230;”);<br />
Serial.print(CurieIMU.getAccelerometerOffset(X_AXIS)); Serial.print(“\t”);<br />
Serial.print(CurieIMU.getAccelerometerOffset(Y_AXIS)); Serial.print(“\t”);<br />
Serial.print(CurieIMU.getAccelerometerOffset(Z_AXIS)); Serial.print(“\t”);<br />
Serial.print(CurieIMU.getAccelerometerOffset(X_AXIS)); Serial.print(“\t”);<br />
Serial.print(CurieIMU.getAccelerometerOffset(Y_AXIS)); Serial.print(“\t”);<br />
Serial.print(CurieIMU.getAccelerometerOffset(Z_AXIS)); Serial.print(“\t”);<br />
Serial.println(“”);<br />
}<br />
}</p>
<p>void loop() {<br />
// 가속도와 자이로센서로부터 원시데이터를 읽어 온다.<br />
CurieIMU.readMotionSensor(ax, ay, az, gx, gy, gz);</p>
<p>// MagdwickAHRS.h 함수를 통해 쿼터니언을 계산하여 가져온다.<br />
filter.updateIMU(gx / factor, gy / factor, gz / factor, ax, ay, az);</p>
<p>// 쿼터니언으로부터 yaw, roll, pitch를 계산해낸다.<br />
yaw = filter.getYaw();<br />
roll = filter.getRoll();<br />
pitch = filter.getPitch();</p>
<p>// print gyro and accel values for debugging only, comment out when running Processing<br />
/*<br />
Serial.print(ax); Serial.print(“\t”);<br />
Serial.print(ay); Serial.print(“\t”);<br />
Serial.print(az); Serial.print(“\t”);<br />
Serial.print(gx); Serial.print(“\t”);<br />
Serial.print(gy); Serial.print(“\t”);<br />
Serial.print(gz); Serial.print(“\t”);<br />
Serial.println(“”);<br />
*/</p>
<p>if (Serial.available() &gt; 0) {<br />
int val = Serial.read();<br />
if (val == ‘s’) { // 시리얼 포트로 “s”라는 문자가 오는지 체크. 즉 프로세싱코드에서 보내야함<br />
Serial.print(yaw);<br />
Serial.print(“,”); // 콤마가 구분자로 사용된다.<br />
Serial.print(pitch);<br />
Serial.print(“,”); // 콤마가 구분자로 사용된다.<br />
Serial.println(roll);<br />
}<br />
}<br />
}</p>
</div>
<p><span style="color: #ff9900"><strong>4.2. 프로세싱용 소스코드</strong></span></p>
<p>아래 파일은 PC상에서 프로세싱을 실행시킨 후 불러들이면 3D애니메이션으로 된 제누이노101 보드가 보입니다.</p>
<p><strong>ㅇ 파일명 : IMU_OrientationVisualiser_Processing.pde</strong></p>
<div class="symple-box gray none" style="text-align:left; width:100%;"> 
<p>import processing.serial.*;<br />
Serial myPort;</p>
<p>int newLine = 13; // new line character in ASCII<br />
float yaw;<br />
float pitch;<br />
float roll;<br />
String message;<br />
String [] ypr = new String [3];</p>
<p>void setup()<br />
{<br />
size(600, 500, P3D);</p>
<p>/*자신의 제누이노보드의 통신속도와 PC의 포트번호를 참조하여 설정한다.*/<br />
//myPort = new Serial(this, Serial.list()[0], 9600); // if you have only ONE COM port active<br />
myPort = new Serial(this, &#8220;COM51&#8243;, 9600); // if you know the 101 COM port</p>
<p>textSize(16); // set text size<br />
textMode(SHAPE); // set text mode to shape<br />
}</p>
<p>void draw()<br />
{<br />
serialEvent(); // read and parse incoming serial message<br />
background(255); // set background to white</p>
<p>translate(width/2, height/2); // set position to centre</p>
<p>pushMatrix(); // begin object</p>
<p>rotateX(pitch); // RotateX pitch value<br />
rotateY(-yaw); // yaw<br />
rotateZ(-roll); // roll</p>
<p>drawArduino(); // function to draw rough Arduino shape</p>
<p>popMatrix(); // end of object</p>
<p>// Print values to console<br />
print(pitch);<br />
print(&#8220;\t&#8221;);<br />
print(roll);<br />
print(&#8220;\t&#8221;);<br />
print(-yaw);<br />
println(&#8220;\t&#8221;);</p>
<p>myPort.write(&#8220;s&#8221;); // &#8220;s&#8221;를 제누이노 보드로 보내 다음 문자를 받아 들인다.<br />
}</p>
<p>void serialEvent()<br />
{<br />
message = myPort.readStringUntil(newLine); // read from port until new line (ASCII code 13)<br />
if (message != null) {<br />
ypr = split(message, &#8220;,&#8221;); // split message by commas and store in String array<br />
yaw = float(ypr[0]); // convert to float yaw<br />
pitch = float(ypr[1]); // convert to float pitch<br />
roll = float(ypr[2]); // convert to float roll<br />
}<br />
}</p>
<p>void drawArduino() {<br />
/* function contains shape(s) that are rotated with the IMU */<br />
stroke(0, 90, 90); // set outline colour to darker teal<br />
fill(0, 130, 130); // set fill colour to lighter teal<br />
box(300, 10, 200); // draw Arduino board base shape</p>
<p>stroke(0); // set outline colour to black<br />
fill(80); // set fill colour to dark grey</p>
<p>translate(60, -10, 90); // set position to edge of Arduino box<br />
box(170, 20, 10); // draw pin header as box</p>
<p>translate(-20, 0, -180); // set position to other edge of Arduino box<br />
box(210, 20, 10); // draw other pin header as box<br />
}</p>
<p>출처 : https://www.arduino.cc/en/Tutorial/Genuino101CurieIMUOrientationVisualiser</p>
</div>
<p><strong style="color: #ff9900">4.3. 동작화면</strong></p>
<table style="width: 620px" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><img class="alignnone size-full wp-image-31764" alt="37 special review (11)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-11.jpg" width="620" height="451" /></td>
</tr>
<tr>
<td style="text-align: center">프로세싱 동작화면</td>
</tr>
</tbody>
</table>
<table style="width: 620px" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-12.jpg" rel="lightbox[31462]"><img class="alignnone size-full wp-image-31765" alt="37 special review (12)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-12.jpg" width="620" height="296" /></a></td>
</tr>
<tr>
<td style="text-align: center">그래픽 구현장면</td>
</tr>
</tbody>
</table>
<p><strong style="color: #ff9900">4.4. 작동 원리</strong></p>
<p>Madgwick 필터 알고리즘은 오픈 소스이며, Madgwick의 논문에 잘 서술이 되어있다고 합니다. Madgwick 필터 알고리즘은 세바스찬 Madgwick에 의해 2010년에 개발되었습니다. 이 알고리즘은 낮은 샘플링 속도에서도 효율적으로 동작되도록 설계되어 있습니다.</p>
<p>프로세싱 쪽에서 ‘s’ 문자를 송신하면 제누이노101에서는 yaw, pitch, roll값을 차례로 보내도록 프로토콜이 만들어져 있습니다. 이러한 체계는 예제를 위해 간이로 만들어진 것이며 제대로 사용되기 위해서는 에러 처리 작업 등이 필요합니다. 실제 동작되는 동영상은 제 블로그를 통해서도 보실 수 있을 것입니다.</p>
<p>(Madgwick 필터 알고리즘 오픈 소스는 http://www.x-io.co.uk/res/doc/madgwick_internal_report.pdf에서 볼 수 있습니다.)</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="color: #ff6600;font-size: medium"><strong>5. (예제2) Curie IMU IMU 정보 그래프로 표출</strong></span></p>
<p>자이로센서와 가속도센서의 값 6개를 시리얼 포트로 출력한 후에 시리얼 오실로스코프로 관찰을 해보도록 합니다.</p>
<p><span style="color: #ff9900"><strong>5.1. 시리얼오실로스코프 설치하기</strong></span> 시리얼 오실로스코프 프로그램은 오픈소스기반의 프로그램으로서 최대 9채널의 값을 그래프로 표현해 낼 수 있습니다. 시리얼 오실로스코프프로그램을 아래에서 다운로드 받습니다.</p>
<p><strong>ㅇ https://github.com/xioTechnologies/Serial-Oscilloscope</strong></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-13.jpg" rel="lightbox[31462]"><img class="alignnone size-full wp-image-31766" alt="37 special review (13)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-13.jpg" width="620" height="275" /></a></p>
<p><span style="color: #ff9900"><strong>5.2. 시리얼오실스코프 간단한 사용법</strong></span></p>
<p><strong>ㅇ 시리얼로 보낼 때 기본원칙 : &#8220;11,22,33\r&#8221;</strong></p>
<p>위와 같은 데이터를 시리얼 오실로스코프로 보내면 CH1에는 11, CH2에는 22, CH3에는 33이 들어가게 됩니다. 즉 데이터 구분자가 콤마가 되게 됩니다.</p>
<p><strong>ㅇ 기본설정 순서</strong></p>
<p>Baud rate 설정 ⇒ Serial Port 설정 ⇒ Osciloscope를 선택하여 데이터 3개 이하가 콤마로 구분되어 전송되어 온다면 “Channels 1, 2, and 3&#8243;을 선택하면 됩니다. 선택 시 보이는 UI는 다음과 같이 조절합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-14.jpg" rel="lightbox[31462]"><img class="alignnone size-full wp-image-31767" alt="37 special review (14)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-14.jpg" width="620" height="275" /></a></p>
<p>&nbsp;</p>
<p><span style="color: #ff9900"><strong>5.3. 소스코드</strong></span></p>
<div class="symple-box gray none" style="text-align:left; width:100%;"> 
<p>===============================================<br />
Example sketch for CurieIMU library for Intel(R) Curie(TM) devices.<br />
Copyright (c) 2015 Intel Corporation. All rights reserved.<br />
Based on I2C device class (I2Cdev) demonstration Arduino sketch for MPU6050<br />
class by Jeff Rowberg: https://github.com/jrowberg/i2cdevlib<br />
===============================================<br />
I2Cdev device library code is placed under the MIT license<br />
Copyright (c) 2011 Jeff Rowberg</p>
<p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &#8220;Software&#8221;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p>
<p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p>
<p>THE SOFTWARE IS PROVIDED &#8220;AS IS&#8221;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.<br />
===============================================</p>
<p>#include &#8220;CurieIMU.h&#8221;<br />
int ax, ay, az; // accelerometer values<br />
int gx, gy, gz; // gyrometer values</p>
<p>const int ledPin = 13; // activity LED pin<br />
boolean blinkState = false; // state of the LED</p>
<p>int calibrateOffsets = 1; // int to determine whether calibration takes place or not</p>
<p>void setup() {<br />
Serial.begin(9600); // initialize Serial communication<br />
while (!Serial); // wait for the serial port to open</p>
<p>// initialize device<br />
Serial.println(&#8220;Initializing IMU device&#8230;&#8221;);<br />
CurieIMU.begin();</p>
<p>// verify connection<br />
Serial.println(&#8220;Testing device connections&#8230;&#8221;);<br />
if (CurieIMU.begin()) {<br />
Serial.println(&#8220;CurieIMU connection successful&#8221;);<br />
} else {<br />
Serial.println(&#8220;CurieIMU connection failed&#8221;);<br />
}</p>
<p>// use the code below to calibrate accel/gyro offset values<br />
if (calibrateOffsets == 1) {<br />
Serial.println(&#8220;Internal sensor offsets BEFORE calibration&#8230;&#8221;);<br />
Serial.print(CurieIMU.getAccelerometerOffset(X_AXIS));<br />
Serial.print(&#8220;\t&#8221;); // -76<br />
Serial.print(CurieIMU.getAccelerometerOffset(Y_AXIS));<br />
Serial.print(&#8220;\t&#8221;); // -235<br />
Serial.print(CurieIMU.getAccelerometerOffset(Z_AXIS));<br />
Serial.print(&#8220;\t&#8221;); // 168<br />
Serial.print(CurieIMU.getGyroOffset(X_AXIS));<br />
Serial.print(&#8220;\t&#8221;); // 0<br />
Serial.print(CurieIMU.getGyroOffset(Y_AXIS));<br />
Serial.print(&#8220;\t&#8221;); // 0<br />
Serial.println(CurieIMU.getGyroOffset(Z_AXIS));</p>
<p>// To manually configure offset compensation values,<br />
// use the following methods instead of the autoCalibrate&#8230;() methods below<br />
//CurieIMU.setAccelerometerOffset(X_AXIS,495.3);<br />
//CurieIMU.setAccelerometerOffset(Y_AXIS,-15.6);<br />
//CurieIMU.setAccelerometerOffset(Z_AXIS,491.4);<br />
//CurieIMU.setGyroOffset(X_AXIS,7.869);<br />
//CurieIMU.setGyroOffset(Y_AXIS,-0.061);<br />
//CurieIMU.setGyroOffset(Z_AXIS,15.494);</p>
<p>Serial.println(&#8220;About to calibrate. Make sure your board is stable and upright&#8221;);<br />
delay(5000);</p>
<p>// The board must be resting in a horizontal position for<br />
// the following calibration procedure to work correctly!<br />
Serial.print(&#8220;Starting Gyroscope calibration and enabling offset compensation&#8230;&#8221;);<br />
CurieIMU.autoCalibrateGyroOffset();<br />
Serial.println(&#8221; Done&#8221;);</p>
<p>Serial.print(&#8220;Starting Acceleration calibration and enabling offset compensation&#8230;&#8221;);<br />
CurieIMU.autoCalibrateAccelerometerOffset(X_AXIS, 0);<br />
CurieIMU.autoCalibrateAccelerometerOffset(Y_AXIS, 0);<br />
CurieIMU.autoCalibrateAccelerometerOffset(Z_AXIS, 1);<br />
Serial.println(&#8221; Done&#8221;);<br />
Serial.println(&#8220;Internal sensor offsets AFTER calibration&#8230;&#8221;);<br />
Serial.print(CurieIMU.getAccelerometerOffset(X_AXIS));<br />
Serial.print(&#8220;\t&#8221;); // -76<br />
Serial.print(CurieIMU.getAccelerometerOffset(Y_AXIS));<br />
Serial.print(&#8220;\t&#8221;); // -2359<br />
Serial.print(CurieIMU.getAccelerometerOffset(Z_AXIS));<br />
Serial.print(&#8220;\t&#8221;); // 1688<br />
Serial.print(CurieIMU.getGyroOffset(X_AXIS));<br />
Serial.print(&#8220;\t&#8221;); // 0<br />
Serial.print(CurieIMU.getGyroOffset(Y_AXIS));<br />
Serial.print(&#8220;\t&#8221;); // 0<br />
Serial.println(CurieIMU.getGyroOffset(Z_AXIS));<br />
}</p>
<p>// configure Arduino LED for activity indicator<br />
pinMode(ledPin, OUTPUT);<br />
}</p>
<p>void loop() {<br />
// read raw accel/gyro measurements from device<br />
CurieIMU.readMotionSensor(ax, ay, az, gx, gy, gz);</p>
<p>// these methods (and a few others) are also available</p>
<p>//CurieIMU.readAcceleration(ax, ay, az);<br />
//CurieIMU.readRotation(gx, gy, gz);</p>
<p>//ax = CurieIMU.readAccelerometer(X_AXIS);<br />
//ay = CurieIMU.readAccelerometer(Y_AXIS);<br />
//az = CurieIMU.readAccelerometer(Z_AXIS);<br />
//gx = CurieIMU.readGyro(X_AXIS);<br />
//gy = CurieIMU.readGyro(Y_AXIS);<br />
//gz = CurieIMU.readGyro(Z_AXIS);</p>
<p>// display tab-separated accel/gyro x/y/z values<br />
// Serial.print(&#8220;a/g:\t&#8221;);<br />
Serial.print(ax);<br />
Serial.print(&#8220;\t&#8221;);<br />
Serial.print(ay);<br />
Serial.print(&#8220;\t&#8221;);<br />
Serial.print(az);<br />
Serial.print(&#8220;\t&#8221;);<br />
Serial.print(gx);<br />
Serial.print(&#8220;\t&#8221;);<br />
Serial.print(gy);<br />
Serial.print(&#8220;\t&#8221;);<br />
Serial.println(gz);</p>
<p>// blink LED to indicate activity<br />
blinkState = !blinkState;<br />
digitalWrite(ledPin, blinkState);<br />
}<br />
</div><span style="font-size: large"><strong><br />
</strong></span></p>
<p><strong><span style="color: #ff9900"> 6.1. 동작화면</span></strong></p>
<table style="width: 620px" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><img class="alignnone size-large wp-image-31768" alt="37 special review (15)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-15-620x479.jpg" width="620" height="479" /></td>
</tr>
<tr>
<td>① 제누이노101 개발중 스케치화면<br />
② 시리얼모니터화면<br />
③ 시리얼오실로스코프 메인화면</td>
</tr>
</tbody>
</table>
<table style="width: 620px" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td> <a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-sr-66.jpg" rel="lightbox[31462]"><img class="alignnone size-large wp-image-31789" alt="37 sr 66" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-sr-66-620x480.jpg" width="620" height="480" /></a></td>
</tr>
<tr>
<td>④ CH1∼3  - Red : ax &#8211; Green : ay &#8211; Blue : az<br />
⑤ CH4∼6  - Red : gx &#8211; Green : gy &#8211; Blue : gz</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>기본적인 동작은 MPU6050을 사용하는 것과 견주어 봐도 별 차이가 없습니다. 다만 차이가 있다는 점은 MPU6050을 사용할 때는 TWI통신을 하여야 하는데 제누이노101에서는 인스턴스만 생성해 주는 것으로 간단히 마무리할 수 있습니다.</p>
<p><span style="color: #ff9900"><strong>6.2. (예제3) CurieBLE</strong><strong> 라이브러리</strong><strong> </strong><strong>기반 스마트폰으로 LED 제어하기</strong></span></p>
<p>제누이노101 보드에 내장된 블루투스 통신기능을 활용하여 스마트폰의 명령에 따라 보드의 LED를 점멸하는 테스트를 해보고자 합니다. HC-05 등 아두이노의 블루투스 실험에서 많이 등장하는 모듈이 있기는 합니다만 온보드로 되어 있는 블루투스 모듈은 상당한 접근 편리성을 제공해 준다고 볼 수 있습니다. 큐리칩에 내장되어 있으므로 시리얼, TWI, SPI 등의 통신과정 없이 직접 접근이 이뤄지게 됩니다. 이 점이 좀 생소할 수는 있겠습니다만 제누이노101과 친해 지려면 열심히 적응해야지 별 수 없습니다.</p>
<p><span style="color: #ff9900"><strong>6.3. 실험을 위한 사전준비</strong></span></p>
<p>우선 스마트폰(안드로이드 or 아이폰)과 제누이노101 보드를 준비합니다. 스크래치쪽 프로그램에서는 아래와 같은 함수와 라이브러리들이 동원됩니다. 다음으로 스마트폰에도 약간의 준비가 필요합니다.</p>
<table style="width: 620px" border="1" cellspacing="0" cellpadding="3">
<tbody>
<tr>
<td>구분</td>
<td>파일 &amp; 함수명</td>
<td>비고</td>
</tr>
<tr>
<td>라이브</td>
<td>CurieBLE.h</td>
<td>블루투스에 접근하기위한 라이브러리</td>
</tr>
<tr>
<td></td>
<td>blePeripheral- ConnectHandler()</td>
<td>블루투스로 연결을 처리하는 함수 연결시 LED를 점등 시킨다.&nbsp;</p>
<p>시리얼 모니터로도 메시지를 내보낸다.</td>
</tr>
<tr>
<td>함수</td>
<td>blePeripheral- DisconnectHandler()</td>
<td>연결을 중지시킨다.<br />
시리얼 모니터로도 상태 메시지를 출력한다.</td>
</tr>
<tr>
<td></td>
<td>switchCharacte-risticWritten ()</td>
<td>스마트폰의 NRF 마스터 컨트롤러의 명령에 따라 LED를 켜거나 끕니다.</td>
</tr>
</tbody>
</table>
<p>제누이노101 보드의 LED를 스마트폰으로 제어하기 위해서는 스마트폰에 ‘nRF Master Control Panel(BLE)’라고 하는 앱을 설치하여야 합니다.</p>
<p>플레이스토어에서 다운받아 설치를 합니다. 설치를 완료한 후 아래 [그림1] 처럼 SCAN을 실행시키고 LEDCB가 발견되면 connect 버튼을 누릅니다. 연결이 되고나면 아래 [그림2]와 같은 모습을 볼 수 있을 것입니다. 여기서 “Unknown service UUID 19B10000-E8F2-537E-4F6C-D104768A1214“를 선택 합니다.</p>
<p>이것은 스케치의 아래 구문으로 인해 이렇게 보이는 것입니다.</p>
<table style="width: 620px" border="0">
<tbody>
<tr>
<td colspan="2"><img class="alignnone size-full wp-image-31769" alt="37 special review (16)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-16.jpg" width="620" height="440" /></td>
</tr>
<tr>
<td style="text-align: center">그림 1</td>
<td style="text-align: center">그림 2</td>
</tr>
</tbody>
</table>
<p>BLEService ledService(&#8220;19B10000-E8F2-537E-4F6C-D104768A1214&#8243;); Unknown service UUID를 탭하면 [그림3]과 같은 모습을 볼 수 있으며⇅를 누르면 [그림4]와 같은 모습을 볼 수 있습니다. 여기서 값으로 1또는 0을 쓰면 제누이노101 보드의 LED를 켜거나 끌 수가 있겠습니다.UNIT는 unit8을 선택해야 합니다.</p>
<table style="width: 620px" border="0">
<tbody>
<tr>
<td colspan="2"><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-18.jpg" rel="lightbox[31462]"><img class="alignnone size-full wp-image-31771" alt="37 special review (18)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-18.jpg" width="620" height="436" /></a></td>
</tr>
<tr>
<td style="text-align: center">그림 3</td>
<td style="text-align: center">그림 4</td>
</tr>
</tbody>
</table>
<p>보드상에는 D13에 1608사이즈보다 좀 더 작아 보이는 작은 LED가 붙어 있어 이를 제어합니다만 너무 작아 외부에 고휘도 LED를 D13에 연결해 보았습니다. 그림4에서와 같이 1을 전송하면 D13이 High가되어 LED가 켜지고 0을 전송하면 LED가 꺼짐을 알 수 있습니다. 우리의 제누이노101 보드로 블루투스를 통한 원격제어가 어떻게 이뤄지는가를 적나라(?)하게 체험을 해봤습니다.</p>
<table style="width: 620px" border="0">
<tbody>
<tr>
<td><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-19.jpg" rel="lightbox[31462]"><img class="alignnone size-full wp-image-31772" alt="37 special review (19)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-19.jpg" width="620" height="404" /></a></td>
</tr>
<tr>
<td style="text-align: center">그림 5</td>
</tr>
<tr>
<td><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-20.jpg" rel="lightbox[31462]"><img class="alignnone size-full wp-image-31773" alt="37 special review (20)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-20.jpg" width="620" height="404" /></a></td>
</tr>
<tr>
<td style="text-align: center">그림 6</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><span style="color: #ff9900"><strong>6.4. 적용코드</strong></span></p>
<div class="symple-box gray none" style="text-align:left; width:100%;"> 
<p>/*<br />
* Copyright (c) 2016 Intel Corporation. All rights reserved.<br />
* See the bottom of this file for the license terms.<br />
*/</p>
<p>#include &lt;CurieBLE.h&gt;</p>
<p>const int ledPin = 13; // 보드상에 있는 LED를 사용하기위해 설정<br />
BLEPeripheral blePeripheral; // 블루투스 패리퍼럴 인스턴스를 생성한다.</p>
<p>BLEService ledService(&#8220;19B10000-E8F2-537E-4F6C-D104768A1214&#8243;); // 서비스를 생성한다.</p>
<p>// switch characteristic 를 원격장치에서 읽고 쓸 수 있도록 생성한다.<br />
BLECharCharacteristic switchChar(&#8220;19B10001-E8F2-537E-4F6C-D104768A1214&#8243;, BLERead | BLEWrite);</p>
<p>void setup() {<br />
Serial.begin(9600);<br />
pinMode(ledPin, OUTPUT); // LED포트(pin 13)를 출력으로 설정</p>
<p>// 주변장치에게 광고할 제누이노101보드의 블루투스 이름<br />
// 즉, 이 이름이 스마트폰 등에서 확인이 된다.<br />
blePeripheral.setLocalName(&#8220;LEDCB&#8221;);</p>
<p>// UUID를 설정한다.<br />
blePeripheral.setAdvertisedServiceUuid(ledService.uuid());</p>
<p>// 서비스와 특성 정보를 추가시킨다.<br />
blePeripheral.addAttribute(ledService);<br />
blePeripheral.addAttribute(switchChar);</p>
<p>// 주변장치를 연결하거나 끊기 위한 이벤트 핸들러를 할당 한다.<br />
blePeripheral.setEventHandler(BLEConnected, blePeripheralConnectHandler);<br />
blePeripheral.setEventHandler(BLEDisconnected, blePeripheralDisconnectHandler);</p>
<p>// 특성제어를 위한 이벤트 핸들러를 할당한다.<br />
switchChar.setEventHandler(BLEWritten, switchCharacteristicWritten);</p>
<p>// 특성정보를 초기화 한다.<br />
switchChar.setValue(0);</p>
<p>// 서비스를 광고한다. 즉, 다른 기기에서 이제부터 이 서비스를 탐지(탐색) 할 수 있다.<br />
blePeripheral.begin();<br />
Serial.println((&#8220;Bluetooth device active, waiting for connections&#8230;&#8221;));<br />
}</p>
<p>void loop() {<br />
// 주변장치로부터 반응을 지속적으로 폴링한다.<br />
blePeripheral.poll();<br />
}</p>
<p>// 접속이벤트 처리용 핸들러<br />
void blePeripheralConnectHandler(BLECentral&amp; central) {<br />
// central connected event handler<br />
Serial.print(&#8220;Connected event, central: &#8220;);<br />
Serial.println(central.address());<br />
}</p>
<p>// 접속끊김 이벤트 처리용 핸들러<br />
void blePeripheralDisconnectHandler(BLECentral&amp; central) {<br />
// central disconnected event handler<br />
Serial.print(&#8220;Disconnected event, central: &#8220;);<br />
Serial.println(central.address());<br />
}</p>
<p>// 실제로 LED를 제어하는 부분으로 switchChar.value()값을 읽어 LED 점멸을 제어한다.<br />
void switchCharacteristicWritten(BLECentral&amp; central, BLECharacteristic&amp; characteristic) {<br />
// central wrote new value to characteristic, update LED<br />
Serial.print(&#8220;Characteristic event, written: &#8220;);</p>
<p>if (switchChar.value()) {<br />
Serial.println(&#8220;LED on&#8221;);<br />
digitalWrite(ledPin, HIGH);<br />
} else {<br />
Serial.println(&#8220;LED off&#8221;);<br />
digitalWrite(ledPin, LOW);<br />
}<br />
}</p>
<p>/*<br />
Copyright (c) 2016 Intel Corporation. All rights reserved.</p>
<p>This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.<br />
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.</p>
<p>You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA<br />
*/</p>
<p>&nbsp;</p>
<p>출처 : https://www.arduino.cc/en/Tutorial/Genuino101CurieBLECallbackLED<br />
</div>
<p>블루투스를 통해 스마트폰과 통신이 정확히 되기 위해서는 인텔사에서 미리 만들어 놓은 BLEPeripheral 클래스에 대해서 많은 학습이 필요하리라 봅니다. 단순히 값을 넘겨주고 넘겨받는 차원이 아니라 블루투스 장치에 접근하기 위한 인스턴스 생성까지를 해주어야 하므로 좀 더 고차원적인 일을 할 수는 있을 것으로 봅니다만 학습을 필요로 하는 것이 그만큼 많아질 공산이 큽니다.</p>
<p><span style="color: #ff9900"><strong>7. (예제4)심장박동 모니터 시뮬레이션</strong></span></p>
<p>블루투스로 스마트폰과 연결된 상태에서 심장 박동을 모니터링 해보도록 하겠습니다. 정말로 심장박동을 모니터링하기 위해서는 손가락의 혈류흐름을 감지하는 센서가 필요합니다만 편의상 A0에 포텐셔메터를 연결하여 심장박동센서에서 심박 수가 얻어 짐을 포텐셔메터의 각도 값에 따른 저항 값으로 대체 합니다. 이 예제를 돌려보기 위해서는 스마트폰에 ‘nRF Toolbox for BLE’가 설치되어야 합니다.</p>
<p><span style="color: #ff9900"><strong>7.1. 제누이노101측 HW구성</strong></span></p>
<p>우선 테스트를 위해 포텐셔메터와 LED 1개를 아래와 같이 연결합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-21.jpg" rel="lightbox[31462]"><img class="alignnone size-full wp-image-31774" alt="37 special review (21)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-21.jpg" width="620" height="330" /></a></p>
<p>&nbsp;</p>
<table style="width: 620px" border="1" cellspacing="0" cellpadding="3">
<tbody>
<tr>
<td style="text-align: center">핀</td>
<td style="text-align: center">부품연결</td>
<td style="text-align: center">비고</td>
</tr>
<tr>
<td style="text-align: center">A0</td>
<td style="text-align: center">포텐셔메터 2번핀</td>
<td style="text-align: center" rowspan="3">심장박동 신호값</td>
</tr>
<tr>
<td style="text-align: center">+3V</td>
<td style="text-align: center">포텐셔메터 3번핀</td>
</tr>
<tr>
<td style="text-align: center">GND</td>
<td style="text-align: center">포텐셔메터 1번핀</td>
</tr>
<tr>
<td style="text-align: center">D13</td>
<td style="text-align: center">LED Anode</td>
<td style="text-align: center" rowspan="2">상태표시</td>
</tr>
<tr>
<td style="text-align: center">GND</td>
<td style="text-align: center">LED Cathode</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><span style="color: #ff9900"><strong>7.2. 스마트폰측 환경설정</strong></span></p>
<p><strong>ㅇ nRF Toolbox for BLE를 플레이스토어에서 찾아 설치합니다.</strong></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/Cap-2016-10-21-10-53-42-482.jpg" rel="lightbox[31462]"><img class="alignnone size-full wp-image-31790" alt="Cap 2016-10-21 10-53-42-482" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/Cap-2016-10-21-10-53-42-482.jpg" width="443" height="145" /></a></p>
<p><strong>ㅇ 제누이노101용 심장박동 시뮬레이션 소스코드</strong></p>
<div class="symple-box gray none" style="text-align:left; width:100%;"> 
<p>/* Copyright (c) 2015 Intel Corporation. All rights reserved.</p>
<p>This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.</p>
<p>This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.</p>
<p>You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA<br />
*/</p>
<p>/*<br />
This sketch example partially implements the standard Bluetooth Low-Energy Heart Rate service.<br />
For more information: https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx<br />
*/</p>
<p>#include &lt;CurieBLE.h&gt;</p>
<p>BLEPeripheral blePeripheral; // BLE Peripheral Device (the board you&#8217;re programming)<br />
BLEService heartRateService(&#8220;180D&#8221;); // BLE Heart Rate Service</p>
<p>// BLE Heart Rate Measurement Characteristic&#8221;<br />
BLECharacteristic heartRateChar(&#8220;2A37&#8243;, // standard 16-bit characteristic UUID<br />
BLERead | BLENotify, 2); // remote clients will be able to get notifications if this characteristic changes</p>
<p>// the characteristic is 2 bytes long as the first field needs to be &#8220;Flags&#8221; as per BLE specifications<br />
// https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?<br />
// u=org.bluetooth.characteristic.heart_rate_measurement.xml</p>
<p>int oldHeartRate = 0; // last heart rate reading from analog input<br />
long previousMillis = 0; // last time the heart rate was checked, in ms</p>
<p>void setup() {<br />
Serial.begin(9600); // initialize serial communication<br />
pinMode(13, OUTPUT); // initialize the LED on pin 13 to indicate when a central is connected</p>
<p>/* Set a local name for the BLE device<br />
This name will appear in advertising packets<br />
and can be used by remote devices to identify this BLE device<br />
The name can be changed but maybe be truncated based on space left in advertisement packet */<br />
blePeripheral.setLocalName(&#8220;HeartRateSketch&#8221;);<br />
blePeripheral.setAdvertisedServiceUuid(heartRateService.uuid()); // add the service UUID<br />
blePeripheral.addAttribute(heartRateService); // Add the BLE Heart Rate service<br />
blePeripheral.addAttribute(heartRateChar); // add the Heart Rate Measurement characteristic</p>
<p>/* Now activate the BLE device. It will start continuously transmitting BLE<br />
advertising packets and will be visible to remote BLE central devices<br />
until it receives a new connection */<br />
blePeripheral.begin();<br />
Serial.println(&#8220;Bluetooth device active, waiting for connections&#8230;&#8221;);<br />
}</p>
<p>void loop() {<br />
// listen for BLE peripherals to connect:<br />
BLECentral central = blePeripheral.central();</p>
<p>// if a central is connected to peripheral:<br />
if (central) {<br />
Serial.print(&#8220;Connected to central: &#8220;);<br />
// print the central&#8217;s MAC address:<br />
Serial.println(central.address());<br />
// turn on the LED to indicate the connection:<br />
digitalWrite(13, HIGH);<br />
// check the heart rate measurement every 200ms<br />
// as long as the central is still connected:<br />
while (central.connected()) {<br />
long currentMillis = millis();<br />
// if 200ms have passed, check the heart rate measurement:<br />
if (currentMillis &#8211; previousMillis &gt;= 200) {<br />
previousMillis = currentMillis;<br />
updateHeartRate();<br />
}<br />
}<br />
// when the central disconnects, turn off the LED:<br />
digitalWrite(13, LOW);<br />
Serial.print(&#8220;Disconnected from central: &#8220;);<br />
Serial.println(central.address());<br />
}<br />
}</p>
<p>void updateHeartRate() {<br />
/* Read the current voltage level on the A0 analog input pin.<br />
This is used here to simulate the heart rate&#8217;s measurement.<br />
*/<br />
int heartRateMeasurement = analogRead(A0);<br />
int heartRate = map(heartRateMeasurement, 0, 1023, 0, 100);<br />
if (heartRate != oldHeartRate) { // if the heart rate has changed<br />
Serial.print(&#8220;Heart Rate is now: &#8220;); // print it<br />
Serial.println(heartRate);<br />
//const unsigned char heartRateCharArray[2] = { 0, (char)heartRate };<br />
const unsigned char heartRateCharArray[2] = { 0, (unsigned char)heartRate };<br />
heartRateChar.setValue(heartRateCharArray, 2); // and update the heart rate measurement characteristic<br />
oldHeartRate = heartRate; // save the level for next comparison<br />
}<br />
}<br />
</div>
<p><span style="color: #ff9900"><strong>7.3. 스마트폰에서 동작이 되고 있는 화면</strong></span></p>
<table style="width: 620px" border="0">
<tbody>
<tr>
<td colspan="2"><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-23.jpg" rel="lightbox[31462]"><img class="alignnone size-full wp-image-31776" alt="37 special review (23)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-23.jpg" width="620" height="398" /></a></td>
</tr>
<tr>
<td style="text-align: center">HRM 선택</td>
<td style="text-align: center">CONNECT</td>
</tr>
</tbody>
</table>
<table style="width: 620px" border="0">
<tbody>
<tr>
<td colspan="2"><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-24.jpg" rel="lightbox[31462]"><img class="alignnone size-full wp-image-31777" alt="37 special review (24)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-24.jpg" width="620" height="396" /></a></td>
</tr>
<tr>
<td style="text-align: center">HartRateSkech</td>
<td style="text-align: center">HartRate 그래프</td>
</tr>
</tbody>
</table>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-25.jpg" rel="lightbox[31462]"><img class="alignnone size-full wp-image-31778" alt="37 special review (25)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-25.jpg" width="620" height="457" /></a></p>
<p>스마트폰에서 ‘nRF Toolbox for BLE‘ 아이콘을 터치하면 [HRM]을 선택할 수 있는 초기 화면이 보입니다. HRM이 선택되면 [CONNECT] 단계로 넘어갑니다. [HartRateSkech]를 선택하면 비로소 심장박동 모니터를 볼 수 있습니다. 본 프로그램은 일종으로 시뮬레이터로 제누이노101의 포텐셔메터를 돌리면 심장박동 값을 스마트폰 측으로 전송할 수 있게 됩니다.</p>
<p><span style="color: #ff9900"><strong>8. (예제5) 제누이노101을 비콘으로 만들기</strong></span></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-26.jpg" rel="lightbox[31462]"><img class="alignnone  wp-image-31779" alt="37 special review (26)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-26.jpg" width="496" height="187" /></a></p>
<p>IOT라는 용어와 함께 빠지지 않고 등장하는 것이 비콘입니다. 비콘은 등대라는 의미로 전자기파를 주기적으로 발사시켜 자신의 존재를 알리는 장치를 통칭합니다. 블루투스뿐만 아니라 Wi-Fi를 사용해서도 비콘을 만들 수 있으며 디지털시대를 맞이하여 단순히 존재뿐만 아니라 위치, 거리, 메시지 등의 정보를 함께 실어서 보낼 수가 있습니다. 블루투스 4.0 LE는 매우 낮은 전력을 사용하는 통신규격으로, 블루투스 헤드셋, 마우스, 키보드 등에 널리 사용되며 코인배터리를 사용하는 디바이스에 매우 적합한 특성을 갖고 있다고 봅니다. 우리의 제누이노101 보드에는 블루투스 4.0 LE가 들어가 있고 이를 제어할 수 있는 큐리칩이 있으므로 비콘을 만들 수 있을 것이란 생각에 열심히 구글링한 결과 쓸만한 Sample Code를 얻을 수 있었습니다.</p>
<p><span style="color: #ff9900"><strong>8.1. 스마트폰 환경설정</strong></span></p>
<p>우선적으로 비콘 신호를 잡아낼 앱을 스마트폰에 설치하여야 합니다. 구글 플레이스토어 &gt; eddystone &gt; iBeacon &amp; Eddystone를 설치합니다. iBeacon은 애플사가 미는 비콘 생태계이고 Eddystone은 구글이 미는 생태계입니다. 제누이노101로 실험하는 환경은 Eddystone입니다. 열정적인 누군가가 iBeacon 스케치를 발표할 수도 있을 듯 합니다만 아직은 발견할 수가 없습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-27.jpg" rel="lightbox[31462]"><img class="alignnone  wp-image-31780" alt="37 special review (27)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-27.jpg" width="496" height="318" /></a></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-28.jpg" rel="lightbox[31462]"><img class="alignnone  wp-image-31781" alt="37 special review (28)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-28.jpg" width="496" height="322" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="color: #ff9900"><strong>8.2. 아두이노 환경구성</strong></span></p>
<p>우선 비콘을 돌릴 수 있도록 환경을 재구성 하여야 합니다. 블루투스와 관련된 라이브러리를 설치하여야 하며 아래 URL로 접속하여 다운받은 후 압축을 풀어 제누이노101 라이브러가 설치된 곳에 붙여 넣으면 됩니다.</p>
<p>필자의 경우 경로는 다음과 같습니다. C:\Users\home\AppData\Local\Arduino15\packages\Intel\hardware\arc32\1.0.6\libraries</p>
<p><strong>ㅇ 라이브러리 주소 :</strong> https://github.com/bneedhamia/corelibs-arduino101/tree/support-eddystone-url</p>
<p><strong><strong>ㅇ </strong>아두이노 스케치 다운로드</strong> https://github.com/bneedhamia/CurieEddystoneURL</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-29.jpg" rel="lightbox[31462]"><img class="alignnone size-full wp-image-31782" alt="37 special review (29)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-29.jpg" width="620" height="448" /></a></p>
<p>소스코드가 너무 길어 도입 부분만 언급하면 아래와 같습니다.</p>
<div class="symple-box gray none" style="text-align:left; width:100%;"> 
<p>/*<br />
* Eddystone URL for Arduino/Genuino 101.<br />
*<br />
* This is an Intel Curie Eddystone-compatible Sketch<br />
* (https://github.com/google/eddystone).<br />
*<br />
* The Eddystone BLE protocol is used by the Physical Web(tm) project<br />
* (https://github.com/google/physical-web).<br />
* The Physical Web project is about BLE beacons that broadcast URLs<br />
* so your users don&#8217;t have to download an app just to interact with<br />
* your device.<br />
*<br />
* Note: this version doesn&#8217;t support Eddystone Config mode.<br />
* To change the URL, you need to modify MY_URL and reload the Arduino.<br />
*<br />
* Parts required:<br />
* Arduino/Genuino 101. This Sketch runs only on Curie-based devices.<br />
* No other hardware is required.<br />
*<br />
* To Use:<br />
* &#8211; Setup your CurieBLE libraries to support Eddystone.<br />
* Doing this may be a little complicated until the Eddystone support<br />
* is added to the CurieBLE library. Until then&#8230;<br />
* There are two ways to do that:<br />
* 1) Pull code from https://github.com/bneedhamia/corelibs-arduino101/tree/support-eddystone-url<br />
* or<br />
* 2) Replace CurieBLE/BLEPeripheral.* and CurieBLE/keywords.txt<br />
* with a modified version that supports Eddystone Advertising packets.<br />
* See https://github.com/bneedhamia/CurieBLEServiceData<br />
* once that&#8217;s done&#8230;<br />
* &#8211; Set MY_URL to the url for the beacon you wish to broadcast.<br />
* &#8211; Download this Sketch to an Arduino/Genuino 101.<br />
* &#8211; Download a Physical Web app to your phone.<br />
* For example, Google&#8217;s Physical Web Android app is at<br />
* https://play.google.com/store/apps/details?id=physical_web.org.physicalweb<br />
*<br />
* Copyright (c) 2016 Bradford Needham, North Plains, Oregon, USA<br />
* @bneedhamia, https://www.needhamia.com<br />
* Licensed under the Apache 2.0 License, a copy of which<br />
* should have been included with this software.<br />
*/</p>
<p>/*<br />
* Note: as of this writing, the documentation of the CurieBLE library<br />
* is the library source, at (on Linux)<br />
* ~/.arduino15/packages/Intel/hardware/arc32/1.0.4/libraries/CurieBle/src<br />
*<br />
* Version 1.0.4 of CurieBle doesn&#8217;t support Eddystone-format<br />
* BLE Advertising packets, for 2 reasons:<br />
* &#8211; It uses the BLE code for Incomplete Service UUID list<br />
* instead of Complete Service UUID list code required by Eddystone.<br />
* &#8211; It doesn&#8217;t support Service Data, which is required by Eddystone.<br />
*<br />
* Note: the name of the Curie BLE library changed between 1.0.4 and<br />
* the latest (as of March 10, 2016) version:<br />
* In 1.0.4, the name is CurieBle.h; in later versions, it&#8217;s CurieBLE.h<br />
*/</p>
<p>#include &lt;CurieBLE.h&gt; // BHN-Modified Curie-specific BLE Library</p>
<p>/*<br />
* Pinout:<br />
* PIN_BLINK = digital Output. The normal Arduino 101 LED.<br />
* If everything is working, the LED blinks.<br />
* If instead there is a startup error, the LED is solid.<br />
*/<br />
const int PIN_BLINK = 13; // Pin 13 is the on-board LED</p>
<p>/*<br />
* The (unencoded) URL to put into the<br />
* Eddystone-URL beacon frame.<br />
*<br />
* NOTE: the encoded length must be under 18 bytes long.<br />
* See initEddystoneUrlFrame().<br />
*<br />
* NOTE: This Sketch supports only lower-case URLs.<br />
* See initEddystoneUrlFrame().<br />
*/<br />
const char* MY_URL = &#8220;http://www.devicemart.co.kr/&#8221;;</p>
<p>/*<br />
* The reported Tx Power value to put into the Eddystone-URL beacon frame.<br />
*<br />
* From the Eddystone-URL Protocol specification<br />
* (https://github.com/google/eddystone/blob/master/eddystone-url/README.md#tx-power-level)<br />
* &#8220;the best way to determine the precise value<br />
* to put into this field is to measure the actual output<br />
* of your beacon from 1 meter away and then add 41dBm to that.<br />
* 41dBm is the signal loss that occurs over 1 meter.&#8221;<br />
*<br />
* I used the Nordic nRF Master Control Panel Android app<br />
* (https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp&amp;hl=en)<br />
* to measure the beacon power at 1 meter.<br />
*/<br />
const int8_t TX_POWER_DBM = (-70 + 41);</p>
<p>/*<br />
* Maximum number of bytes in an Eddystone-URL frame.<br />
* The Eddystone-URL frame contains<br />
* the frame type, Tx Power, Url Prefix, and up to 17 bytes of Url.<br />
* (The spec isn&#8217;t completely clear. That might be 18 rather than 17.)<br />
*/<br />
const uint8_t MAX_URL_FRAME_LENGTH = 1 + 1 + 1 + 17;</p>
<p>/*<br />
* Eddystone-URL frame type<br />
*/<br />
const uint8_t FRAME_TYPE_EDDYSTONE_URL = 0&#215;10;</p>
<p>/*<br />
* Eddystone-URL url prefix types<br />
* representing the starting characters of the URL.<br />
* 0&#215;00 = http://www.<br />
* 0&#215;01 = https://www.<br />
* 0&#215;02 = http://<br />
* 0&#215;03 = https://<br />
*/<br />
const uint8_t URL_PREFIX_HTTP_WWW_DOT = 0&#215;00;<br />
const uint8_t URL_PREFIX_HTTPS_WWW_DOT = 0&#215;01;<br />
const uint8_t URL_PREFIX_HTTP_COLON_SLASH_SLASH = 0&#215;02;<br />
const uint8_t URL_PREFIX_HTTPS_COLON_SLASH_SLASH = 0&#215;03;</p>
<p>/*<br />
* eddyService = Our BLE Eddystone Service.<br />
* See https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx<br />
* and https://github.com/google/eddystone/blob/master/protocol-specification.md<br />
* NOTE: as of this writing, Eddystone doesn&#8217;t seem to be part of the Standard BLE Services list.<br />
*<br />
*/<br />
BLEService eddyService(&#8220;FEAA&#8221;);</p>
<p>BLEPeripheral ble; // Root of our BLE Peripheral (server) capability</p>
<p>&lt;중략&gt;<br />
</div>
<p><span style="color: #ff9900"><strong>8.4 최종화면</strong></span></p>
<p>모든 작업이 순조롭게 진행 되었다면 아래와 같은 스마트폰 화면을 보실 수 있습니다. 이 정보는 비콘과 스마트폰을 연계하여 어떠한 형태로 동작을 시킬 수 있는지를 보여주는 단순한 사례에 해당됩니다. 좀 더 그럴싸한 앱을 개발하여 적용한다면 실용성을 갖춘 제품도 가능하리라 예상해 봅니다. 이 앱을 통해 전파 수신세력, 서비스 형식, 비콘과 스마트폰간의 거리, 비콘을 발견했을때 접속할 URL 등의 정보를 얻을 수가 있습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-30.jpg" rel="lightbox[31462]"><img class="alignnone size-full wp-image-31783" alt="37 special review (30)" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/37-special-review-30.jpg" width="620" height="285" /></a></p>
<p><span style="color: #ff6600;font-size: medium"><strong>9. 정리</strong></span></p>
<p>이상으로 제누이노101 보드가 가진 특징 위주로 쭉~ 살펴봤습니다. 아두이노 우노에 비해 파워풀한 성능과 다양한 기능으로 무장한 제누이노101은 매우 강력하다는 느낌이 우선적으로 듭니다. 아무리 아두이노가 학습용으로 많이 사용되는 물품이라 하지만 간단한 테스트 하는 용도를 넘어서기에 부족함이 없을 것 같다는 생각이 또한 들었습니다. 이 보드의 가장 강력한 점을 들라고 한다면 블루투스 4.0 LE의 탑재라고 생각됩니다. 단순히 SPP(Serial Port Profile)로 UART 통신 정도나 하는 그런 블루투스 디바이스와는 완전히 차원이 다른 기능으로 무장하고 있다는 점입니다. 이 모듈을 이용하여 Beacon으로 활용하거나 6모션센서로 센싱된 결과 값으로 로봇 등을 제어하되 블루투스 기능으로 원격제어하는 용도에 아주 잘 맞는 제품으로 생각됩니다. 이런 점에서 볼 때 아두이노를 처음 접하는 새내기 아누이노어들에게는 조금 벅찬 제품일 수 있겠다는 생각도 한편으로 듭니다. 일전에도 잠시 다뤄본 바 있는 에디슨보드는 프로토타이핑용 혹은 IOT용으로 사용하기에는 너무도 강력함에 기인된 구조상 불편한 점(70핀 히로세 커넥터 등)이 다소 있었다면 제누이노101 보드는 이런 불편 점을 일소시킨 보드라는 생각이 듭니다. 이 보드는 인텔에서 적극적으로 밀고 있는 보드인 만큼 시장에서 상당한 반향을 몰고 올 소지도 충분히 있다고 봅니다. 제누이노101 보드를 한마디로 표현해 본다면 아두이노 외투를 걸친 초미니 PC 정도에 해당될 수 있을 것 같습니다. 이상으로 제누이노101 보드에 대한 리뷰를 마칩니다. 감사합니다.</p>
<p><span style="color: #ff6600;font-size: medium"><strong>자료참고</strong></span></p>
<p>1. 제누이노 공식 웹사이트 : www.arduino.cc/en/Main/ArduinoBoard101<br />
2. 인텔사 큐리칩 공식 소개 페이지 : www.intel.com/content/www/us/en/wearables/intel-curie-fact-sheet.html<br />
3. 인텔 큐리칩 개인 포스팅 자료</p>
<p>http://blog.naver.com/jjy0501/220235133315</p>
<p>http://www.bodnara.co.kr/bbs/article.html?num=117199</p>
<p>4. 쿼터니언 관련 기초지식 : ko.wikipedia.org/wiki/%EC%82%AC%EC%9B%90%EC%88%98<br />
5. 프로세싱 프로그램 다운로드 : processing.org/download/<br />
6. 제누이노101 라이브러리 : github.com/01org/corelibs-arduino101<br />
7. 제누이노101 실험용 소스코드<br />
www.arduino.cc/en/Tutorial/Genuino101CurieIMUOrientationVisualiser<br />
www.arduino.cc/en/Tutorial/Genuino101CurieIMURawImuDataSerial<br />
www.arduino.cc/en/Tutorial/Genuino101CurieBLECallbackLED<br />
www.arduino.cc/en/Tutorial/Genuino101CurieBLEHeartRateMonitor<br />
8. madgwick 라이브러리 논문 : www.x-io.co.uk/res/doc/madgwick_internal_report.pdf<br />
9. PC기반 시리얼 오실로스코프 프로그램 : github.com/xioTechnologies/Serial-Oscilloscope<br />
10. 비콘 관련 언론 보도자료 : news.naver.com/main/read.nhn?mode=LSD&amp;mid=sec&amp;sid1=101&amp;oid=469&amp;aid=0000059091<br />
11. 에디스톤 제누이노101 라이브러리 : github.com/bneedhamia/corelibs-arduino101/tree/support-eddystone-url<br />
12. 제누이노101용 에디스톤 스캐치 : github.com/bneedhamia/CurieEddystoneURL</p>
<p>&nbsp;</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/07/Cap-2016-10-21-11-05-26-324.jpg" rel="lightbox[31462]"><img class="alignnone size-large wp-image-31791" alt="Cap 2016-10-21 11-05-26-324" src="http://www.ntrexgo.com/wp-content/uploads/2016/07/Cap-2016-10-21-11-05-26-324-620x282.jpg" width="620" height="282" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ntrexgo.com/archives/31462/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[35호]Arduino M0 &amp; Arduino 9 Axes Motion Shield 리뷰</title>
		<link>http://www.ntrexgo.com/archives/30749</link>
		<comments>http://www.ntrexgo.com/archives/30749#comments</comments>
		<pubDate>Tue, 15 Mar 2016 05:35:39 +0000</pubDate>
		<dc:creator>디바이스마트 매거진</dc:creator>
				<category><![CDATA[디바이스마트 매거진]]></category>
		<category><![CDATA[스페셜 컬럼]]></category>
		<category><![CDATA[35호]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[Special]]></category>
		<category><![CDATA[디바이스마트]]></category>
		<category><![CDATA[매거진]]></category>
		<category><![CDATA[아두이노]]></category>

		<guid isPermaLink="false">http://www.ntrexgo.com/?p=30749</guid>
		<description><![CDATA[디바이스마트 매거진 35호 &#124; 스마트폰에서 촉발된 IOT 기술의 빅뱅은 영향을 받지 않는 곳이 없을 정도로 무섭게 확산되고 있습니다. 마치 나비효과처럼 전 세계에서 자신의 손으로 뭔가를 만들고 싶어하는 DIY(Do It Yourself)족 및 컴퓨터를 잘 모르는 이들에게도 교육차원으로 많이 사용되어 선풍적인 인기를 끌고 있는 아두이노, 라즈베리파이 등등에도 그 바람을 피하기 힘든 듯합니다. ]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-2.png" rel="lightbox[30749]"><img class="alignnone size-large wp-image-30846" alt="35 re (2)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-2-620x290.png" width="620" height="290" /></a></p>
<p>&nbsp;</p>
<p><span style="color: #ff6600;font-size: x-large;background-color: #ffffff"><strong>Arduino M0 &amp;<br />
</strong></span></p>
<p><strong><span style="font-size: x-large;color: #ff6600;background-color: #ffffff">Arduino 9 Axes Motion Shield 리뷰</span><br />
</strong></p>
<p>&nbsp;</p>
<p style="text-align: right">글 | 금강초롱 객원기자 blog.naver.com/crucian2k3</p>
<p>스마트폰에서 촉발된 IOT 기술의 빅뱅은 영향을 받지 않는 곳이 없을 정도로 무섭게 확산되고 있습니다.<br />
마치 나비효과처럼 전 세계에서 자신의 손으로 뭔가를 만들고 싶어하는 DIY(Do It Yourself)족 및 컴퓨터를 잘 모르는 이들에게도 교육차원으로 많이 사용되어 선풍적인 인기를 끌고 있는 아두이노, 라즈베리파이 등에도 그 바람을 피하기 힘든 듯합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-1.jpg" rel="lightbox[30749]"><img class="alignnone size-large wp-image-30843" alt="35 re (1)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-1-620x348.jpg" width="620" height="348" /></a></p>
<p>유난히 폭 넓은 사용자층을 형성하고 있는 아두이노 진영에서도 앙증맞은 32비트급 아두이노 보드가 정식출시 되었으며, 이제는 프로토타이핑 보드도 고사양이 되는 길이 열린 듯합니다. 언제나 그래 왔듯이 세월이 지나면 더 쎈 녀석이 등장할 것입니다만&#8230;</p>
<p>여기서 프로토타이핑이란 용어가 낯설은 독자를 위해 첨언을 좀 하자면 실험실습 등을 위해 간이로 만들어보는 보드 혹은 도구 또는 그러한 일들을 의미합니다. 억지스럽게 표현해 본다면 시작품, 시제품, 연습용 제품 등으로 해석될 수 있을 듯합니다.</p>
<p>요 근래 이러한 아두이노 진영에 내분이 있었으며 2016. 3월 현재 arduino.cc 진영과 arduino.org로 나뉘어 아두이노에 대한 기술지원이 이뤄지고 있는 점은 제 개인적인 생각으로는 그리 바람직해 보이지 않습니다. 그도 그럴 것이 동일한 하드웨어를 다른 명칭으로 불러 혼란을 유발하거나 arduino IDE의 버전이 헛갈리게 발표되고 있는 점도 그러한 사실을 충분히 뒷받침 한다고 봅니다.</p>
<p>이러한 거시적(?) 상황을 살짝 감안 해보며 이번 차에는 막강한 성능을 가진 ‘아두이노-M0’를 다뤄보려 합니다. 본격적으로 ‘아두이노-M0’를 거론하기 전에 한두 해를 거슬러 올라가면, 지난 2014년 5월경 arduino.cc 진영에서 ‘ARDUINO-Zero’라는 Atmel 32비트 MCU를 사용하는 모델을 발표 합니다. 발표 후 1년여가 흐를 무렵 ‘arduino.cc’와 ‘arduino.org’로 조직이 분열되면서 ‘ARDUINO-Zero’가 ‘ARDUINO-M0-Pro’라는 명칭으로 arduino.org에서 발표가 됩니다. 그리고 얼마 후 arduino.org에서 ‘ARDUINO-M0-Pro’ 하드웨어에서 Atmel 의 디버거 기능인 EDBG를 제외한 새로운 모델인 ‘ARDUINO-M0’를 발매하게 됩니다.</p>
<p>위에서 열거한 ‘ARDUINO-Zero, ARDUINO-M0, ARDUINO-M0-Pro’는 사실상 같은 MCU를 사용하고 있으며 H/W 적으로는 EDBG만 있고 없을 뿐입니다. 이번에 다루게 될 ‘ARDUINO-M0’는 사실 이전에 발매된 ‘아두이노-레오나르도’와 닮은 점이 많습니다. 이에 대한 내용도 아래에서 잠깐 다뤄보고자 합니다.</p>
<p>이러한 ‘ARDUINO-M0’를 살펴보면서 제가 흥미를 가졌던 부분은</p>
<p>· D0, D1을 제외한 전 포트에 PWM 기능이 동작됨을 의미하는 ~ 문양이 있는데 이에 대한 특성은?<br />
· Serial Port 어떻게 클래스 매핑이 되어 있는가?<br />
· 8비트급 MCU를 쓰는 모델들에 비해 새로운 기능은 무엇이 있는가?<br />
· 12비트 ADC는 충분히 쓸만 한가?<br />
· 10비트 DAC를 어떻게 사용할 수 있는가?<br />
· 실행속도는 8비트급에 비해 어느 정도 빠른가?</p>
<p>‘아두이노-M0’는 종래의 Atmega328을 사용하는 ‘아두이노-우노’ 시리즈 혹은 Atmega23u4를 사용하는 ‘아두이노-레오나르도’ 시리즈와 견주어 볼 때 노는 물이 다름은 이론의 여지가 없습니다. 저에게 M3를 사용하는 ‘아두이노-두에’가 있었다면 서로 비교해 볼 수 있었을 텐데 사정상 ‘아두이노-레오나르도’와 성능이나 기타 특이점에 대해만 논해 보려합니다.<br />
이번 포스팅은 ㈜엔티렉스-디바이스마트의 지원을 받아 작성하게 되었습니다.</p>
<p><span style="color: #ff6600"><strong>1. 제품 개봉기</strong></span></p>
<p>‘아두이노-우노-R3’의 폼팩터를 그대로 계승하고 있기에 그다지 새로울 것은 없습니다. 다만 보드 자체가 매우 작고 정교하게 만들어 졌다는 느낌이 드는 것은 사실입니다.<br />
기왕 하는 김에 ‘아두이노-M0-Pro’ 모델이었다면 디버그 기능도 살펴 볼 수 있었을 텐데 하는 아쉬움도 있었습니다만 디버그 기능 외 차이점은 없다고 봅니다.</p>
<table style="width: 620px" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-2.jpg" rel="lightbox[30749]"><img class="alignnone size-large wp-image-30845" alt="35 re (2)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-2-620x348.jpg" width="620" height="348" /></a></td>
</tr>
<tr>
<td style="text-align: center">그림1 : 아두이노-M0 박스 외관</td>
</tr>
</tbody>
</table>
<p>뒷면에는 이탈리아에서 제조된 물품임을 확인하는 로고가 선명하게 인쇄되어 있습니다. 박스를 열면 앙증맞은(?) 보드가 한 장 덩그러니 들어가 있으며 ‘아두이노-우노’와 마찬가지로 Atmel사의 SAMD21G18A-AUT을 기반으로 한 보드가 보이며 전체적인 분위기는 ‘아두이노-레오나르도’와 유사하다고 생각됩니다.</p>
<table style="width: 620px" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-3.jpg" rel="lightbox[30749]"><img class="alignnone size-large wp-image-30847" alt="35 re (3)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-3-620x348.jpg" width="620" height="348" /></a></td>
</tr>
<tr>
<td style="text-align: center">그림2 : 아두이노-M0 전면부</td>
</tr>
</tbody>
</table>
<table style="width: 620px" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-4.jpg" rel="lightbox[30749]"><img class="alignnone size-large wp-image-30849" alt="35 re (4)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-4-620x348.jpg" width="620" height="348" /></a></td>
</tr>
<tr>
<td style="text-align: center">그림3 : 아두이노-M0 후면부</td>
</tr>
</tbody>
</table>
<p>‘9축 모션 센서 쉴드’ 보드는 그보다 약간 큰 박스로 구성되어져 있으며 얼핏 본다면 아두이노 본체로 오해라도 할 수 있을 만큼 비슷하게 생겼습니다.</p>
<p>쉴드 보드는 아두이노의 확장보드로 매우 다양한 쉴드보드가 존재합니다. 이번에 리뷰하는 쉴드 보드는 3축 14bit 가속도센서, 3축 16bit 자이로센서, 3축 지자기센서가 원칩에 들어있는 보쉬센서텍의 BNO055라는 칩을 기반으로 하고 있습니다.</p>
<table style="width: 620px" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-5.jpg" rel="lightbox[30749]"><img class="alignnone size-large wp-image-30851" alt="35 re (5)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-5-620x348.jpg" width="620" height="348" /></a></td>
</tr>
<tr>
<td style="text-align: center">그림4 : 9축 모션센서 쉴드 박스 외관</td>
</tr>
</tbody>
</table>
<table style="width: 620px" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-6.jpg" rel="lightbox[30749]"><img class="alignnone size-large wp-image-30853" alt="35 re (6)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-6-620x348.jpg" width="620" height="348" /></a></td>
</tr>
<tr>
<td style="text-align: center">그림5 : 9축 모션센서 쉴드 후면부</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><span style="color: #ff6600"><strong>2. 아두이노-M0 살펴보기</strong></span></p>
<p>기 발매중인 모델 중 ‘아두이노-레오나르도’와 폼펙터 측면에서 유사성이 많음에 따라 두 모델을 상호 비교해 보도록 하겠습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35sr-2.png" rel="lightbox[30749]"><img class="alignnone  wp-image-30761" alt="35sr  (2)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35sr-2-620x416.png" width="446" height="299" /></a></p>
<p><strong><span style="color: #ff9900">2.1 기본적인 스펙</span></strong><br />
우선 눈에 띄는 부분이 동작전압이 3.3V라는 점입니다.<br />
5V를 기반으로 만들어진 쉴드를 연결할 때 주의가 필요해 보입니다.<br />
다음으로 A/D변환기의 분해능이 12비트로 올라갔고 플래시메모리가 대폭 늘어났으며 무엇보다도 클럭 속도가 올라갔습니다.<br />
한마디로 컴퓨팅 파워를 끌어 올렸다고 보면 틀림이 없을 것 같습니다.<br />
이제 세부적인 변경 사항들을 하나하나 살펴보도록 하겠습니다.</p>
<p><span style="color: #ff9900"><strong>2.2 전원공급핀</strong></span><br />
외부에서 전원을 공급받는 방법은 2가지가 있습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-7.jpg" rel="lightbox[30749]"><img class="alignnone size-full wp-image-30855" alt="35 re (7)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-7.jpg" width="303" height="196" /></a></p>
<p>2.1mm 규격의 DC아답터를 사용하여 6~15V를 인가하는 방법과 마이크로USB 컨넥터를 통해 DC 5V를 인가하는 방법이 있습니다.<br />
USB 2.0포트에 연결되는 경우 500mA가 한계치이므로 전력이 부족한 경우 DC아답터를 사용하여 공급할 수 있습니다.<br />
DC아답터는 시중에서 9V, 12V를 흔히 구입할 수 있을 것 같으며 중심축이 +전원이고 외경은 GND가 되어야 합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35sr-3.png" rel="lightbox[30749]"><img class="alignnone size-full wp-image-30762" alt="35sr  (3)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35sr-3.png" width="445" height="167" /></a></p>
<p><span style="color: #ff9900"><strong>2.3 메모리 관련사항</strong></span><br />
ATSAMD21G18 MCU는 256KB의 플레시메모리를 내장하고 있으며 이중 4KB는 부트로더 영역으로 사용됩니다. 이 부트로더 영역은 NVM 퓨즈에 의해 보호되도록 설정되어 있습니다. 램은 32KB가 내장되어 있으며 이중 16KB는 EEPROM 라이브러리에 의해 에뮬레이션 될 수 있습니다. 즉, EEPROM 라이브러리로 램 영역을 활용할 수는 있으나 전원이 차단되면 데이터는 유실 되게 됩니다.</p>
<p><span style="color: #ff9900"><strong>2.4 입출력핀 관련사항</strong></span><br />
‘아두이노-M0’는 디지털 I/O핀으로 총 14개가 설정되어 있습니다. 이들은 pinMode(), digitalWrite(), digitalRead()함수를 사용하여 손쉽게 입·출력이 이뤄지게 됩니다.<br />
위에서 언급한 바와 같이 ATSAMD21G18은 3.3V에서 동작되므로 신호 레벨은 3.3V가 됩니다. 풀업저항은 20∼60kΩ의 내부 풀업저항이 연결될 수 있으며 전원이 투입되면 기본적으로는 해제되어 있습니다. 최대 출력전류는 7mA입니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35sr-4.png" rel="lightbox[30749]"><img class="alignnone size-large wp-image-30763" alt="35sr  (4)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35sr-4-607x620.png" width="607" height="620" /></a></p>
<p><span style="color: #ff9900"><strong>2.5 프로그래밍 관련사항</strong></span><br />
‘아두이노-M0’에 프로그래밍을 하기 위해서는 일단 플레시메모리가 삭제되어져야 합니다. 이 기능은 마이크로USB 커넥터로 구성된 네이티브USB포트를 통해 진행됩니다.<br />
이 포트는 SAMD21에 직접 연결되어 있으며 업로드 진행시 일단 1200bps에서 플레시메모리 삭제가 진행된 후 다시 부트로더에 의해 57600bps등으로 연결되게 됩니다.<br />
이러한 기능은 ‘아두이노 레오나르도’도 동일하며 프로그램을 업로드 시킨 후 네이티브 USB포트를 사용할 수 없는 지경으로 만들면 전용프로그래머를 사용하지 않고는 다시는 아두이노 IDE로 접근이 곤란해질 수 있는 위험이 있습니다.</p>
<p><span style="color: #ff9900"><strong>2.6 USB 과전류 보호회로</strong></span><br />
아두이노-M0는 폴리퓨즈를 설치하여 과전류로부터 SAMD21을 보호하도록 되어 있습니다. 일반적으로 사용되는 USB2.0포트는 500mA이상의 전류가 흐르면 출력을 차단하는 기능을 갖고 있습니다. 과도한 전류를 흐르게 하는 경우에 다양한 요인에 의해 아두이노-M0가 동작되지 않거나 동작이 불안정해질 수 있음을 유의해야 합니다.</p>
<p><span style="color: #ff6600"><strong>3. 아두이노-M0 연결하기</strong></span></p>
<p>서두에서 밝힌 바와 같이 아두이노 진영에서 지난해 여름 무렵 상표분쟁이 있었다고 합니다. 2016. 3월 현재 www.arduino.cc와 www.arduino.org로 양분되어 아두이노 IDE와 각종 보드들을 공식적으로 지원하고 있는 형국입니다. 아두이노 IDE버전 1.6.x는 arduino.cc에서 공급하고 있고 1.7.x는 arduino.org에서 공급하고 있습니다. 또한 arduino studio란 IDE도 있는데 현재 알파버젼이 발표된 상태입니다.<br />
금번에 리뷰가 진행되고 있는 ‘Arduino-M0’는 www.arduino.org에서만 공급되고 있으며 1.7.x버젼의 IDE에서 정상적으로 사용할 수 있습니다. 이런 이유로 보드에는 ‘NEW IDE www.arduino.org’라는 딱지가 가운데에 붙어 있습니다. 이러한 정보 없이 ’아두이노-M0’를 구입하면 다소 난감하리라 봅니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-8.jpg" rel="lightbox[30749]"><img class="alignnone size-full wp-image-30857" alt="35 re (8)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-8.jpg" width="523" height="343" /></a></p>
<p><span style="color: #ff9900"><strong>3.1. ‘아두이노-M0’에 네이티브USB 연결하기</strong></span><br />
정확한 원인은 알 수 없었으나 USB드라이버가 제대로 인식되지 않아 애를 먹었습니다. 해결책을 찾아 arduino.org 포럼을 수소문한 끝에 방법을 알아내었고 다름 아닌 수동드라이버 인식 이었습니다. 아마도 이 글을 읽는 독자 중에는 동일한 증상을 겼을 가능성이 충분히 있다고 봅니다. ‘아두이노-레오나르도’인 경우에는 ‘아두이노 설치경로/driver’에서 손쉽게 드라이버 문제를 해결 할 수 있었습니다만 ‘Arduino-M0’는 이 방법이 소용이 없었습니다.<br />
아래 그림과 같이 ‘기타장치 ▶ 알 수 없는 장치’ 현상이 있을 때 해결책입니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-9.jpg" rel="lightbox[30749]"><img class="alignnone size-large wp-image-30859" alt="35 re (9)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-9-620x443.jpg" width="620" height="443" /></a></p>
<p>장치관리자 ▶ 기타장치 ▶ 알 수 없는 장치 ▶ 드라이버 소프트웨어 업데이트<br />
▶ 컴퓨터에서 드라이버 소프트웨어 업데이트<br />
▶ 컴퓨터의 장치목록에서 직접 선택<br />
▶ 포트 (COM &amp; LPT)<br />
▶ (제조업체)Arduino Sri(www.arduino.org)<br />
▶ (모델)Arduino Zero Native Port 를 순서대로 선택합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-10.jpg" rel="lightbox[30749]"><img class="alignnone size-large wp-image-30861" alt="35 re (10)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-10-620x446.jpg" width="620" height="446" /></a></p>
<p>이에 대한 설명을 <a href="http://labs.arduino.org/Manual+installation+of+drivers+on+Windows" target="_blank">http://labs.arduino.org/Manual+installation+of+drivers+on+Windows</a>에서도 확인할 수 있습니다.</p>
<p><span style="color: #ff9900"><strong>3.2. (Demo1)Hello World에 도전하기</strong></span><br />
LCD가 없으니 LED로 도전해 보고자 합니다. 위에서 LED는 D13에 연결되어 있음을 알았습니다.<br />
‘아두이노-우노’ 시리즈 등 8비트 계열과는 다른 MCU를 사용한 상황이므로 우선 www.arduino.org에서 특별히 제공하는 예제로 테스트를 해봅니다.<br />
만일 시작하면서 로그를 꼭 보고자 한다면 setup()에 아래와 같은 코드를 넣어줍니다.</p>
<div class="symple-box yellow none" style="text-align:left; width:100%;"> 
<p><span style="color: #008000">// If Serial moniter Used!</span><br />
<span style="color: #ff0000">while (!SerialUSB);</span></p>
</div>
<p><strong>● 소스의 위치 :</strong><br />
· http://labs.arduino.org ▶ DOCUMANTATION ▶ Boards<br />
▶ Arduino M0<br />
· http://labs.arduino.org/Arduino+M0<br />
· http://labs.arduino.org/ArduinoM0+Blink+example</p>
<p><strong>● 보드설정 : 아래와 같이</strong><br />
· 아두이노IDE1.7.8 ▶ 도구 ▶ 보드 ▶ Arduino M0를 선택합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-11.jpg" rel="lightbox[30749]"><img class="alignnone size-full wp-image-30862" alt="35 re (11)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-11.jpg" width="351" height="257" /></a></p>
<p>일단 아래와 같이 초 간단 코드를 넣어봅니다.</p>
<div class="symple-box yellow none" style="text-align:left; width:100%;"> 
<p><span style="color: #339966">// setup() is the first function executed when you plug you board</span><br />
<span style="color: #339966">// or when you reset it. This funcion runs once</span><br />
void setup() {<br />
<span style="color: #339966">// The pinMode sets digital pin 13 as an Output</span><br />
pinMode(13, OUTPUT);<br />
}</p>
<p><span style="color: #339966">// After the setup() function, the loop runs over and over</span><br />
<span style="color: #339966">// until you stop the board</span><br />
void loop() {<br />
digitalWrite(13, HIGH); <span style="color: #339966">// turn the LED on setting the pin 13 to HIGH</span><br />
delay(1000);// wait for a second<br />
digitalWrite(13, LOW); <span style="color: #339966">// turn the LED off setting the pin 13 to LOW</span><br />
delay(1000);// wait for a second<br />
}</p>
<p>Source Code1 : Blink</p>
</div>
<p>위 코드를 실행하기 위한 회로는 다음 장과 같습니다. 사실은 D13에 이미 LED가 하나 붙어 있으므로 이마저도 필요 없습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-12.jpg" rel="lightbox[30749]"><img class="alignnone  wp-image-30863" alt="35 re (12)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-12-594x620.jpg" width="535" height="558" /></a></p>
<p>1초 주기로 깜빡거리면 이제 ‘아두이노-M0’와 소통이 시작되었음을 의미합니다. 이제부터는 맛있게 요리하는 일만 남았습니다.</p>
<p><span style="color: #ff9900"><strong>3.3. (Demo2) 인터럽트방식으로 알람시각을 알려주는 리얼타임시계</strong></span><br />
‘아두이노-M0’에는 RTC를 내장하고 있습니다. 정교한 32.768Khz 오실레이터까지 포함하고 있으므로 DS1302 등 RTC칩을 사용하지 않고도 시계 어플리케이션을 만들 수 있을 것 같습니다.<br />
arduino.org 에 올라와 있는 예제를 한번 돌려 보기로 합니다.</p>
<div class="symple-box yellow none" style="text-align:left; width:100%;"> 
<p><span style="color: #339966">***********************************************************************</span><br />
<span style="color: #339966">* This sketch demonstrate how to use alarm in interrupt mode.</span><br />
<span style="color: #339966">This mode is more conveniently because you use processor for other tasks and when alarm match occurs interrupt routine is executed.</span><br />
<span style="color: #339966">In this way, alarm flag checking is indipendent from main program flow.</span><br />
<span style="color: #339966">***********************************************************************</span><br />
<span style="color: #339966">//*RTC Alarm in interrupt mode*/</span><br />
#include &lt;RTCInt.h&gt; <span style="color: #339966">//include RTCint library</span></p>
<p>RTCInt rtc; <span style="color: #339966">//create an RTCInt type object</span><br />
int buzzer=11; <span style="color: #339966">//connect the buzzer to digital pin 11</span><br />
int red=12; <span style="color: #339966">//connect red led to digital pin 12</span><br />
int green=13; <span style="color: #339966">//connect green led to digital pin 13</span><br />
<span style="color: #339966">/*setup*/</span><br />
void setup()<br />
{<br />
SerialUSB.begin(9600); <span style="color: #339966">//serial communication initializing</span><br />
pinMode(green,OUTPUT); <span style="color: #339966">//define green as output</span><br />
pinMode(red,OUTPUT); <span style="color: #339966">//define red as output</span><br />
pinMode(buzzer,OUTPUT); <span style="color: #339966">//define buzzer as output</span><br />
digitalWrite(green,LOW); <span style="color: #339966">//initialize the green to LOW level</span><br />
digitalWrite(red,LOW); <span style="color: #339966">//initialize the green to LOW level</span><br />
rtc.begin(TIME_H24); <span style="color: #339966">//RTC initializing with 24 hour representation mode</span><br />
rtc.setTime(17,0,5,0); <span style="color: #339966">//setting time (hour minute and second)</span><br />
rtc.setDate(13,8,15); <span style="color: #339966">//setting date</span><br />
rtc.enableAlarm(SEC,ALARM_INTERRUPT,alarm_int); <span style="color: #339966">//enabling alarm in interrupt mode</span><br />
rtc.local_time.hour=17; <span style="color: #339966">//setting hour alarm</span><br />
rtc.local_time.minute=1;<span style="color: #339966"> //setting minute alarm</span><br />
rtc.local_time.second=10;<span style="color: #339966"> //setting second to match</span><br />
rtc.setAlarm();<span style="color: #339966"> //write second in alarm register</span><br />
}<br />
<span style="color: #339966">/*loop*/</span><br />
void loop()<br />
{ noTone(buzzer); <span style="color: #339966">// disable the buzzer</span><br />
digitalWrite(green,HIGH); <span style="color: #339966">//turn on green led</span><br />
delay(500); <span style="color: #339966">//wait 500 millisecond</span><br />
}</p>
<p><span style="color: #339966">*************** Interrupt routine for alarm ******************************</span><br />
void alarm_int(void)<br />
{<br />
SerialUSB.println(“Alarm match!”);<br />
for(int i=0; i &lt; 30; i++)<br />
{ digitalWrite(green,LOW);<span style="color: #339966"> //turn off green led</span><br />
tone(buzzer,200); <span style="color: #339966">//play buzzer</span><br />
digitalWrite(red,HIGH); <span style="color: #339966">//turn on red green</span><br />
for(int j=0; j &lt; 1000000; j++)<br />
asm(“NOP”); <span style="color: #339966">//in interrupt routine you cannot use delay function then an alternative is NOP instruction cicled many time as you need</span><br />
digitalWrite(red,LOW); <span style="color: #339966">//turn off red green italWrite(13,LOW);</span><br />
for(int j=0; j &lt; 2000000; j++)<br />
asm(“NOP”);<br />
}<br />
RTC-&gt;MODE2.INTFLAG.bit.ALARM0=1; <span style="color: #339966">//clearing alarm0 flag</span><br />
}</p>
<p>- Source Code2 : RTC Alarm Clock</p>
</div>
<p>문제없이 잘 동작됨을 알 수 있기는 합니다만 전원을 끄거나 프로그램을 내려 보내면 다시 초기화 되어버리는 상황에서 얼마나 실효성이 있을지 의문이 들기도 합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-13.jpg" rel="lightbox[30749]"><img class="alignnone size-large wp-image-30864" alt="35 re (13)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-13-620x479.jpg" width="620" height="479" /></a></p>
<p><span style="color: #ff9900"><strong>3.4. (Demo3) D/A컨버터 기능 맛보기</strong></span><br />
‘아두이노 M0’에는 10비트 D/A컨버터 기능이 있음을 살펴보았습니다. 이 D/A컨버터의 기능을 시험해보려고 arduino.org를 이곳저곳 기웃거려 봤으나 마땅 정보가 없었고 arduino.cc에서 아두이노-Zero 보드용으로 공개해 놓은 라이브러리를 입수 할 수 있었습니다.<br />
소스를 쭉 살펴보니 44.1Khz로 sampling된 wav파일을 디코딩하는 라이브러리였고 과연 어느 정도의 음질인지 확인해 보고 싶었습니다. 그러나 아쉽게도 ‘아두이노-M0’에는 wave 파일을 담을 매체인 SD-CARD가 부착되어져 있지 않으므로 SD메모리카드소켓을 아래와 같이 직접 부착을 하였습니다.</p>
<table style="width: 620px" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-14.jpg" rel="lightbox[30749]"><img class="alignnone size-large wp-image-30865" alt="35 re (14)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-14-620x482.jpg" width="620" height="482" /></a></td>
</tr>
<tr>
<td><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-15.jpg" rel="lightbox[30749]"><img class="alignnone size-large wp-image-30866" alt="35 re (15)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-15-620x348.jpg" width="620" height="348" /></a></td>
</tr>
<tr>
<td>
<p style="text-align: center">회로도3 : SD Card Interface 부착</p>
</td>
</tr>
</tbody>
</table>
<p>소리는 제 블로그(http://blog.naver.com/crucian2k3)를 방문하면 들을 수 있을 것입니다만 우선 오실로스코프에 나타난 파형은 아래와 같이 관찰할 수 있었습니다.</p>
<table style="width: 620px" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-16.jpg" rel="lightbox[30749]"><img class="alignnone size-large wp-image-30867" alt="35 re (16)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-16-620x348.jpg" width="620" height="348" /></a></td>
</tr>
<tr>
<td><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-17.jpg" rel="lightbox[30749]"><img class="size-full wp-image-30868 aligncenter" alt="35 re (17)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-17.jpg" width="342" height="256" /></a></td>
</tr>
<tr>
<td style="text-align: center">그림7 : DAC Analog Signal 출력</td>
</tr>
</tbody>
</table>
<p>소스코드는 다음과 같습니다.</p>
<div class="symple-box yellow none" style="text-align:left; width:100%;"> 
<p><span style="color: #339966">/*</span><br />
<span style="color: #339966"> Simple Audio Player for Arduino Zero</span></p>
<p><span style="color: #339966">Demonstrates the use of the Audio library for the Arduino Zero</span></p>
<p><span style="color: #339966">Hardware required :</span><br />
<span style="color: #339966"> * Arduino shield with a SD card on CS4</span><br />
<span style="color: #339966"> * A sound file named “test.wav” in the root directory of the SD card</span><br />
<span style="color: #339966"> * An audio amplifier to connect to the DAC0 and ground</span><br />
<span style="color: #339966"> * A speaker to connect to the audio amplifier</span></p>
<p><span style="color: #339966"> Arturo Guadalupi &lt;a.guadalupi@arduino.cc&gt;</span><br />
<span style="color: #339966"> Angelo Scialabba &lt;a.scialabba@arduino.cc&gt;</span><br />
<span style="color: #339966"> Claudio Indellicati &lt;c.indellicati@arduino.cc&gt;</span></p>
<p><span style="color: #339966">This example code is in the public domain</span></p>
<p><span style="color: #339966">http://arduino.cc/en/Tutorial/SimpleAudioPlayerZero</span><br />
<span style="color: #339966"> */</span></p>
<p><span style="color: #339966"> /*</span><br />
<span style="color: #339966"> Modify 2016.2.29 By D.H.Kim SD Memory Card Interface</span></p>
<p><span style="color: #339966"> [SD CARD]&#8212;-[ARDUINO]</span><br />
<span style="color: #339966"> 9: NC &#8212;&#8211;</span><br />
<span style="color: #339966"> 1: CS &#8212;&#8211;D4</span><br />
<span style="color: #339966"> 2: DI &lt;&#8212;-MOSI(84)</span><br />
<span style="color: #339966"> 3: VSS1&#8212;&#8211;GND(86)</span><br />
<span style="color: #339966"> 4: VDD &#8212;&#8211;3.3V</span><br />
<span style="color: #339966"> 5: CLK &lt;&#8212;-CLK(83)</span><br />
<span style="color: #339966"> 6: VSS2&#8212;&#8211;GND(86)</span><br />
<span style="color: #339966"> 7: DO &#8212;-&gt;MISO(81)</span><br />
<span style="color: #339966"> 8: NC &#8212;&#8211;</span><br />
<span style="color: #339966">*/</span></p>
<p>#include &lt;SD.h&gt;<br />
#include &lt;SPI.h&gt;<br />
#include &lt;AudioZero.h&gt;</p>
<p>void setup()<br />
{<br />
<span style="color: #339966">// debug output at 115200 baud</span><br />
SerialUSB.begin(115200);</p>
<p><span style="color: #339966"> //Wait until USB CDC port connects</span><br />
while(!SerialUSB);</p>
<p><span style="color: #339966">// setup SD-card</span><br />
SerialUSB.print(“Initializing SD card&#8230;”);<br />
if (!SD.begin(4)) {<br />
SerialUSB.println(“ failed!”);<br />
while(true);<br />
}<br />
SerialUSB.println(“ done.”);</p>
<p><span style="color: #339966">// 44100kHz stereo =&gt; 88200 sample rate</span><br />
AudioZero.begin(44100);<br />
}</p>
<p>void loop()<br />
{<br />
int count = 0;</p>
<p>// open wave file from sdcard<br />
File myFile = SD.open(“test.wav”);<br />
if (!myFile) {<br />
<span style="color: #339966">// if the file didn’t open, print an error and stop</span><br />
SerialUSB.println(“error opening test.wav”);<br />
while (true);<br />
}</p>
<p>SerialUSB.print(“Playing”);</p>
<p><span style="color: #339966">// until the file is not finished</span><br />
AudioZero.play(myFile);</p>
<p>SerialUSB.println(“End of file. Thank you for listening!”);<br />
//while (true) ;<br />
}</p>
<p>- Source Code3 : WAV File 출력<br />
</div>
음질은 FM 라디오수준 정도는 되는듯합니다만 사람에 따라 느낌은 다소 다르리라 봅니다. 코덱칩이 붙어있지 않은 상황에서도 ‘아두이노-M0’는 wav정도는 거뜬히 재생할 수 있음을 확인할 수 있었습니다.</p>
<p>· 인코딩작업 조건 : 44.1Khz, 8bit mono sampling<br />
· 라이브러리 출처 : https://www.arduino.cc/en/Tutorial/SimpleAudioPlayerZero</p>
<p>&nbsp;</p>
<p><span style="color: #ff6600;font-size: medium"><strong>4. 시리얼 포트와 관련된 유의 사항</strong></span></p>
<p>아래와 같이 시리얼 클래스는 Serial5를 써서 Pin0, Pin1을 통해 통신(TTL Level)하는 방법과 SerialUSB(CDC)를 사용하는 방법이 있습니다.<br />
즉 Serial5는 H/W타입의 시리얼포트라고 볼 수 있겠습니다.<br />
이 시리얼5와 SerialUSB는 동시에 사용될 수 있으며 매우 간단하게 USB To Serial Bridge를 만들 수 있습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35sr-5.png" rel="lightbox[30749]"><img class="alignnone size-full wp-image-30764" alt="35sr  (5)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35sr-5.png" width="593" height="191" /></a></p>
<p><span style="color: #ff9900"><strong>4.1. (Demo4) USB To Serial 브릿지 구현 예</strong></span><br />
아래에 실제로 구현된 Bridge Source입니다.<br />
D0, D1을 통해 TTL신호가 들어오거나 나가게 되며 USB CDC를 통해 PC측과 연결되게 됩니다. 이러한 기능은 유사한 H/W 구조를 가진 ‘아두이노 레오나르도’에서도 구현이 가능합니다.<br />
이때는 시리얼클래스명이 다르므로 주의해야 합니다.</p>
<div class="symple-box yellow none" style="text-align:left; width:100%;"> 
<p><span style="color: #339966">/*</span><br />
<span style="color: #339966"> leo_usb2serial</span><br />
<span style="color: #339966"> 아두이노 M0를 활용한 USB to Serial Bridge</span><br />
<span style="color: #339966"> 자료참고 : https://petervanhoyweghen.wordpress.com/2012/11/08/</span><br />
<span style="color: #339966"> using-the-leonardo-as-usb-to-serial-converter/</span><br />
<span style="color: #339966"> */</span><br />
static long baud = 57600;<br />
static long newBaud = baud;</p>
<p><span style="color: #339966">// this pin will output the DTR signal (as set by the pc)</span><br />
#define DTR_PIN 13</p>
<p>#define LINESTATE_DTR 1</p>
<p>void lineCodingEvent(long baud, byte databits, byte parity, byte charFormat)<br />
{<br />
newBaud = baud;<br />
}</p>
<p>void lineStateEvent(unsigned char linestate)<br />
{<br />
if(linestate &amp; LINESTATE_DTR)<br />
digitalWrite(DTR_PIN, HIGH);<br />
else<br />
digitalWrite(DTR_PIN, LOW);<br />
}</p>
<p>void setup() {<br />
pinMode(DTR_PIN, OUTPUT);<br />
digitalWrite(DTR_PIN, LOW);</p>
<p>Serial5.begin(baud);<br />
SerialUSB.begin(baud);</p>
<p><span style="color: #339966">//Wait until USB CDC port connects</span><br />
while(!SerialUSB){};<br />
}</p>
<p>void loop() {</p>
<p><span style="color: #339966">// Set the new baud rate</span><br />
if(newBaud != baud) {<br />
baud = newBaud;<br />
SerialUSB.end();<br />
SerialUSB.begin(baud);<br />
}</p>
<p>//Copy byte incoming via TTL serial<br />
if (Serial5.available()) {<br />
char c = (char)Serial5.read();<br />
SerialUSB.write(c);<br />
}</p>
<p>//Copy byte incoming via CDC serial<br />
if (SerialUSB.available()) {<br />
char c = (char)SerialUSB.read();<br />
Serial5.write(c);<br />
}<br />
}</p>
<p>- Source Code4 : USB 2 SERIAL<br />
</div>
<p><span style="color: #ff6600;font-size: medium"><strong>5. (Demo 5) A/D 컨버터관련 사항</strong></span></p>
<p><strong>● 함수명 : analogReference(ref)</strong><br />
· AR_DEFAULT : VDDana(3.3V) 핀의 전압을 사용<br />
· AR_INTERNAL : 1V<br />
· AR_EXTERNAL : 가변적이다.</p>
<p><strong>● 함수명 : analogReadResolution(res)</strong><br />
· 8: 0 to 255<br />
· 10: 0 to 1023<br />
· 12: 0 to 4096 (최고 해상도)</p>
<div class="symple-box yellow none" style="text-align:left; width:100%;"> 
<p><span style="color: #339966">//Define the Temperature Sensor Pin</span><br />
#define ADCVREF 3.3f<br />
#define ADCMAXCOUNT 4096.0f<br />
#define ADCVDIV 1.0f<br />
#define ADCACCUR (ADCVREF / ADCMAXCOUNT) // 0.00080566<br />
#define ADCRESOLUTION 12</p>
<p>int sensorPin = A0;<br />
int inTmp;</p>
<p><span style="color: #339966">/********************************************************************</span><br />
<span style="color: #339966">* Function Name: int lowPassFilter2(int adVal)</span><br />
<span style="color: #339966">* Return Value:</span><br />
<span style="color: #339966">* Parameters:</span><br />
<span style="color: #339966">* Description: 제1차 저주파 필터로 여러 함수에서 공통적으로 사용될 수 있으므로 구조체를</span><br />
<span style="color: #339966">* 통해 접근이 이뤄지도록 한다.</span><br />
<span style="color: #339966">*</span><br />
<span style="color: #339966">* NOTE: http://wlsgk123123.blog.me/</span><br />
<span style="color: #339966">********************************************************************/</span><br />
#define LPFALPHA 0.95f<br />
int lowPassFilter2(int adVal)<br />
{<br />
static float xLFP;<br />
static float prevX;<br />
static unsigned short firstRun;</p>
<p>if (firstRun == 0){<br />
<span style="color: #339966">// 필터가 호출되면 처음 실행되는 부분으로 함수 내부의 변수들을 초기화 한다.</span><br />
prevX = 0;<br />
firstRun = 1;<br />
}<br />
<span style="color: #339966">// 이전 값에다 현재 값의 LPFALPHA 만큼을 더한 값이 최종 현재 값이 된다. 즉, 이전 값과 현재 값의 일정 퍼센트 만을 더해 현재 값을 생성해 내는 방식으로 필터링 한다.</span><br />
xLFP = (LPFALPHA * prevX) + (1 &#8211; LPFALPHA) * (float)adVal;<br />
prevX = xLFP;<br />
return (unsigned int)prevX; // 정수값 만을 반환 시킨다.<br />
}</p>
<p><span style="color: #339966">/*</span><br />
<span style="color: #339966">-AR_DEFAULT: the default analog reference are 5V or 3.3V; </span><br />
<span style="color: #339966">-AR_INTERNAL: an built-in reference, equal to 1 volts </span><br />
<span style="color: #339966">-AR_EXTERNAL: use as reference the voltage applied to AREF pin in the range 0-5V only. </span><br />
<span style="color: #339966">*/</span><br />
void setup() {<br />
//Start Serial connection to read results in Serial Monitor<br />
SerialUSB.begin(9600);<br />
analogReadResolution(ADCRESOLUTION);<br />
analogReference(AR_DEFAULT);<br />
}</p>
<p>void loop() {<br />
int lpfVar;<br />
int adVal;<br />
float rawADVoltage;<br />
signed int adcMiliVolts;<br />
signed int miliRealTemp;</p>
<p><span style="color: #339966">//Get the sensor raw reading </span><br />
<span style="color: #339966"> //then convert it from a </span><br />
<span style="color: #339966"> // 10bit: 0 to 1023 digital range(1step = 0.00322)</span><br />
<span style="color: #339966"> // 12bit: 0 to 4095 digital range(1step = 0.0008056)</span><br />
<span style="color: #339966"> // 만일 12bit모드면 [21.9℃] 는 888이 읽힌다</span><br />
<span style="color: #339966"> // 888 = 0.719v / 0.0008056</span><br />
adVal = analogRead(sensorPin);</p>
<p><span style="color: #339966">// A/D채널을 읽어</span><br />
lpfVar = lowPassFilter2(adVal); // 저역통과필터</p>
<p><span style="color: #339966">// A/D변환 결과를 Voltage로 변환 시킨다. </span><br />
<span style="color: #339966"> // 이때 절사가 일어나 0.1도의 편차가 발생한다.</span><br />
rawADVoltage = (float)lpfVar * ADCACCUR * ADCVDIV;</p>
<p><span style="color: #339966">// Voltage를 MCP9700의 온도값 형태인 mV로 변환 시켜준다.</span><br />
<span style="color: #339966"> // 719.00 = (0.719 * 10000) / 10</span><br />
adcMiliVolts = rawADVoltage * 1000.0f;</p>
<p><span style="color: #339966">// MCP9700스타일의 온도를 섭씨 형태로 변환 시켜준다.</span><br />
<span style="color: #339966"> // 이때 온도는 219 = 719 &#8211; 500</span><br />
miliRealTemp = adcMiliVolts &#8211; 500;</p>
<p><span style="color: #339966">//Convert the raw value to Celsius</span><br />
<span style="color: #339966"> //temperature = (temperature &#8211; .5) * 100;</span></p>
<p>SerialUSB.print(adVal); SerialUSB.print(“, “);<br />
SerialUSB.print(lpfVar); SerialUSB.print(“, “);<br />
<span style="color: #339966">//SerialUSB.print(rawADVoltage); SerialUSB.print(“, “);</span><br />
<span style="color: #339966"> //SerialUSB.print(adcMiliVolts); SerialUSB.print(“, “);</span><br />
SerialUSB.println(miliRealTemp);</p>
<p><span style="color: #339966">//Print the temperature value to Serial Monitor</span><br />
<span style="color: #339966"> //SerialUSB.println(voltage);</span></p>
<p><span style="color: #339966">//Read the temperature each second</span><br />
delay(10);<br />
}</p>
<p>- Source Code5 : 12Bit ADC<br />
</div>
<p>10bit 상태에서는 ADC 값이 1 증가 혹은 감소할 때마다 0.00322v (3.3v/1024)를 차지하게 됩니다. 이로 인해 MCP9700 등 고정밀 아날로그 센서를 사용하면 수숫점 이하의 온도는 약 0.3V 단위로 증가 혹은 감소하게 됩니다(19.8℃ ▶ 20.1℃).<br />
그러나 12bit에서는 1스텝 당 0.0008056(3.3/4096)이 되므로 좀 더 정확한 소숫점 이하 자릿수 표현이 가능합니다(0.1도씩 증가 : 21.5℃ ▶21.6℃).</p>
<p><span style="color: #ff6600;font-size: medium"><strong>6. 9축 모션센서 쉴드</strong></span></p>
<p>BNO055 9축 모션센서 칩은 종래의 칩에 비하면 대단히 고 집적화된 기능을 포함하고 있습니다. 우선 3축 14비트 가속도계, 3축 16비트 자이로스코프, 3축 지자기센서로 구성되어 있으며 BSX3.0 FusionLib를 통해 손쉬운 접근이 가능하도록 만들어졌습니다.<br />
이 라이브러리는 내장된 32비트 머신에서 실행되며 초당 ±2,000℃ 범위를 출력할 수 있습니다. 이를 통해 3차원 가속기능, 3가지 방향의 지자기 강도데이터를 얻을 수 있고 오일러각도, 회전벡터, 선형가속, 중력벡터와 같은 센서 융합정보를 산출해 낼 수 있습니다.<br />
이 보드는 5V가 인가되지만 내부적으로는 3.3V로 레벨쉬프트 되어 구동됩니다. 또한 이 칩은 네비게이션, 로봇, 운동, 증강현실, 상황인식, 태블릿, 울트라북 등의 하이테크한 전자제품에 두루 사용될 수 있다고 합니다. 그럼 BOSCH의 데이터쉬트에 기재된 내용을 바탕으로 각 파트를 좀 더 상세히 살펴보도록 하겠습니다.</p>
<p><span style="color: #ff9900"><strong>6.1. Bosch Sensortec GmbH의 BNO055칩 스펙</strong></span><br />
<strong></strong></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35sr-6.png" rel="lightbox[30749]"><img class="alignnone size-full wp-image-30765" alt="35sr  (6)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35sr-6.png" width="518" height="342" /></a></p>
<p><strong><span style="color: #ff9900">6.2 시스템 아키텍처</span></strong><br />
<strong></strong></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-1.png" rel="lightbox[30749]"><img class="alignnone size-full wp-image-30844" alt="35 re (1)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-1.png" width="452" height="288" /></a></p>
<p><strong><span style="color: #ff9900">6.3. 9축 모션쉴드에 장착된 컨넥터</span></strong><br />
<strong>● 기판 상부에 위치한 커넥터는 다음과 같이 맵핑되어 있습니다.</strong></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35sr-7.png" rel="lightbox[30749]"><img class="alignnone  wp-image-30766" alt="35sr  (7)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35sr-7.png" width="358" height="168" /></a></p>
<p><strong>● 기판 상부에 위치한 솔더링 점퍼</strong></p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35sr-1.png" rel="lightbox[30749]"><img class="alignnone  wp-image-30760" alt="35sr  (1)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35sr-1.png" width="361" height="90" /></a><br />
모션쉴드와 아두이노-M0는 TWI를 통해 서로 연결되게 됩니다.<br />
INT핀은 기본적으로 오픈이 되어 있으나 인터럽트 서비스 등을 하기위해서는 D7 또는 D2에 연결되어야 합니다.</p>
<p><strong><span style="color: #ff9900">6.4. 센서 테스트</span></strong><br />
센서를 테스트 해보기 전에 Pitch, Roll, Yaw에 대해서 간단히 짚고 넘어갑니다.<br />
말 그대로 모션을 처리하기 위해서는 3차원 좌표계에서 물체의 위치나 이동경로를 표현할 수 있어야 하는데, 이와 관련된 아주 기초적인 용어가 위에 언급한 피치, 롤, 요입니다. 이러한 용어는 항공기, 드론, 균형로봇 등에서 활발하게 사용됩니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-19.jpg" rel="lightbox[30749]"><img class="alignnone  wp-image-30870" alt="35 re (19)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-19-620x430.jpg" width="496" height="344" /></a></p>
<p>● Pitch(X축) : 피치는 비행기의 승강, 하강 개념입니다. 즉 조종사가 조종간을 앞으로 밀거나 뒤로 당기면 동체가 상승, 하강을 하게 되는데 여기에서 사용되는 용어에 해당합니다.<br />
● Roll(Y축) : 항공기의 조종간을 좌우로 밀면 동체가 그에 따라 기울어질 때 나타나게 되는 현상입니다.<br />
● Yaw(Z축) : 자동차의 핸들을 돌리면 좌, 우측으로 주행하는 방향을 칭하며 항공기에서는 왼발, 오른발 패달에 해당합니다.</p>
<p>가속도 센서는 현재의 기울어짐을 정확히 나타내는데 사용됩니다. 자이로센서는 센서가 회전이 되는 상황에서 시간에 따른 움직임을 추적할 수 있으며 적분방식으로 사용되고 이에 따라 시간에 따른 오차를 동반하게 됩니다.<br />
따라서 정확한 피치와 롤 값을 얻기 위해 가속도센서와 자이로센서를 동시에 사용하게 됩니다. 여기서 가속도센서와 자이로센서만으로는 요 값을 정확히 산정해 낼 수 없는 문제에 봉착하며 이를 해결하기 위해 지자기센서가 사용됩니다. 이러한 내용을 좀 더 깊이 있게 접하고자 하는 독자는 아래 주소를 참고하시기 바랍니다.<a href="//www.hardcopyworld.com/ngine/aduino/index.php/archives/126)" target="_blank">(http://www.hardcopyworld.com/ngine/aduino/index.php/archives/126)</a><br />
이론은 이 정도로만 하고 9축 모션쉴드를 동작시켜 보고 과연 피치, 롤, 요가 어떻게 반응 하는지를 그래프로 살펴보도록 하겠습니다.</p>
<table style="width: 620px" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-20.jpg" rel="lightbox[30749]"><img class="aligncenter" alt="35 re (20)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-20.jpg" width="493" height="510" /></a></td>
</tr>
<tr>
<td style="text-align: center">그림9 : 9축 모션센서 출력</td>
</tr>
</tbody>
</table>
<p>우선 Serial Oscilloscope 프로그램을 아래 주소에서 다운로드 받습니다. (<a href="http://www.x-io.co.uk/serial-oscilloscope/" target="_blank">http://www.x-io.co.uk/serial-oscilloscope/</a>) 다음으로 아래의 프로그램을 ‘아두이노-M0’로 내려 보냅니다.</p>
<p>이 프로그램에는 쉴드에서 얻어진 가속도 데이터를 1줄에 3개씩 묶어 Native USB포트를 통해 PC로 전송을 하게 됩니다.<br />
Serial Oscilloscope로 데이터가 들어오면 첫 번째 데이터는 적색, 두 번째 데이터는 녹색, 세 번째는 청색으로 그래프가 그려지게 됩니다.<br />
아래 그래프를 보면 가속도 센서에서 피치(X축), 롤(Y축) 정보가 잘 얻어 짐을 알 수 있습니다.</p>
<table style="width: 620px" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-21.jpg" rel="lightbox[30749]"><img class="alignnone size-large wp-image-30872" alt="35 re (21)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-21-620x398.jpg" width="620" height="398" /></a></td>
</tr>
<tr>
<td style="text-align: center">그림10 : 가속도센서 출력화면</td>
</tr>
</tbody>
</table>
<p>arduino.org에서 공개해 놓은 예제를 Serial Oscilloscope로 볼 수 있도록 조금만 변경해 봅니다.</p>
<div class="symple-box yellow none" style="text-align:left; width:100%;"> 
<p><span style="color: #339966">/********************************************************************</span><br />
<span style="color: #339966">* Copyright (C) 2011 &#8211; 2014 Bosch Sensortec GmbH</span><br />
<span style="color: #339966">*</span><br />
<span style="color: #339966">* Usage: Example code to stream Accelerometer data</span><br />
<span style="color: #339966">*</span><br />
<span style="color: #339966">* License:</span><br />
<span style="color: #339966">* Redistribution and use in source and binary forms, with or without</span><br />
<span style="color: #339966">* modification, are permitted provided that the following conditions are met:</span><br />
<span style="color: #339966">* Redistributions of source code must retain the above copyright</span><br />
<span style="color: #339966">* notice, this list of conditions and the following disclaimer.</span><br />
<span style="color: #339966">* Redistributions in binary form must reproduce the above copyright</span><br />
<span style="color: #339966">* notice, this list of conditions and the following disclaimer in the</span><br />
<span style="color: #339966">* documentation and/or other materials provided with the distribution.</span><br />
<span style="color: #339966">* Neither the name of the copyright holder nor the names of the</span><br />
<span style="color: #339966">* contributors may be used to endorse or promote products derived from</span><br />
<span style="color: #339966">* this software without specific prior written permission.</span><br />
<span style="color: #339966">*</span><br />
<span style="color: #339966">* The information provided is believed to be accurate and reliable.</span><br />
<span style="color: #339966">* The copyright holder assumes no responsibility for the consequences of use</span><br />
<span style="color: #339966">* of such information nor for any infringement of patents or</span><br />
<span style="color: #339966">* other rights of third parties which may result from its use.</span><br />
<span style="color: #339966">* No license is granted by implication or otherwise under any patent or</span><br />
<span style="color: #339966">* patent rights of the copyright holder.</span><br />
<span style="color: #339966">*/</span></p>
<p><span style="color: #339966">/* </span><br />
<span style="color: #339966">9축모션쉴드를 테스트해보기 위해 만들어진 프로그램</span><br />
<span style="color: #339966">*동작시키는 방법*</span><br />
<span style="color: #339966">1. Serial Osciloscope 프로그램을 아래 주소에서 다운로드 받는다.</span><br />
<span style="color: #339966"> ( http://www.x-io.co.uk/serial-oscilloscope/ )</span><br />
<span style="color: #339966">2. 아래 3개 파트로 나뉘어진 주석을 한 영역씩만 풀어가며 아두이노-m0로 내려 보낸다. </span><br />
<span style="color: #339966">3. Serial Osciloscope로 데이터가 들어오면 첫번째 데이터는 적색, </span><br />
<span style="color: #339966"> 두번째 데이터는 녹색, 세번째는 청색으로 그래프가 그려진다.</span><br />
<span style="color: #339966">4. 결과 : 가가속도 센서에서는 피치(X축), 롤(Y축) 정보가 잘 얻어 짐을 알 수 있다.</span><br />
<span style="color: #339966">*/</span></p>
<p><span style="color: #339966">//Contains the bridge code between the API and the Arduino Environment</span><br />
#include “NAxisMotion.h”<br />
#include &lt;Wire.h&gt;</p>
<p><span style="color: #339966">//Object that for the sensor</span><br />
NAxisMotion mySensor;</p>
<p><span style="color: #339966">//To store the last streamed time stamp</span><br />
unsigned long lastStreamTime = 0;</p>
<p><span style="color: #339966">//To stream at 25Hz without using additional timers</span><br />
<span style="color: #339966">//(time period(ms) =1000/frequency(Hz))</span><br />
const int streamPeriod = 40;</p>
<p><span style="color: #339966">//Flag to update the sensor data</span><br />
<span style="color: #339966">//Default is true to perform the first read before the first stream</span><br />
bool updateSensorData = true;</p>
<p><span style="color: #339966">//This code is executed once</span><br />
void setup() {<br />
<span style="color: #339966">//Peripheral Initialization</span></p>
<p><span style="color: #339966">//Initialize the Serial Port</span><br />
<span style="color: #339966">//to view information on the Serial Monitor</span><br />
SerialUSB.begin(115200);</p>
<p>while(!SerialUSB);</p>
<p><span style="color: #339966">//Initialize I2C communication to the let the</span><br />
<span style="color: #339966">//library communicate with the sensor.</span><br />
I2C.begin();</p>
<p><span style="color: #339966">//Sensor Initialization</span><br />
<span style="color: #339966">//The I2C Address can be changed here</span><br />
<span style="color: #339966">//inside this function in the library</span><br />
mySensor.initSensor();</p>
<p><span style="color: #339966">//Can be configured to other operation modes as desired</span><br />
mySensor.setOperationMode(OPERATION_MODE_NDOF);</p>
<p><span style="color: #339966">//The default is AUTO</span><br />
<span style="color: #339966">//Changing to manual requires calling the relevant</span><br />
<span style="color: #339966">//update functions prior to calling the read functions</span><br />
mySensor.setUpdateMode(MANUAL);<br />
<span style="color: #339966">//Setting to MANUAL requires lesser reads to the sensor</span></p>
<p>mySensor.updateAccelConfig();<br />
updateSensorData = true;</p>
<p>SerialUSB.println();<br />
SerialUSB.println(“Default accelerometer configuration settings&#8230;”);<br />
SerialUSB.print(“Range: “);<br />
SerialUSB.println(mySensor.readAccelRange());<br />
SerialUSB.print(“Bandwidth: “);<br />
SerialUSB.println(mySensor.readAccelBandwidth());<br />
SerialUSB.print(“Power Mode: “);<br />
SerialUSB.println(mySensor.readAccelPowerMode());</p>
<p><span style="color: #339966">//Countdown</span><br />
SerialUSB.println(“Streaming in &#8230;”);<br />
SerialUSB.print(“3&#8230;”);<br />
delay(1000); //Wait for a second<br />
SerialUSB.print(“2&#8230;”);<br />
delay(1000); //Wait for a second<br />
SerialUSB.println(“1&#8230;”);<br />
delay(1000); //Wait for a second<br />
}</p>
<p>void loop() { <span style="color: #339966">//This code is looped forever</span><br />
<span style="color: #339966">//Keep the updating of data as a separate task</span><br />
if (updateSensorData) {<br />
//Update the Accelerometer data<br />
mySensor.updateAccel();<br />
//Update the Linear Acceleration data<br />
mySensor.updateLinearAccel();<br />
//Update the Gravity Acceleration data<br />
mySensor.updateGravAccel();<br />
//Update the Calibration Status<br />
mySensor.updateCalibStatus();<br />
updateSensorData = false;<br />
}<br />
if ((millis() &#8211; lastStreamTime) &gt;= streamPeriod) {<br />
lastStreamTime = millis();<br />
//Accelerometer X-Axis data : 적색그래프<br />
SerialUSB.print(“ aX: “);<br />
SerialUSB.print(mySensor.readAccelX());<br />
SerialUSB.print(“m/s2, “);</p>
<p>//Accelerometer Y-Axis data : 녹색그래프<br />
SerialUSB.print(“ aY: “);<br />
SerialUSB.print(mySensor.readAccelY());<br />
SerialUSB.print(“m/s2, “);</p>
<p>//Accelerometer Z-Axis data : 청색그래프<br />
SerialUSB.print(“ aZ: “);<br />
SerialUSB.print(mySensor.readAccelZ());<br />
SerialUSB.print(“m/s2, “);</p>
<p>SerialUSB.println();<br />
updateSensorData = true;<br />
}<br />
}</p>
<p>- Source Code5 : 가속도센서 테스트<br />
</div>
<table style="width: 620px" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-22.jpg" rel="lightbox[30749]"><img class="alignnone size-large wp-image-30873" alt="35 re (22)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-22-620x348.jpg" width="620" height="348" /></a></td>
</tr>
<tr>
<td style="text-align: center">9축모션쉴드를 장착한 모습</td>
</tr>
</tbody>
</table>
<p>모션쉴드를 ‘아두이노-M0’에 결합하여 실제로 어떻게 동작 되는지 까지를 살펴봤습니다. 지면 관계상 위 예에서는 가속도센서만 그래프를 그렸습니다만 자이로센서나 지자기센서도 동일한 방식으로 접근하여 실제로 동작되는 모습들을 충분히 눈으로 볼 수 있을 것으로 봅니다.</p>
<table style="width: 620px" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-23.jpg" rel="lightbox[30749]"><img class="alignnone size-large wp-image-30874" alt="35 re (23)" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/35-re-23-620x348.jpg" width="620" height="348" /></a></td>
</tr>
<tr>
<td style="text-align: center">그림11 : 모션센서 방향각, X축 방향은 보드의 가로방향이며 Y축은 세로방향, Z축은 중심점이다</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><strong style="color: #ff6600">7. 마무리</strong></p>
<p>아두이노 진영이 이처럼 각광 받을 수 있었던 것은 폼펙터 표준화와 쉴드 호환성이 가장 큰 요인이 아니었나 봅니다.<br />
심지어 아두이노와 아주 이질적으로 보이는 제조사 측에서도 아두이노의 폼펙터를 따라하고 심지어 명령어까지도 동일하게 만드는 것을 보면 대세는 아두이노가 맞는 듯합니다. 이러한 상황에서 최근에 출시된 ‘아두이노-M0, 아두이노-M0-Pro, 아두이노-Zero’ 등은 동일한 MCU를 사용하기에 성능은 대동소이하며 컴퓨팅 파워에 목말라 하던 하이엔드 지향형 사용자층에게 강하게 어필 할 수 있을 것으로 봅니다.<br />
특히 ‘아두이노-M0’의 기능 중 DAC는 간단한 효과음, 음악, 목소리 등을 발생시킬 수 있음에 따라 다양한 용도가 있을 듯합니다.<br />
9축 모션센서 쉴드 또한 막강한 성능을 자랑하긴 합니다만, 이 쉴드보드는 임베디드컴퓨터 쪽을 전문을 다루는 사람이 아니라면 상당한 진입장벽을 느낄 수도 있을 것 같습니다. ‘아두이노-M0’와 모션쉴드를 결합하면 게임컨트롤러, 균형로봇, 드론 등등에 매우 유용하게 사용될 수 있을 것으로 기대됩니다.<br />
시간이 허락되는 대로 모션쉴드를 응용한 재미나는 프로젝트로 진행해보고자 하며 제 블로그(blog.naver.com/crucian2k3)에서 결과물을 보실 수 있을 것입니다.<br />
감사합니다.<br />
<span style="color: #ff6600"><strong>8. 참고자료</strong></span></p>
<p>1. Arduino-M0 공식제품 소개서 : www.arduino.org<br />
2. Arduino-M0 ‘How to your board.’ Document : labs.arduino.org<br />
3. 9축 모션쉴드 : www.arduino.org<br />
4. 자세제어와 관련된 아티클 : www.hardcopyworld.com<br />
5. DAC 라이브러리 및 예제 : www.arduino.cc<br />
6. 시리얼 오실로스코프 : www.x-io.co.uk</p>
<p>&nbsp;</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2016/03/Cap-2016-05-20-11-01-08-470.jpg" rel="lightbox[30749]"><img class="alignnone size-full wp-image-30875" alt="Cap 2016-05-20 11-01-08-470" src="http://www.ntrexgo.com/wp-content/uploads/2016/03/Cap-2016-05-20-11-01-08-470.jpg" width="474" height="194" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ntrexgo.com/archives/30749/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[33호]측정/센서 필수 길라잡이 7.엔코더, 주파수</title>
		<link>http://www.ntrexgo.com/archives/29858</link>
		<comments>http://www.ntrexgo.com/archives/29858#comments</comments>
		<pubDate>Sun, 15 Nov 2015 09:01:58 +0000</pubDate>
		<dc:creator>디바이스마트 매거진</dc:creator>
				<category><![CDATA[디바이스마트 매거진]]></category>
		<category><![CDATA[스페셜 컬럼]]></category>
		<category><![CDATA[33호]]></category>
		<category><![CDATA[NI]]></category>
		<category><![CDATA[길라잡이]]></category>
		<category><![CDATA[디바이스마트]]></category>
		<category><![CDATA[매거진]]></category>
		<category><![CDATA[센서]]></category>
		<category><![CDATA[엔코더]]></category>
		<category><![CDATA[주파수]]></category>
		<category><![CDATA[측정]]></category>

		<guid isPermaLink="false">http://www.ntrexgo.com/?p=29858</guid>
		<description><![CDATA[디바이스마트 매거진 33호 &#124; 측정 및 센서 기본 시리즈의 마지막 순서인 엔코더와 주파수에 대해서 알아보도록 하겠습니다.]]></description>
				<content:encoded><![CDATA[<p><strong><a href="http://www.ntrexgo.com/archives/29858/33-sc-ni7-13" rel="attachment wp-att-30091"><img alt="33 sc ni7 (13)" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-13-620x133.jpg" width="620" height="133" /></a></strong></p>
<p><span style="font-size: x-large;color: #000080"><strong>한국NI에서 알려주는</strong></span></p>
<p><span style="font-size: x-large;color: #000080"><strong>측정/센서 필수 길라잡이 7</strong></span></p>
<p style="text-align: right">글 | 한국 NI, SW 및 측정 담당 조한길</p>
<p><span style="font-size: medium;color: #ffffff;background-color: #000080"><strong>7. 엔코더, 주파수</strong></span></p>
<p>측정 및 센서 기본 시리즈의 마지막 순서인 엔코더와 주파수에 대해서 알아보도록 하겠습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-1.jpg" rel="lightbox[29858]"><img class="alignnone size-full wp-image-30076" alt="33 sc ni7 (1)" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-1.jpg" width="500" height="285" /></a></p>
<p>엔코더는 선형 또는 회전 변위를 디지털 또는 펄스 신호로 변환하는 전기 기계 디바이스입니다. 가장 많이 사용하는 엔코더 유형은 광학 엔코더로서 회전 디스크, 광원, 광감지기(빛 센서)로 구성되어 있습니다. 회전하는 샤프트에 장착되는 디스크는 부호 처리되어 있는 불투명 및 투명한 섹터들의 패턴을 가지고 있습니다(그림 1 참고). 디스크가 회전하면, 이 패턴은 광감지기에 방출된 빛을 해석하고 디지 털 또는 펄스 신호 출력을 생성합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-2.jpg" rel="lightbox[29858]"><img class="alignnone size-full wp-image-30078" alt="33 sc ni7 (2)" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-2.jpg" width="500" height="234" /></a></p>
<p><strong>절대위치 엔코더:</strong> 절대위치 엔코더는 샤프트의 모든 위치에 대한 특정 문자 패턴을 생성합니다. 절대위치 엔코더 디스크의 트랙은 일반적으로 4 ~ 6개이며, 일반적으로 바이너리 코드, binary-coded decimal(BCD), 그레이 코드 출력을 생성하도록 부호 처리됩니다. 절대위치 엔코더는 장기간 동안 디바이스가 활성화되지 않고, 전력이 차단될 리스크가 있거나 시작 위치를 알지 못하는 어플리케이션에 가장 많이 사용됩니다.</p>
<p><strong>증분 엔코더:</strong> 증분 엔코더는 전체 디지털 문자에 상반되는 펄스를 각 증가 단계를 위해 생성합니다. 증분 엔코더는 절대 위치를 출력하지 않지만, 더 낮은 가격으로 더 뛰어난 분해능을 제공합니다. 예를 들어, 단일 코드 트랙을 가진 증분 엔코더는 타코미터 엔코더라고도 하며 주파수가 변위의 속도를 나타내는 주파수의 펄스 신호를 생성합니다. 하지만, 단일 채널 엔코더의 출력은 방향을 나타내지는 않습니다. 방향을 결정하기 위해 2-채널 또는 구적 엔코더는 두 개의 감지기와 두 개의 코드 트랙을 이용합니다.<br />
증분 엔코더를 이용하면, 위치의 변화만 측정할 수 있지만(속도와 가속을 판단할 수 있는 곳에서), 대상의 절대 위치는 파악할 수 없습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-1.png" rel="lightbox[29858]"><img class="alignnone size-full wp-image-30077" alt="33 sc ni7 (1)" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-1.png" width="500" height="156" /></a><br />
엔코더 측정에는 기본적인 전자 컴포넌트인 카운터가 필요합니다. 여러 개의 입력을 가지고 있는 기본 카운터는 카운트된 에지 수(웨이브폼으로 low ~ high 전환)를 나타내는 값을 출력합니다.<br />
대부분의 카운터는 세 개의 입력인 게이트, 소스, 업/다운을 가지고 있습니다. 카운터는 소스 입력에 등록된 이벤트를 카운트하고 업/다운 라인의 상태에 따라 카운트를 증분하거나 감소시킵니다. 예를 들어, 업/다운 라인이 “high”일 경우 카운터는 카운트를 증분하고 “low”일 경우 카운터는 카운트를 감소시킵니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-3.jpg" rel="lightbox[29858]"><img class="alignnone size-full wp-image-30080" alt="33 sc ni7 (3)" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-3.jpg" width="500" height="262" /></a></p>
<p>카운터가 수집하고 생성할 수 있는 세 가지 유형의 신호에 대해 알아보겠습니다. 카운터는 TTL 호환 신호로 작동합니다. TTL 호환 신호란 다음과 같습니다:</p>
<p><em>0V &#8211; 0.8V = 로직 low</em><br />
<em> 2V &#8211; 5V = 로직 high</em><br />
<em> 최대 상승/하강 시간 = 50ns</em></p>
<p>디지털 I/O에서 배운 것처럼, 디지털 라인은 디지털 라인의 상태를 설정하거나 모니터링 할 수 있습니다. 카운터는 신호의 상태와 관련이 없을 뿐 아니라 한 상태에서 다른 상태로의 변화에도 관련이 없습니다.<br />
카운터는 상승 에지(로직 low에서 로직 high로 전환)와 하강 에지(로직 high에서 로직 low로)를 감지할 수 있습니다. 상승 및 하강 에지와 관련된 두 개의 중요한 파라미터는 상승/하강 시간 그리고 최소 펄스폭입니다.<br />
상승/하강 시간은 신호가 low에서 high로 얼마나 빠르게 전환되는지 알 수 있는 방법입니다. 카운터가 에지를 감지하기 위해서는 TTL 호환 신호의 사양에 따라 정의된 것처럼 50ns 미만 내에 반드시 발생해야 합니다.<br />
얼마나 빠르게 신호가 전환되는 지에 대한 시간 규제 외에도, 카운터가 다른 상승 또는 하강 에지를 감지할 때까지 상승 또는 하강 에지를 감지할 때 최소한의 지연이 필요합니다. 이런 지연을 최소 펄스폭이라고 합니다. 최소 펄스폭은 사용되는 카운터 칩에 좌우됩니다. 두 소스와 DAQ-STC 칩의 게이트에 대한 최소 펄스폭은 10ns입니다. 카운터의 최소 펄스폭에 대한 사양은 디바이스의 하드웨어 매뉴얼에서 확인할 수 있습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-4.jpg" rel="lightbox[29858]"><img class="alignnone size-full wp-image-30081" alt="33 sc ni7 (4)" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-4.jpg" width="500" height="228" /></a></p>
<p>엔코더는 계측기를 연결하는데 필요한 5개의 와이어를 가지고 있으며, 엔코더에 따라 와이어의 색상은 다양합니다. 이 와이어를 이용하면 엔코더에 전력을 공급하고 A, B, Z 신호로 읽을 수 있습니다.<br />
다음 단계는 이 와이어 각각을 연결해야 할 위치를 결정해야 합니다. 위에서 기술한 것처럼 카운터를 고려할 경우, 신호 A는 소스 터미널에 연결되어 펄스가 카운트되는 신호로 만듭니다. 신호 B는 업/다운 터미널에 연결되며, +5V DC와 접지 신호를 원하는 전력원에 연결할 수 있습니다. 대부분은 데이터 수집 디바이스 카드의 디지털 라인이면 충분합니다.<br />
에지가 카운트되면 다음으로 이 값들이 어떻게 위치로 변환될지 개념을 고려해야 합니다. 에지 카운트가 위치로 변환되는 프로세스는 사용되는 엔코딩의 유형에 따라 다릅니다. 기본적인 엔코딩 종류에는 세 가지로 X1, X2, X4가 있습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-5.jpg" rel="lightbox[29858]"><img class="alignnone size-full wp-image-30082" alt="33 sc ni7 (5)" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-5.jpg" width="500" height="142" /></a><br />
<strong>X1 엔코딩</strong><br />
위 그림은 구적 사이클과 X1 엔코딩의 결과 증분 및 감소를 나타냅니다. 채널 A가 채널 B를 이어줄 때, 증분은 채널 A의 상승 에지에서 발생합니다. 채널 B가 채널 A를 이어줄 때, 감소는 채널 A의 하강 에지에서 발생합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-6.jpg" rel="lightbox[29858]"><img class="alignnone size-full wp-image-30083" alt="33 sc ni7 (6)" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-6.jpg" width="500" height="142" /></a></p>
<p><strong>X2 엔코딩</strong><br />
채널 A의 각 에지에서 어떤 채널이 다른 채널로 연결되는 지에 따라 카운터가 증분되거나 감소한다는 점 외에 X2 엔코딩은 X1과 동일합니다. 각 사이클은 두 번의 증분 또는 감소가 발생합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-7.jpg" rel="lightbox[29858]"><img class="alignnone size-full wp-image-30084" alt="33 sc ni7 (7)" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-7.jpg" width="500" height="142" /></a><br />
<strong>X4 엔코딩</strong><br />
카운터는 X4 엔코딩의 채널 A와 B의 각 에지에서 비슷하게 증분되거나 감소합니다. 각 사이클은 위 그림과 같이 네 번의 증분 또는 감소가 발생합니다.</p>
<p><strong>For Rotational Position</strong></p>
<p style="padding-left: 30px">Amount of rotation is Edge Count/xN * 360<br />
where N = number of pulses generated by the encoder per shaft revolution</p>
<p style="padding-left: 150px">x = encoding type</p>
<p><strong>For Linear Position</strong></p>
<p style="padding-left: 30px">Amount of displacement is (Edge Count/xN) * (1/PPI)<br />
where PPI = pulses per inch (a parameter specific to each encoder)</p>
<p>엔코딩 타입을 설정하고 펄스를 카운트했다면, 위치를 변환하는 것은 위의 공식 중 하나를 이용하면 됩니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-8.jpg" rel="lightbox[29858]"><img class="alignnone size-full wp-image-30085" alt="33 sc ni7 (8)" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-8.jpg" width="500" height="181" /></a><br />
본 섹션에서는 NI cDAQ-9178 섀시와 NI 9401 C 시리즈 디지털 I/O 모듈을 이용한 예를 들어보겠습니다. 절차는 다른 계측기나 디바이스를 이용할 때와 비슷합니다.<br />
NI 9401은 8개의 디지털 채널과 연결하기 위한 D-Sub 커넥터를 제공합니다. 각 채널은 디지털 입력이나 출력 디바이스를 연결할 수 있는 디지털 I/O 핀을 가지고 있습니다.<br />
cDAQ-9178의 4개 카운터는 섀시의 어떤 슬롯에서도 사용할 수 있습니다. cDAQ-9172를 이용할 경우, 두 개의 카운터는 슬롯 5와 6을 통해서만 가능하기 때문에 9401은 슬롯 5에 삽입합니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-9.jpg" rel="lightbox[29858]"><img class="alignnone size-full wp-image-30086" alt="33 sc ni7 (9)" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-9.jpg" width="500" height="293" /></a><br />
엔코더를 측정 디바이스에 연결했으므로, NI LabVIEW 그래픽 기반 프로그래밍 소프트웨어를 이용하여 데이터를 시각화 처리하고 분석할 수 있도록 컴퓨터로 전송할 수 있습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-10.jpg" rel="lightbox[29858]"><img class="alignnone size-full wp-image-30087" alt="33 sc ni7 (10)" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-10.jpg" width="500" height="314" /></a><br />
디지털 신호의 주파수 측정은 데이터 수집 하드웨어에서 사용할 수 있는 카운터를 이용하여 수행됩니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-11.jpg" rel="lightbox[29858]"><img class="alignnone size-full wp-image-30088" alt="33 sc ni7 (11)" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-11.jpg" width="500" height="103" /></a><br />
첫 번째 방식은 하나의 카운터를 이용하는 방법입니다. 이는 낮은 주파수를 측정하는데 주로 사용됩니다. 입력신호의 rising edge가 타임베이스의 틱 수를 카운트합니다. 타임베이스 주파수는 알고 있으므로 입력 신호의 주파수를 계산할 수 있습니다.</p>
<p><a href="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-12.jpg" rel="lightbox[29858]"><img class="alignnone size-full wp-image-30089" alt="33 sc ni7 (12)" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-sc-ni7-12.jpg" width="500" height="120" /></a><br />
두 번째 방식은 두 개의 카운터를 이용하는 것입니다. 한 카운터는 알 수 없는 주파수와 함께 펄스 트레인을 생성하고, 한 카운터는 구간 측정을 수행합니다. 카운터 1은 구간 측정을 수행하며, 내부 타임베이스가 아닌 소스를 외부 신호로 사용합니다. 카운터 1의 게이트 신호는 카운터 0의 출력에서 나오며, 이 신호는 펄스 트레인을 생성합니다. 카운터 0의 출력 주파수를 알고 있으므로 카운터 1의 게이트 사이클 길이를 정확히 알고 있습니다. 카운터 1의 소스에 도달하는 소스 에지 수에 따라 주파수를 추정할 수 있고, 카운터 1의 구간 측정을 게이트 구간으로 나눌 수 있습니다. 예를 들어, 카운터 0은 10 Hz의 펄스 트레인을 출력할 경우 게이트 구간은 0.1s입니다. 이 구간 동안일 경우, 100개의 소스 에지를 카운트하고 카운트의 소스 주파수가 (100+/-1)/0.1 또는 1000+/-10 Hz라는 것을 알고 있습니다.</p>
<p>지금까지 엔코더 및 주파수에 대한 원리와 측정하는 방법에 대하여 알아보았습니다. 간단한 DIO 만으로도 엔코더 및 주파수를 쉽게 측정할 수 있는 더 자세한 방법은 www.ni.com에서 확인하시길 바랍니다.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ntrexgo.com/archives/29858/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[33호]방사능에 대처하는 현명한 자세는?</title>
		<link>http://www.ntrexgo.com/archives/29862</link>
		<comments>http://www.ntrexgo.com/archives/29862#comments</comments>
		<pubDate>Sun, 15 Nov 2015 00:20:10 +0000</pubDate>
		<dc:creator>디바이스마트 매거진</dc:creator>
				<category><![CDATA[디바이스마트 매거진]]></category>
		<category><![CDATA[스페셜 컬럼]]></category>
		<category><![CDATA[33호]]></category>
		<category><![CDATA[showcase]]></category>
		<category><![CDATA[디바이스마트]]></category>
		<category><![CDATA[매거진]]></category>
		<category><![CDATA[방사능]]></category>
		<category><![CDATA[쇼케이스]]></category>

		<guid isPermaLink="false">http://www.ntrexgo.com/?p=29862</guid>
		<description><![CDATA[디바이스마트 매거진 33호 &#124; 방사능에 대한 일반인들의 관심도 점점 높아져서 방사능 측정기를 구매하는 소비자들도 꾸준히 늘어나고 있는 추세입니다. ]]></description>
				<content:encoded><![CDATA[<p><img alt="33 쇼케이스 001" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-쇼케이스-001.jpg" width="371" height="363" /></p>
<p><span style="font-size: large"><strong>Showcase</strong></span></p>
<p><strong><span style="font-size: x-large">방사능에 대처하는 현명한 자세는?</span></strong></p>
<p style="text-align: right">글 | 아나로그리서치시스템</p>
<p>&nbsp;</p>
<p>2011년 후쿠시마 원전 사고가 난 이후, 4년의 시간이 흘렀습니다. 그때의 충격은 점차 사라지고 있지만, 현재까지도 사고의 수습은 완료되지 않았습니다. 후쿠시마 원전에서는 매일 400톤의 오염수가 생성되고 있고, 800억 베크렐의 오염물질이 바다로 흘러들어가고 있습니다. 이미 2012년 우리나라 토양에서도 후쿠시마발 세슘이 검출되었습니다.<br />
후쿠시마 원전 사고 전까지 방사능 측정기는 관련업계 종사자들이나 전문가들만의 영역이었습니다. 그러나 사고 이후, 방사능에 대한 일반인들의 관심도 점점 높아져서 방사능 측정기를 구매하는 소비자들도 꾸준히 늘어나고 있는 추세입니다. 그러나 구매한 방사능 측정기를 효과적으로 활용하고 있는지는 의문이 남습니다.</p>
<p><span style="font-size: medium;color: #ff0000"><strong>방사능 감지 센서의 종류</strong></span></p>
<table style="width: 620px" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="text-align: center"><img alt="Figure 1 시중에 판매되고 있는  휴대용 방사능 측정기" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-쇼케이스-01.jpg" width="335" height="310" /></td>
</tr>
<tr>
<td style="text-align: center">Figure 1 시중에 판매되고 있는 휴대용 방사능 측정기</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>시중에는 다양한 종류의 방사능 측정기가 출시되어 있습니다. 그에 따라 센서의 종류도 다양합니다. 휴대용 방사능 측정기에서 일반적으로 사용하는 센서에는 다음과 같은 종류가 있습니다.</p>
<p><strong>GM-tube (Geiger-müller tube)</strong><br />
일반적으로 많이 사용하는 센서입니다. GM-Tube 방식은 가스가 들어있는 관에 고전압(500V 이상)을 인가하고, 방사선에 의해 발생하는 전자를 측정하는 원리입니다. 비교적 큰 신호가 발생하여, 기기제작이 어렵지 않아 많은 측정기에 도입되고 있는 센서 방식입니다.<br />
그러나 고전압에 의한 표면의 산화로 인해 수명이 3년 이하이고, 감도가 변화되어 6개월마다 교정이 필요합니다.</p>
<p><strong>반도체센서</strong><br />
외부로부터의 신호를 전기적인 신호로 바꾸어 나타내는 센서입니다. GM-tube에 비해 저전압(50V 이하)을 사용하여, 수명이 길고 감도의 변화가 거의 없습니다. 그러나 감도가 낮은 편이고, 방사능 의외의 외부 자극(전자파, 진동)에도 반응한다는 단점이 있습니다.</p>
<p><strong>신틸레이터(Scintillator)</strong><br />
신틸레이터는 방사선(감마 또는 X-ray)을 받으면 가시광선으로 변환시켜주는 무기 또는 유기물을 말합니다. 이를 이용한 센서를 섬광(신틸레이터)센서라고 합니다. 섬광(신틸레이터)센서는 방사선을 받으면 빛을 방출하는 특성을 이용, 신틸레이터와 고감도 광센서를 결합시켜서 방사선을 검출하는 센서입니다.<br />
섬광(신틸레이터)센서는 다른 센서에 비해 아직 가격이 높지만 감도가 높고, 수명이 길며, 외부자극(전자파, 진동)에도 반응하지 않아 높은 신뢰성을 가집니다.</p>
<table style="width: 620px" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="text-align: center"> <img alt="Figure 2 신틸레이터" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-쇼케이스-02-286x300.jpg" width="286" height="300" /></td>
</tr>
<tr>
<td style="text-align: center"> Figure 2 신틸레이터</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><span style="font-size: medium;color: #ff0000"><strong>불편한 진실, 이 사실을 아시나요?</strong></span></p>
<p>일반인들이 자신을 보호하기 위해서 구입하는 방사능 측정기는 활용도가 매우 떨어집니다. 일반인들이 손쉽게 구매하는 일반 휴대용 방사능 측정기로는 건강상의 가장 큰 위협이 되고 있는, 식품 방사능 측정이 불가능하기 때문입니다.</p>
<table style="width: 620px" border="0" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td><img class="alignnone  wp-image-29919" alt="33 쇼케이스 03" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-쇼케이스-03-300x216.jpg" width="240" height="173" /></td>
<td><img class="alignnone size-medium wp-image-29920" alt="33 쇼케이스 04" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-쇼케이스-04-300x169.jpg" width="300" height="169" /></td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><strong>방사능과 방사선의 차이</strong><br />
방사능을 향수에 비유하자면 방사선은 향수에서 나오는 향기와 같습니다. 방사능은 방사선을 방출할 수 있는 원소, 원자(세슘, 우라늄, 플로토늄 등)을 말하고, 방사선이란 전자파와 같이 에너지를 가진 광선과 같은 것을 말합니다.</p>
<p><strong>식품 방사능 측정의 중요성</strong><br />
신체가 방사선에 노출 되는 경우, 방사선은 노출된 세포를 파괴하고 지나갑니다. 이는 일회성 손상에 그칩니다. 그러나 만약 방사능 물질(원소)을 섭취한다면, 지속적으로 방사선이 나와 세포를 파괴하므로, 백혈병, 암 등 각종 질병을 일으킬 위험이 매우 큽니다. 따라서 식품 방사능의 측정이 매우 중요합니다.</p>
<p><strong>휴대용 방사능 측정기로는 식품 방사능 측정이 불가능한 이유</strong><br />
식품 방사능 측정이란 국가의 법적 식품방사능 기준치 100Bq/Kg의 방사능을 측정할 수 있는지를 기준으로 합니다. Bq(베크렐)이란 1초당 일어나는 핵분열 횟수를 의미하는 단위로, Bq/Kg은 1Kg의 식품에서 1초간 일어나는 핵분열 횟수를 나타냅니다. 100 Bq/kg이란 1kg의 식품이 1초에 100번의 핵분열을 일으키고, 이때 방사선을 방출합니다. 1번의 핵분열로 1개의 방사선을 방출하는 핵종(세슘 Cs-137,요오드 I-131)도 있고 여러 개의 방사선을 방출하는 핵종(코발트 Co-60)도 있습니다.</p>
<table style="width: 620px" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="text-align: center"><img alt="Figure 3 자연 방사능" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-쇼케이스-05-300x168.jpg" width="300" height="168" /></td>
</tr>
<tr>
<td style="text-align: center">Figure 3 자연 방사능</td>
</tr>
</tbody>
</table>
<p>일반적인 환경에서는 우주나 토양으로부터 오는 자연방사능이 항상 존재합니다. 자연방사선의 세기는 식품 방사능 기준치 100Bq/Kg보다 50~100배나 높은 수치입니다. 일반적인 환경에서 일반 휴대용 측정기로 식품을 측정하면 대부분 자연방사선량을 측정하게 됩니다. 식품이 심하게 오염되어 자연방사선 수치보다 높은 방사선을 방출하면 당연히 휴대용 측정기로도 측정이 가능하지만 100Bq/Kg으로 오염된 식품은 자연방사선 세기의 1/100 정도의 방사선을 방출하므로 그 차이를 휴대용 측정기로 측정하는 것은 불가능합니다.</p>
<table style="width: 620px" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><img class="aligncenter" alt="Figure 4 내부 피폭의 위험성, 방사능과의 거리에 따른 피폭량" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-쇼케이스-06-300x213.jpg" width="300" height="213" /></td>
</tr>
<tr>
<td style="text-align: center">Figure 4 내부 피폭의 위험성, 방사능과의 거리에 따른 피폭량</td>
</tr>
</tbody>
</table>
<p>그러면 왜 식품방사능 기준치가 우리가 생활하는 환경에 항상 존재하는 자연방사능 수치보다 1/100 낮게 정해져 있을까요? 이는 앞에서 설명 드린 ‘방사선’을 먹는 것이 아니라 ‘방사능’을 먹기 때문입니다.</p>
<p>방사선도 전자기파의 일종으로 발생원으로부터 거리의 제곱에 비례하여 세기가 약해집니다. 방사선을 방출하는 원소(예-세슘, Cs-137), 100 Bq/kg으로 오염된 식품을 5cm 거리에서 휴대용 측정기로 측정하면 감지가 불가능합니다. 하지만 인체에 들어오면 세슘과 세포와의 거리가 1 ~100micro m 이내에 존재하게 되고, 그 세포들이 받는 방사선량은 원자폭탄이 터질 당시의 방사선량과 맞먹게 됩니다. 소수의 세포가 그러한 피폭을 당한다 해도 일부 세포가 암세포로 돌연변이를 일으키고 이것이 계속 증식한다면 심각한 암이 될 수 있습니다. (참고: 일반적인 휴대용 측정기는 Sv/h(시버트/시간)라는 단위를 사용합니다. 이는 절대적인 물체의 방사능의 세기를 나타내는 것이 아니라 현재의 측정되고 있는 방사선의 세기, 즉 피폭량의 단위입니다. 식품방사능을 나타내는 Bq(베크렐)은 물체가 가지고 있는 절대적인 방사능의 세기입니다. Bq(베크렐)은 반감기로 인해 세기가 시간에 따라 줄어들 뿐 다른 물리, 화학적인 변화에 의해서도 변화하지 않습니다. 하지만 Sv/h(시버트/시간)은 방사능 원소로부터 거리가 멀어지면 줄어드는 양이고, 납이나 금 등 밀도가 높은 물질로 차폐하면 줄어드는 양입니다. 두 단위를 바로 비교하는 것은 불가능하며 두 단위를 변화시키려면 거리, 핵종, 측정면적 등 추가적인 정보가 있어야만 가능합니다.)</p>
<p><strong>새로운 모델 고감도 휴대용 측정기 QSF104</strong><br />
아나로그리서치시스템에서 출시한 새로운 모델 QSF104는 2000 CPM/uSv/h 의 감도를 가집니다. 이는 시중에 500만원대에 판매되는 제품과 동급의 성능입니다. (QSF104-40만원대) 이와 동시에, 90g의 초경량 측정기입니다.</p>
<table style="width: 620px" border="0">
<tbody>
<tr>
<td style="text-align: center"><img class="aligncenter" alt="Figure 5 가격대비 성능비가 매우 뛰어난 QSF104" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-쇼케이스-07-253x300.jpg" width="253" height="300" /></td>
</tr>
<tr>
<td style="text-align: center">Figure 5 가격대비 성능비가 매우 뛰어난 QSF104</td>
</tr>
</tbody>
</table>
<table style="width: 620px" border="0" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td style="text-align: center"><img class=" wp-image-29934 aligncenter" alt="33 쇼케이스081" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-쇼케이스081-300x168.jpg" width="300" height="168" /></td>
</tr>
<tr>
<td style="text-align: center"><img class="size-medium wp-image-29936" alt="33 쇼케이스082" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-쇼케이스0821-300x164.jpg" width="300" height="164" /></td>
</tr>
<tr>
<td style="text-align: center"><img class="size-medium wp-image-29933" alt="33 쇼케이스08" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-쇼케이스08-300x169.jpg" width="300" height="169" /></td>
</tr>
<tr>
<td style="text-align: center">Figure 6 대리석, 대기 중,세면대 등 다양한 측정이 가능한 QSF104</td>
</tr>
</tbody>
</table>
<p>고감도 신틸레이션 센서를 사용한 제품으로 측정 에너지 범위도 50 keV ~ 6 MeV 까지 가능합니다. 요즘 우려되고 있는 방사능 시멘트 등, 모든 물체 및 대기중 방사능을 측정을 간단하고 정확하게 할 수 있습니다.<br />
측정시 방사능 오염 지역을 탐지하기 위한 빠른 반응시간이 필요한 경우 “F” 모드를 사용, 6초의 반응시간으로 탐지가 가능하며, 일반적인 측정 “N” 모드는 21초 반응시간, 정밀한 측정을 위한 “P”모드는 120초 반응시간으로 변경하여 광범위한 분야에 적용이 가능합니다.</p>
<p><strong>식품 방사능 측정</strong><br />
식약처 기준 식품방사능을 측정하는 방식은 다음과 같습니다. 납 차폐함 안에 음식물을 넣어서 자연방사선을 낮춘 환경에서 어떤 원소에 의한 방사선인지 구별이 가능한 감마스펙트럼을 분석하여 핵종을 파악합니다. 감마 스펙트럼은 그림 7로 표현됩니다.</p>
<table style="width: 620px" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="text-align: center"><img class="alignnone  wp-image-29937" alt="33 쇼케이스 5555" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-쇼케이스-5555-300x157.jpg" width="400" /></td>
</tr>
<tr>
<td style="text-align: center">Figure 7 감마 스펙트럼, Cs137과 K40에 봉우리가 생겼으므로 두 핵종이 존재함</td>
</tr>
</tbody>
</table>
<p>각 에너지 범위에 봉우리가 생긴다면, 해당하는 핵종이 검출되었다는 의미입니다. 검출된 방사능이 어떤 핵종인지 파악할 수 있는 방법입니다. 감마스펙트럼 분석을 하는 이유는 음식물 속에 포함된 자연방사능 때문입니다. 대부분의 음식은 자연방사선 원소인 칼륨(K-40)을 포함하고 있는데, 칼륨은 인체에 필요한 원소이지만 기본적으로 방사선을 방출하며 반감기가 지구 나이만큼 길기 때문에 인위적으로 제거하기가 어렵고, 때문에 방사능 물질이지만 칼륨이 포함되어 있다고 해서 방사능 오염으로 분류하지 않습니다. 칼륨을 다량 포함하고 있는 다시마나 미역, 바나나 같은 경우에는 칼륨에 의해 방사능 수치가 올라 갈 수 있기 때문에 이를 구분하기 위해서 감마 스펙트럼 분석을 해야 합니다. 또한 음식물을 측정용기 안에 넣은 후, 두꺼운 납 차폐물 안에 넣어서 측정을 합니다. 이는 자연방사선을 낮추기 위한 방법입니다. 미량의 방사능을 검출하기 위해서는 자연방사선을 낮추는 것이 유리합니다. 그러나 이러한 방사능 측정기는 수천에서 수억 원대에 이르고, 유지 관리 또한 매우 어렵기 때문에 일반인들이 사용하기에는 매우 어렵습니다.</p>
<p><strong>식품 방사능 간이 측정이 가능한 QSF104</strong><br />
QSF104는 핵종분석 기능이 없습니다. 그러나 핵종분석 기능이 없다고 해서, 식품방사능 측정이 불가능한 것은 아닙니다. QSF104는 다른 휴대용 측정기의 10~1000배에 이르는 고감도 센서를 장착한 측정기이기 때문에 100Bq/Kg 식품기준치의 측정이 가능합니다.</p>
<p><strong>섬광(신틸레이터)센서를 장착한 QSF104</strong><br />
QSF104는 섬광(신틸레이터)센서를 장착한 고감도 방사능 측정기입니다. 선량률 측정, 누적 선량률, 알람 설정, 펄스 측정, 조명 설정, 소리 설정, 제품 정보 등의 8개의 모드가 있는데, 이중 주목할 만한 모드는 펄스 측정 모드입니다.</p>
<p><strong>강력한 펄스 측정(Total Pulse)모드</strong><br />
펄스 측정 모드란, 측정된 감마선의 총 펄스 수를 보여주는 모드입니다. 선량률 측정 모드보다 정밀하게 측정할 경우 사용합니다.<br />
주목할 점은, 펄스 측정 모드를 이용하여 식품방사능의 측정이 가능하다는 점입니다. QSF104는 핵종분석기능이 없습니다. 그러므로 칼륨과 세슘을 구분할 수는 없습니다. 그러나 칼륨(K-40)과 같은 자연방사선이라고 해서 몸에 해롭지 않은 것은 아닙니다. 오히려 칼륨의 에너지는 높기 때문에 세포분열이 활발한 어린아이와 임신부에 치명적일 수 있습니다. 그러므로, 핵종 구분을 하지 않고 방사능의 ‘총량’을 측정하는 것도 의미가 있습니다. 고감도 QSF104의 펄스측정 모드를 이용하여 방사능의 총량을 측정하는 방식으로 식품방사능 측정을 할 수 있습니다.</p>
<table style="width: 620px" border="0" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td><img class="alignnone size-medium wp-image-29925" alt="33 쇼케이스 10" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-쇼케이스-10-300x216.jpg" width="300" height="216" /></td>
<td><img class="alignnone size-medium wp-image-29926" alt="33 쇼케이스 11" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-쇼케이스-11-300x209.jpg" width="300" height="209" /></td>
</tr>
<tr>
<td style="text-align: center">Figure 8 QSF104측정</td>
<td style="text-align: center">Figure 9 QSF104 식품측정용기</td>
</tr>
</tbody>
</table>
<table style="width: 620px" border="0" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td style="text-align: center"><img class="alignnone  wp-image-29938" alt="33 쇼케이스 666" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-쇼케이스-666.png" width="477" height="178" /></td>
</tr>
<tr>
<td style="text-align: center">일반 환경 (납 차폐물을 이욯하지 않을 경우)</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><strong> 식품 측정의 방법</strong><br />
식품 측정은 빈 측정용기를 이용하여 배경 측정 후 식품을 넣고 측정된 펄스 수를 비교하여 이루어집니다. 배경 및 식품 측정시간을 길게 할수록 검출 한계는 낮아집니다. 측정 시간에 따른 QSF104의 검출 한계는 다음과 같습니다.<br />
납 차폐물을 이용하지 않고 일반 환경에서 측정할 경우 60분 배경과 식품을 측정하면 식품기준치인 100Bq/kg 수준의 측정이 가능하며 24시간 측정시 17Bq/kg까지 측정이 가능합니다.<br />
납 차폐함을 사용한다면, 측정 한계를 더욱 낮출 수 있습니다.</p>
<table style="width: 620px" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="text-align: center"><img class="alignnone size-thumbnail wp-image-29927" alt="33 쇼케이스 12" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-쇼케이스-12-150x150.jpg" width="150" height="150" /></td>
<td style="text-align: center"><img class="alignnone size-thumbnail wp-image-29928" alt="33 쇼케이스 13" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-쇼케이스-13-150x150.jpg" width="150" height="150" /></td>
<td style="text-align: center"><img class="alignnone size-thumbnail wp-image-29929" alt="33 쇼케이스 14" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-쇼케이스-14-150x150.jpg" width="150" height="150" /></td>
</tr>
<tr>
<td style="text-align: center">Figure 10 QSF104 납 차폐함</td>
<td style="text-align: center">Figure 11 QSF104 납 차폐함과 측정 용기</td>
<td style="text-align: center">Figure 12 QSF104 납 차폐 측정</td>
</tr>
</tbody>
</table>
<table style="width: 620px" border="0" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td style="text-align: center"><img class="size-full wp-image-29939 aligncenter" alt="33 쇼케이스 666666" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-쇼케이스-666666.png" width="442" height="166" /></td>
</tr>
<tr>
<td style="text-align: center">납 차폐함 이용시</td>
</tr>
</tbody>
</table>
<p>납 차폐함이란, 납으로 만든 차폐함으로, 자연방사선을 낮추어 측정 한계를 낮출 수 있습니다.<br />
현재의 납 차폐함은 기본 10mm의 두 께를 가지고 있어 더 나은 측정이 가능하도록 30mm 두께의 납 차폐함도 준비중입니다. 납 차폐함과 측정 용기는 QSF104의 옵션 사항으로 구매하실 수 있습니다.</p>
<p><strong>측정결과의 해석</strong><br />
배경의 방사선 수와 샘플의 방사선 수를 비교해서 ‘샘플의 방사선 수가 더 많이 나왔으므로 식품이 방사능에 오염되었다’라고 바로 판단할 수는 없습니다. 방사선 측정은 하이젠베르크의 불확정성의 원리를 따르고 통계적인 방법을 통해서 해석이 가능합니다.<br />
첫 번째 측정에서는 배경보다 샘플이 더 높은 측정값을 가졌다고 해도, 다음번 측정에서는 더 낮은 측정값을 가질 수도 있습니다.<br />
측정 시간과 측정값을 이용하여 이산분포 곡선을 그릴 수 있고, 일반적으로 95%의 정확도, 2 sigma 영역에서 배경 측정과 샘플 측정의 그래프가 겹치지 않으면 방사능이 더 많이 포함되어 있다고 해석합니다.</p>
<p><img class="alignnone  wp-image-29940" alt="33 쇼케이스 888888" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-쇼케이스-888888.jpg" width="472" height="442" /></p>
<p>배경 측정값과 샘플 측정값의 결과를 그래프로 그려서 겹치는 구간이 있다면, 배경 측정과 샘플 측정값의 차이가 없다는 것이고, 샘플의 측정값이 더 높더라도 방사능이 포함되어 있다고 판단하지 않습니다.<br />
관련된 더 자세한 내용은 홈페이지(qsafe.co.kr)를 참고해주세요.</p>
<p><strong>합리적인 식품방사능 측정이 가능한 QSF104</strong><br />
기존 식품방사능 측정기는 수천만~수억 원까지 하는 높은 금액과, 조작의 어려움, 유지 관리의 어려움으로 인해 전문기관이 아닌 일반인들이 접근하기에는 현실적으로 불가능했습니다. 그래서 방사능으로 인한 막연한 두려움이 증폭되는 현상까지도 가져왔습니다.<br />
새로 출시된 QSF104는 시멘트 및 환경의 방사능 측정 및 일반인들도 손쉽게 식품 방사능 측정이 가능하도록 제작된 제품으로 방사능의 두려움으로부터 능동적으로 벗어날 수 있게 해 줄 것입니다.</p>
<p><strong>출시 예정인 QSF105</strong></p>
<table style="width: 620px" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><img class="wp-image-29932 aligncenter" alt="33 쇼케이스 17" src="http://www.ntrexgo.com/wp-content/uploads/2015/11/33-쇼케이스-17.jpg" width="496" height="237" /></td>
</tr>
<tr>
<td style="text-align: center">Figure 15 QSF105 핵종분석기능-감마스펙트럼 LCD　화면</td>
</tr>
</tbody>
</table>
<p>식약처에서 수행하는 식품방사능 측정법인 감마스팩트럼 기능을 탑재한 QSF105가 출시 예정입니다. QSF104와 동일한 크기와 무게를 가지고 있습니다.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ntrexgo.com/archives/29862/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
