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

初心者、電子工作に入門。 Python Charity Talks 2021.09 / A beginner started electronic handicraft - Python Charity Talks 2021.09

853cd87b5c317b8c16b0e78c2efbf8d1?s=47 北䑓如法
September 11, 2021

初心者、電子工作に入門。 Python Charity Talks 2021.09 / A beginner started electronic handicraft - Python Charity Talks 2021.09

Python Charity Talks in Japan 2021.09 https://pyconjp.connpass.com/event/218154/
で「すごい広島 with Python」チームの発表の中で
電子工作初心者のわしが電子工作に入門したことを説明したものです。

Python Charity Talks / A beginner started electronic handicraft -

853cd87b5c317b8c16b0e78c2efbf8d1?s=128

北䑓如法

September 11, 2021
Tweet

Transcript

  1. Nyoho @ Python Charity Talks 2021 ॳ৺ऀ/ZPIPɺ ిࢠ޻࡞ʹೖ໳ɻ

  2. - ๺㝳೗๏ (͖͍ͨͩΏ͖ͷΓ) - ೔༵ϓϩάϥϚ (झຯϓϩάϥϚ) - ిࢠ޻࡞ॳ৺ऀ ͋Μͨ͊୭ͳΜ

  3. ిࢠ޻࡞ ͳΜ΋Θ͔ΒΜ

  4. Ͱ΋ɺͣͬͱʜʜ ిࢠ޻࡞΍ͬͯΈ͔ͨͬͨ

  5. <ిࢠ޻࡞ͳΜ΋Θ͔ΒΜ>ͷ಺༁

  6. <ిࢠ޻࡞ͳΜ΋Θ͔ΒΜ>ͷ಺༁ ԿΛങ͑͹͍͍ͷ

  7. <ిࢠ޻࡞ͳΜ΋Θ͔ΒΜ>ͷ಺༁ ԿΛങ͑͹͍͍ͷ Ͳ͏ͭͳ͛͹

  8. <ిࢠ޻࡞ͳΜ΋Θ͔ΒΜ>ͷ಺༁ ԿΛങ͑͹͍͍ͷ Ͳ͏ͭͳ͛͹ ϓϩάϥϜ͸Ͳ͏ॻ͘ͷ

  9. <ిࢠ޻࡞ͳΜ΋Θ͔ΒΜ>ͷ಺༁ ←ͦΕ͸ɺ·͋Θ͔Δ ԿΛങ͑͹͍͍ͷ Ͳ͏ͭͳ͛͹ ϓϩάϥϜ͸Ͳ͏ॻ͘ͷ

  10. Θ͠

  11. ιϑτ΢ΣΞ PROGRAM Θ͠

  12. ιϑτ΢ΣΞ PROGRAM Θ͠

  13. ιϑτ΢ΣΞ PROGRAM ϋʔυ΢ΣΞ CPU ϝϞϦ Ճ଎౓ηϯα GPS δϟΠϩηϯα εΫϦʔϯ GPU

    όε Networking Χϝϥ ؾѹܭ ۙ઀ηϯα όε όε όε ྫ͑͹J1IPOFΞϓϦ͸ॻ͚Δ͕ʜʜ Θ͠
  14. ιϑτ΢ΣΞ PROGRAM ϋʔυ΢ΣΞ CPU ϝϞϦ Ճ଎౓ηϯα GPS δϟΠϩηϯα εΫϦʔϯ GPU

    όε Networking Χϝϥ ؾѹܭ ۙ઀ηϯα όε όε όε ྫ͑͹J1IPOFΞϓϦ͸ॻ͚Δ͕ʜʜ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Θ͠
  15. <ిࢠ޻࡞ͳΜ΋Θ͔ΒΜ>ͷ಺༁ ԿΛങ͑͹͍͍ͷ Ͳ͏ͭͳ͛͹ ϓϩάϥϜ͸Ͳ͏ॻ͘ͷ 済

  16. <ిࢠ޻࡞ͳΜ΋Θ͔ΒΜ>ͷ಺༁ ԿΛങ͑͹͍͍ͷ Ͳ͏ͭͳ͛͹ ϓϩάϥϜ͸Ͳ͏ॻ͘ͷ 済 ੢ຊ͞Μʹ ՝୊Λ ग़ͯ͠΋Β͏!

  17. ੢ຊ͞Μ͔Β՝୊Λग़ͯ͠΋Β͍ͬͯΔ༷ࢠ - Nyoho: ॳ৺ऀೖ໳޲͚ͱͯ͜͠ͷลΛങͬͯ΍ͬͱ͍ͯ͘Εͱ ͍͏՝୊ΛͿͬࠐΜͰ͍ͩ͘͞ - nishimotz: ͡Ό͋ Raspberry Pi

    Pico Ͱ LνΧ Λ࠷ॳͷ໨ඪʹ͠ ·͠ΐ͏͔ɻ͍҆͠ྲྀߦͬͯΔٕ͠దͷ৺഑͕ͳ͍͠
  18. ͞ΒʹԿΛങ͏͔૬ஊ

  19. ͞ΒʹԿΛങ͏͔૬ஊ

  20. ͞ΒʹԿΛങ͏͔૬ஊ

  21. ങͬͨ΋ͷ 1.ʲI-11396ʳRGBΠϧϛωʔγϣϯϑϧΧϥʔLED OST1MA58K1B Ձ֨:ˇ40 × ਺ྔ:1 = ߹ܭ:ˇ40 2.ʲI-12167ʳRGBϑϧΧϥʔLED 5mm

    OSTAMA5B31A ΞϊʔυίϞϯ Ձ֨:ˇ50 × ਺ྔ:1 = ߹ܭ:ˇ50 3.ʲI-11577ʳ3mm੺৭LED 625nm 70౓ OSR5JA3Z74A Ձ֨:ˇ10 × ਺ྔ:5 = ߹ܭ:ˇ50 4.ʲI-11578ʳ3mm੨৭LED 470nm 70° OSB5YU3Z74A Ձ֨:ˇ20 × ਺ྔ:4 = ߹ܭ:ˇ80 5.ʲI-11637ʳ3mmԫ྘৭LED 570nm 70౓ OSG8HA3Z74A Ձ֨:ˇ10 × ਺ྔ:5 = ߹ܭ:ˇ50 6.ʲI-09851ʳ3mmന৭LED LEBWL34A06AA00 Ձ֨:ˇ10 × ਺ྔ:5 = ߹ܭ:ˇ50 7.ʲI-11639ʳ3mmԫ৭LED 590nm 70౓ OSY5JA3Z74A Ձ֨:ˇ20 × ਺ྔ:3 = ߹ܭ:ˇ60 8.ʲI-12605ʳ5mm੺৭LED 625nm OSR5JA5E34B Ձ֨:ˇ10 × ਺ྔ:5 = ߹ܭ:ˇ50 9.ʲI-11985ʳ5mm੨྘৭LED 505nm OSBG5111A Ձ֨:ˇ20 × ਺ྔ:1 = ߹ܭ:ˇ20 10.ʲR-25101ʳΧʔϘϯ఍߅(୸ૉൽບ఍߅) 1/4W100Ω (100ຊೖ) Ձ֨:ˇ100 × ਺ྔ:1 = ߹ܭ:ˇ100 (1ାͷ৔߹͸ˇ100ԁ/2ାҎ্ͷ৔߹͸୯Ձˇ90ԁ) 11.ʲR-25181ʳΧʔϘϯ఍߅(୸ૉൽບ఍߅) 1/4W180Ω (100ຊೖ) Ձ֨:ˇ100 × ਺ྔ:1 = ߹ܭ:ˇ100 (1ାͷ৔߹͸ˇ100ԁ/2ାҎ্ͷ৔߹͸୯Ձˇ90ԁ) 12.ʲR-25221ʳΧʔϘϯ఍߅(୸ૉൽບ఍߅) 1/4W220Ω (100ຊೖ) Ձ֨:ˇ100 × ਺ྔ:1 = ߹ܭ:ˇ100 (1ାͷ৔߹͸ˇ100ԁ/2ାҎ্ͷ৔߹͸୯Ձˇ90ԁ) 13.ʲR-25331ʳΧʔϘϯ఍߅(୸ૉൽບ఍߅) 1/4W330Ω (100ຊೖ) Ձ֨:ˇ100 × ਺ྔ:1 = ߹ܭ:ˇ100 (1ାͷ৔߹͸ˇ100ԁ/2ାҎ্ͷ৔߹͸୯Ձˇ90ԁ) 14.ʲR-25102ʳΧʔϘϯ఍߅(୸ૉൽບ఍߅) 1/4W1kΩ (100ຊೖ) Ձ֨:ˇ100 × ਺ྔ:1 = ߹ܭ:ˇ100 (1ାͷ৔߹͸ˇ100ԁ/2ାҎ্ͷ৔߹͸୯Ձˇ90ԁ) 15.ʲP-00327ʳి஑ϘοΫε ୯3×2ຊ ϦʔυઢɾεΠον෇ Ձ֨:ˇ70 × ਺ྔ:1 = ߹ܭ:ˇ70 16.ʲI-05886ʳCdSηϧ(1MΩ)GL5528(4ݸೖ) Ձ֨:ˇ100 × ਺ྔ:1 = ߹ܭ:ˇ100 17.ʲT-03639ʳ͸Μͩٵऔث GS-108 Ձ֨:ˇ1,100 × ਺ྔ:1 = ߹ܭ:ˇ1,100 18.ʲT-02537ʳ͸Μͩͯ͜୆ ST-11 Ձ֨:ˇ730 × ਺ྔ:1 = ߹ܭ:ˇ730 19.ʲP-12031ʳ0.96Πϯν 128×64υοτ༗ػELσΟεϓϨΠ(OLED) ന৭ Ձ֨:ˇ580 × ਺ྔ:1 = ߹ܭ:ˇ580 20.ʲP-14435ʳ༗ػELσΟεϓϨΠ 0.95Πϯν 96×64υοτ RGB Ձ֨:ˇ1,280 × ਺ྔ:1 = ߹ܭ:ˇ1,280 21.ʲC-04398ʳࡉϐϯϔομ 1×20 Ձ֨:ˇ20 × ਺ྔ:5 = ߹ܭ:ˇ100 (1ݸͷ৔߹͸ˇ20ԁ/10ݸҎ্ͷ৔߹͸୯Ձˇ18ԁ) 22.ʲT-14456ʳ͸Μͩͯ͝ FX600-02 Ձ֨:ˇ4,200 × ਺ྔ:1 = ߹ܭ:ˇ4,200 23.ʲC-05159ʳϒϨουϘʔυɾδϟϯύʔϫΠϠ(Φε-Φε)ηοτ ֤छ ߹ܭ60ຊҎ্ Ձ֨:ˇ220 × ਺ྔ:1 = ߹ܭ:ˇ220 24.ʲK-15232ʳKXTC9-2050࢖༻3࣠Ճ଎౓ηϯαϞδϡʔϧ Ձ֨:ˇ500 × ਺ྔ:1 = ߹ܭ:ˇ500 25.ʲK-04912ʳখܕѹిৼಈδϟΠϩϞδϡʔϧ Ձ֨:ˇ400 × ਺ྔ:1 = ߹ܭ:ˇ400 26.ʲM-08761ʳϚΠΫϩαʔϘ9g SG-90 Ձ֨:ˇ400 × ਺ྔ:1 = ߹ܭ:ˇ400 27.ʲP-05155ʳϛχϒϨουϘʔυ BB-601(ന) Ձ֨:ˇ130 × ਺ྔ:1 = ߹ܭ:ˇ130 (1ݸͷ৔߹͸ˇ130ԁ/2ݸҎ্ͷ৔߹͸୯Ձˇ120ԁ) 28.ʲP-00315ʳϒϨουϘʔυ EIC-801 Ձ֨:ˇ270 × ਺ྔ:1 = ߹ܭ:ˇ270 29.ʲK-16149ʳRaspberry Pi Pico ϕʔγοΫηοτ Ձ֨:ˇ730 × ਺ྔ:1 = ߹ܭ:ˇ730
  22. ಧ͍ͨʙ̇

  23. ͋Γ͕ͱ͏ 1Z$PO޿ౡ4MBDL

  24. ·ͣ͸Μͩ෇͚ ὑॳΊͯͷ͸Μͩ෇͚ὑ

  25. ·ͣ͸Μͩ෇͚ 3BTQCFSSZ1J1JDPʹ ϐϯϔομΛ͸Μͩ෇͚

  26. ·ͣ͸Μͩ෇͚ 3BTQCFSSZ1J1JDPʹ ϐϯϔομΛ͸Μͩ෇͚ ˛ϒϨουϘʔυ ˛͸Μͩͯ͝ ˝ͯ͜୆ ˛ϒϨουϘʔυ ˛͸Μͩ ˡ3BTQCFSSZ1J1JDP ˝δϟΠϩ

  27. None
  28. ͍Α͍Αͭͳ͛Δ

  29. ࡞ྫͷαΠτΛ͍ͬͺ͍ ڭ͑ͯ΋Β͏

  30. !͋Γ͕ͱ͏! !1Z$PO޿ౡ4MBDL!

  31. αʔϘϞʔλͱ ͭͳ͍ͰΈͨ

  32. ͭͳ͔͗ͨ GPIO 0 GND VBUS αʔϘϞʔλ SG-90

  33. ιϑτ΢ΣΞ͸ .JDSP1ZUIPO

  34. - ιϑτ΢ΣΞ͸MicroPython - ύιίϯʹ Thonny ͱ͍͏ΞϓϦΛೖΕΔ →→ - Raspberry Pi

    Pico ͱ ύιίϯʹUSBͰͭͳ͙ɻ - Thonny ͔ΒίʔυΛॻ͍࣮ͯߦ ιϑτ΢ΣΞ෦෼ Raspberry Pi Pico ύιίϯͷUSB ϓϩάϥϜΛೖΕΔ
  35. Ξοϓϩʔυ஫: ͜͜͸ಈը͕ྲྀΕ͍ͯͨͱ఻Θ͍ͬͯΔɻ

  36. Ξοϓϩʔυ஫: ͜͜͸ಈը͕ྲྀΕ͍ͯͨͱ఻Θ͍ͬͯΔɻ

  37. ָثͰ͖ͨ

  38. - GPIO (general purpose input/output) - ͜ͷαʔϘϞʔλ͸ύϧε৴߸Λड͚ͯɺ֯౓ΛมԽͤ͞Δ αʔϘ͸(1*0ʹܨ͍Ͱ੍ޚ from machine

    import PWM, Pin import utime servo = PWM(Pin(0)) servo.freq(50) max_duty = 65025 deg_m90 = 0.025 # -90 deg deg_0 = 0.0725 # 0 deg deg_p90 = 0.12 # +90 deg def rot(deg): servo.duty_u16(int(max_duty*((deg/90.0)*(deg_p90-deg_0)+deg_0))) while True: rot(0.0) utime.sleep(0.5) rot(-40.0) ... ←)[ͷύϧεʹઃఆͯ͋͠Δ
  39. δϟΠϩɾՃ଎౓ηϯα Λͭͳ͍ͰΈͨ

  40. - ग़͢஋͸Ξφϩά৴߸ɺిѹͱͯ͠ग़ͯ͘Δ - Ξφϩάσδλϧม׵ϙʔτ (ADC) ʹͭͳ͙ - Raspberry Pi Pico

    ͸ʮ3ϙʔτʯ૷උ δϟΠϩɾՃ଎౓ηϯαΛͭͳ͍ͰΈͨ
  41. "͜ΕΛ࢖͑͹ʜʜ

  42. #ڧԽֶशͰ͖Δͷ Ͱ͸

  43. ϒϥϯίͷڧԽֶश

  44. Ξοϓϩʔυ஫: ͜͜͸ಈը͕ྲྀΕ͍ͯͨͱ఻Θ͍ͬͯΔɻ

  45. Ξοϓϩʔυ஫: ͜͜͸ಈը͕ྲྀΕ͍ͯͨͱ఻Θ͍ͬͯΔɻ

  46. None
  47. None
  48. ʊਓਓਓਓʊ ʼɹໟࢳɹʻ ʉ̮̮̮̮ʉ

  49. None
  50. None
  51. ʊਓਓਓʊ ʼɹຊɹʻ ʉ̮̮̮ʉ

  52. None
  53. ʊਓਓਓਓਓʊ ʼɹׂΓṟɹʻ ʉ̮̮̮̮̮ʉ

  54. None
  55. None
  56. ʊਓਓਓਓਓਓʊ ʼɹख๓͍ࢳɹʻ ʉ̮̮̮̮̮̮ʉ

  57. None
  58. ʊਓਓਓਓਓʊ ʼɹςʔϓɹʻ ʉ̮̮̮̮̮ʉ

  59. None
  60. ʊਓਓਓਓਓਓਓʊ ʼɹ୯ͳΔॏΓɹʻ ʉ̮̮̮̮̮̮̮ʉ

  61. None
  62. ࣠Ճ଎౓ ηϯα

  63. αʔϘϞʔλͰΏΒ͢

  64. ڧԽֶश ΏΕΛֶश

  65. Ξοϓϩʔυ஫: ͜͜͸ಈը͕ྲྀΕ͍ͯͨͱ఻Θ͍ͬͯΔɻ

  66. Ξοϓϩʔυ஫: ͜͜͸ಈը͕ྲྀΕ͍ͯͨͱ఻Θ͍ͬͯΔɻ

  67. ͩΜͩΜֶशͯ͠େ͖ͳΏΕʹ Ξοϓϩʔυ஫: ͜͜͸ಈը͕ྲྀΕ͍ͯͨͱ఻Θ͍ͬͯΔɻ

  68. -ͦΕͳΓʹֶश͢Δ! -Qֶशͱݺ͹ΕΔํ๏Λ࣮૷ - 3࣠Ճ଎౓ηϯαͷ஋ (x,y,z) Λঢ়ଶͱ͢Δ - ӈʹ༳Β͔͢ɺࠨʹ༳Β͔͢ͷߦಈΛαʔϘϞʔλΛ੍ޚ - େ͖͍ΏΕʹใुΛ༩͑Δ

    -300ճ(Τϐιʔυ)͙Β͍΍Δͱ݁ߏେ͖͘ ϒϥϯίͷڧԽֶश
  69. ͓΋͠Ζ͍

  70. ͜ͷ͓΋͠Ζ͞͸ʜʜ

  71. Θ͠ ϋʔυ΢ΣΞ ιϑτ΢ΣΞ CPU ϝϞϦ Ճ଎౓ηϯα GPS δϟΠϩηϯα εΫϦʔϯ GPU

    όε Networking Χϝϥ ؾѹܭ ۙ઀ηϯα όε όε όε PROGRAM
  72. Θ͠ ϋʔυ΢ΣΞ ιϑτ΢ΣΞ CPU ϝϞϦ Ճ଎౓ηϯα GPS δϟΠϩηϯα εΫϦʔϯ GPU

    όε Networking Χϝϥ ؾѹܭ ۙ઀ηϯα όε όε όε PROGRAM \\ ͪΐͬͱΘ͔Δ // Raspberry Pi Pico
  73. ࣗ෼ͷͰ͖Δ͜ͱ ͕޿͕ͬͨͷΛײͨ͡ ͸͖ͬΓ https://unsplash.com/photos/3WMjImq5syU