[New features] Settings 앱의 WiFi & AP 모드 기능 Settings 앱의 새로운 기능을 소개해드립니다!!
기존에 소개해드린 Settings 앱이 가지고 있는 기능은 아래와 같았습니다.
* PROTA 버전 업그레이드 * 부팅 앱 선택 및 제외 * 네트워크 정보(Ethernet 정보) * 외부 접속 허용 여부 결정(Security settings) * Reboot & Shutdown * PROTA EULA, License 여러분이 사용하시는 프로타(PROTA)가 아직도 랜(LAN)선에 붙잡혀 있다면, Settings 앱의 새로운 기능인 WiFi 기능을 써보세요!! 당신의 프로타를 무선으로 사용할 수 있습니다! 아주 간단하게 설명을 드릴게요!
# WiFi 연결하기
사용 무선랜카드 칩셋은 RTL 8188EU 입니다.
라즈베리파이(Raspberry Pi) B, B+ 지원 칩셋
RTL8192CU
RTL8188CU
RTL8188EU
라즈베리파이(Raspberry Pi)2 지원 칩셋
RTL8192CU
RTL8188CU
더 나아가서 가끔씩 Hidden SSID(숨겨진 SSID)가 있는 경우가 있죠?!
그런 경우는 "Join Other Network"로 숨겨진 SSID를 연결하시면 됩니다!
# AP 모드 사용하기
AP 모드는 여러분의 프로타를 WiFi 공유기로 사용할 수 있는 기능입니다! "AP mode"를 선택하신 후 연결이 완료되면 노트북, 스마트폰, PC 등으로 WiFi 연결을 시도할 수 있습니다. 참 많은 기능이 있는 프로타(PROTA) 입니다 :) 자 이렇게 두 가지 기능을 배우면 무엇이 좋을까요??
더 이상 스마트 허브 프로타를 한 곳에 둘 필요가 없어지는 것이죠! WiFi 를 연결한 상태에서 외장 배터리를 이용한다면 더 이상 선을 통해 프로타를 연결해 둘 필요가 없어지죠! 또한 공유기를 따로 구입하지 않아도 프로타로 공유기를 사용할 수 있는거죠. (대신 AP mode 기능을 사용할 경우 무선랜카드의 사양이 꽤 좋아야겠죠?!) 셋팅앱의 다른 사용 포스팅을 소개해드릴테니 참고하시기 바랍니다! http://thenaran.blogspot.kr/2014/08/prota-settings-settings-prota.html 감사합니다 :)
Booting time of PROTA OS on Raspberry Pi2 reduced to 70%in comparison to Raspberry Pi B+. on Raspberry Pi2 : 38 seconds on Raspberry Pi B+ : 2minutes 4 seconds
- Shorter 'Installation time'
Raspberry Pi2 vs Rpi B+
Install time of 'Transmission' app just took 12seconds on Raspberry Pi2. Installation time of PROTA OS on Raspberry Pi2reduced to 66% in comparison to Raspberry Pi B+.
on Raspberry Pi2 : 12 seconds on Raspberry Pi B+ : 35 seconds
- More 'Powerful'
Raspberry Pi2 vs Rpi B+
B+ wasn't powerful enough, but with Pi2 now you can!
Shares, syncs, and collaborates files securely like cloud.
[Advanced features] Ambiency Language : What is AMBLANG?
1. Overview * Amblang is a mini language for specifying filters and actuator input parameters. ###### The grammar The context-free grammar of amblang is as follows.
Expressions can be embedded in any kind of text. When evaluated, the result can be any type of object and will be accordingly put into the enclosing text.
###### Evaluation An expression is evaluated into one of the following types. * symbol * number * bool * object A symbol is not evaluated unless it's enclosed with double curly braces ({{}}). The value of a symbol is retrieved from the provided symbol table containing sensor data with corresponding names. A literal is either a string enclosed with quotations (single or double) or a number (integer or float). If the result is an object, it must be consumed by a converter function until the end of evaluation. Failing to do so, the original expression will be remained.
A converter function can be applied to any expression with zero or more arguments. When failed, the original expression will be remained but without the converter function itself. 2. Examples --- ---
Amblang is used in sensor filters and actuator inputs. In sensor filters, amblang must be evaluted into a bool-type result. For actuator inputs, amblang must produce values of a type the actuator expects; otherwise, the actuator will not be executed. ###### Sensor Filters
When specifying filters for sensor data, users can write a filter expression in amblang. All sensor data fields can be used in a expression, and more than one expression are allowed but must result in a single boolean value at the end. Consider the following filter expression for the Email sensor.
````
{{ sender!endswith("thenaran.com") }}
````
This will check if the first sender's domain is "thenaran.com." and get evaluated to a boolean value; true or false.
````
{{ {{ receivers!len }}!gt(1) }}
````
This expression will be evaluated to true only if the number of receivers is greater than 1, meaning the email was sent to multiple recipients. Specifying multiple expressions in more than one depth is also allowed.
This evaluates to true only if the email is from "thenaran.com" and sent to multiple recipients. ###### Actuator Inputs Actuators consumes sensor data. However, from time to time, sensor data have different types and formats making direct feeding impossible. Amblang can be used to re-format any type of sensor data and assign to actuator inputs accordingly. As an example, the Email application has an actuator which can send an email message with or without attachments. The email's send actuator expects the following inputs. * receivers : string * subject : string * message : string * file : binary * file name : string Each input field has its type and it must be respected in order for a rule to succeed. For each field, amblang can be used for formatting and converting sensor data.
For instance, in a string field, an amblang expression must be evaluated into a string. If it fails to produce a corresponding input type, the expression leaves as it is written before evaluation. In other types of fields, the actuator will not be executed unless all inputs have appropriately-typed values. Consider the following input expression for the Email actuator's subject field. The WebCam application is used as an example sensor, and the trigger is "snapshot available".
````
Snapshot taken at {{ time!strftime("%a, %d %b %Y %H:%M:%S +0000") }}
````
the message field,
````
Checkout the snapshot below.
````
and the file field which expects a binary data,
````
{{image}}
````
The "snapshot available" trigger produces two types of sensor data; timestamp and snapshot image file. Each data is available under the symbols "time" and "image" respectively. The "time" data is an integer type so it must be converted to a string. In this example, the "strftime" converter is used to format the millisecond timestamp into a human-readable text. The "image" data is a binary data so it can be directly fed to the file field.
Once a motion is detected on the webcam and the snapshot gets ready, an email with the above inputs is sent with the snapshot as an attachment file. 3. Recap --- ---
Amblang is a micro-programming language that defines sensor data filter and actuator input values. It is an advanced feature of possibilities that may require getting used to, but it is not a big deal for most users because Rules can be shared and applied with almost no effort.
This is only a part of Amblang and more will be shared in the coming weeks.
4. Rule Example --- ---
Try out now with a drag-and-drop of the below image file onto your Ambiency. All you need to do is drop the image file onto the app, you can see it applied instantly.
[Advanced features] Ambiency Language : 엠블랑(AMBLANG) 이란? 자동화 룰을 만들면서 조금 더 세세한 제어를 원하신 적이 계신가요? 자동화 룰을 조금 더 나에게 맞게 사용하고 싶은 분이 있다면, 엠블랑(AMBLANG)을 배워보세요! 조금 어렵지만 꽤 강력합니다.
'센서 필터(sensor filters)', '액츄에이터 인풋(actuator inputs)' 설정시 엠블랑을 사용하면 더 정확하게 룰을 만들 수 있습니다. 센서필터 화면 왼쪽 아래에 "Advanced" 버튼을 누르시면 엠블랑으로 필터 설정을 할 수 있고, 액츄에이터 화면에서는 바로 엠블랑을 활용하여 각 인풋 필드에 값을 설정 할 수 있습니다.
(Sensor app 필터(filters) 화면)
(Actuator app 인풋(inputs) 화면)
AMBLANG
1. Overview
엠블랑(AMBLANG)은 엠비언시 앱의 ‘필터’와 액츄에이터의 인자값을 명시하기 위한 조그만 프로그래밍 언어입니다.
위의 문법을 사용한 표현식은 어느 텍스트에도 포함될 수 있습니다. 텍스트에 포함된 표현식이 도출될 때 그 결과는 객체의 어떤 타입으로도 도출될 수 있고 문자열이 될수도 있습니다.
Evaluation
하나의 표현식은 아래의 타입들 중 하나로 도출됩니다.
symbol
number
bool
object (객체)
symbol은 중괄호({{ }})로 둘러쌓여 있지 않으면 도출되지 않습니다. symbol value는 일치하는 항목의 센서데이터를 포함하는 symbol table 에서 얻을 수 있습니다. 표현식 내에서의 문자는 따옴표 혹은 쌍따옴표로 둘러 쌓여져 있어야 도출이 되고, 숫자는 정수 혹은 실수만 사용할 수 있습니다.
결과값이 객체라면, 표현식에서 도출이 완료될 때까지 변환되어 재가공되어져야 합니다. 재가공이 실패하게되면, 원래의 표현이 그대로 남게 됩니다.
2. Examples
엠블랑은 센서 필터(Sensor filters)와 액츄에이터 인풋(Actuator inputs)에 사용됩니다. 센서필터에서는 엠블랑은 bool-type 결과로 도출됩니다. 액츄에이터 인풋에서 사용되기 위해 엠블랑은 액츄에이터에서 요구되는 값으로 작성되어야 하며, 그렇지 않을 경우 액츄에이터가 제대로 실행이 되지 않을 수 있습니다.
Sensor Filters(센서 필터)
센서 데이터를 센서 필터에 구체적으로 쓰기 위해서 사용자는 엠블랑의 문법에 맞게 사용해야 합니다. 모든 센서 데이터 필드들은 한 가지 표현으로 사용되어야 하고, 한 개 이상의 표현식을 사용은 할 수 있지만, 한 가지의 boolean으로 사용되어야 합니다.
위 표현식은 “thenaran.com” 도메인으로부터 오고, 여러 수신자에게 보내질 때만 ‘true’ 값으로 도출됩니다.
Actuator Inputs(액츄에이터 인풋)
액츄에이터는 센서 데이터를 사용합니다. 센서 데이터가 다른 타입을 가지고 있어서 바로 적용하지 못하는 포맷인 경우가 있습니다. 엠블랑은 센서 데이터의 타입을 재가공하여 사용할 수 있게 해주며, 액츄에이터 인풋에서 요구하는 타입으로 맞춰서 값을 줄 수 있습니다.
한 예로 메일 앱이 액츄에이터로 사용될 때 첨부파일이 있는 경우 혹은 없는 경우로 메일을 보내는 경우가 있습니다.
메일의 ‘메일 송신 액츄에이터’는 아래의 인풋 데이터 필드를 지원합니다.
receivers : string
subject : string
message : string
file : binary
file name : string
각 액츄에이터 인풋 필드는 자동화 룰이 실행되기 위해서 필요한 값을 받게 되는데, 엠블랑은 센서데이터를 변환하여 액츄에이터 인풋 필드에서 사용될 수 있게 만들 수 있습니다. 이때 변환되는 최종값은 인풋 필드에서 요구하는 타입에 맞아야 룰이 실행 될 수 있습니다.
예를 들어, string 필드에서 엠블랑 문법을 통해 string으로 도출해야 합니다. input type(string이어야 하는 경우)을 string으로 만들지 못한다면, 원래의 input type으로 쓰여지게 됩니다. 다른 필드 타입의 경우, 모든 인풋 데이터가 적절한 타입으로 변환되지 않는다면 액츄에이터가 제대로 실행되지 않습니다.
웹캠(WebCam)앱이 센서로 사용되어 trigger가 ‘snapshot 사용’인 경우의 이메일 액츄에이터 제목 필드 부분의 인풋 표현식을 보겠습니다.
````
Snapshot taken at {{ time!strftime("%a, %d %b %Y %H:%M:%S +0000") }}
````
메세지 필드(message field),
````
Checkout the snapshot below.
````
바이너리 데이터가 쓰여져야되는 파일 필드(file field),
````
{{image}}
````
"snapshot 사용” trigger는 센서 데이터에서 두 개의 타입을 만드는데, ‘타임 스탭프(time stamp)’와 ‘스냅샷 이미지 파일(snapshot image file)’입니다.
각 데이터는 개별적으로 “time”과 “image”로 사용이 가능하고, “time” 데이터는 integer(정수)이기 때문에 string으로 변환되어져야 합니다. 이 경우 “strftime” 변환기가 사람이 읽을 수 있는 글자로 “time” 데이터를 천분의 일초(milisecond)로 변환합니다.
일단 웹캠에 움직임이 감지되면(motion detected), 위 인풋 값들이 쓰여진 이메일 앱이 첨부파일로 스냅샷을 함께 보내게 됩니다.
3. Recap
엠블랑은 센서 데이터 필터와 액츄에이터 인풋 값 정의에 사용되는 미니 프로그래밍 언어 입니다.
조금 복잡하기 때문에 전문가 분들만 사용하시겠지만, 복잡한 룰이라도 공유 받아 사용하는데는 전문지식이 필요없기 때문에 큰 걱정은 안 하셔도 될 겁니다.
아직 다 엠블랑의 기능을 보여드리진 못 했습니다. 앞으로 천천히 룰도 공유하면서 엠블랑을 더 깊게 알려드리도록 하겠습니다.
4. Rule Example
아래의 룰 이미지를 여러분의 엠비언시(ambiency) 페이지에 드래그 앤 드랍(drag & drop)하면, 룰이 공유되어 엠블랑(Amblang)의 사용예제를 직접 보실 수 있습니다.
[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 detailsfrom the product page of your purchased goods)
Product information from ultrasonic sensor: HG-C40U
From here on, please follow theinstructions 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 areworking properly.
2. ConfigureUART 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.
[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)을 만들어봤습니다. 여러분은 다른 버튼을 만들어보세요! 초음파 거리를 이용해서 리모콘이 있던 제품, 리모콘이 없던 제품 또한 제어가 가능합니다!
이번 Tutorial에서는 RFID 애플리케이션을 소개해드리려고 합니다. RFID 는 핸드폰과 같은 Bluetooth 사용이 가능한 장치들을 등록 시키는 애플리케이션입니다.
Ready RFID 애플리케이션을 사용하시기 전에 반드시 필요한 사항이 두 가지 있는데요. 첫 번째가 App repository에서 RFID 애플리케이션을 설치한다.
두 번째가 바로 CSR 4.0 칩셋이 사용된 Bluetooth dongle 이 필요하다는 것입니다. How to Used? 먼저 PROTA에 Bluetooth dongle 를 설치한 후 Settings > Network settings에서 잘 인식이 되었는지 확인합니다.
만약 위 같이 나오지 않는다면 Bluetooth dongle 를 설치한 상태에서 PROTA 를 Rebooting 해주세요. 확실히 인식이 되었는지 확인하셨나요? 이제 다음 스텝으로 넘어가도록 하겠습니다.
앱을 처음 실행시키신다면 ‘+ Add RFID’ 를 선택 하시면 됩니다. 혹은 상단의 ‘+'버튼을 선택하시면 됩니다.
위와 같은 화면이 나오면 Manual, Scan 중 한 가지를 선택해서 인식을 시작합니다. Manual 은 'Device name'과 'Tag'를 수동으로 작성하고 Mac address는 핸드폰이나 Bluetooth 사용이 가능한 장치의 고유 'Mac address'를 입력하여 등록하는 방식입니다. 한 마디로 수동으로 입력해야 된다는 거죠~ Scan 은 핸드폰이나 Bluetooth 사용이 가능한 장치의 Bluetooth 기능을 활성화시켜서 인식하는 방식입니다. 이 방법은 자동으로 'Mac address'와 'device name'이 채워져요. 'Manual' 등록하기
Device name과 Tag를 임의로 작성하고 핸드폰이나 Bluetooth 사용 가능한 디바이스의 Mac address를 입력한 후 ‘Regist’를 선택하면 됩니다. 'Scan'으로 등록하기
핸드폰이나 Bluetooth 사용 가능한 디바이스의 Bluetooth 을 실행한 후 ‘Scan’ 버튼을 선택합니다.
Scan이 완료되면 Tag를 작성한 후 ‘Register all’ 버튼을 선택합니다. 현재 Tag는 영문만 지원하고 있습니다. 그럼 바로 등록이 완료 됩니다.
저의 스마트폰 블루투스 신호를 등록해봤습니다 :) Used to RFID RFID앱은 자동화 규칙 생성 애플리케이션 엠비언시(Ambiency)에서 Sensor 로 사용할 수 있습니다!