⚠️ 블로그 복구 안내: 모든 최신 글은 gyongsu.com 에서 확인해 주세요!
본문 바로가기
Engineer's world/Wireless Communication

시리얼 명령어 몇개로 간단히 무선랜기반 센서 네트워크 꾸미기

by 파파 존스 2011. 3. 24.
반응형

Networks의 WiFly를 이용하여 일정 시간 간격으로 센서의 값을 읽어서 서버에 HTML언어로 보내는 예제입니다.
WiFly는 http://www.rovingnetworks.com/wifly-gsx.php 에 정보가 있습니다.
 
아래는 캡쳐된 터미널 화면입니다.

*OPEN*HTTP/1.1 200 OK
Date: Thu, 24 Mar 2011 00:24:30 GMT
Server: Apache/2.2.3 (Red Hat)
X-Powered-By: PHP/5.1.6
Content-Length: 1029
Connection: close
Content-Type: text/html; charset=UTF-8

============================================================================
This is WiFly Test example by Dr.Lee (gyongsu@adc.co.kr)
============================================================================
ID: 10D11CF2943314DF9494400FB00DA2D932FF7
DATA:
*CLOS**OPEN*HTTP/1.1 200 OK
Date: Thu, 24 Mar 2011 00:24:46 GMT
Server: Apache/2.2.3 (Red Hat)
X-Powered-By: PHP/5.1.6
Content-Length: 1029
Connection: close
Content-Type: text/html; charset=UTF-8

============================================================================
This is WiFly Test example by Dr.Lee (gyongsu@adc.co.kr)
============================================================================
ID: 10D11CF2943354DEF494000FB00DB2DB6300B
DATA:
*CLOS**OPEN*

소스라고 할 것도 없습니다.
php로 이렇게만 하시면 됩니다.

<?
$var1 = $_GET["ID"];
$var2 = $_GET["DATA"];
{
    echo "ID: $var1\n\r";
    echo "DATA: $var2\n\r";
}
?>

WiFly의 세팅은.. 이야기와 같은 UART로 연결된 터미널에서
   set dns name mail.adc.co.kr // set up the URL of the server
   set ip host 0          // to use DNS address of host server
   set ip remote 80       // standard web server port
   set ip proto 18        // enable HTTP and TCP protocols
   set com remote GET$/~gyongsu/G2/wifly.php?ID=      //seting up the string
   set sys auto 10        // auto connect every 10 seconds
   set option format 7    // send the header and sampled binary data converted to ASCII
   set option sensor 0xFF // sets sensor mask to sample all channels
   save                   // save the configurations in config file
   reboot                 // reboot so that the settings take effect
해주시면 되구요,
http://mail.adc.co.kr/~gyongsu/G2/wifly.php?ID=XX&DATA=YY
를 WiFly로 수행하는 것이 되겠죠..
WiFly 데이터시트 챕처 13.6에 있는 내용을 한번 실행해봤습니다.

이쁘게 만드는 건 잘 하시는 분들이 많으실테고.. 
참 쉽죠잉~ 


반응형