레이블이 iot smart hub인 게시물을 표시합니다. 모든 게시물 표시
레이블이 iot smart hub인 게시물을 표시합니다. 모든 게시물 표시

2015. 2. 15.

[Casual hacking] GPIO app project 2 : how to build Air Button using ultrasonic sensor

[Casual hacking] GPIO app project 2 : how to build Air Button using ultrasonic sensor 



This is the second project using the GPIO app.
Please note the following to build an Air Button using an ultrasonic sensor.

First of all, ultrasonic sensor adopts serial communication called UART.
If you would like to check out the specification of the sensor, you can do so by clicking the link below.
(Please note the data sheet or details from the product page of your purchased goods)

Product information from ultrasonic sensor: HG-C40U


From here on, please follow the instructions below.


1. Get your breadboard ready




Like in the picture, only TxD, RxD, GND, and 5V are connected.
An LED has also been pinned to be notified whether the settings are working properly.



2. Configure UART from the GPIO app
Please configure your settings as shown in the guideline of UI of GPIO app.
  • Baud rate : 38,400 bps
  • Data bit : 8 bit
  • Stop bit : 1 bit
  • Buffer size : 100
    • The buffer size means the number of letters that can be delivered at one transfer.
  • Register all values &  Set !
  • As a result, 'Read data’ of ultrasonic sensor is retrieved.
  • /x32/x37/x03/x02/x5e/x31/x37/x32/x38/x03/x02/x5e.. so on. Data like /x03/x02 repeats and meaningful data follows from the third.
  • (note that this is limited to HG-C40U specification and data may differ depends on your ultrasonic models.)


I will also pin a LED to provide me a feedback of whether the ultrasonic sensor has been properly placed.


3. Test the ultrasonic sensor


To test whether the ultrasonic sensor has been placed properly, I will use the rules below.

Like in the clip below, tests can be made with the two automation rules.



Lets go over with how to configure the first Rule.

“If the distance reading on ultrasonic is less than 10cm, turn on the LED."


- Check out the configuring process of the first Rule in .gif!



<How to configure a sensor app>
1. select GPIO app
2. select UART serial
3. UART Read
4. (check the green checkbox)
5. select and register filter : click '+ Advanced'
 Test True : {{{{{{data!split("\x03\x02^")}}[1]!to_int}}!le(100)}}
This works by parsing /x03/x02 and making use of the second data in list(=[1]). This is the value retrieved from ultrasonic sensor.
(This may be a bit difficult step to some of us.. in short, le(less than and equal to) 100mm. Try testing by changing the numbers yourself!)

If you’d like to understand more about how to register code in filter values and build the rule for yourself, please try out the link(blog) below.

<How to configure an actuator app>
1. select GPIO app 
2. select Write Digital
3. select GPIO pin$
4. (check the green checkbox), Set '1’(turn on the LED)



Lets check out how to setup the second Rule.

“If the distance reading on ultrasonic is more than 10cm, turn off the LED."

- Check out the configuring process of the second Rule in .gif!



<How to configure a sensor app>
1. select GPIO app
2. select UART serial  
3. UART Read  
4. (check the green checkbox)
5. select and register filter : click '+ Advanced'
  Test True : {{{{{{data!split("\x03\x02^")}}[1]!to_int}}!ge(100)}}
(ge(greater than and equal to) 100mm.)

<How to configure an actuator app>
1. select GPIO app
2. select Write Digital
3. select GPIO pin$
4. (check the green checkbox), Set '0’(turn off the LED)


4. Build an Air button!



Lets make use of the rules we created above for testing and create an air button.
Using the button and the Volumio app, I can 'Play music', 'Stop music', 'Volume up', 'Volume down.'

I’ve marked the heights for the buttons using a ruler and some Post-it.
… and this’s what my desk looks like :)

# Marking buttons





Heights for Air Button

         ~ 10cm : volume up
11cm ~ 20cm : volume down
21cm ~ 30cm : play music
31cm ~ 40cm : stop music

# Create automation rules



Please note the gif above for creating the first rule.

This’s been the guideline of creating an Air Button using ultrasonic wave.

Try building a button of different purpose.

Control digital devices and appliances using an Air Button next to yo ur bed.
“I wish I could turn on and off the bedside lights with Air Button."
“Turn on the monitors and notebook cooler with Air Button on my desk!"
More IoT experience to come using the GPIO app! :)

[Casual hacking] GPIO 앱 프로젝트 2 : 초음파 센서 에어 버튼(Air button) 만들기!

 [Casual hacking] GPIO app PROJECT 2 : 초음파 센서 Air button 만들기! 


GPIO 앱을 이용한 두 번째 프로젝트!
초음파 센서를 이용한 에어 버튼(Air button) 만들기 입니다.

우선 초음파 센서는 UART라는 시리얼 통신을 이용하죠.
우선 사용한 초음파 센서 사양은 아래의 링크를 통해 확인 가능합니다!
(구입하신 전자제품 쇼핑몰에 대부분 데이타 시트 및 상세 정보 등이 있으니 참고하세요)

초음파센서 제품 가이드 : HG-C40U

자 그럼 기본적인 초음파 센서를 숙지했다고 가정하고 설명을 시작해볼게요~


1. 브레드보드 셋팅하기



그림처럼 TxD, RxD, GND, 5V 만을 설정해주었습니다.
또한 제대로 셋팅했는지 알기 위해 LED를 설치해놨습니다.


2. GPIO 앱에서 UART 설정하기

제품 가이드에 나와있던 것처럼 GPIO 앱 UI에서도 똑같이 설정해주면 됩니다!


  • Baud rate : 38,400 bps
  • Data bit : 8 bit
  • Stop bit : 1 bit
  • Buffer size : 100
    • 버퍼 사이즈는 한 번에 받을 글자 사이즈를 의미해요.
  • 값들을 모두 입력해주고  Set !
  • 그러면 'Read data'에 초음파 센서로부터 데이터가 넘어오게 됩니다.
  • /x32/x37/x03/x02/x5e/x31/x37/x32/x38/x03/x02/x5e.... 같은 데이터가 반복되게 됩니다. 여기서 /x03/x02/ 가 반복되고 유용한 초음파 거리 값은 그 바로 뒤 2번째에 나옵니다.
    나중에 이 데이터를 이용해서 버튼을 만들 수 있어요!
  • (단, 저희가 가지고 있는 HG-C40U 사양에 해당하는 내용이니, 여러분의 초음파 센서와 데이터가 다를 수 있습니다!)



자 그리고 초음파 센서가 제대로 설정됐는지 확인하기 위해 LED 핀도 설정을 함께 해줄게요!


3. 초음파 센서 테스트하기

아래의 두 가지 룰로 초음파 센서가 제대로 셋팅됐는지 확인해 보겠습니다!

이 두 가지 자동화 규칙으로 아래의 영상처럼 테스트를 해볼 수 있습니다.



우선 첫 번째 Rule 설정과정부터 확인해볼게요!

"초음파 거리가 10cm 이하가 되면, LED 가 켜져라"

- 첫 번째 룰 설정 .gif 로 보기!


<센서(sensor) 앱 설정 스텝>
1. GPIO app 선택  
2. UART serial 선택  
3. UART Read  
4. (녹색박스 체크)
5. 필터 선택 및 입력 : '+ Advanced' 클릭
 Test True : {{{{{{data!split("\x03\x02^")}}[1]!to_int}}!le(100)}}
(필터에 입력하는 값이 어렵죠..
/x03/x02 를 파싱해서 리스트의 2번째(=[1]) 데이터를 사용하는 겁니다. 위에서 말했듯이 그 값이 초음파 센서가 감지한 거리이기 때문이죠!
그리고 그 데이터를 숫자로 바꾼 후 le(less and equal) 100mm 이하거나 같다는 의미입니다. 직접 숫자를 바꿔서 테스트 해보세요!)


필터 값에 입력하는 코드를 자세히 알고, 직접 만들어보고 싶다면 아래의 링크를 참고해주세요!
'AMBLANG(엠비언시 언어) 자세히 알기'

<액츄에이터(actuator) 앱 설정 스텝>
1. GPIO app 선택  
2. Write Digital 선택  
3. GPIO pin$ 선택  
4. (녹색박스 체크), Set '1'(LED를 켜라)


이제 두 번째 Rule 설정과정을 볼게요.

"초음파 거리가 10cm 이상이 되면, LED가 꺼져라"

- 두 번째 룰 설정 .gif로 보기!


<센서(sensor) 앱 설정 스텝>
1. GPIO app 선택  
2. UART serial 선택  
3. UART Read  
4. (녹색박스 체크)
5. 필터 선택 및 입력 : '+ Advanced' 클릭
  Test True : {{{{{{data!split("\x03\x02^")}}[1]!to_int}}!ge(100)}}
(ge(greater and equal) 100mm 라는 의미입니다. 100mm보다 크거나 같거나가 되겠네요...)

<액츄에이터(actuator) 앱 설정 스텝>
1. GPIO app 선택  
2. Write Digital 선택  
3. GPIO pin$ 선택  
4. (녹색박스 체크), Set '0'(LED를 꺼라)


4. Air button 만들기!


자 이제 위의 테스트를 응용해서 에어 버튼(air button)을 만들어볼까요?
버튼의 용도는 Volumio 앱을 이용해서 'Play music', 'Stop music', 'Volume up', 'Volume down' 만들어보겠습니다!

자 우선 자로 에어 버튼을 만들기 위해 버튼의 위치를 만들어 볼게요!
... 제 책상에서 테스트 해봤어요 :)

# 버튼 설치




에어 버튼(air button) 위치

         ~ 10cm : volume up
11cm ~ 20cm : volume down
21cm ~ 30cm : play music
31cm ~ 40cm : stop music

# 자동화 룰 설정


첫 번째 룰 설정 방법만 gif 를 참고해보세요!


자 이렇게 해서 초음파(Ultrasonic wave)를 이용한 에어 버튼(air button)을 만들어봤습니다.

여러분은 다른 버튼을 만들어보세요!

초음파 거리를 이용해서 리모콘이 있던 제품, 리모콘이 없던 제품 또한 제어가 가능합니다!
"침대 옆에 에어 버튼(air button)을 만들어 전등을 껐다 켰다 하고 싶다"
"출근하고 에어 버튼(air button)을 누르면 모니터와 노트북 쿨러가 켜져라!"
GPIO  앱 프로젝트를 이용한 사물인터넷 체험은 계속됩니다! :)

2015. 1. 26.

[PROTA] New Class of Operating System for Raspberry Pi, PROTA Pi



[PROTA] New Class of Operating System for Raspberry Pi, PROTA Pi



Raspberry Pi + PROTA OS = PROTA Pi

PROTA Pi OS is a new class of operating system for Raspberry Pi.

     Raspberry Pi has been on the spotlight for years for its money for value it provides to its users in education, entertainment, hacking, development, and projects. In the process, Raspbian, Pidora, RISC OS, and many more have been the choices for users that were to operate their hardware. Some like Raspbmc and OpenELEC were fairly easy to install but for OS in overall the experience wasn't exactly user-friendly. PROTA Pi we built is no just another distro. It's a complete alternative for your device that yields an OS experience rethought, an aim to achieve a programmable automation that anyone can create and share. PROTA Pi is the novel class of operating system for everyone.

It furnishes you with HTML5-based user interface
((shell snapshot, apprepo snapshot with caption))
     Your prior experience with Raspberry Pi called for wired connection of your monitor and Raspberry Pi. This was the point where we needed to change. Due to its current picture of connectivity, your user experience of Raspberry Pi was much like that of personal computers and accessibility of the device was limited. We believed Raspberry Pi must be a network device like servers that was accessible via web. Moreover, by bringing in HTML5, we gave the richness and vitality of user interface you were accustomed to.
     Network devices, however, have never been easy to manage. One of the reasons is that you had to find and type in the IP address of the device, which changed from time to time, to access via network. We solved this with myprota.me, the user experience much like web surfing that you have been used to: accessing by a specific web address. You can type in the web address, myprota.me, or make a bookmark to access from the home screen of your device.


AppRepo

     Richness and vitality of user interface wouldn’t have meant much without proper apps for the device. AppRepo, short for App Repository, solves the problem. It keeps all useful apps in one place, letting you install and update apps on your PROTA with a single click. Similar to app stores, developers can develop and distribute their apps via the development tool, CIDE and automation rules for your PROTA apps and REST APIs via the rule-sharing app, Ambiency.

Creating and sharing automation rules with Ambiency
     Services that IFTTT and Zapier provide, as you may already know, grant users the power to build automation rules. Using open APIs, they attempt to create an atmosphere of an unified experience.

     Ambiency for PROTA, like its resembling services, gives users the power to create automation rules using what the hardware of Raspberry Pi supports including GPIO, not to mention the open APIs that are already available on online.

Ambiency


Rule timeline: history of triggered rules

Creating rules with Sensors & Actuators

Ambiency as can be seen above is an app for creating and sharing automation rules.

     Sensors and actuators are tools for logical user programming that is capable of creating rules adaptable to almost all kinds of environments. They bridge just about all apps for PROTA. Check out below for how it can be applied.

GPIO, the exclusive app for PROTA Pi
     Raspberry Pi is a micro-Single Board Computer built for wide adaptation of computer in education. There has been numerous attempts and developments using the board to create disruptive projects. 40 pins of GPIO gave users the freedom to control and integrate the hardware.


GPIO

What GPIO looks like

We believed supporting this IO would revolutionize how users made use of their board. Moreover, this disrupts how the development can be applied not just to a single project but also to a wider adaptation in the fields via rule sharing and integration with other apps, physical things, and REST APIs. As a result, faster development of the projects can be achieved.

Since its debut in 21st of January this year, there are interesting projects coming up that we will be sharing with you in the coming days for education starting with building traffic lights.

Except for what’s to follow, all this is available right now for PROTA Pi.
Check out the PROTA Pi OS image if you haven’t already.

[PROTA] 라즈베리파이의 새로운 운영체제, 프로타 파이(PROTA Pi)

[PROTA] 라즈베리파이의 새로운 운영체제, 프로타 파이(PROTA Pi)



(라즈베리파이 Raspberry Pi)

- PROTA Pi OS
- For IoT smart hub platform
- Supported device : Raspberry Pi B, B+
- File size : 3GB


Raspberry Pi + PROTA OS = PROTA Pi


프로타파이(PROTA Pi) OS는 라즈베리파이(Raspberry Pi)의 새로운 운영체제입니다.
기존 라즈베리파이 사용자들은 raspbian과 같은 운영체제를 개발 테스트, DIY 프로젝트 등에 활용해 왔습니다. Raspbmc, OpenELEC과 같은 미디어 중심의 비교적 쉬운 운영체제도 있지만 대체적으로 설치하고 사용하는 것이 간단하지는 않았습니다.

프로타파이 OS는 사물인터넷(IoT)를 위한 라즈베리파이용 운영체제입니다. 라즈베리를 처음 접하는 분도 사용하실 수 있도록 개발되었는데,
여러분의 프로타파이 사용을 위해 몇 가지 특징을 설명해드리겠습니다.



# HTML5기반의 사용자 인터페이스
raspbian, raspbmc와 같은 운영체제는 모니터에 연결하여 사용하도록 되어 있는데, 프로타파이는 모니터를 연결할 필요없이 웹브라우저로 접속하여 사용하도록 설계되었습니다. 
프로타파이와 동일한 네트워크 환경에 접속되어 있다면 http://myprota.me를 웹브라우저 주소창에 입력하면 HTML5 기반의 UI를 접할 수 있어요.

(img : apprepo)

위 이미지는 프로타파이마다 가지게 되는 앱리포(App Repository)입니다.
스마트폰의 앱스토어와 같이 다양한 프로타 앱을 다운로드 받을 수 있습니다.

곧 개발툴도 배포하여 누구나 프로타 앱을 만들 수 있도록 지원해 나아갈 계획입니다.



# 사물인터넷의 시작. 자동화 애플리케이션 엠비언시(Ambiency)
IFTTT, Zapier 등 최근 웹 서비스를 통해 자동화 규칙(automation rule)을 지원하는 기업들이 늘어나고 있습니다. 서비스와 서비스를 연결하여 자동화 규칙을 생성할 수 있는 것이 핵심이죠.

 물론 라즈베리파이 사용자분들도 이제 이런 서비스간의 자동화 규칙 생성이 가능합니다.
바로 프로타파이 OS를 이용해서 말이죠.

(img : ambiency icon)


(img : triggered rule)


(img : Sensor & Actuator list)

위의 이미지는 '엠비언시(ambiency)'라는 서비스 자동화 앱입니다.

센서(sensor) 앱과 액츄에이터(actuator) 앱을 선택하여 사용자가 원하는 대로 특정 환경에서 원하는 결과가 일어나게 만드는 것이죠.
각 서비스가 다른 프로토콜을 사용하며 지원 형태가 다르다고 하더라도 엠비언시 앱이 그것들을 연결해 줄 수 있습니다.
아래의 몇 가지 예는 실제로 엠비언시 앱을 통해 만든 규칙들입니다.


# 라즈베리파이 유저만을 위한 앱 'GPIO 앱'
라즈베리파이는 교육용 소형 컴퓨터, SBC 입니다. 전 세계 많은 분들이 다양한 방법으로 기발하고 참신한 프로젝트를 만들어 냈습니다.
40개의 GPIO pin은 개발용 보드의 역할을 똑똑히 수행해냈다고 할 수 있습니다.


(img : GPIO app icon)


(img : GPIO shell)


그래서 NARAN은 라즈베리파이 유저들을 위해 GPIO 앱을 개발했습니다.
하드웨어 해킹과 더불어 소프트웨어 개발을 이용한 하나의 프로젝트가 그 상태에서 멈추는 것이 아니라,
프로타파이의 다른 앱들과 엠비언시(ambiency)라는 자동화 앱을 통해 연동이 가능해진 것입니다.

2015년 1월 21일 처음 소개된 이 앱을 이용한 프로젝트는 아직 많지 않지만,
앞으로는 다른 서비스들과 연동되어 예측할 수 없는 기발한 프로젝트들이 탄생할 것입니다.
PROJECT 1 : Traffic lights

지금 라즈베리파이가 있다면
이 모든 매력적인 요소들을 당장 체험할 수 있습니다.
Download now

프로타파이 OS 는 14일 Trial version 으로 제공되고,
계속적으로 사용하기 위해서는 라이센스 구매를 권장드립니다.