Slide 1

Slide 1 text

࢈ۀͰΨνར༻͞ΕΔ Raspberry Piͷ࿩ גࣜձࣾPhotosynth @kazuph

Slide 2

Slide 2 text

ࣗݾ঺հ • HN @kazuph • WebΤϯδχΞ(3.5 year) • IoTΤϯδχΞ(4.0 year) • גࣜձࣾPhotosynthͰ೔ຊͰ࠷ॳʹग़ՙ͞Εͨε ϚʔτϩοΫʮAkerunʯͱ͍͏IoT੡඼Λͭͬ͘ ͯ·͢

Slide 3

Slide 3 text

࿩͢͜ͱ • ͳͥRaspberry PiΛ࢈ۀ׆༻ͰબͿͷ͔ • ฐࣾͰͷRaspberry Pi࠾༻ͷ࣮੷ • ΑΓڧݻͳσόΠεʹ͢ΔͨΊͷج൘֦ு • ͦΕͰ΋Raspberry PiͰ͸ͩΊͳ৔߹͸Ͳ͏ ͢Δ͔ʁ

Slide 4

Slide 4 text

ͳͥRaspberry PiΛ
 ࢈ۀ׆༻ͰબͿͷ͔ʁ

Slide 5

Slide 5 text

Raspberry Pi • ҎલΑΓిࢠ޻࡞΍ڭҭ༻్Ͱ࢖ΘΕ͍ͯΔ γϯάϧϘʔυίϯϐϡʔλʔ • ࠷৽൛ͷ3B(+)Ͱ͸Wi-Fi(+5GHz)ʹՃ͑ Bluetooth Low EnergyʹରԠͨ͜͠ͱͰ
 ௥Ճύʔπͳ͠ʹ׬શͳIoTରԠ͕࣮ݱͨ͠

Slide 6

Slide 6 text

Raspberry Pi࢈ۀར༻ • ߴ͍඼࣭ • ଞࣾͱൺ΂ͯඇৗʹ҆Ձ • ൚༻తͳ։ൃ؀ڥ • ҆ఆڙڅ

Slide 7

Slide 7 text

ߴ͍඼࣭ • ੈքφϯόʔϫϯͷ੡଄਺ʢ͓ͦΒ͘ಉछͰʣ • 2012೥4݄ʹ࠷ॳͷϞσϧ͕ൃച։࢝ • 2018೥3݄࣌఺Ͱ1900ສ୆ग़ՙ • ଞࣾ͸ɾɾɾʁ • ιχʔͷ޻৔ʹͯੜ࢈ʢӳࠃɺ೔ຊɺதࠃʣ

Slide 8

Slide 8 text

ଞࣾͱൺ΂ͯඇৗʹ҆Ձ • ௨ৗ35$ఔ౓ˠ೔ຊͰ͸4000ԁڧ • ଞࣾ੡͸5ສԁલޙ • ߪೖͷίϛοτͰσΟεΧ΢ϯτ͸Մೳ • ࠷ۙ਺ສԁҎԼͷϞσϧ΋ग़͖͕ͯͨɾɾɾ
 ※͍͢·ͤΜɺ͜ͷล͸ΦʔϓϯՁ֨Λᨳ͍ͬͯΔاۀ͕ଟ͍ͷͰ
 ɹՁ֨͸ࡌͤ·ͤΜ

Slide 9

Slide 9 text

൚༻తͳ։ൃ؀ڥ • σϑΥͷOS͕Debian • ΄΅sshͰೖͬͯaptͰࣄ଍ΓΔ • ARM༻Ϗϧυ΋૿͍͑ͯΔ • GolangɺTensorFlowɺJlink(ϚΠίϯͷ ॻ͖ࠐΈɾσόοά༻ͷϓϩʔϒʣɺɺɺ

Slide 10

Slide 10 text

҆ఆڙڅ • ͜ͷੈ͔Β͠͹Β͘Raspberry Pi͸ফ໓͠ͳ͍ ͩΖ͏ͱ͍͏҆৺ײ • ޓ׵Ϙʔυ΋ग़͍ͯΔ
 (ASUSͷTinker-BoardͳͲ)

Slide 11

Slide 11 text

Raspberry Pi࢈ۀར༻ • ߴ͍඼࣭…⭕ • ଞࣾͱൺ΂ͯඇৗʹ҆Ձ…⭕ • ൚༻తͳ։ൃ؀ڥ…⭕ • ҆ఆڙڅ…⭕

Slide 12

Slide 12 text

ฐࣾͰͷRaspberry Pi
 ࠾༻ͷ࣮੷

Slide 13

Slide 13 text

ฐࣾͰͷ࣮ࡍͷར༻ • ࣮੡඼ͷϓϩτλΠϐϯά • ૊ࠐ੡඼σόοά༻్ • ޻৔Ͱͷग़ՙπʔϧ • [New!]IoTήʔτ΢ΣΠ

Slide 14

Slide 14 text

࣮੡඼ͰͷϓϩτλΠϐϯά

Slide 15

Slide 15 text

࣮੡඼ͰͷϓϩτλΠϐϯά

Slide 16

Slide 16 text

࣮੡඼ͰͷϓϩτλΠϐϯά • Raspberry PiͰࢼ࡞ͯ͠ຊ൪੡඼΁స༻ • ԿΒ͔ͷLinux OS • ARM • ࢼ࡞࣌ͷݴޠ • NodeɺPythonɺGolang

Slide 17

Slide 17 text

૊ࠐ੡඼ͷσόοά༻్ J-LinkͷARMϏϧυ͕
 ͋Δͷ͕஍ຯʹศར

Slide 18

Slide 18 text

૊ࠐ੡඼ͷσόοά༻్

Slide 19

Slide 19 text

޻৔ग़ՙπʔϧ

Slide 20

Slide 20 text

޻৔ग़ՙπʔϧ

Slide 21

Slide 21 text

RaspPiͰRaspPiΛݕࠪ

Slide 22

Slide 22 text

޻৔πʔϧ։ൃࡇΓʢ࣏۩ࡇΓʣ

Slide 23

Slide 23 text

޻৔ग़ՙπʔϧ(ϚΠίϯͷ৔߹) 1.αʔόʔͰੜ੒ͨ͠ϚΠίϯ༻όΠφϦͷμ΢ϯϩʔυʢݸମ͝ͱʹϢχʔΫ ͳIDɺΫϨσϯγϟϧʣ 2.ج൘ʹ౥ࡌ͞Ε͍ͯΔϚΠίϯ΁ྲྀ͠ࠐΈ 3.ͦͷ··ج൘ࣗମͷݕࠪ 1.ηϯαʔ৘ใɺిѹɺIOͳͲͷνΣοΫ 2.BLEͷνΣοΫʢج൘BLEϚΠίϯ㲗RaspPiʣ 4.αʔόʔʹݕࠪ݁ՌΛૹ৴ 5.ج൘Λࡌͤସ͑ͯ1΁໭Δ

Slide 24

Slide 24 text

޻৔ग़ՙπʔϧ(ϚΠίϯͷ৔߹) • RaspPi→Jlink→BLEϚΠίϯ • RaspPi→Arduino→ج൘ͷ෦඼ͷશମ • Golang(Web Server, BLE) 
 + Shell(όΠφϦॻࠐ)
 + Cʢݕࠪ༻νΣοΧʔʣ • nRF52΁ͷྲྀ͠ࠐΈπʔϧJlinkʴshell(expect)

Slide 25

Slide 25 text

nRF52 + Jlink + expect શ෦ਧͬඈ͹͢΍ͭ ϚΠίϯΠϝʔδΛॻ͖ࠐΉ܅ ୭͔ͷ໾ʹཱͭʁ (6*͡Όͳͯ͘$-*Ͱ0,

Slide 26

Slide 26 text

޻৔ͰAnsible • ੡඼(૬ख)͕Linuxϕʔεͷ৔߹ • RaspPi→RaspPi • ࠷ॳͷLinuxΠϝʔδ΋࡞੒ͨ͠ • ޻৔Ͱ͸ݕࠪͱޙย෇͚ʹ࢖༻ • ֤ݸମ͝ͱʹ࣮ߦ͢Δ • ೚ҙͷίϚϯυΛྲྀͯ͠໭Γ஋ΛνΣοΫ • APIʹݕࠪ৘ใΛૹ৴ • ૊Έཱͯ”ޙ”ݕࠪ༻ͷ
 ࣗյϓϩάϥϜΛྲྀ͠ࠐΉ • ݕࠪͰ͖Δঢ়ଶ”Ͱ͸ͳ͘͢”

Slide 27

Slide 27 text

޻৔Ͱͷग़ՙπʔϧ૯ׅ • Raspberry Pi͚ͩͰߏஙՄೳ • 2016೥͔Β࿈ଓՔಇதͰަ׵ͳ͠ • LinuxͷࢿݯΛϑϧ׆༻ͯ͠ݕ͕ࠪՄೳ • Webαʔόʔ • RESTΫϥΠΞϯτ • PIN IOɺUSB IOɺΞφϩάIO͕ඞཁͳ৔߹͸Arduino • BLE௨৴ॲཧ • ϓϩϏδϣχϯάπʔϧ

Slide 28

Slide 28 text


 
 
 ※IoTͰΑ͋͘Δߏ੒ͷ͏ͪͷҰ͚ͭͩΛදͯ͠·͢ IoTήʔτ΢ΣΠ &EHF %FWJDF &EHF %FWJDF &EHF %FWJDF ɾ
 ɾ
 ɾ (BUFXBZ %FWJDF #MVFUPPUI )551 4 .255 4 $MPVE )551 4 4NBSU1IPOF

Slide 29

Slide 29 text

ͳͥIoTήʔτ΢ΣΠͱͯ͠બΜ͔ͩʁ • ࠷ॳ͸඼࣭ʹରͯ͠ջٙతͩͬͨ • ҎԼͷ߲໨͕ޙԡ͠ • ޻৔πʔϧͱͯ͠ͷ࣮੷ • ࣮ࡍʹෛՙࢼݧͯ͠ͷ࣮੷ • 3B͔Βඪ४ͰBLEରԠͨ͜͠ͱͰͷݪՁ࡟ݮ • Wi-FiɺBLEυϯάϧ͸ͦΕͧΕ਺ઍԁ

Slide 30

Slide 30 text

ෛՙࢼݧ࣮੷ • ࢼݧ߲໨ • CPUɺIOɺUSBɺແઢ/༗ઢLANɺ
 BLEɺిݯܥɺSDΧʔυ • ਺ສʙඦສճͷON/OFF΍࿈ଓॲཧΛ͠ ͯ໰୊ͳ͍͜ͱΛ֬ೝ

Slide 31

Slide 31 text

BLEੑೳ ※ ͍͡Ίͯ܅ɾɾɾʁ

Slide 32

Slide 32 text

IoTήʔτ΢ΣΠߏ੒ • Raspberry Piɹʴɹ֦ுج൘

Slide 33

Slide 33 text

ిݯपΓ • Raspberry Pi͚ͩͰ͸ɾɾɾ • ཕαʔδରࡦࡁΈͷACΞμϓλʔͰରԠ • ֦ுج൘ʹͯ੩ిؾରࡦ͸ผ్ඞཁ

Slide 34

Slide 34 text

ιϑτ΢ΣΞߏ੒ • Raspberry Pi • Node(noble, express) • ௨৴ • HTTPS…APIͱͷ௨৴ • MQTTS…pub/subɺϦΞϧλΠϜ༻్ • SPI…֦ுج൘ͱͷ௨৴ • ֦ுج൘ʢnRF52ʣ • CʹͯLEDɺα΢ϯμɺSPI • ࣮͸DFUҎ֎ͰBLE͸࢖ͬͯͳ͍

Slide 35

Slide 35 text

ϩάઓུ • جຊతʹ͸ී௨ͷαʔόʔͱҰॹ • ҧ͏෦෼ • ༰ྔ͕গͳ͍ˠ͙͢࡟আ • IOͷ্ݶ͕͋ΔˠͰ͖Δ͚ͩΦϯϝϞϦ • ઀ଓͰ͖ͳ͍ˠS3ʹ೔࣍Ξοϓϩʔυ

Slide 36

Slide 36 text

ηΩϡϦςΟΛͲ͏͢Δ͔ʁ • SDΧʔυΛ࢖͏Ҏ্͸த਎Λൈ͔ΕΔ • ߟ͑ํ • େࣄͳ΋ͷΛSDΧʔυʹஔ͔ͳ͍ • ΫϨσϯγϟϧΛ͢΂֦ͯுج൘(nRF52)ʹೖΕΔ • ιʔείʔυͷ҉߸ԽΛ͢Δ • OSΛ࠷৽ʹอͭ • ࢓༷ͱͯ͠ήʔτ΢ΣΠىҼͰ
 ΫϦςΟΧϧͳॲཧ͕࣮ߦ͞Εͳ͍Α͏ʹ͢Δ • ֎෦ػؔʹηΩϡϦςΟݕূͯ͠΋Β͏

Slide 37

Slide 37 text

ιϑτ΢ΣΞΞοϓσʔτ • SSH❌ɺ೚ҙͷίϚϯυ࣮ߦ❌ • ͏ͪͰ͸ΞϓϦέʔγϣϯ΋apt • पลπʔϧͷηΩϡϦςΟɾΞοϓσʔτ • ߏ੒มߋ࣌ʹ͸ႈ౳ੑͷ͋ΔεΫϦϓτΛ࡞੒ͯ͠ରԠ • Πϝʔδ࡞੒ͱ͔͸ਏ͍ • ϥζύΠҎ֎ͷ֦ுج൘(nRF52)΋͋Δͱ… • ผͷ࢓૊Έʹ৐͔ͬͬͯ΋͍͍͔΋…ϕεϓϥڞ༗͠߹͍͍ͨ

Slide 38

Slide 38 text

લੈ୅͔Βͷ৐Γ׵͑ • લੈ୅΋Debianϕʔεͩͬͨ • ϝΠϯͷ෦෼͸΄΅ॻ͖׵͑ͯ͠ͳ͍ • ৽نͷΠϯλʔϑΣʔε(֦ுج൘ɺUSB)෦෼Λΰ ϦΰϦॻ͍ͨ • ʴηΩϡϦςΟରࡦ • ͍ͭͰʹϦϑΝΫλ(ָ͍͠ʂ)

Slide 39

Slide 39 text

ͦΕͰ΋Raspberry PiͰ
 ͩΊͳ৔߹ʹͲ͏͢Δ͔ʁ

Slide 40

Slide 40 text

Raspberry PiΛ࢖͑ͳ͍ͱ͖ • 4000ԁ͢Βߴ͍ͱ͖ɺίϯγϡʔϚ༻్ • ి஑ۦಈ͍ͤͨ͞ • ηΩϡϦςΟతʹΫϦςΟΧϧͳॲཧΛ͢Δ

Slide 41

Slide 41 text

͍҆୅ସ • BLE͚ͩͰ͍͍ͳΒnRF52 • ΄΅σϑΝΫτ • ͏ͪ΋2೥લ͔Βຊ൪ར༻ • Wi-Fi΋΄͍͠৔߹͸ίϯϘνοϓ • ESP32͕͍͍͔΋ʁਖ਼௚σϑΝΫτͳ͍(ೝࣝ) • ଞࣾ੡඼ͰESPͷ΍ͭΛݟͨ͜ͱ͋Δ͕ • ESPͰ͸ͳ͍͕BLEͱWi-FiΛಉ࣌ʹ࢖͑ͳ͍໰୊ͳͲ
 ະ૝ఆͷ໰୊ʹରॲ͢Δඞཁ͕͋ΔՄೳੑ

Slide 42

Slide 42 text

ి஑ۦಈ • ͦ΋ͦ΋ͷ࢓༷ͰWi-FiΛબ୒Ͱ͖ͳ͍৔߹͕ଟ͍ • ి஑ͩͱ਺࣌ؒ • SIM΍LPWAͳͲ΋ಉ༷ʢLPWA΋޻෉͸Ͱ͖Δ͕ΰχϣΰχϣ…ʣ • ߏ੒ • NݸͷBLEΤοξσόΠεʴڅిήʔτ΢ΣΠ • ෺ཧతɺిؾతʹ෼཭͢Δඞཁ͕͋Δ

Slide 43

Slide 43 text

ηΩϡϦςΟ • ૊ΈࠐΈܥͷઐ༻νοϓͷ৔߹େ఍֎͔Βͷ
 ΞΫηεΛ๷͙࢓૊ΈΛඋ͍͑ͯΔ • ഁյ͢Δ͜ͱͰத਎ΛऔΓग़͢͜ͱ΋Ͱ͖Δ͕ɺ
 ͦͷ৔߹͸੡඼͕յΕΔͷͰແҙຯԽ͢Δʢ࢓༷͕͍͍ʣ • ڞ௨ͷΫϨσϯγϟϧΛආ͚Δ

Slide 44

Slide 44 text

᠘ • ΄΅͢΂ͯͷNon-OSܥͷίϯϘνοϓ͸
 Wi-Fi 5GHzରԠͯ͠ͳ͍ • ʢฐࣾͷήʔτ΢ΣΠ͸ॳظͷ2015೥͔Β 5GHzରԠࡁΈʣ

Slide 45

Slide 45 text

ʢϥζύΠ͡Όͳ͍ͳΒʣ nRF52(BLE)Ͱ͍͍Α

Slide 46

Slide 46 text

·ͱΊ

Slide 47

Slide 47 text

·ͱΊ • Raspberry Pi͕׬શʹ඼࣭໘ͰଞΛѹ౗͍ͯ͠Δ • Raspberry Pi͕׬શʹIoTϨσΟʔͱͳͬͨ • Raspberry Pi஋ஈ΋(ಉྨͷதͰ͸)΄΅࠷҆ • Raspberry Piʹ͸େྔͷιϑτ΢ΣΞ
 ࢿݯ͕͋ΔͷͰࢼ࡞ɾ։ൃίετΛѹॖͰ͖Δ

Slide 48

Slide 48 text

ຊ൪ར༻͸඼࣭”໋” Raspberry PiΛ࢖͓͏ʂ

Slide 49

Slide 49 text

͓ΘΓ