際際滷

際際滷Share a Scribd company logo
? 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 C tells sshfs to use port number XXXXX.
-o Ciphers=arcfour C speeds up for the connection.
-o ro C read only.
-o nonempty C allow nonempty mount point.
-o cache_timeout=N C set default cache timeout (in seconds)
-o cache=no C disable cache.
-o intr C allows to interrupt file access.
-o reconnect C automatically reconnect
-o idmap=user C 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

More Related Content

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 C tells sshfs to use port number XXXXX. -o Ciphers=arcfour C speeds up for the connection. -o ro C read only. -o nonempty C allow nonempty mount point. -o cache_timeout=N C set default cache timeout (in seconds) -o cache=no C disable cache. -o intr C allows to interrupt file access. -o reconnect C automatically reconnect -o idmap=user C 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

Editor's Notes

  • #16: https://youtu.be/y-x-RseAns8
  • #23: http://elinux.org/RPi_Hardware
  • #25: https://www.raspberrypi.org/wp-content/uploads/2016/03/pi3.jpg SMC9514: http://www.microchip.com/wwwproducts/en/LAN9514
  • #27: http://www.element14.com/community/docs/DOC-68090/l/raspberry-pi-zero-pi-2-b-a-compute-module-dev-kit-comparison-chart
  • #28: https://archlinuxarm.org/platforms/armv7/broadcom/raspberry-pi-2 https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-3
  • #29: http://raspberrypi.stackexchange.com/questions/51615/raspberry-pi-power-limitations http://elinux.org/RPi_Hardware
  • #32: http://downloads.raspberrypi.org/raspbian/release_notes.txt
  • #39: http://downloads.raspberrypi.org/raspbian/release_notes.txt
  • #46: https://en.wikipedia.org/wiki/Virtual_Network_Computing#/media/File:VNC_in_KDE.png
  • #58: dokan1.dll not found ?? ??!!!
  • #62: http://s11.postimg.org/jy79tc6kj/Serial_Diffs.jpg
  • #63: 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*.*
  • #71: http://elinux.org/RPi_Software http://studio2b.tistory.com/44
  • #72: http://kr15h.github.io/RPi-Setup/
  • #91: http://www.hardcopyworld.com/gnuboard5/bbs/board.php?bo_table=lecture_rpi&wr_id=18
  • #92: http://www.hardcopyworld.com/gnuboard5/bbs/board.php?bo_table=lecture_rpi&wr_id=18
  • #93: http://www.hardcopyworld.com/gnuboard5/bbs/board.php?bo_table=lecture_rpi&wr_id=18
  • #95: http://www.makeuseof.com/tag/setup-wi-fi-bluetooth-raspberry-pi-3/
  • #102: ??? ???? "vcgencmd measure_temp VCHI initialization failed" ??? pi ??? groups? video, autio, gpio ?? ??? ???? ??? ??.
  • #117: http://raspberrypi.stackexchange.com/questions/51615/raspberry-pi-power-limitations
  • #122: 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