SlideShare une entreprise Scribd logo
1  sur  131
• Start Raspberry Pi
• VERSION 1.6.2
• Release Date : 2017.3
OSHW ARM:
Raspberry Pi
고 강 태
james@thinkbee.kr
https://www.linkedin.com/in/thinkbeekr/
참조
ARM으로 배우는
임베디드 리눅스 시스템
임베디드 리눅스 기초와 응용
https://www.raspberrypi.org
2
OSHW Raspberry Pi
오픈소스 하드웨어
임베디드 시스템
Raspberry Pi
Raspbian 설치
오픈소스 시스템
Opensource HW
http://www.oshwa.org/definition/korean/
오픈 소스 하드웨어는 누구나 이 디자인이나 이 디자인에 근거
한 하드웨어를 배우고, 수정하고, 배포하고, 제조하고 팔 수
있는 그 디자인이 공개된 하드웨어이다.
5
오픈소스HW
http://linuxgizmos.com/tiny-raspberry-pi-compatible-sbc-targets-wearables/
대표적 하드웨어 종류
Arduino
- 2005, AVR microcontroller
- code driven
Raspberry Pi
- 2011, 교육용
single-board computer
- os driven6
오픈소스HW
Opensource H/W communities
7 오픈하드웨어와 사물인터넷, 2014, Digieco
Arduino vs Raspberry Pi
8
오픈소스HW
http://readwrite.com/2014/05/07/arduino-vs-raspberry-pi-projects-diy-platform
Arduino Usage
9
오픈소스HW
http://blog.arduino.cc/wp-content/uploads/2013/09/1-Arduino-Temboo-schema.png
Raspberry Pi
오픈소스HW
http://goo.gl/htGGKD10
Clones:Odroid-W
RaspberryPi-B+ 기반으로 Wearable을 목표로한 플랫폼.
11
오픈소스HW
http://linuxgizmos.com/tiny-raspberry-pi-compatible-sbc-targets-wearables/
Meet Otto
12 https://www.kickstarter.com/projects/1598272670/meet-otto-the-hackable-gif-camera
pix-E
13
RAPIRO
프로그램할 수 있는 DIY Robot
14
오픈소스HW
http://www.rapiro.com
Mini Mac
15
오픈소스HW
Pi-Top
16 https://hackaday.io/contest/15532-enlightened-raspberry-pi-contest/log/46760-prizes
CP/M
http://www.projekte.daleske.de/prog/11_EMUZ80_RPI/prog_EMUZ80_RPI_en
.htm
17
http://hackaday.com/2016/10/12/raspberry-pi-boots-cpm/
ARM core Cloud server
https://www.scaleway.com
ARM core로 제공하는 VPS 서버
$3.4/month
4core, 2GB ram, 50GB space 제공
1개 랙에 912개 장착
18
32EA 912EA
Rapsberry Pi
Raspberry Pi Model A
21
USB Ports
Ethernet
GPIO
3.5mm Audio &
Composite Output Jack
HDMI Out5V Micro USB
Power
CSI Camera
connector
SMSC LAN9514 USB
Ethernet controller
DSI Display
connector
MicroSD Card
slot (밑면)
Less power
consumption
Power Regulator
Pi reset
Run Header
Broadcom
BCM2835
RaspberryPi
Raspberry Pi 2 Model B v1.1
22
4 USB Ports
Ethernet
GPIO
3.5mm Audio &
Composite Output JackHDMI Out5V Micro USB
Power
CSI Camera
connector
SMSC LAN9514 USB
Ethernet controller
DSI Display
connector
(밑면) MicroSD
Card Slot
Less power
consumption
Power Regulator
Pi reset
Run Header
Broadcom
BCM2836
RaspberryPi
참조 http://elinux.org/RPi_Hardware
Raspberry Pi 2 Model B v1.2
23
Serial In (Rx)
4 USB Ports
Ethernet
GPIO
3.5mm Audio &
Composite Output JackHDMI Out5V Micro USB
Power
CSI Camera
connector
SMSC LAN9514 USB
Ethernet controller
DSI Display
connector
(밑면)
MicroSD Slot
Less power
consumption
Power Regulator
Pi reset
Run Header
Broadcom
BCM2837
Raspberry Pi 3 Model B
24
Serial In (Rx)
4 USB Ports
Ethernet
GPIO
3.5mm Audio &
Composite Output Jack
HDMI Out5V Micro USB
Power up to 2.5A
CSI Camera
connector
SMSC LAN9514 USB
Ethernet controller
DSI Display
connector
MicroSD Card
slot (밑면)
Less power
consumption
Power Regulator
On board
BT 4.1, WiFi
Chip Antenna
Broadcom
BCM2837 64bit
Quad core CPU
at 1.2Ghz
Raspberry Pi Zero
25
GPIO
Micro USBMini-HDMI 1080p
Video & Audio
Output
5V Micro USB
Power
CSI Camera
connector
Micro SDCard
Pi reset
Run Header
Broadcom BCM2835 SoC
Dual core 1Ghz
VideoCore IV GPU
512MB Onboard RAM
RCA Composite
Video Output
65 x 30 x 5 mm
Raspberry Pi Table
26
항목 Pi 1 Model B+ Pi 2 Model B Pi Zero Pi 3 Model B Pi 2 v1.2
SoC SoC BCM 8235 SoC BCM 8236 SoC BCM 8335 SoC BCM 2837 SoC BCM 2837
CPU ARM11 @700Mhz
Quad Coretex A7
@900Mhz
ARM11 @1Ghz
Quad Coretex A53
@1.2Ghz
Quad Coretex A53
@900Mhz
IS Set ARMv6 ARMv7-A ARMv6 ARMv8-A ARMv8-A
GPU
250Mhz VideoCore
IV
250Mhz VideoCore
IV
250Mhz VideoCore
IV
400Mhz VideoCore
IV
250Mhz VideoCore
IV
Memory 512MB Ram 1GB Ram 512MB Ram 1GB Ram 1GB Ram
Network 10/100 10/100 N/A
10/100, WiFi, BL
4.1
10/100
USB 2 x USB2.0 4 x USB2.0 1 Micro USB 4 x USB2.0 4 x USB 2.0
GPIO 40 40 40 40 40
Video
640×350 to
1920×1200,
1080p, PAL &
NTSC
640×350 to
1920×1200,
1080p, PAL &
NTSC
640×350 to
1920×1200,
1080p, PAL &
NTSC
640×350 to
1920×1200,
1080p, PAL &
NTSC
640×350 to
1920×1200,
1080p, PAL &
NTSC
Raspberry Pi ARM core
Raspberry Pi 2는 Broadcom BCM2836 칩셋을 사용.
- ARMv7 Cortex-A7
- https://goo.gl/nLAhZH
- BCM2836은 대부분 BCM2835와 동일
- https://goo.gl/IqF2TW
- BCM2835 ARM Peripherals reference
- https://goo.gl/Zh9SeO
- 32bit 구성의 레지스터를 제공하고 있다.
Raspberry Pi 3는 Broadcom BCM2837
- ARMv8 Cortex-A53
Raspberry Pi 2 v1.2는 Broadcom BCM2837
- ARMv8 Cortex-A53
27
소비전력
USB 2.0 표준 허브는 포트당 5V에 500mA 제공
USB 3 표준 허브는 포트당 5 V에 900 mA 제공
28
Product
Recommended
PSU current
capacity
Maximum total
USB peripheral
current draw
Typical bare-
board active
current
consumption
Raspberry Pi Model A 700mA 500mA 200mA
Raspberry Pi Model B 1.2A 500mA 500mA
Raspberry Pi Model A+ 700mA 500mA 180mA
Raspberry Pi Model B+ 1.8A
600mA/1.2A
(switchable)
330mA
Raspberry Pi 2 Model B 1.8A
600mA/1.2A
(switchable)
Raspberry Pi 3 Model B 800mA~2.5A 1.2A ~400mA
https://www.raspberrypi.org/help/faqs/
Raspbian 설치
Download
현재 2017-03-02 버전
https://www.raspberrypi.org/downloads/
30
RaspberryPi
주요 공개 노트
2017-03-02:
* NOOBS installs now checks for presence of 'ssh' file on the NOOBS partition
2017-01-11:
* Re-release of the 2016-11-25 image with a FAT32-formatted boot partition
2016-11-25:
* SSH disabled by default; can be enabled by creating a file with name "ssh" in boot
partition
2016-09-23:
* New PIXEL desktop environment
* RealVNC server and viewer included
31 http://downloads.raspberrypi.org/raspbian/release_notes.txt
Writing OS Image
Format SDCard
-SD Association 제공 sdFormater
Writing image
- Etcher, Win32DiskImager
- dd command
32
jessie-raspbian Ubuntu OSMC
NOOB
RaspberryPi
SDHC Class 6 이상
SDCard Formatter 이용
33
Mac: SDCard Formatter 이용
34
Write a image
https://etcher.io
35
Win32 Disk Imager
36
2016-05-17-raspbian-jessie.img
zip 압축을 해제합니
다.
dd 명령
37
ssh 활성화
2016-11-25-raspbian-jessie는 ssh 비활성화
- http://downloads.raspberrypi.org/raspbian/release_notes.txt
ssh는 /boot 밑에 빈 ssh 파일 추가하면 활성화
Linux/Mac:
$ touch ssh
Window
type NUL > ssh
38
ssh 통해 원격 접
속해서 설정을 계
속한다.
Expand Filesystem
부팅후 자동으로 disk resize 된다.
39
pi@raspberrypi:~ $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 3.6G 3.3G 114M 97% /
devtmpfs 459M 0 459M 0% /dev
tmpfs 463M 0 463M 0% /dev/shm
pi@raspberrypi:~ $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 15G 3.3G 11G 24% /
devtmpfs 459M 0 459M 0% /dev
tmpfs 463M 0 463M 0% /dev/shm
tmpfs 463M 6.2M 457M 2% /run
Expand
Filesystem 실
행 후
최신 raspbian은
처음 부팅시 자동으
로 확장
Raspberry Pi Updates
1. Wheezy 배포본 최신 상태로 Upgrade
- apt-get 유틸리티 이용
- 가까운 미러사이트 이용
2. Raspberry Pi Firmware Upgrade
- 펌웨어를 최신 버전으로 유지
40
Raspbian Update
미러사이트를 가까운 곳으로 설정
apt-get을 이용 배포본을 최신 상태로 유지
41
pi@raspberrypi ~ $ sudo vi /etc/apt/sources.list
#deb http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi
deb http://ftp.neowiz.com/raspbian/raspbian wheezy main contrib non-free rpi
deb http://ftp.kaist.ac.kr/raspbian/raspbian/ wheezy main contrib non-free rpi
Raspberry Pi 원격지 환경
원격 개발환경
USB serial이용 접속
dhcp 원격접속 설정
raspi-config
무선랜 설정
원격 개발 환경
원격 개발
https://goo.gl/k2xwZX
45 https://en.wikipedia.org/wiki/Virtual_Network_Computing
Windows SSH client
전통적인 putty
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
MobaXterm
http://mobaxterm.mobatek.net
46
ssh client
Raspbian 기본 계정
user id: pi
user pw: raspberry
47
command line ssh
대상 서버에 로그인
ssh [USERID@]HOST_NAME
$ssh pi@192.168.1.1
서버 포트 변경
ssh [USERID@]HOST_NAME -pPORT
$ssh pi@192.168.1.1 -p1022
48
라즈베리파이에 ssh 로그인
49
ssh auto login
ssh 자동 로그인
1)ssh용 개인용-공개용 key 생성
$ ssh-keygen -t rsa -C "Pi user"
2) 원격 서버에 키 복사
$ scp .ssh/id_rsa.pub userid@111.111.111.11:~/.ssh/userid_rsa.pub
원격 서버에 로그인
$ ssh userid@111.111.111.11
복사한 공개키를 authorized_keys에 복사
(111.111.111.11)$ cat .ssh/userid_rsa.pub >> .ssh/authorized_keys
(111.111.111.11)$ exit
서버에 로그인
$ ssh -i ~/.ssh/id_rsa myuser@111.111.111.11
50
scp 이용
대상 서버에 복사
scp FILE USERID@HOST_NAME:PATH
$scp test.txt pi@192.168.1.1:/home/pi/
서버에서 복사해 오기
scp USERID@HOST_NAME:PATH FILEPATH
$scp pi@192.168.1.1:/home/pi/test.txt ~/temp
scp 포트 변경
scp -P PORT USERID@HOST_NAME:PATH FILEPATH
폴더 단위 복사
scp -r USERID@HOST_NAME:FOLDER_PATH FOLDER_PATH
$scp -r pi@192.168.1.1:/home/pi/folder ~/temp/
51
X forward
ssh 를 이용해 원격 X server를 사용해 GUI 실행
52
Server
RaspberryPi
X11 Tunnel
X11 forwarding over ssh connection
http://bahndal.egloos.com/534415
http://talkingaboutme.tistory.com/409
sshfs
ssh 기반의 remote filesystem
53
RaspberryPi
sshfs 설치
원격 호스트에 sshfs 설치
- Raspberry Pi / Linux sshfs 설치
$sudo apt-get install sshfs
54
sshfs usage
sshfs 옵션은 다음 같다:
sshfs -pXXXX -o [options] user@remotehost:/path /local/path/
Useful options:
-pXXXXX – tells sshfs to use port number XXXXX.
-o Ciphers=arcfour – speeds up for the connection.
-o ro – read only.
-o nonempty – allow nonempty mount point.
-o cache_timeout=N – set default cache timeout (in seconds)
-o cache=no – disable cache.
-o intr – allows to interrupt file access.
-o reconnect – automatically reconnect
-o idmap=user – helps with file ownership conflicts
55
sshfs 이용 마운트
개발 호스트 컴퓨터에서 다음 같이 원격 볼륨을 마운트 한다.
$sudo sshfs USER_ID@xxx.xxx.xxx.xxx:/ /Volume/remote
예)
$ sshfs user@host:/example ~/example -
oauto_cache,reconnect,defer_permissions,negative_vncache,noappledouble,volna
me=Example
사용후 언마운트는 다음과 같다.
$sudo umount /Volume/remote
56
win-sshfs
https://github.com/dimov-cz/win-sshfs
http://dokan-dev.github.io
다운로드:
- https://github.com/dimov-cz/win-sshfs/releases
- https://github.com/dokan-dev/dokany/releases
57
dokan 1.0RC 사
용
Serial Console 이용 접속
Serial console
USB to TTL Serial 케이블을 Raspberry Pi의 UART의 Rx, Tx
를 크로스 연결한다.
59
UART와 USB to TTL
Raspberry Pi의 UART는 TTL 수준의 Serial signal
- 보통 USB to serial cable은 Serial signal을 TTL로 제공.
- 보통 터미널 프로그램 사용해 시리얼 콘솔로 이용
60
TTL
61 http://s11.postimg.org/jy79tc6kj/Serial_Diffs.jpg
PL2303HX
Windows Driver
- Prolific: https://goo.gl/p5EDh
- Adafurits: https://www.adafruit.com/product/954
Mac OS Driver
- Prolific: https://goo.gl/nw5zgk
- Adafurits: https://www.adafruit.com/product/954
62 https://www.adafruit.com/product/954
Adafurit가 공개한
- PL2303TA USB TTL to RS232 Converter
- Black : GND
- Green : TXD
- White : RXD
- Red : VCC
Serial port
장치관리자에서 USB to ttl 포트를 확인
63
시리얼 터미널 연결
터미널 프로그램 : putty, MobaXterm, Hyperterminal...
64
Mac serial terminal
Mac OS X에서 screen 시리얼 터미널 프로그램
$ screen <디바이스 이름> <전송속도>
예)
$ screen /dev/tty.usbserial-XXXXXXXX 115200
시리얼 터미널에서 빠져나오려면
'ctrl-a, ctrl-'를 순서데로 입력
혹은 외부 터미널에서 'pkill SCREEN' 혹은 -R 옵션을 주고
다시 연다
$ screen -R /dev/tty.usbserial-XXXXXXXX 115200
65
Static IP Address
ifconfig 명령으로 IP 확인
Static IP 입력: /etc/network/interfaces
67
$ sudo vi /etc/network/interfaces
auto lo
iface lo inet loopback
# auto eth0
# iface eth0 inet dhcp
# manual
auto eth0
iface eth0 inet static
address 192.168.0.204
netmask 255.255.255.0
netwrok 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 8.8.8.8 8.8.4.4
```
Serial console
Raspberry Pi는 Jessie 까지 기본적으로 UART 핀을 Host
machine의 Serial로 연결해서 Console로 사용할 수 있다.
- 라즈비안의 UART 는 기본으로 Serial console로 지정되어 있
다.
만약 serial communication으로 사용하려면 raspi-config로 해제
한다.
68
cmdline.txt 이용 원격접속 설정
부팅시 static ip 설정
라즈베리 파이의 boot process 단계 설정 파일을 이용
1. 보드에 전원이 들어오고 GPU가 활성화된다.
2. SoC 내 ROM에 있는 첫번째 부트로더(Firmware)를 읽어
들인다.
3. 첫번째 부트로더가 SD카드에 있는 두번째 부트로더
(bootcode.bin)을 호출한다.
4. 두번째 부트로더가 SD카드에 있는 config.txt를 읽고 실행
한다.
4. 두번째 부트로더가 세번째 부트로더(start.elf)를 호출 및
실행하여, ARM Core를 활성화한다.
6. ARM Core가 활성화되면 네번째 부트로더(kernel.img)를
70
/boot/cmdline.txt
71
라즈베리파이에 접속
개발머신에서 ssh로 라즈베리파이에 로그인
로그인 후 raspi-config 명령을 실행해야 한다.
72
Static IP Address
/etc/network/interfaces
73
$ sudo vi /etc/network/interfaces
auto lo
iface lo inet loopback
# auto eth0
# iface eth0 inet dhcp
# manual
auto eth0
iface eth0 inet static
address 192.168.0.204
netmask 255.255.255.0
netwrok 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 8.8.8.8 8.8.4.4
```
dhcp IP로 원격접속
DHCP IP 이용 ssh 접속
75
내부 DHCP 공유기 접근 가능
OS 이미지 굽기 (sd card)
관리 페이지에서 mac address
ip 확인후 ssh 접속
nmap 과 arp 유틸리티로 ip 확인
접근 불가능
ID: pi
PW: raspberry
공유기 사용시; DHCP 할당 확인
76
오늘은 무선랜을
사용해서 접속해
보겠습니다.
Windows용 nmap
네트워크 안의 호스트를 고속으로 검색하는 도구
- Windows nmap: nmap.org/download.html
- Microsoft Visual C++ 2013 Redistributable Package
- WinCap Library: wincap.org
77
nmap 사용
nmap으로 subnet의 호스트를 검색한다.
> nmap -sP 192.168.0.0/24
78
ssh pi@192.168.0.20
nmap, arp 등으로 IP 검색후 ssh 로그인.
$ ssh pi@192.168.11.100
The authenticity of host '192.168.11.100 (192.168.11.100)' can't be established.
ECDSA key fingerprint is SHA256:G8MGJDNGJeYqF123aYlKj4MMQF9aevRhF/aO2ldWo6E.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.11.100' (ECDSA) to the list of known hosts.
pi@192.168.11.100's password:
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri Mar 3 16:24:26 2017
SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set a
new password.79
raspi-config
raspi-config
raspi-config는 라즈비안 시스템을 설정하는 유틸리티입니다.
$sudo raspi-config
다음 1번은 꼭 실행해 주어야 SD카드 용량을 모두 사용합니다.
1. Expand Filesystem 사용을 허용합니다. 라즈베리파이는 SD card
를 4GB까지만 인식하도록 설정되어 있습니다. 그래서 8GB이상의
SD Card를 사용중이라면 (대부분...) Exapnd Filesystem 설정을
해야 합니다.
2. ssh 접속을 허용하기 위해서 Advanced Options -> SSH enable 을
실행합니다.
81 http://www.raspberrypi.org/documentation/configuration/raspi-config.md
raspi-config
SSH enable
82
raspi-config
Boot option
83
VNC
VNC server
Raspbian 2016-11-25 일 버전 이후 VNC server 내장
RealVNC 등 클라이언트를 사용해 접속
raspi-config 혹은 GUI menu
- Select Menu > Preferences > Raspberry Pi Configuration >
Interfaces.
• Ensure VNC is Enabled.
85 https://www.raspberrypi.org/documentation/remote-access/vnc/
raspi-config
VNC enable
86
VNC Client
RealVNC
- https://www.realvnc.com
87
VNC Client
88
WiFi 설정
WiFi 설정
무선랜 동글 확인
$iwconfig
wlan0 ...
lo
eth0
주변 공유기 확인후 ESSID, 암호방식 메모
$iwlist wlan0 scan
Cell 02 - Address: 98:5A:EB:8D:5C:36
ESSID:"macbook_pro"
Protocol:IEEE 802.11bgn
Mode:Master
Frequency:2.462 GHz (Channel 11)
Encryption key:on
Bit Rates:144 Mb/s
90
WiFi 설정
AP 인증 설정 : /etc/wpa_supplicant/wpa_supplicant.conf
wpa_passphrase 명령으로 설정 가능
$sudo -s
#wpa_passphrase "SSID_NAME" SSID_PASSWORD
>> /etc/wpa_supplicant/wpa_supplicant.conf
파일: wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="SSID_NAME"
psk="SSID_PASSWORD"
key_mgmt=WPA-PSK
}91
WiFi 설정
wlan0 랜카드 재시작
$sudo ifdown wlan0
$sudo ifup wlan0
잠시후 ip 할당 확인
$ifconfig wlan0
92
Bluetooth 설정
Raspberry Pi 3
Bluetooth package
bluez 패키지를 설치한다.
$sudo apt install bluez bluez-firmware
bluez 를 설치하면 'pi-bluetooth' 가 설치된다. 혹은 직접 설치;
$sudo apt install pi-bluetooth
'pi-bluetooth'는 BCM43430A1 칩의 펌웨어를 부팅할 때 적재한
다.
bluez 패키지는 블루투스를 다룰 수 있는 명령행이 설치된다.
94
bluetoothctl
$ bluetoothctl
[NEW] Controller B8:27:EB:62:F5:E1 homepi [default]
[bluetooth]# help
Available commands:
list List available controllers
show [ctrl] Controller information
select <ctrl> Select default controller
devices List available devices
paired-devices List paired devices
power <on/off> Set controller power
pairable <on/off> Set controller pairable mode
discoverable <on/off> Set controller discoverable mode
agent <on/off/capability> Enable/disable agent with given capability
default-agent Set agent as the default one
scan <on/off> Scan for devices
info <dev> Device information
pair <dev> Pair with device
trust <dev> Trust device
untrust <dev> Untrust device
block <dev> Block device
unblock <dev> Unblock device
remove <dev> Remove device
connect <dev> Connect device
disconnect <dev> Disconnect device
version Display version
quit Quit program
[bluetooth]#95
bluetoothctl은 단말의
블루투스 장치를 제어할
수 있다.
bluetoothctl
bluetoothctl에서 장치 정보 확인
$ bluetoothctl
[NEW] Controller A8:27:EB:62:D5:E1 homepi [default]
[bluetooth]# show A8:27:EB:62:D5:E1
Controller B8:27:EB:62:F5:E1
Name: homepi
Alias: homepi
Class: 0x000000
Powered: yes
Discoverable: no
Pairable: yes
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d0517
Discovering: no96
bluetoothctl
bluetoothctl에서 장치를 켜고 연결할 수 있다.
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# agent on
Agent registered
[bluetooth]# scan on
Discovery started
[CHG] Controller A8:27:EB:62:D5:E1 Discovering: yes
97
Raspberry Pi 장치 on
scan 가능 on
카메라/휴대폰
paring
System info
cpuinfo
99
/proc 살펴보기
cat /proc/meminfo
cat /proc/iomem
cat /proc/sys/kernel/osrelease
cat /proc/partitions
cat /proc/version
현재 시스템 런타임 커널 파라미터
sysctl --all100
vcgencmd
vcgencmd는 CPU의 클럭 속도, CPU의 전압, 온도와 같은 시스
템 정보를 표시할 수 있는 명령입니다.
- http://elinux.org/RPI_vcgencmd_usage
101
pi@raspberrypi:~$ vcgencmd commands
commands="vcos, ap_output_control, ap_output_post_processing, vchi_test_init, vchi_test_exi
pm_set_policy, pm_get_status, pm_show_stats, pm_start_logging, pm_stop_logging, version, co
set_vll_dir, led_control, set_backlight, set_logging, get_lcd_info, set_bus_arbiter_mode,
cache_flush, otp_dump, codec_enabled, measure_clock, measure_volts, measure_temp, get_confi
hdmi_ntsc_freqs, render_bar, disk_notify, inuse_notify, sus_suspend, sus_status, sus_is_ena
sus_stop_test_thread, egl_platform_switch, mem_validate, mem_oom, mem_reloc_stats, file,
vctest_memmap, vctest_start, vctest_stop, vctest_set, vctest_get"
시스템 클럭 정보
102
시스템 전압과 온도
103
유용한 SysFS 정보
보드 모델
CPU Max frequency
Debian 계열 시스템 정보:
104
$ cat /sys/firmware/devicetree/base/model
Raspberry Pi 3 Model B Rev 1.2
$ cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq
1200000
$ getconf -a
GPIO
GPIO
기본소자
저항연결
GPIO
GPIO Overview
GPIO는 INPUT, OUTPUT 기능을 수행
모든 pin은 Pull-up & down 저항을 내장
모든 pin은 3.3v (5v가 아니다.)
GPIO에 최대 전류는 50mA 정도
107 http://elinux.org/RPi_Low-level_peripherals
RPi Model A
Physical pin : Header pin108 http://pinout.xyz/
RPi Model B
109 http://pinout.xyz/
RPi 2 Model B pin layout
RPi 2
110
기본 소자 연결
전기전자 부품
112
Push Button Digital Input Switch - Closes or
opens circuit
Polarized, needs
resistor
Trim
potentiometer
Analog Input Variable resistor Also called a
Trimpot.
Photoresistor Analog Input Light Dependent
Resistor (LDR)
Resistance varies
with light.
Relay Digital Output Switch driven by
a small signal
Used to control
larger voltages
Temp Sensor Analog Input Temp Dependent
Resistor
Flex Sensor Analog Input Variable resistor
Soft Trimpot Analog Input Variable resistor Careful of shorts
RGB LED Dig & Analog
Output
16,777,216
different colors
Ooh... So pretty.
Name Image Type Function Notes
전기전자 부품
113
전기전자 부품
114
전기전자 부품
115
LED 연결
RPi의 3.3V를 LED에 걸면 ?
116
GPIO port는 약 50mA
출력.
발광다이오드
http://www.devicemart.co.kr/1153316
117
저항의 기능과 용도
전류의 흐름을 제한하는 것으로 전기회로를 순조롭게 동
작하도록 하는 기능을 가지고 있는 것이 저항이며 전기
회로에서 중요한 부품 중 하나이다.
118
발광하지 않는다 전류가 너무 흐른다 이상적인 동작 상태
LED에 흐르는 전류( )가
15[mA]인 경우 저항값
저항의 양단에
걸리는 전압
LED와 저항
5V를 LED에 안전하게 사용하기 위해서는
R = (5 - 2.6) / 0.02 = 150
보유한 220ohm 저항을 활용할 수 있다.
119
구동 저항 계산
http://www.gst-lcd.com/test_led3.htm
sysfs
sysfs
sysfs는 리눅스 커널 2.4에서 /proc 에 복잡하게 사용하던 디바
이스 관련 정보를 커널 2.6 이후에 sysfs로 체계적으로 재 배
치했다.
- 가상 파일시스템으로 /sys 디렉토리에 마운트
- 사용자가 읽기/쓰기/변경 등 권한
- 하드웨어 구성 정보, 디바이스 드라이버 정보가 통합적인 계
층으로 보여주게 하기 위해 kobject라는 구조체 이용.
- 사용자 프로그램이 시스템 버스 드라이버, 플랫폼 드라이버
등의 상위 드라이버와 데이터 교환을 위해 export 용도로 제
공
121 http://egloos.zum.com/moonkh/v/4841757
https://www.kernel.org/doc/Documentation/gpio/sysfs.txt
122
GPIO 드라이버
라즈베리파이의 GPIO는 arch/arm/mach-
bcm2708/bcm2708_gpio.c 소스의 디바이스 드라이버 모델
을 기반으로 플랫폼 드라이버로 작성되어 있다.
사용자는 sysfs를 통해서 GPIO 포트에 접근할 수 있다.
$ cd /sys/class/gpio/
pi@raspberrypi /sys/class/gpio $ ls -l
total 0
-rwxrwx--- 1 root gpio 4096 Jan 1 1970 export
lrwxrwxrwx 1 root gpio 0 Jan 1 1970 gpiochip0 ->
../../devices/platform/soc/3f200000.gpio/gpio/gpiochip0
-rwxrwx--- 1 root gpio 4096 Jan 1 1970 unexport
123
GPIO17 활성화
예를 들어 Pin 17을 활성화 하고자 하면
pi@raspberrypi /sys/class/gpio $ echo "17" > export
pi@raspberrypi /sys/class/gpio $ ls -l
total 0
-rwxrwx--- 1 root gpio 4096 Nov 19 21:41 export
lrwxrwxrwx 1 root gpio 0 Nov 19 21:41 gpio17 ->
../../devices/platform/soc/3f200000.gpio/gpio/gpio11
lrwxrwxrwx 1 root gpio 0 Jan 1 1970 gpiochip0 ->
../../devices/platform/soc/3f200000.gpio/gpio/gpiochip0
-rwxrwx--- 1 root gpio 4096 Jan 1 1970 unexport
124
125 https://www.kernel.org/doc/Documentation/gpio/sysfs.txt
Pin 상태
이제 GPIO 17번 포트에 대해서 활성, 엣지, 값을 파일 시스템을
통해서 접근할 수 있다.
pi@raspberrypi /sys/class/gpio $ cd gpio17/
pi@raspberrypi /sys/class/gpio/gpio17 $ ls -l
total 0
-rw-r--r-- 1 root root 4096 Nov 19 21:42 active_low
lrwxrwxrwx 1 root root 0 Nov 19 21:42 device -> ../../../3f200000.gpio
-rw-r--r-- 1 root root 4096 Nov 19 21:42 direction
-rw-r--r-- 1 root root 4096 Nov 19 21:42 edge
lrwxrwxrwx 1 root root 0 Nov 19 21:41 subsystem ->
../../../../../../class/gpio
-rw-r--r-- 1 root root 4096 Nov 19 21:41 uevent
-rw-r--r-- 1 root root 4096 Nov 19 21:42 value
126
출력
Pin 11번에 HIGH 출력을 하려면 gpio17/direction을 'out'으로
전환한다.
$ echo "out" > /sys/class/gpio/gpio17/direction
-bash: /sys/class/gpio/gpio11/direction: Permission denied
그리고 LED를 on/off 하려면 gpio17/value에 '1', '0' 값을 쓴다.
127
unexport
GPIO를 sysfs에서 사용하지 않게되면 unexport 에 핀 번호를
출력하면 제거된다.
$ echo "11" > unexport
128
sysfs 쉘 코드
sysfs_23.sh
129
# the pin to control
PIN=23
# make this pin available through the SysFS
echo $PIN > /sys/class/gpio/export
# now, set this pin to output
echo out > /sys/class/gpio/gpio${PIN}/direction
# write a value to this pin
echo 1 > /sys/class/gpio/gpio${PIN}/value
# wait for some seconds
sleep 3s
# write a value to this pin
echo 0 > /sys/class/gpio/gpio${PIN}/value
# make this pin unavailable through the SysFS
echo $PIN > /sys/class/gpio/unexport
Fritzing
Fritzing
http://fritzing.org/
131
Fritzing example
132
RaspberryPi
Fritzing Parts
FrizingParts
-http://fritzing.org/parts/
https://github.com/RafaGS/Fritzing
Fritzing User Created Parts
- https://code.google.com/p/fritzing/issues/detail?id=2753
Adafruit / Fritzing library
- https://github.com/adafruit/Fritzing-Library
133
Creat My Own Parts
http://fritzing.org/learning/tutorials/creating-custom-parts/
https://embeddist.wordpress.com/2014/10/24/create-my-
part-on-fritzing/
134

Contenu connexe

Tendances

OSTree: OSイメージとパッケージシステムの間にGitのアプローチを
OSTree: OSイメージとパッケージシステムの間にGitのアプローチをOSTree: OSイメージとパッケージシステムの間にGitのアプローチを
OSTree: OSイメージとパッケージシステムの間にGitのアプローチをi_yudai
 
vAccel: Interoperable Application Hardware Acceleration
vAccel: Interoperable Application Hardware AccelerationvAccel: Interoperable Application Hardware Acceleration
vAccel: Interoperable Application Hardware AccelerationCarlos Reaño González
 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with AnsibleRayed Alrashed
 
OpenStackトラブルシューティング入門
OpenStackトラブルシューティング入門OpenStackトラブルシューティング入門
OpenStackトラブルシューティング入門VirtualTech Japan Inc.
 
Replication in PostgreSQL tutorial given in Postgres Conference 2019
Replication in PostgreSQL tutorial given in Postgres Conference 2019Replication in PostgreSQL tutorial given in Postgres Conference 2019
Replication in PostgreSQL tutorial given in Postgres Conference 2019Abbas Butt
 
YugabyteDBの実行計画を眺める(NewSQL/分散SQLデータベースよろず勉強会 #3 発表資料)
YugabyteDBの実行計画を眺める(NewSQL/分散SQLデータベースよろず勉強会 #3 発表資料)YugabyteDBの実行計画を眺める(NewSQL/分散SQLデータベースよろず勉強会 #3 発表資料)
YugabyteDBの実行計画を眺める(NewSQL/分散SQLデータベースよろず勉強会 #3 発表資料)NTT DATA Technology & Innovation
 
The MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer TraceThe MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer Traceoysteing
 
PostgreSQL on EXT4, XFS, BTRFS and ZFS
PostgreSQL on EXT4, XFS, BTRFS and ZFSPostgreSQL on EXT4, XFS, BTRFS and ZFS
PostgreSQL on EXT4, XFS, BTRFS and ZFSTomas Vondra
 
Linux Char Device Driver
Linux Char Device DriverLinux Char Device Driver
Linux Char Device DriverGary Yeh
 
OpenStackで始めるクラウド環境構築入門(Horizon 基礎編)
OpenStackで始めるクラウド環境構築入門(Horizon 基礎編)OpenStackで始めるクラウド環境構築入門(Horizon 基礎編)
OpenStackで始めるクラウド環境構築入門(Horizon 基礎編)VirtualTech Japan Inc.
 
Summary of linux kernel security protections
Summary of linux kernel security protectionsSummary of linux kernel security protections
Summary of linux kernel security protectionsShubham Dubey
 
[오픈소스컨설팅] Docker를 활용한 Gitlab CI/CD 구성 테스트
[오픈소스컨설팅] Docker를 활용한 Gitlab CI/CD 구성 테스트[오픈소스컨설팅] Docker를 활용한 Gitlab CI/CD 구성 테스트
[오픈소스컨설팅] Docker를 활용한 Gitlab CI/CD 구성 테스트Ji-Woong Choi
 
[KubeConUS2019 Docker, Inc. Booth] Distributed Builds on Kubernetes with Bui...
 [KubeConUS2019 Docker, Inc. Booth] Distributed Builds on Kubernetes with Bui... [KubeConUS2019 Docker, Inc. Booth] Distributed Builds on Kubernetes with Bui...
[KubeConUS2019 Docker, Inc. Booth] Distributed Builds on Kubernetes with Bui...Akihiro Suda
 
java.lang.OutOfMemoryError #渋谷java
java.lang.OutOfMemoryError #渋谷javajava.lang.OutOfMemoryError #渋谷java
java.lang.OutOfMemoryError #渋谷javaYuji Kubota
 
Container Storage Best Practices in 2017
Container Storage Best Practices in 2017Container Storage Best Practices in 2017
Container Storage Best Practices in 2017Keith Resar
 
Capturing NIC and Kernel TX and RX Timestamps for Packets in Go
Capturing NIC and Kernel TX and RX Timestamps for Packets in GoCapturing NIC and Kernel TX and RX Timestamps for Packets in Go
Capturing NIC and Kernel TX and RX Timestamps for Packets in GoScyllaDB
 

Tendances (20)

OSTree: OSイメージとパッケージシステムの間にGitのアプローチを
OSTree: OSイメージとパッケージシステムの間にGitのアプローチをOSTree: OSイメージとパッケージシステムの間にGitのアプローチを
OSTree: OSイメージとパッケージシステムの間にGitのアプローチを
 
vAccel: Interoperable Application Hardware Acceleration
vAccel: Interoperable Application Hardware AccelerationvAccel: Interoperable Application Hardware Acceleration
vAccel: Interoperable Application Hardware Acceleration
 
TO Hack an ASP .NET website?
TO Hack an ASP .NET website?  TO Hack an ASP .NET website?
TO Hack an ASP .NET website?
 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with Ansible
 
OpenStackトラブルシューティング入門
OpenStackトラブルシューティング入門OpenStackトラブルシューティング入門
OpenStackトラブルシューティング入門
 
Replication in PostgreSQL tutorial given in Postgres Conference 2019
Replication in PostgreSQL tutorial given in Postgres Conference 2019Replication in PostgreSQL tutorial given in Postgres Conference 2019
Replication in PostgreSQL tutorial given in Postgres Conference 2019
 
ssh-agentのすすめ
ssh-agentのすすめssh-agentのすすめ
ssh-agentのすすめ
 
YugabyteDBの実行計画を眺める(NewSQL/分散SQLデータベースよろず勉強会 #3 発表資料)
YugabyteDBの実行計画を眺める(NewSQL/分散SQLデータベースよろず勉強会 #3 発表資料)YugabyteDBの実行計画を眺める(NewSQL/分散SQLデータベースよろず勉強会 #3 発表資料)
YugabyteDBの実行計画を眺める(NewSQL/分散SQLデータベースよろず勉強会 #3 発表資料)
 
The MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer TraceThe MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer Trace
 
PostgreSQL on EXT4, XFS, BTRFS and ZFS
PostgreSQL on EXT4, XFS, BTRFS and ZFSPostgreSQL on EXT4, XFS, BTRFS and ZFS
PostgreSQL on EXT4, XFS, BTRFS and ZFS
 
Linux Char Device Driver
Linux Char Device DriverLinux Char Device Driver
Linux Char Device Driver
 
OpenStackで始めるクラウド環境構築入門(Horizon 基礎編)
OpenStackで始めるクラウド環境構築入門(Horizon 基礎編)OpenStackで始めるクラウド環境構築入門(Horizon 基礎編)
OpenStackで始めるクラウド環境構築入門(Horizon 基礎編)
 
New VIdeo CODEC AV1
New VIdeo CODEC AV1 New VIdeo CODEC AV1
New VIdeo CODEC AV1
 
Summary of linux kernel security protections
Summary of linux kernel security protectionsSummary of linux kernel security protections
Summary of linux kernel security protections
 
[오픈소스컨설팅] Docker를 활용한 Gitlab CI/CD 구성 테스트
[오픈소스컨설팅] Docker를 활용한 Gitlab CI/CD 구성 테스트[오픈소스컨설팅] Docker를 활용한 Gitlab CI/CD 구성 테스트
[오픈소스컨설팅] Docker를 활용한 Gitlab CI/CD 구성 테스트
 
[KubeConUS2019 Docker, Inc. Booth] Distributed Builds on Kubernetes with Bui...
 [KubeConUS2019 Docker, Inc. Booth] Distributed Builds on Kubernetes with Bui... [KubeConUS2019 Docker, Inc. Booth] Distributed Builds on Kubernetes with Bui...
[KubeConUS2019 Docker, Inc. Booth] Distributed Builds on Kubernetes with Bui...
 
java.lang.OutOfMemoryError #渋谷java
java.lang.OutOfMemoryError #渋谷javajava.lang.OutOfMemoryError #渋谷java
java.lang.OutOfMemoryError #渋谷java
 
Container Storage Best Practices in 2017
Container Storage Best Practices in 2017Container Storage Best Practices in 2017
Container Storage Best Practices in 2017
 
Capturing NIC and Kernel TX and RX Timestamps for Packets in Go
Capturing NIC and Kernel TX and RX Timestamps for Packets in GoCapturing NIC and Kernel TX and RX Timestamps for Packets in Go
Capturing NIC and Kernel TX and RX Timestamps for Packets in Go
 
Interrupts on xv6
Interrupts on xv6Interrupts on xv6
Interrupts on xv6
 

Similaire à Raspberry Pi Basic Usage

소프트박스 라즈베리파이 교육키트 개발환경 설정
소프트박스 라즈베리파이 교육키트 개발환경 설정소프트박스 라즈베리파이 교육키트 개발환경 설정
소프트박스 라즈베리파이 교육키트 개발환경 설정봉조 김
 
04강 라즈베리-개발환경구축-실습
04강 라즈베리-개발환경구축-실습04강 라즈베리-개발환경구축-실습
04강 라즈베리-개발환경구축-실습봉조 김
 
caanoo Ernice
caanoo Ernicecaanoo Ernice
caanoo Ernicejumiss
 
Raspberry pi
Raspberry piRaspberry pi
Raspberry piDooNa Lee
 
시스템 관리자를 위한 리눅스강의 1강 20130203
시스템 관리자를 위한 리눅스강의 1강 20130203시스템 관리자를 위한 리눅스강의 1강 20130203
시스템 관리자를 위한 리눅스강의 1강 20130203doo rip choi
 
라즈베리파이 설치하기 두번째
라즈베리파이 설치하기 두번째라즈베리파이 설치하기 두번째
라즈베리파이 설치하기 두번째Yongho HWANG
 
20141029 하둡2.5와 hive설치 및 예제
20141029 하둡2.5와 hive설치 및 예제20141029 하둡2.5와 hive설치 및 예제
20141029 하둡2.5와 hive설치 및 예제Tae Young Lee
 
리얼리눅스 제 1 회 세미나: "리눅스, 제대로 알고 코딩하자!"
리얼리눅스 제 1 회 세미나: "리눅스, 제대로 알고 코딩하자!"리얼리눅스 제 1 회 세미나: "리눅스, 제대로 알고 코딩하자!"
리얼리눅스 제 1 회 세미나: "리눅스, 제대로 알고 코딩하자!"리얼리눅스
 
[IoT] MAKE with Open H/W + Node.JS - 1st
[IoT] MAKE with Open H/W + Node.JS - 1st[IoT] MAKE with Open H/W + Node.JS - 1st
[IoT] MAKE with Open H/W + Node.JS - 1stPark Jonggun
 
2015.03.14 Piday in Korea 지앤선 라즈베리 미트업(박종건)
2015.03.14 Piday in Korea 지앤선 라즈베리 미트업(박종건)2015.03.14 Piday in Korea 지앤선 라즈베리 미트업(박종건)
2015.03.14 Piday in Korea 지앤선 라즈베리 미트업(박종건)JiandSon
 
IoT with Raspberry Pi + Node JS - Chapter 1
IoT with Raspberry Pi + Node JS - Chapter 1IoT with Raspberry Pi + Node JS - Chapter 1
IoT with Raspberry Pi + Node JS - Chapter 1Park Jonggun
 
이호민 - 우분투 환경에서의 임베디드 개발환경 구축 및 어플리케이션 개발 (2010Y06M24D)
이호민 - 우분투 환경에서의 임베디드 개발환경 구축 및 어플리케이션 개발 (2010Y06M24D)이호민 - 우분투 환경에서의 임베디드 개발환경 구축 및 어플리케이션 개발 (2010Y06M24D)
이호민 - 우분투 환경에서의 임베디드 개발환경 구축 및 어플리케이션 개발 (2010Y06M24D)Ubuntu Korea Community
 
오픈스택: 구석구석 파헤쳐보기
오픈스택: 구석구석 파헤쳐보기오픈스택: 구석구석 파헤쳐보기
오픈스택: 구석구석 파헤쳐보기Jaehwa Park
 
안드로이드 플랫폼 설명
안드로이드 플랫폼 설명안드로이드 플랫폼 설명
안드로이드 플랫폼 설명Peter YoungSik Yun
 
초보 개발자/학생들을 위한 오픈소스 트랜드
초보 개발자/학생들을 위한 오픈소스 트랜드 초보 개발자/학생들을 위한 오픈소스 트랜드
초보 개발자/학생들을 위한 오픈소스 트랜드 YoungSu Son
 
망고100 보드로 놀아보자 13
망고100 보드로 놀아보자  13망고100 보드로 놀아보자  13
망고100 보드로 놀아보자 13종인 전
 
Raspberry-PI GPIO with Python
Raspberry-PI GPIO with PythonRaspberry-PI GPIO with Python
Raspberry-PI GPIO with Pythonsewoo lee
 
cross compile
cross compilecross compile
cross compilehe4722
 
NDC14 모바일 게임서비스를 위한 사설 클라우드 구축/운영 분투기
NDC14 모바일 게임서비스를 위한 사설 클라우드 구축/운영 분투기NDC14 모바일 게임서비스를 위한 사설 클라우드 구축/운영 분투기
NDC14 모바일 게임서비스를 위한 사설 클라우드 구축/운영 분투기Jinuk Kim
 

Similaire à Raspberry Pi Basic Usage (20)

소프트박스 라즈베리파이 교육키트 개발환경 설정
소프트박스 라즈베리파이 교육키트 개발환경 설정소프트박스 라즈베리파이 교육키트 개발환경 설정
소프트박스 라즈베리파이 교육키트 개발환경 설정
 
04강 라즈베리-개발환경구축-실습
04강 라즈베리-개발환경구축-실습04강 라즈베리-개발환경구축-실습
04강 라즈베리-개발환경구축-실습
 
caanoo Ernice
caanoo Ernicecaanoo Ernice
caanoo Ernice
 
Raspberry pi
Raspberry piRaspberry pi
Raspberry pi
 
시스템 관리자를 위한 리눅스강의 1강 20130203
시스템 관리자를 위한 리눅스강의 1강 20130203시스템 관리자를 위한 리눅스강의 1강 20130203
시스템 관리자를 위한 리눅스강의 1강 20130203
 
라즈베리파이 설치하기 두번째
라즈베리파이 설치하기 두번째라즈베리파이 설치하기 두번째
라즈베리파이 설치하기 두번째
 
20141029 하둡2.5와 hive설치 및 예제
20141029 하둡2.5와 hive설치 및 예제20141029 하둡2.5와 hive설치 및 예제
20141029 하둡2.5와 hive설치 및 예제
 
리얼리눅스 제 1 회 세미나: "리눅스, 제대로 알고 코딩하자!"
리얼리눅스 제 1 회 세미나: "리눅스, 제대로 알고 코딩하자!"리얼리눅스 제 1 회 세미나: "리눅스, 제대로 알고 코딩하자!"
리얼리눅스 제 1 회 세미나: "리눅스, 제대로 알고 코딩하자!"
 
[IoT] MAKE with Open H/W + Node.JS - 1st
[IoT] MAKE with Open H/W + Node.JS - 1st[IoT] MAKE with Open H/W + Node.JS - 1st
[IoT] MAKE with Open H/W + Node.JS - 1st
 
2015.03.14 Piday in Korea 지앤선 라즈베리 미트업(박종건)
2015.03.14 Piday in Korea 지앤선 라즈베리 미트업(박종건)2015.03.14 Piday in Korea 지앤선 라즈베리 미트업(박종건)
2015.03.14 Piday in Korea 지앤선 라즈베리 미트업(박종건)
 
PI day in COREA
PI day in COREAPI day in COREA
PI day in COREA
 
IoT with Raspberry Pi + Node JS - Chapter 1
IoT with Raspberry Pi + Node JS - Chapter 1IoT with Raspberry Pi + Node JS - Chapter 1
IoT with Raspberry Pi + Node JS - Chapter 1
 
이호민 - 우분투 환경에서의 임베디드 개발환경 구축 및 어플리케이션 개발 (2010Y06M24D)
이호민 - 우분투 환경에서의 임베디드 개발환경 구축 및 어플리케이션 개발 (2010Y06M24D)이호민 - 우분투 환경에서의 임베디드 개발환경 구축 및 어플리케이션 개발 (2010Y06M24D)
이호민 - 우분투 환경에서의 임베디드 개발환경 구축 및 어플리케이션 개발 (2010Y06M24D)
 
오픈스택: 구석구석 파헤쳐보기
오픈스택: 구석구석 파헤쳐보기오픈스택: 구석구석 파헤쳐보기
오픈스택: 구석구석 파헤쳐보기
 
안드로이드 플랫폼 설명
안드로이드 플랫폼 설명안드로이드 플랫폼 설명
안드로이드 플랫폼 설명
 
초보 개발자/학생들을 위한 오픈소스 트랜드
초보 개발자/학생들을 위한 오픈소스 트랜드 초보 개발자/학생들을 위한 오픈소스 트랜드
초보 개발자/학생들을 위한 오픈소스 트랜드
 
망고100 보드로 놀아보자 13
망고100 보드로 놀아보자  13망고100 보드로 놀아보자  13
망고100 보드로 놀아보자 13
 
Raspberry-PI GPIO with Python
Raspberry-PI GPIO with PythonRaspberry-PI GPIO with Python
Raspberry-PI GPIO with Python
 
cross compile
cross compilecross compile
cross compile
 
NDC14 모바일 게임서비스를 위한 사설 클라우드 구축/운영 분투기
NDC14 모바일 게임서비스를 위한 사설 클라우드 구축/운영 분투기NDC14 모바일 게임서비스를 위한 사설 클라우드 구축/운영 분투기
NDC14 모바일 게임서비스를 위한 사설 클라우드 구축/운영 분투기
 

Plus de 고포릿 default

신경망 첫걸음 - 한빛미디어 요약
신경망 첫걸음 - 한빛미디어 요약신경망 첫걸음 - 한빛미디어 요약
신경망 첫걸음 - 한빛미디어 요약고포릿 default
 
비트교육센터-AWS활용 1주차: ssh authorized_keys
비트교육센터-AWS활용 1주차: ssh authorized_keys비트교육센터-AWS활용 1주차: ssh authorized_keys
비트교육센터-AWS활용 1주차: ssh authorized_keys고포릿 default
 
비트교육센터-AWS활용 1주차: EC2, S3, Elastic Beanstalks 사용
비트교육센터-AWS활용 1주차: EC2, S3, Elastic Beanstalks 사용비트교육센터-AWS활용 1주차: EC2, S3, Elastic Beanstalks 사용
비트교육센터-AWS활용 1주차: EC2, S3, Elastic Beanstalks 사용고포릿 default
 
Raspberry Pi GPIO Programming with Python
Raspberry Pi GPIO Programming with PythonRaspberry Pi GPIO Programming with Python
Raspberry Pi GPIO Programming with Python고포릿 default
 
BigData, Hadoop과 Node.js, R2
BigData, Hadoop과 Node.js, R2BigData, Hadoop과 Node.js, R2
BigData, Hadoop과 Node.js, R2고포릿 default
 
앱 클라우드 서비스 개발
앱 클라우드 서비스 개발앱 클라우드 서비스 개발
앱 클라우드 서비스 개발고포릿 default
 
안드로이드에서 Baasio 서비스 이용하기
안드로이드에서 Baasio 서비스 이용하기 안드로이드에서 Baasio 서비스 이용하기
안드로이드에서 Baasio 서비스 이용하기 고포릿 default
 

Plus de 고포릿 default (8)

신경망 첫걸음 - 한빛미디어 요약
신경망 첫걸음 - 한빛미디어 요약신경망 첫걸음 - 한빛미디어 요약
신경망 첫걸음 - 한빛미디어 요약
 
비트교육센터-AWS활용 1주차: ssh authorized_keys
비트교육센터-AWS활용 1주차: ssh authorized_keys비트교육센터-AWS활용 1주차: ssh authorized_keys
비트교육센터-AWS활용 1주차: ssh authorized_keys
 
비트교육센터-AWS활용 1주차: EC2, S3, Elastic Beanstalks 사용
비트교육센터-AWS활용 1주차: EC2, S3, Elastic Beanstalks 사용비트교육센터-AWS활용 1주차: EC2, S3, Elastic Beanstalks 사용
비트교육센터-AWS활용 1주차: EC2, S3, Elastic Beanstalks 사용
 
Raspberry Pi GPIO Programming with Python
Raspberry Pi GPIO Programming with PythonRaspberry Pi GPIO Programming with Python
Raspberry Pi GPIO Programming with Python
 
BigData, Hadoop과 Node.js, R2
BigData, Hadoop과 Node.js, R2BigData, Hadoop과 Node.js, R2
BigData, Hadoop과 Node.js, R2
 
BigData, Hadoop과 Node.js
BigData, Hadoop과 Node.jsBigData, Hadoop과 Node.js
BigData, Hadoop과 Node.js
 
앱 클라우드 서비스 개발
앱 클라우드 서비스 개발앱 클라우드 서비스 개발
앱 클라우드 서비스 개발
 
안드로이드에서 Baasio 서비스 이용하기
안드로이드에서 Baasio 서비스 이용하기 안드로이드에서 Baasio 서비스 이용하기
안드로이드에서 Baasio 서비스 이용하기
 

Raspberry Pi Basic Usage

  • 1. • Start Raspberry Pi • VERSION 1.6.2 • Release Date : 2017.3 OSHW ARM: Raspberry Pi 고 강 태 james@thinkbee.kr https://www.linkedin.com/in/thinkbeekr/
  • 2. 참조 ARM으로 배우는 임베디드 리눅스 시스템 임베디드 리눅스 기초와 응용 https://www.raspberrypi.org 2
  • 3. OSHW Raspberry Pi 오픈소스 하드웨어 임베디드 시스템 Raspberry Pi Raspbian 설치
  • 5. Opensource HW http://www.oshwa.org/definition/korean/ 오픈 소스 하드웨어는 누구나 이 디자인이나 이 디자인에 근거 한 하드웨어를 배우고, 수정하고, 배포하고, 제조하고 팔 수 있는 그 디자인이 공개된 하드웨어이다. 5 오픈소스HW http://linuxgizmos.com/tiny-raspberry-pi-compatible-sbc-targets-wearables/
  • 6. 대표적 하드웨어 종류 Arduino - 2005, AVR microcontroller - code driven Raspberry Pi - 2011, 교육용 single-board computer - os driven6 오픈소스HW
  • 7. Opensource H/W communities 7 오픈하드웨어와 사물인터넷, 2014, Digieco
  • 8. Arduino vs Raspberry Pi 8 오픈소스HW http://readwrite.com/2014/05/07/arduino-vs-raspberry-pi-projects-diy-platform
  • 11. Clones:Odroid-W RaspberryPi-B+ 기반으로 Wearable을 목표로한 플랫폼. 11 오픈소스HW http://linuxgizmos.com/tiny-raspberry-pi-compatible-sbc-targets-wearables/
  • 14. RAPIRO 프로그램할 수 있는 DIY Robot 14 오픈소스HW http://www.rapiro.com
  • 18. ARM core Cloud server https://www.scaleway.com ARM core로 제공하는 VPS 서버 $3.4/month 4core, 2GB ram, 50GB space 제공 1개 랙에 912개 장착 18 32EA 912EA
  • 20. Raspberry Pi Model A 21 USB Ports Ethernet GPIO 3.5mm Audio & Composite Output Jack HDMI Out5V Micro USB Power CSI Camera connector SMSC LAN9514 USB Ethernet controller DSI Display connector MicroSD Card slot (밑면) Less power consumption Power Regulator Pi reset Run Header Broadcom BCM2835 RaspberryPi
  • 21. Raspberry Pi 2 Model B v1.1 22 4 USB Ports Ethernet GPIO 3.5mm Audio & Composite Output JackHDMI Out5V Micro USB Power CSI Camera connector SMSC LAN9514 USB Ethernet controller DSI Display connector (밑면) MicroSD Card Slot Less power consumption Power Regulator Pi reset Run Header Broadcom BCM2836 RaspberryPi 참조 http://elinux.org/RPi_Hardware
  • 22. Raspberry Pi 2 Model B v1.2 23 Serial In (Rx) 4 USB Ports Ethernet GPIO 3.5mm Audio & Composite Output JackHDMI Out5V Micro USB Power CSI Camera connector SMSC LAN9514 USB Ethernet controller DSI Display connector (밑면) MicroSD Slot Less power consumption Power Regulator Pi reset Run Header Broadcom BCM2837
  • 23. Raspberry Pi 3 Model B 24 Serial In (Rx) 4 USB Ports Ethernet GPIO 3.5mm Audio & Composite Output Jack HDMI Out5V Micro USB Power up to 2.5A CSI Camera connector SMSC LAN9514 USB Ethernet controller DSI Display connector MicroSD Card slot (밑면) Less power consumption Power Regulator On board BT 4.1, WiFi Chip Antenna Broadcom BCM2837 64bit Quad core CPU at 1.2Ghz
  • 24. Raspberry Pi Zero 25 GPIO Micro USBMini-HDMI 1080p Video & Audio Output 5V Micro USB Power CSI Camera connector Micro SDCard Pi reset Run Header Broadcom BCM2835 SoC Dual core 1Ghz VideoCore IV GPU 512MB Onboard RAM RCA Composite Video Output 65 x 30 x 5 mm
  • 25. Raspberry Pi Table 26 항목 Pi 1 Model B+ Pi 2 Model B Pi Zero Pi 3 Model B Pi 2 v1.2 SoC SoC BCM 8235 SoC BCM 8236 SoC BCM 8335 SoC BCM 2837 SoC BCM 2837 CPU ARM11 @700Mhz Quad Coretex A7 @900Mhz ARM11 @1Ghz Quad Coretex A53 @1.2Ghz Quad Coretex A53 @900Mhz IS Set ARMv6 ARMv7-A ARMv6 ARMv8-A ARMv8-A GPU 250Mhz VideoCore IV 250Mhz VideoCore IV 250Mhz VideoCore IV 400Mhz VideoCore IV 250Mhz VideoCore IV Memory 512MB Ram 1GB Ram 512MB Ram 1GB Ram 1GB Ram Network 10/100 10/100 N/A 10/100, WiFi, BL 4.1 10/100 USB 2 x USB2.0 4 x USB2.0 1 Micro USB 4 x USB2.0 4 x USB 2.0 GPIO 40 40 40 40 40 Video 640×350 to 1920×1200, 1080p, PAL & NTSC 640×350 to 1920×1200, 1080p, PAL & NTSC 640×350 to 1920×1200, 1080p, PAL & NTSC 640×350 to 1920×1200, 1080p, PAL & NTSC 640×350 to 1920×1200, 1080p, PAL & NTSC
  • 26. Raspberry Pi ARM core Raspberry Pi 2는 Broadcom BCM2836 칩셋을 사용. - ARMv7 Cortex-A7 - https://goo.gl/nLAhZH - BCM2836은 대부분 BCM2835와 동일 - https://goo.gl/IqF2TW - BCM2835 ARM Peripherals reference - https://goo.gl/Zh9SeO - 32bit 구성의 레지스터를 제공하고 있다. Raspberry Pi 3는 Broadcom BCM2837 - ARMv8 Cortex-A53 Raspberry Pi 2 v1.2는 Broadcom BCM2837 - ARMv8 Cortex-A53 27
  • 27. 소비전력 USB 2.0 표준 허브는 포트당 5V에 500mA 제공 USB 3 표준 허브는 포트당 5 V에 900 mA 제공 28 Product Recommended PSU current capacity Maximum total USB peripheral current draw Typical bare- board active current consumption Raspberry Pi Model A 700mA 500mA 200mA Raspberry Pi Model B 1.2A 500mA 500mA Raspberry Pi Model A+ 700mA 500mA 180mA Raspberry Pi Model B+ 1.8A 600mA/1.2A (switchable) 330mA Raspberry Pi 2 Model B 1.8A 600mA/1.2A (switchable) Raspberry Pi 3 Model B 800mA~2.5A 1.2A ~400mA https://www.raspberrypi.org/help/faqs/
  • 30. 주요 공개 노트 2017-03-02: * NOOBS installs now checks for presence of 'ssh' file on the NOOBS partition 2017-01-11: * Re-release of the 2016-11-25 image with a FAT32-formatted boot partition 2016-11-25: * SSH disabled by default; can be enabled by creating a file with name "ssh" in boot partition 2016-09-23: * New PIXEL desktop environment * RealVNC server and viewer included 31 http://downloads.raspberrypi.org/raspbian/release_notes.txt
  • 31. Writing OS Image Format SDCard -SD Association 제공 sdFormater Writing image - Etcher, Win32DiskImager - dd command 32 jessie-raspbian Ubuntu OSMC NOOB RaspberryPi SDHC Class 6 이상
  • 37. ssh 활성화 2016-11-25-raspbian-jessie는 ssh 비활성화 - http://downloads.raspberrypi.org/raspbian/release_notes.txt ssh는 /boot 밑에 빈 ssh 파일 추가하면 활성화 Linux/Mac: $ touch ssh Window type NUL > ssh 38 ssh 통해 원격 접 속해서 설정을 계 속한다.
  • 38. Expand Filesystem 부팅후 자동으로 disk resize 된다. 39 pi@raspberrypi:~ $ df -h Filesystem Size Used Avail Use% Mounted on /dev/root 3.6G 3.3G 114M 97% / devtmpfs 459M 0 459M 0% /dev tmpfs 463M 0 463M 0% /dev/shm pi@raspberrypi:~ $ df -h Filesystem Size Used Avail Use% Mounted on /dev/root 15G 3.3G 11G 24% / devtmpfs 459M 0 459M 0% /dev tmpfs 463M 0 463M 0% /dev/shm tmpfs 463M 6.2M 457M 2% /run Expand Filesystem 실 행 후 최신 raspbian은 처음 부팅시 자동으 로 확장
  • 39. Raspberry Pi Updates 1. Wheezy 배포본 최신 상태로 Upgrade - apt-get 유틸리티 이용 - 가까운 미러사이트 이용 2. Raspberry Pi Firmware Upgrade - 펌웨어를 최신 버전으로 유지 40
  • 40. Raspbian Update 미러사이트를 가까운 곳으로 설정 apt-get을 이용 배포본을 최신 상태로 유지 41 pi@raspberrypi ~ $ sudo vi /etc/apt/sources.list #deb http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi deb http://ftp.neowiz.com/raspbian/raspbian wheezy main contrib non-free rpi deb http://ftp.kaist.ac.kr/raspbian/raspbian/ wheezy main contrib non-free rpi
  • 41. Raspberry Pi 원격지 환경 원격 개발환경 USB serial이용 접속 dhcp 원격접속 설정 raspi-config 무선랜 설정
  • 44. Windows SSH client 전통적인 putty http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html MobaXterm http://mobaxterm.mobatek.net 46
  • 45. ssh client Raspbian 기본 계정 user id: pi user pw: raspberry 47
  • 46. command line ssh 대상 서버에 로그인 ssh [USERID@]HOST_NAME $ssh pi@192.168.1.1 서버 포트 변경 ssh [USERID@]HOST_NAME -pPORT $ssh pi@192.168.1.1 -p1022 48
  • 48. ssh auto login ssh 자동 로그인 1)ssh용 개인용-공개용 key 생성 $ ssh-keygen -t rsa -C "Pi user" 2) 원격 서버에 키 복사 $ scp .ssh/id_rsa.pub userid@111.111.111.11:~/.ssh/userid_rsa.pub 원격 서버에 로그인 $ ssh userid@111.111.111.11 복사한 공개키를 authorized_keys에 복사 (111.111.111.11)$ cat .ssh/userid_rsa.pub >> .ssh/authorized_keys (111.111.111.11)$ exit 서버에 로그인 $ ssh -i ~/.ssh/id_rsa myuser@111.111.111.11 50
  • 49. scp 이용 대상 서버에 복사 scp FILE USERID@HOST_NAME:PATH $scp test.txt pi@192.168.1.1:/home/pi/ 서버에서 복사해 오기 scp USERID@HOST_NAME:PATH FILEPATH $scp pi@192.168.1.1:/home/pi/test.txt ~/temp scp 포트 변경 scp -P PORT USERID@HOST_NAME:PATH FILEPATH 폴더 단위 복사 scp -r USERID@HOST_NAME:FOLDER_PATH FOLDER_PATH $scp -r pi@192.168.1.1:/home/pi/folder ~/temp/ 51
  • 50. X forward ssh 를 이용해 원격 X server를 사용해 GUI 실행 52 Server RaspberryPi X11 Tunnel X11 forwarding over ssh connection http://bahndal.egloos.com/534415 http://talkingaboutme.tistory.com/409
  • 51. sshfs ssh 기반의 remote filesystem 53 RaspberryPi
  • 52. sshfs 설치 원격 호스트에 sshfs 설치 - Raspberry Pi / Linux sshfs 설치 $sudo apt-get install sshfs 54
  • 53. sshfs usage sshfs 옵션은 다음 같다: sshfs -pXXXX -o [options] user@remotehost:/path /local/path/ Useful options: -pXXXXX – tells sshfs to use port number XXXXX. -o Ciphers=arcfour – speeds up for the connection. -o ro – read only. -o nonempty – allow nonempty mount point. -o cache_timeout=N – set default cache timeout (in seconds) -o cache=no – disable cache. -o intr – allows to interrupt file access. -o reconnect – automatically reconnect -o idmap=user – helps with file ownership conflicts 55
  • 54. sshfs 이용 마운트 개발 호스트 컴퓨터에서 다음 같이 원격 볼륨을 마운트 한다. $sudo sshfs USER_ID@xxx.xxx.xxx.xxx:/ /Volume/remote 예) $ sshfs user@host:/example ~/example - oauto_cache,reconnect,defer_permissions,negative_vncache,noappledouble,volna me=Example 사용후 언마운트는 다음과 같다. $sudo umount /Volume/remote 56
  • 57. Serial console USB to TTL Serial 케이블을 Raspberry Pi의 UART의 Rx, Tx 를 크로스 연결한다. 59
  • 58. UART와 USB to TTL Raspberry Pi의 UART는 TTL 수준의 Serial signal - 보통 USB to serial cable은 Serial signal을 TTL로 제공. - 보통 터미널 프로그램 사용해 시리얼 콘솔로 이용 60
  • 60. PL2303HX Windows Driver - Prolific: https://goo.gl/p5EDh - Adafurits: https://www.adafruit.com/product/954 Mac OS Driver - Prolific: https://goo.gl/nw5zgk - Adafurits: https://www.adafruit.com/product/954 62 https://www.adafruit.com/product/954 Adafurit가 공개한 - PL2303TA USB TTL to RS232 Converter - Black : GND - Green : TXD - White : RXD - Red : VCC
  • 61. Serial port 장치관리자에서 USB to ttl 포트를 확인 63
  • 62. 시리얼 터미널 연결 터미널 프로그램 : putty, MobaXterm, Hyperterminal... 64
  • 63. Mac serial terminal Mac OS X에서 screen 시리얼 터미널 프로그램 $ screen <디바이스 이름> <전송속도> 예) $ screen /dev/tty.usbserial-XXXXXXXX 115200 시리얼 터미널에서 빠져나오려면 'ctrl-a, ctrl-'를 순서데로 입력 혹은 외부 터미널에서 'pkill SCREEN' 혹은 -R 옵션을 주고 다시 연다 $ screen -R /dev/tty.usbserial-XXXXXXXX 115200 65
  • 64. Static IP Address ifconfig 명령으로 IP 확인 Static IP 입력: /etc/network/interfaces 67 $ sudo vi /etc/network/interfaces auto lo iface lo inet loopback # auto eth0 # iface eth0 inet dhcp # manual auto eth0 iface eth0 inet static address 192.168.0.204 netmask 255.255.255.0 netwrok 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.1 dns-nameservers 8.8.8.8 8.8.4.4 ```
  • 65. Serial console Raspberry Pi는 Jessie 까지 기본적으로 UART 핀을 Host machine의 Serial로 연결해서 Console로 사용할 수 있다. - 라즈비안의 UART 는 기본으로 Serial console로 지정되어 있 다. 만약 serial communication으로 사용하려면 raspi-config로 해제 한다. 68
  • 67. 부팅시 static ip 설정 라즈베리 파이의 boot process 단계 설정 파일을 이용 1. 보드에 전원이 들어오고 GPU가 활성화된다. 2. SoC 내 ROM에 있는 첫번째 부트로더(Firmware)를 읽어 들인다. 3. 첫번째 부트로더가 SD카드에 있는 두번째 부트로더 (bootcode.bin)을 호출한다. 4. 두번째 부트로더가 SD카드에 있는 config.txt를 읽고 실행 한다. 4. 두번째 부트로더가 세번째 부트로더(start.elf)를 호출 및 실행하여, ARM Core를 활성화한다. 6. ARM Core가 활성화되면 네번째 부트로더(kernel.img)를 70
  • 69. 라즈베리파이에 접속 개발머신에서 ssh로 라즈베리파이에 로그인 로그인 후 raspi-config 명령을 실행해야 한다. 72
  • 70. Static IP Address /etc/network/interfaces 73 $ sudo vi /etc/network/interfaces auto lo iface lo inet loopback # auto eth0 # iface eth0 inet dhcp # manual auto eth0 iface eth0 inet static address 192.168.0.204 netmask 255.255.255.0 netwrok 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.1 dns-nameservers 8.8.8.8 8.8.4.4 ```
  • 72. DHCP IP 이용 ssh 접속 75 내부 DHCP 공유기 접근 가능 OS 이미지 굽기 (sd card) 관리 페이지에서 mac address ip 확인후 ssh 접속 nmap 과 arp 유틸리티로 ip 확인 접근 불가능 ID: pi PW: raspberry
  • 73. 공유기 사용시; DHCP 할당 확인 76 오늘은 무선랜을 사용해서 접속해 보겠습니다.
  • 74. Windows용 nmap 네트워크 안의 호스트를 고속으로 검색하는 도구 - Windows nmap: nmap.org/download.html - Microsoft Visual C++ 2013 Redistributable Package - WinCap Library: wincap.org 77
  • 75. nmap 사용 nmap으로 subnet의 호스트를 검색한다. > nmap -sP 192.168.0.0/24 78
  • 76. ssh pi@192.168.0.20 nmap, arp 등으로 IP 검색후 ssh 로그인. $ ssh pi@192.168.11.100 The authenticity of host '192.168.11.100 (192.168.11.100)' can't be established. ECDSA key fingerprint is SHA256:G8MGJDNGJeYqF123aYlKj4MMQF9aevRhF/aO2ldWo6E. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.11.100' (ECDSA) to the list of known hosts. pi@192.168.11.100's password: The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Fri Mar 3 16:24:26 2017 SSH is enabled and the default password for the 'pi' user has not been changed. This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.79
  • 78. raspi-config raspi-config는 라즈비안 시스템을 설정하는 유틸리티입니다. $sudo raspi-config 다음 1번은 꼭 실행해 주어야 SD카드 용량을 모두 사용합니다. 1. Expand Filesystem 사용을 허용합니다. 라즈베리파이는 SD card 를 4GB까지만 인식하도록 설정되어 있습니다. 그래서 8GB이상의 SD Card를 사용중이라면 (대부분...) Exapnd Filesystem 설정을 해야 합니다. 2. ssh 접속을 허용하기 위해서 Advanced Options -> SSH enable 을 실행합니다. 81 http://www.raspberrypi.org/documentation/configuration/raspi-config.md
  • 81. VNC
  • 82. VNC server Raspbian 2016-11-25 일 버전 이후 VNC server 내장 RealVNC 등 클라이언트를 사용해 접속 raspi-config 혹은 GUI menu - Select Menu > Preferences > Raspberry Pi Configuration > Interfaces. • Ensure VNC is Enabled. 85 https://www.raspberrypi.org/documentation/remote-access/vnc/
  • 87. WiFi 설정 무선랜 동글 확인 $iwconfig wlan0 ... lo eth0 주변 공유기 확인후 ESSID, 암호방식 메모 $iwlist wlan0 scan Cell 02 - Address: 98:5A:EB:8D:5C:36 ESSID:"macbook_pro" Protocol:IEEE 802.11bgn Mode:Master Frequency:2.462 GHz (Channel 11) Encryption key:on Bit Rates:144 Mb/s 90
  • 88. WiFi 설정 AP 인증 설정 : /etc/wpa_supplicant/wpa_supplicant.conf wpa_passphrase 명령으로 설정 가능 $sudo -s #wpa_passphrase "SSID_NAME" SSID_PASSWORD >> /etc/wpa_supplicant/wpa_supplicant.conf 파일: wpa_supplicant.conf ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="SSID_NAME" psk="SSID_PASSWORD" key_mgmt=WPA-PSK }91
  • 89. WiFi 설정 wlan0 랜카드 재시작 $sudo ifdown wlan0 $sudo ifup wlan0 잠시후 ip 할당 확인 $ifconfig wlan0 92
  • 91. Bluetooth package bluez 패키지를 설치한다. $sudo apt install bluez bluez-firmware bluez 를 설치하면 'pi-bluetooth' 가 설치된다. 혹은 직접 설치; $sudo apt install pi-bluetooth 'pi-bluetooth'는 BCM43430A1 칩의 펌웨어를 부팅할 때 적재한 다. bluez 패키지는 블루투스를 다룰 수 있는 명령행이 설치된다. 94
  • 92. bluetoothctl $ bluetoothctl [NEW] Controller B8:27:EB:62:F5:E1 homepi [default] [bluetooth]# help Available commands: list List available controllers show [ctrl] Controller information select <ctrl> Select default controller devices List available devices paired-devices List paired devices power <on/off> Set controller power pairable <on/off> Set controller pairable mode discoverable <on/off> Set controller discoverable mode agent <on/off/capability> Enable/disable agent with given capability default-agent Set agent as the default one scan <on/off> Scan for devices info <dev> Device information pair <dev> Pair with device trust <dev> Trust device untrust <dev> Untrust device block <dev> Block device unblock <dev> Unblock device remove <dev> Remove device connect <dev> Connect device disconnect <dev> Disconnect device version Display version quit Quit program [bluetooth]#95 bluetoothctl은 단말의 블루투스 장치를 제어할 수 있다.
  • 93. bluetoothctl bluetoothctl에서 장치 정보 확인 $ bluetoothctl [NEW] Controller A8:27:EB:62:D5:E1 homepi [default] [bluetooth]# show A8:27:EB:62:D5:E1 Controller B8:27:EB:62:F5:E1 Name: homepi Alias: homepi Class: 0x000000 Powered: yes Discoverable: no Pairable: yes UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb) UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb) UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb) UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb) UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb) Modalias: usb:v1D6Bp0246d0517 Discovering: no96
  • 94. bluetoothctl bluetoothctl에서 장치를 켜고 연결할 수 있다. [bluetooth]# power on Changing power on succeeded [bluetooth]# agent on Agent registered [bluetooth]# scan on Discovery started [CHG] Controller A8:27:EB:62:D5:E1 Discovering: yes 97 Raspberry Pi 장치 on scan 가능 on 카메라/휴대폰 paring
  • 97. /proc 살펴보기 cat /proc/meminfo cat /proc/iomem cat /proc/sys/kernel/osrelease cat /proc/partitions cat /proc/version 현재 시스템 런타임 커널 파라미터 sysctl --all100
  • 98. vcgencmd vcgencmd는 CPU의 클럭 속도, CPU의 전압, 온도와 같은 시스 템 정보를 표시할 수 있는 명령입니다. - http://elinux.org/RPI_vcgencmd_usage 101 pi@raspberrypi:~$ vcgencmd commands commands="vcos, ap_output_control, ap_output_post_processing, vchi_test_init, vchi_test_exi pm_set_policy, pm_get_status, pm_show_stats, pm_start_logging, pm_stop_logging, version, co set_vll_dir, led_control, set_backlight, set_logging, get_lcd_info, set_bus_arbiter_mode, cache_flush, otp_dump, codec_enabled, measure_clock, measure_volts, measure_temp, get_confi hdmi_ntsc_freqs, render_bar, disk_notify, inuse_notify, sus_suspend, sus_status, sus_is_ena sus_stop_test_thread, egl_platform_switch, mem_validate, mem_oom, mem_reloc_stats, file, vctest_memmap, vctest_start, vctest_stop, vctest_set, vctest_get"
  • 101. 유용한 SysFS 정보 보드 모델 CPU Max frequency Debian 계열 시스템 정보: 104 $ cat /sys/firmware/devicetree/base/model Raspberry Pi 3 Model B Rev 1.2 $ cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq 1200000 $ getconf -a
  • 103. GPIO
  • 104. GPIO Overview GPIO는 INPUT, OUTPUT 기능을 수행 모든 pin은 Pull-up & down 저항을 내장 모든 pin은 3.3v (5v가 아니다.) GPIO에 최대 전류는 50mA 정도 107 http://elinux.org/RPi_Low-level_peripherals
  • 105. RPi Model A Physical pin : Header pin108 http://pinout.xyz/
  • 106. RPi Model B 109 http://pinout.xyz/
  • 107. RPi 2 Model B pin layout RPi 2 110
  • 109. 전기전자 부품 112 Push Button Digital Input Switch - Closes or opens circuit Polarized, needs resistor Trim potentiometer Analog Input Variable resistor Also called a Trimpot. Photoresistor Analog Input Light Dependent Resistor (LDR) Resistance varies with light. Relay Digital Output Switch driven by a small signal Used to control larger voltages Temp Sensor Analog Input Temp Dependent Resistor Flex Sensor Analog Input Variable resistor Soft Trimpot Analog Input Variable resistor Careful of shorts RGB LED Dig & Analog Output 16,777,216 different colors Ooh... So pretty. Name Image Type Function Notes
  • 113. LED 연결 RPi의 3.3V를 LED에 걸면 ? 116 GPIO port는 약 50mA 출력.
  • 115. 저항의 기능과 용도 전류의 흐름을 제한하는 것으로 전기회로를 순조롭게 동 작하도록 하는 기능을 가지고 있는 것이 저항이며 전기 회로에서 중요한 부품 중 하나이다. 118 발광하지 않는다 전류가 너무 흐른다 이상적인 동작 상태 LED에 흐르는 전류( )가 15[mA]인 경우 저항값 저항의 양단에 걸리는 전압
  • 116. LED와 저항 5V를 LED에 안전하게 사용하기 위해서는 R = (5 - 2.6) / 0.02 = 150 보유한 220ohm 저항을 활용할 수 있다. 119 구동 저항 계산 http://www.gst-lcd.com/test_led3.htm
  • 117. sysfs
  • 118. sysfs sysfs는 리눅스 커널 2.4에서 /proc 에 복잡하게 사용하던 디바 이스 관련 정보를 커널 2.6 이후에 sysfs로 체계적으로 재 배 치했다. - 가상 파일시스템으로 /sys 디렉토리에 마운트 - 사용자가 읽기/쓰기/변경 등 권한 - 하드웨어 구성 정보, 디바이스 드라이버 정보가 통합적인 계 층으로 보여주게 하기 위해 kobject라는 구조체 이용. - 사용자 프로그램이 시스템 버스 드라이버, 플랫폼 드라이버 등의 상위 드라이버와 데이터 교환을 위해 export 용도로 제 공 121 http://egloos.zum.com/moonkh/v/4841757 https://www.kernel.org/doc/Documentation/gpio/sysfs.txt
  • 119. 122
  • 120. GPIO 드라이버 라즈베리파이의 GPIO는 arch/arm/mach- bcm2708/bcm2708_gpio.c 소스의 디바이스 드라이버 모델 을 기반으로 플랫폼 드라이버로 작성되어 있다. 사용자는 sysfs를 통해서 GPIO 포트에 접근할 수 있다. $ cd /sys/class/gpio/ pi@raspberrypi /sys/class/gpio $ ls -l total 0 -rwxrwx--- 1 root gpio 4096 Jan 1 1970 export lrwxrwxrwx 1 root gpio 0 Jan 1 1970 gpiochip0 -> ../../devices/platform/soc/3f200000.gpio/gpio/gpiochip0 -rwxrwx--- 1 root gpio 4096 Jan 1 1970 unexport 123
  • 121. GPIO17 활성화 예를 들어 Pin 17을 활성화 하고자 하면 pi@raspberrypi /sys/class/gpio $ echo "17" > export pi@raspberrypi /sys/class/gpio $ ls -l total 0 -rwxrwx--- 1 root gpio 4096 Nov 19 21:41 export lrwxrwxrwx 1 root gpio 0 Nov 19 21:41 gpio17 -> ../../devices/platform/soc/3f200000.gpio/gpio/gpio11 lrwxrwxrwx 1 root gpio 0 Jan 1 1970 gpiochip0 -> ../../devices/platform/soc/3f200000.gpio/gpio/gpiochip0 -rwxrwx--- 1 root gpio 4096 Jan 1 1970 unexport 124
  • 123. Pin 상태 이제 GPIO 17번 포트에 대해서 활성, 엣지, 값을 파일 시스템을 통해서 접근할 수 있다. pi@raspberrypi /sys/class/gpio $ cd gpio17/ pi@raspberrypi /sys/class/gpio/gpio17 $ ls -l total 0 -rw-r--r-- 1 root root 4096 Nov 19 21:42 active_low lrwxrwxrwx 1 root root 0 Nov 19 21:42 device -> ../../../3f200000.gpio -rw-r--r-- 1 root root 4096 Nov 19 21:42 direction -rw-r--r-- 1 root root 4096 Nov 19 21:42 edge lrwxrwxrwx 1 root root 0 Nov 19 21:41 subsystem -> ../../../../../../class/gpio -rw-r--r-- 1 root root 4096 Nov 19 21:41 uevent -rw-r--r-- 1 root root 4096 Nov 19 21:42 value 126
  • 124. 출력 Pin 11번에 HIGH 출력을 하려면 gpio17/direction을 'out'으로 전환한다. $ echo "out" > /sys/class/gpio/gpio17/direction -bash: /sys/class/gpio/gpio11/direction: Permission denied 그리고 LED를 on/off 하려면 gpio17/value에 '1', '0' 값을 쓴다. 127
  • 125. unexport GPIO를 sysfs에서 사용하지 않게되면 unexport 에 핀 번호를 출력하면 제거된다. $ echo "11" > unexport 128
  • 126. sysfs 쉘 코드 sysfs_23.sh 129 # the pin to control PIN=23 # make this pin available through the SysFS echo $PIN > /sys/class/gpio/export # now, set this pin to output echo out > /sys/class/gpio/gpio${PIN}/direction # write a value to this pin echo 1 > /sys/class/gpio/gpio${PIN}/value # wait for some seconds sleep 3s # write a value to this pin echo 0 > /sys/class/gpio/gpio${PIN}/value # make this pin unavailable through the SysFS echo $PIN > /sys/class/gpio/unexport
  • 130. Fritzing Parts FrizingParts -http://fritzing.org/parts/ https://github.com/RafaGS/Fritzing Fritzing User Created Parts - https://code.google.com/p/fritzing/issues/detail?id=2753 Adafruit / Fritzing library - https://github.com/adafruit/Fritzing-Library 133
  • 131. Creat My Own Parts http://fritzing.org/learning/tutorials/creating-custom-parts/ https://embeddist.wordpress.com/2014/10/24/create-my- part-on-fritzing/ 134

Notes de l'éditeur

  1. https://youtu.be/y-x-RseAns8
  2. http://elinux.org/RPi_Hardware
  3. https://www.raspberrypi.org/wp-content/uploads/2016/03/pi3.jpg SMC9514: http://www.microchip.com/wwwproducts/en/LAN9514
  4. http://www.element14.com/community/docs/DOC-68090/l/raspberry-pi-zero-pi-2-b-a-compute-module-dev-kit-comparison-chart
  5. https://archlinuxarm.org/platforms/armv7/broadcom/raspberry-pi-2 https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-3
  6. http://raspberrypi.stackexchange.com/questions/51615/raspberry-pi-power-limitations http://elinux.org/RPi_Hardware
  7. http://downloads.raspberrypi.org/raspbian/release_notes.txt
  8. http://downloads.raspberrypi.org/raspbian/release_notes.txt
  9. https://en.wikipedia.org/wiki/Virtual_Network_Computing#/media/File:VNC_in_KDE.png
  10. dokan1.dll not found 에러 발생!!!
  11. http://s11.postimg.org/jy79tc6kj/Serial_Diffs.jpg
  12. Remove PL2303 Remove any previous installed driver first. 1. Open Terminal program (located in /Applications/Utilities/) 2. sudo rm -rf /Library/Extensions/ProlificUsbSerial.kext 3. sudo rm -rf /var/db/receipts/*PL2303*.* 4. sudo rm -rf /var/db/receipts/*ProlificUSbSerial*.*
  13. http://elinux.org/RPi_Software http://studio2b.tistory.com/44
  14. http://kr15h.github.io/RPi-Setup/
  15. http://www.hardcopyworld.com/gnuboard5/bbs/board.php?bo_table=lecture_rpi&wr_id=18
  16. http://www.hardcopyworld.com/gnuboard5/bbs/board.php?bo_table=lecture_rpi&wr_id=18
  17. http://www.hardcopyworld.com/gnuboard5/bbs/board.php?bo_table=lecture_rpi&wr_id=18
  18. http://www.makeuseof.com/tag/setup-wi-fi-bluetooth-raspberry-pi-3/
  19. 사용자 계정에서 "vcgencmd measure_temp VCHI initialization failed" 발생은 pi 계정이 groups의 video, autio, gpio 같은 그룹에 할당되지 않아서 이다.
  20. http://raspberrypi.stackexchange.com/questions/51615/raspberry-pi-power-limitations
  21. sysfs 지원 확인 $ sudo sh -c "cat /lib/modules/`uname -r`/build/.config | fgrep SYSFS" cat: /lib/modules/4.4.38-v7+/build/.config: No such file or directory