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

北䑓如法
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 -

北䑓如法

September 11, 2021
Tweet

More Decks by 北䑓如法

Other Decks in Technology

Transcript

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  10. ιϑτ΢ΣΞ
    PROGRAM
    Θ͠

    View full-size slide

  11. ιϑτ΢ΣΞ
    PROGRAM
    Θ͠

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  16. ੢ຊ͞Μ͔Β՝୊Λग़ͯ͠΋Β͍ͬͯΔ༷ࢠ
    - Nyoho: ॳ৺ऀೖ໳޲͚ͱͯ͜͠ͷลΛങͬͯ΍ͬͱ͍ͯ͘Εͱ
    ͍͏՝୊ΛͿͬࠐΜͰ͍ͩ͘͞
    - nishimotz: ͡Ό͋ Raspberry Pi Pico Ͱ LνΧ Λ࠷ॳͷ໨ඪʹ͠
    ·͠ΐ͏͔ɻ͍҆͠ྲྀߦͬͯΔٕ͠దͷ৺഑͕ͳ͍͠

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  20. ങͬͨ΋ͷ
    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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  25. ͍Α͍Αͭͳ͛Δ

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  30. ιϑτ΢ΣΞ͸
    .JDSP1ZUIPO

    View full-size slide

  31. -
    ιϑτ΢ΣΞ͸MicroPython
    -
    ύιίϯʹ Thonny ͱ͍͏ΞϓϦΛೖΕΔ →→
    - Raspberry Pi Pico ͱ ύιίϯʹUSBͰͭͳ͙ɻ
    - Thonny ͔ΒίʔυΛॻ͍࣮ͯߦ
    ιϑτ΢ΣΞ෦෼
    Raspberry Pi Pico
    ύιίϯͷUSB
    ϓϩάϥϜΛೖΕΔ

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  34. - 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)
    ...
    ←)[ͷύϧεʹઃఆͯ͋͠Δ

    View full-size slide

  35. δϟΠϩɾՃ଎౓ηϯα
    Λͭͳ͍ͰΈͨ

    View full-size slide

  36. -
    ग़͢஋͸Ξφϩά৴߸ɺిѹͱͯ͠ग़ͯ͘Δ
    -
    Ξφϩάσδλϧม׵ϙʔτ (ADC) ʹͭͳ͙
    - Raspberry Pi Pico ͸ʮ3ϙʔτʯ૷උ
    δϟΠϩɾՃ଎౓ηϯαΛͭͳ͍ͰΈͨ

    View full-size slide

  37. "͜ΕΛ࢖͑͹ʜʜ

    View full-size slide

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

    View full-size slide

  39. ϒϥϯίͷڧԽֶश

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  42. ʊਓਓਓਓʊ
    ʼɹໟࢳɹʻ
    ʉ̮̮̮̮ʉ

    View full-size slide

  43. ʊਓਓਓʊ
    ʼɹຊɹʻ
    ʉ̮̮̮ʉ

    View full-size slide

  44. ʊਓਓਓਓਓʊ
    ʼɹׂΓṟɹʻ
    ʉ̮̮̮̮̮ʉ

    View full-size slide

  45. ʊਓਓਓਓਓਓʊ
    ʼɹख๓͍ࢳɹʻ
    ʉ̮̮̮̮̮̮ʉ

    View full-size slide

  46. ʊਓਓਓਓਓʊ
    ʼɹςʔϓɹʻ
    ʉ̮̮̮̮̮ʉ

    View full-size slide

  47. ʊਓਓਓਓਓਓਓʊ
    ʼɹ୯ͳΔॏΓɹʻ
    ʉ̮̮̮̮̮̮̮ʉ

    View full-size slide

  48. ࣠Ճ଎౓
    ηϯα

    View full-size slide

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

    View full-size slide

  50. ڧԽֶश
    ΏΕΛֶश

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  54. -ͦΕͳΓʹֶश͢Δ!
    -Qֶशͱݺ͹ΕΔํ๏Λ࣮૷
    - 3࣠Ճ଎౓ηϯαͷ஋ (x,y,z) Λঢ়ଶͱ͢Δ
    -
    ӈʹ༳Β͔͢ɺࠨʹ༳Β͔͢ͷߦಈΛαʔϘϞʔλΛ੍ޚ
    -
    େ͖͍ΏΕʹใुΛ༩͑Δ
    -300ճ(Τϐιʔυ)͙Β͍΍Δͱ݁ߏେ͖͘
    ϒϥϯίͷڧԽֶश

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  57. Θ͠
    ϋʔυ΢ΣΞ ιϑτ΢ΣΞ
    CPU ϝϞϦ
    Ճ଎౓ηϯα
    GPS
    δϟΠϩηϯα
    εΫϦʔϯ
    GPU
    όε
    Networking Χϝϥ
    ؾѹܭ
    ۙ઀ηϯα
    όε όε όε
    PROGRAM
    \\ ͪΐͬͱΘ͔Δ //
    Raspberry Pi Pico

    View full-size slide

  58. ࣗ෼ͷͰ͖Δ͜ͱ
    ͕޿͕ͬͨͷΛײͨ͡
    ͸͖ͬΓ
    https://unsplash.com/photos/3WMjImq5syU

    View full-size slide