Upgrade to Pro — share decks privately, control downloads, hide ads and more …

北海道情報大学オープンキャンパス模擬講義「IoTプログラミング演習」 / HIUOC2022

yumulab
August 11, 2022

北海道情報大学オープンキャンパス模擬講義「IoTプログラミング演習」 / HIUOC2022

北海道情報大学オープンキャンパス模擬講義「IoTプログラミング演習」の資料

yumulab

August 11, 2022
Tweet

More Decks by yumulab

Other Decks in Technology

Transcript

  1. ๺ւಓ৘ใେֶ ΦʔϓϯΩϟϯύε ໛ٖߨٛ ʢ৘ใϝσΟΞֶ෦ ৘ใϝσΟΞֶՊʣ ౬ଜ ཌྷ !"#$%&'()&*+ ,-./.012 -./.41,5"67"8"519:1;:7<

    ࢿྉ͸Ξοϓϩʔυࡁ https://speakerdeck.com/yumulab/hiuoc2022
  2. !"#$%#&' • IoT֓ཁ (15෼) • IoT (ArduinoγϛϡϨʔλ) ԋश (30෼) •

    ͦͷଞɾ·ͱΊɾ࣭໰ (5෼) 2
  3. !"#=>

  4. ()*+, • Internet of Things • Ϟϊ͕Πϯλʔωοτʹܨ͕Δ • ϋʔυ΢ΣΞΛѻ͏γεςϜͷϓϩάϥϛϯά •

    ޫɺಈ͖ɺԻ ͳͲͳͲ • ΞϓϦ΍ήʔϜͷϓϩάϥϛϯάͱ͸Կ͕ҧ͏͔ʁ • ΞϓϦ΍ήʔϜ͸ίϯϐϡʔλͷதʹด͍ͯ͡Δ • ϑΟδΧϧίϯϐϡʔςΟϯά͸ίϯϐϡʔλͷ֎ͷσʔλΛऔಘ ͨ͠Γϋʔυ΢ΣΞΛಈ͔͢ • ʮ૊ࠐΈίϯϐϡʔςΟϯάʯ΍ʮϑΟδΧϧίϯϐϡʔςΟϯάʯ ͱڞ௨఺΋͋Δ (एׯҧ͏৔߹΋͋Δ) 4
  5. ()*-./0 5 ૯຿লಈըνϟϯωϧ ຀৔ʹ͓͚ΔIoT׆༻ࣄྫ঺հ https://youtu.be/6UIQiSYPwfg

  6. ()*-./0 6 ૯຿লಈըνϟϯωϧ հޢʹ͓͚ΔIoT׆༻ࣄྫ঺հ https://youtu.be/MPQwGPLNeto

  7. ()*-./0 7 ૯຿লಈըνϟϯωϧ ړۀʹ͓͚ΔIoT׆༻ࣄྫ঺հ https://youtu.be/ja0lJk9_yWg

  8. 12345678 • ͍Ζ͍ΖͳπʔϧɾςΫϊϩδʔ͕࢖ΘΕΔ • Χϝϥը૾ղੳ • ηϯα • Ϟʔλʔ •

    LED • ϫϯϘʔυϚΠίϯ 8 ͜ͷߨٛͷର৅
  9. 9:;<=>?@: • ී௨ͷPCͱൺ΂ͯ • ͍҆🙆 • খ͍͞🙆 • ௿ফඅిྗ🙆 •

    ੑೳ௿͍🙅 9 M5Stack Basic (¥5,203) https://ssci.to/3647 Arduino Uno R3 (¥3,300) https://ssci.to/789 micro:bit (¥2,200) https://ssci.to/6600 Raspberry Pi 4 Model B / 2GB (¥5,225) https://ssci.to/5681 ͜ͷߨٛͷର৅
  10. ABCDEF) • ʮΞϧσϡΠʔϊʯͱಡΈ·͢ • ͨͿΜੈքҰ༗໊ͳϫϯϘʔυϚΠίϯ • ͍҆ޓ׵඼΋͋ΔɿύνϞϊ͡Όͳͯ͘Φʔϓϯιʔεϋʔυ΢ΣΞ • Arduino IDEͰ։ൃɿC++ݴޠ

    10 Arduino Uno R3 https://ssci.to/789 Arduino IDE
  11. *EFGHBIJCKLKABCDEF)MNOP<Q • ࢖͑Δ෦඼΋ଟ͘ɺ͍ΖΜͳ͜ͱ͕Ͱ͖Δ • ߨٛ͸TinkercadΛ࢖ͬͯਐΊ·͢ • ※ Tinkercadʹ͸ଞʹ3DϞσϦϯάπʔϧ΋ؚ·Ε͍ͯ·͕͢ɺ͜ͷߨٛͰ͸ 3DϞσϦϯάπʔϧͷػೳ͸࢖༻͠·ͤΜ 11

  12. !"#*+

  13. *EFGHBIJCRSTUV2 • Google ChromeΛ։͘ (σεΫτοϓͷγϣʔτΧοτ͔Β) • ΞυϨεόʔʹ https://bit.ly/hiu2022ͱೖྗ 13

  14. *EFGHBIJCRSTUV2 • χοΫωʔϜͰࢀՃ → χοΫωʔϜΛೖྗ • χοΫωʔϜ͸഑෍ͨ͠ࢴʹॻ͍͍ͯ·͢ (hiu01ʙhiu30) 14 ΫϦοΫ

    هೖ ΫϦοΫ ※ ՈͰ΍Δͱ͖͸ https://www.tinkercad.com/ ʹΞΫηεͯ͠ʮΞΧ΢ϯτΛ࡞੒ʯ ·ͨ͸ʮଞαʔϏεΞΧ΢ϯτ(Google / Apple / Microsoft / Facebook)ͰαΠϯΠ ϯʯ͍ͯͩ͘͠͞
  15. WUXYZ#6[ 15 ʮճ࿏ʯΛબ୒ ΫϦοΫ

  16. YZMNOP<Q\] • ԋशͰ͸جຊతʹ͜ͷը໘Λ࢖͍·͢ 16 ໊લΛΫϦοΫͯ͠ ฤू͠Α͏ ෦඼ΛΫϦοΫ → ഑ஔ (υϥοάˍυϩοϓͰ΋OK)

  17. !"37^+ • (1) LEDΛޫΒͤΔ • (2) NeoPixel (LEDςʔϓ) ΛޫΒͤΔ •

    (3) NeoPixelͷ৭Λม͑ͯΈΔ • (4) LCDΛಈ͔ͯ͠දࣔจࣈΛม͑ͯΈΔ • (5) ͍ΖΜͳ෦඼(ελʔλʔ)Λಈ͔ͯ͠ΈΔ • ͨͿΜશ෦͸Ͱ͖ͳ͍ͷͰɺͥͻ͓͏ͪͰ΍ͬͯΈ͍ͯͩ͘͞ 17
  18. _`aRbcd7 18 ໊લΛΫϦοΫͯ͠ ฤू͠Α͏ ෦඼ΛΫϦοΫ → ഑ஔ (υϥοάˍυϩοϓͰ΋OK)

  19. 19 ෦඼ͷ୺ࢠΛΫϦοΫ →઀ଓઌ୺ࢠΛΫϦοΫ _`aRbcd7

  20. 20 ಈ͔͢ʹ͸͜͜ΛΫϦοΫ _`aRbcd7

  21. 21 ɹΫϦοΫͰ෦඼બ୒ → BackspaceͰ࡟আ shiftΛԡ͠ͳ͕ΒΫϦοΫ͢Δͱ ෳ਺બ୒Մೳ Undo ctrl+zͰ΋Մ _`aRbcd7

  22. 22 Ϛ΢εϗΠʔϧͰը໘֦େ/ॖখ ෦඼ͷճస (Shiftԡ͠ͳ͕Β ΫϦοΫͰٯճస) ϓϩύςΟมߋ ͳʹ΋ͳ͍ͱ͜ΖΛ υϥοά͢Δͱ ը໘Ґஔͷௐ੔ _`aRbcd7

  23. eH)fEgHh • Adafruitࣾ੡ͷϚΠίϯ಺ଂϑϧΧϥʔLED • ͭͳ͛ͯ૿΍ͤΔʂ • ςʔϓঢ়ɺϦϯάঢ়ʹͭͳ͕͍ͬͯΔ੡඼Λ࢖͏͜ͱ͕ଟ͍ • ੍ޚʹ͸ArduinoͳͲΛ࢖͏ •

    ϥΠϒϥϦΛ࢖͑͹͍͍ײ͡ʹͰ͖ΔͷͰɺ੍ޚํ๏ͷৄࡉΛ஌Βͳͯ͘΋େৎ෉ 23 Adafruit Industries, NeoPixel RGBW LEDs w/ Integrated Driver Chip - Natural White [~4500K - Black Casing - 10 Pack] https://www.adafruit.com/product/2761 $5.95 / 10ݸ εΠοναΠΤϯε, NeoPixel Ring - 12࿈ϑϧΧϥʔγϦΞϧLED https://www.switch-science.com/catalog/1593/ 1,177ԁ Adafruit Industries, NeoPixel Digital RGB LED Strip - White 30 LED - WHITE https://www.adafruit.com/product/1376 $16.95 / meter
  24. eH)fEgHhRbcd7 • ελʔλʔ (෦඼ͷ૊Έ߹Θͤ)ͷ഑ஔ 24 1. ελʔλʔ͔Β “Arduino” Λબ୒ 2.

    NeoPixelΛબ୒ͯ͠഑ஔ 3. γϛϡϨʔγϣϯΛ։࢝ ࢀߟɿ࣮ࡍͷNeoPixel
  25. eH)fEgHh#b7iRjk7 • ίʔυ (ϓϩάϥϜ/εέον) ͷฤूํ๏ 25 ʮίʔυʯΛΫϦοΫ

  26. eH)fEgHh#b7iRjk7 • 25ߦ໨ͷredColor, greenColor, blueColorΛফͯ͠ 0ʙ255ͷ޷͖ͳ਺ࣈʹॻ͖׵͑ • ॻ͖׵͑ͨΒʮγϛϡϨʔγϣϯΛ։࢝ʯΛΫϦοΫ 26 ͜͜Λॻ͖׵͑

    ྫ͑͹
  27. _la • Liquid Crystal Display (=ӷথσΟεϓϨΠ) ͷུ • ArduinoͷΑ͏ͳϚΠίϯϘʔυͰ৘ใΛදࣔ͢Δوॏͳखஈ •

    16 × 2 (ԣ16จࣈɺॎ2จࣈ) • ഑ઢ͕େม • ελʔλʔʹ഑ઢࡁΈͷ΋ͷ͕͋ΔͷͰɺͦΕΛ࢖͏ͷָ͕ 27 ळ݄ిࢠ௨঎, ̡̘̙ΩϟϥΫλ σΟεϓϨΠϞδϡʔϧɹ̍̒×̎ ߦɹόοΫϥΠτ෇നൈ͖ https://akizukidenshi.com/catalog/g/ gP-02919/ 800ԁ
  28. _la • ελʔλʔ͔ΒʮLCDʯΛબ୒ 28 LCDΛબ୒ͯ͠഑ஔ

  29. _la • ʮίʔυʯˠʮจࣈʯΛબ୒ 29

  30. _la • ʮଓߦʯΛΫϦοΫ 30

  31. _la • දࣔ͢Δจࣈ΍ɺ਺ࣈͷҐஔΛม͑ͯΈ·͠ΐ͏ 31 ͜͜Λॻ͖׵͑ ͜͜΋ॻ͖׵͑ͯΈͯ΋OK

  32. XmnopqrsQ<Q<tRuvU5w7 • ͍ΖΜͳελʔλʔ͕͋ΔͷͰ͍Ζ͍Ζࢼͯ͠Έ·͠ΐ͏ • جຊతʹɺ഑ஔ࣮ͯ͠ߦ͢Δ͚ͩͰಈ͖·͢ • Α͘Θ͔Βͳ͍΋ͷ΋͋Δͱࢥ͍·͕͢ • Իͷग़Δ΋ͷ΋͋ΔͷͰ஫ҙ •

    ͨ͘͞Μ഑ஔ͢Δͱಈ࡞͕ॏ͘ͳΔͷͰɺ࢖͍ऴΘͬͨ෦඼͸ফ͠·͠ΐ͏ (બ୒ͯ͠BackSpaceΩʔ) 32
  33. ?@ABCDE

  34. xyzeH)fEgHh{<=|}~•€ • 3ຊͷ઀ଓ͕ඞཁɿ৴߸ઢɺ5VɺGND • ઀ଓͯ͠૿΍͢͜ͱ͕Ͱ͖Δ • Կݸ·Ͱ઀ଓͰ͖Δʁ → ߋ৽ϨʔτʹΑΔ •

    Tinkercadͩͱ100ݸۙ͘ͳΔͱॏ͘ͳΔ 34 ͜ΕͰ1ݸ 0 1 2 3 4 5 6 7 8 9 10 11 ৴߸͕ྲྀΕΔํ޲ ͭͳ͛ͯ૿΍ͤΔ (ಉ͡छྨͷ୺ࢠΛ઀ଓ) DIN:৴߸ઢೖྗ(Digital IN) 5V GND DO:৴߸ઢग़ྗ(Digital OUT)
  35. •EIB)‚ƒE„ • ଞͷϚΠίϯϘʔυ micro:bitʢϚΠΫϩϏοτʣ΋঺հ͠·͢ • 2015೥ʙ ։ൃ͞Εͨڭҭ༻ϚΠίϯϘʔυ • ΠΪϦεͰখֶੜʹແঈ഑෍͞Εͨ •

    ݱࡏ͸ϚΠΫϩιϑτࡿԼͷϓϩδΣΫτ • 2020೥ʹv2ʹόʔδϣϯΞοϓ • LED 5×5 = 25ݸɺϘλϯ2ݸɺεϐʔΧɺϚΠΫɺ໌Δ͞ηϯαʔɺՃ଎౓ηϯαʔɺ ࣓ྗηϯαʔɺԹ౓ηϯαʔɺແઢ௨৴ػೳʢBLEʣΛ౥ࡌ 35 εΠοναΠΤϯε, micro:bit https://ssci.to/6600 2,200ԁ ※ ൒ಋମෆ଍ͷӨڹͰ ݱࡏࡏݿͳ͠ɺೖՙະఆ
  36. •EIB)‚ƒE„ • Webϒϥ΢βͷ։ൃ؀ڥͰ։ൃ͢Δ • ϒϩοΫɺJavaScriptɺPythonͰ։ൃ • ͲͷίʔυͰॻ͍ͯ΋ޓ׵ੑ͕͋Δʢม׵Մೳʣ • ։ൃ؀ڥʹγϛϡϨʔλ͕෇ଐ͢Δ 36

  37. pq#…† 37 εΠοναΠΤϯε, ArduinoΛ͸͡ ΊΑ͏Ωοτ https://ssci.to/181 4,400ԁ εΠοναΠΤϯε, The Arduino

    Starter Kitʢ೔ຊޠ൛ʣ https://ssci.to/2628 12,731ԁ εΠοναΠΤϯε, M5GO IoTε λʔλʔΩοτ V2.6 https://ssci.to/7363 9,845ԁ • ΋ͬͱֶͼ͍ͨਓ͸ɺͥͻ࣮ػΛߪೖͯ͠Έ͍ͯͩ͘͞ • ࠷ॳ͸Ωοτ͕͓͢͢ΊͰ͢ • Arduino୯ମͩͱ΄ͱΜͲԿ΋Ͱ͖ͳ͍ • ύʔπબͼ͕೉͍͠
  38. s?‡ˆ‰?Š:s • ΩοτɺϚΠίϯɺNeoPixelɺߴՁ֨ଳηϯα(¥1,000Ҏ্)౳ 38

  39. ‹Œ•Ž•• • ௿Ձ֨ଳ෦඼(఍߅ɺLEDɺεΠονɺIC)ɺܭଌػث౳ • ळ༿ݪʹ࣮ళฮ͕͋Γ·͢ 39

  40. ‘’“” • ࡳຈʢ୪খ࿏̓ஸ໨ʣʹ͋ΔͷͰɺ࣮ػΛݟͨΓ ͙͢ʹങ͍ʹߦ͖͔ͨͬͨΒ͜͜ 40

  41. •–—˜ 41 ౻ݪຑཬࡊ, ແବͳϚγʔϯ Λൃ໌͠Α͏! (2021) Ϊϟϧి, Ϊϟϧిͱͭ͘Δ! όΠϒεςϯΞήαΠόʔύϯΫ ޫΓ෺ిࢠ޻࡞

    (2021) ArduinoΛ͸͡ΊΑ͏ ୈ3൛ (2015)
  42. •–*™E„„HB 42 @shiropen2 @make_jp @fabcrossjp

  43. •–š)D*DƒHˆ›:œ• 43 Πνέϯ ແବͮ͘Γ

  44. žŸ ¡ • ͍ΖΜͳઌੜ͕͍ΖΜͳݚڀΛ͍ͯ͠·͢ • ๺ւಓ৘ใେֶ΍ͦͷଞͷେֶͷWebαΠτΛௐ΂ͯΈ͍ͯͩ͘͞ 44 ,-./.012 -./.41,5"67"8"519:1;:7<