레이블이 rpi hacking인 게시물을 표시합니다. 모든 게시물 표시
레이블이 rpi hacking인 게시물을 표시합니다. 모든 게시물 표시

2015. 1. 13.

[Casual hacking] Introduce GPIO app for Raspberry Pi

 [Casual hacking] GPIO app for Raspberry Pi 

What is GPIO?
GPIO stands for General Purpose Input/Output. By integrating with software, electrical input and output of a device can be controlled.

This blog post is about GPIO Raspberry Pi, one of the most popular board out there.

If you are one of its users, you’ll be able to see that it’s quite different from how you managed and built it before.




(Above is what the GPIO app looks like)


(This is what inside the app looks like when you first launch it.)


(Python code to test input & output)

This’s what it looked like before when trying code to control pins.

To list functions in the GPIO UI you’ve seen above, they are as follows:
GPIO / SPI, UART, I2C / Pull up & down / PWM

1) GPIO pins
- Input, Output


Select the specific GPIO pins that you wish.
When selected it provide you options like the following.


Selecting Input will let you Read.
You can find out if the current GPIO state is 0 or 1 with this option.


Selecting Output will send data of 0 and 1 to the specific device.
For instance, when trying to control the LED using Raspberry Pi, you can control its power using True(=1), False(=1) using python. Writing 1 in blank will turn on the LED and 0 in blank will turn off the LED.

2) PWM - GPIO18 pin
- 1 ~ 1023 write


Inputting 1023 like in the above will increase the voltage to its highest level.

What’s unique about using a GPIO app is that you can select input or output values with a few clicks.

However, this’s the real reason why it was created.


GPIO can be integrated with other apps. They can easily integrated for automation.
In the next blog post, you can find out more about how to integrate the values from GPIO with other apps and how to setup PI, UART, I2C, and Interrupt(rising, falling).

2015. 1. 10.

[Casual hacking] Introduce GPIO app for Raspberry Pi

 [Casual hacking] GPIO app for Raspberry Pi 


GPIO 란?
Genenral Purpose Input/Output. 쉽게 말해 다용도 입출력 포트를 말합니다.
GPIO를 소프트웨어와 연동해서 전기 입력 및 출력 신호를 이용하여 소프트웨어에서 구현하려고 했던 디바이스 컨트롤을 행하죠.

이번에 다루는 GPIO는 세계적인 열풍을 불러 일으킨 라즈베리파이(Raspberry Pi) GPIO 입니다!

기존 라즈베리파이 유저분들이라면 신세계를 맞이할 것 같네요^^



 (위에 GPIO 앱이 보이시나요?)

(GPIO app을 접속하면 처음 보시게 되는 Shell 화면입니다.)


(Input & Output test를 위한 python code)

기존에는 위와 같은 코딩을 통해서 pin들을 컨트롤해왔었죠?!

이제 위 이미지에서 봤던 GPIO 앱 UI를 순서대로 하나씩 설명해 드리겠습니다!^^
GPIO / SPI,UART,I2C / Pull up & down / PWM

1) GPIO pins 
    - Input, Output

해당 GPIO pin 들을 마우스로 선택해줍니다.
선택하면 아래의 옵션이 보이게 되죠.
input option은 Read 를 할 수 있습니다.
현재 해당 GPIO 의 상태가 0인지 1인지를 판단할 수 있죠!



 Output option은 1과 0을 입력하여 해당 device에 data값을 보내줍니다.
예를 들자면,
기존 Raspberry Pi를 이용하여 LED 를 컨트롤 하려고 하면, python 의 경우 True(=1), False(=1)로 LED 의 전원을 제어할 수 있었죠!
blank에 1을 Write하면 LED 가 켜지고, 0을 Write하면 LED 가 

2) PWM - GPIO18 pin
    - 1 ~ 1023 write

위의 이미지에서는 PWM값을 1023으로 입력하여 전압 폭을 늘리는 시도를 하고 있네요!

GPIO 앱을 사용하면 기존의 번거로운 코딩없이 입출력을 클릭 몇번으로 사용할 수 있는 것이 큰 매력이라고 할 수 있습니다.

하지만 GPIO 앱이 개발된 가장 큰 이유는 바로!

PROTA에 설치되어 있는 다른 앱들과의 자동화를 실현할 수 있다는 점입니다!!
실제로 GPIO 값을 다른 앱들과 연동하여 자동화 하는 case는 SPI, UART, I2C, Interrupt(rising, falling) 값을 설정하는 법과 함께 다음 포스팅에서 소개해드리겠습니다!^^