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

MORE FUN WITH HARDWARE AND CIRCUITPYTHON - IOT, WEARABLES, AND MORE!

MORE FUN WITH HARDWARE AND CIRCUITPYTHON - IOT, WEARABLES, AND MORE!

PyCon US 2021 Remote

Learn about programming hardware with Python and advanced uses of CircuitPython by walking through exciting demos of real-world projects in action. Advanced components like buttons, sensors, and screens bump up the fun and the interactivity of your project. Level-up your hardware skills in this fast-paced talk!

CircuitPython is the education-friendly fork of MicroPython that's been steadily rising in popularity as new releases increase stability, reliability, and speed. CircuitPython allows Python enthusiasts to quickly learn about hardware projects without having to learn something completely brand new. Given the rise in popularity, the Python community is quickly becoming familiar with the basics of CircuitPython. In fact, all attendees of PyCon US in 2019 were given a CircuitPython-compatible CircuitPlayground Express device with LEDs, speakers, sensors, and more, all usable without the need of learning to solder.

If you're interested in doing more with hardware, this talk will point you in the right direction of where to go next. We'll start with choosing the right device for the scope of your project. Next, we'll scratch the surface of working with electronics -- what's a circuit? What are good resources for learning to solder? Lastly, I'll cover topics such as IoT, wearables, and adding interactivity to your projects with sensors, buttons, and switches with live demos of real-world projects I've created, along with sharing the build process and code for each.

Viewers will finish the talk feeling confident about continuing their hardware journey across a range of project types.

Nina Zakharenko

May 15, 2021
Tweet

More Decks by Nina Zakharenko

Other Decks in Technology

Transcript

  1. ---
    NINA ZAKHARENKO
    ---
    MORE FUN WITH
    CIRCUITPYTHON
    ---
    IOT, WEARABLES, & MORE!
    ---
    @NNJA
    nina.to/pycon2021

    View Slide

  2. @NNJA
    NNJA.IO
    @NNJAIO
    nina.to/pycon2021

    View Slide

  3. WHY PYTHON
    ON HARDWARE?
    @nnja • nina.to/pycon2021

    View Slide

  4. WHY CIRCUITPYTHON?
    ‣python variant for
    microcontrollers
    ‣education friendly
    ‣open source!

    !
    awesome community
    !

    View Slide

  5. GO BEYOND THE BASICS
    *tip: watch Light Up Your Life,
    With Python and LEDs
    nina.to/pycon2019
    @nnja • nina.to/pycon2021

    View Slide

  6. NEXT TOPICS
    ‣ Wearables
    ‣ Interactivity -
    Sensors, Screens,
    Graphics
    ‣ Bluetooth
    connectivity
    ‣ Internet of Things
    (IoT)

    @nnja • nina.to/pycon2021

    View Slide

  7. CHOOSING A DEVICE & COMPONENTS
    ‣ IoT? -> Need Wifi
    ‣ Sensors?
    ‣ Size (for
    wearables)
    ‣ Raspberry Pi
    ‣ Soldering needed?

    @nnja • nina.to/pycon2021

    View Slide

  8. CONCEPTS
    @nnja • nina.to/pycon2021

    View Slide

  9. LEARN ABOUT ELECTRONICS
    ‣ Basic concepts
    ‣ Units of measurement
    ‣ Circuits
    ‣ Voltage, Current,
    Resistance and Ohm’s
    Law
    High-level overview:
    SparkFun engineering
    essentials

    View Slide

  10. CIRCUIT BASICS
    Source: SparkFun Engineering Essentials

    View Slide

  11. IPHONE / IPAD APP
    ICIRCUIT 3D
    (COST: $15)

    View Slide

  12. BREADBOARDS
    ‣A no-solder way to connect
    components
    ‣use jumper wires


    reuse components


    prototype & test the
    circuit
    ‣components need leads (can
    buy some pre-attached)
    ‣use fritzing app to diagram
    How to Breadboard Video,
    Sparkfun Breadboard Guide

    View Slide

  13. SOLDERING GUIDES
    ‣Soldering is Easy
    Comic Book (Free)
    ‣Adafruit in-depth
    Guide

    Follow safety
    precautions!

    View Slide

  14. ADD INTERACTIVITY
    ‣ Buttons
    ‣ Potentiometers
    (knobs)
    ‣ Switches
    ‣ Sensors
    (temperature, air
    quality, sound,
    lots more!)

    @nnja • nina.to/pycon2021

    View Slide

  15. ADD CONNECTIVITY
    ‣ WiFi enabled
    ‣ Bluetooth
    ‣ Radio
    ‣ API calls
    ‣ Triggers

    @nnja • nina.to/pycon2021

    View Slide

  16. PROJECTS!
    @nnja • nina.to/pycon2021

    View Slide

  17. SOCIAL BATTERY LED LANYARD
    ‣ Select a social
    battery from the
    touch screen
    menu
    ‣ LEDs change
    color, depending
    on selection.

    @nnja • nina.to/pycon2021

    View Slide

  18. while True:
    touch = pyportal.touchscreen.touch_point
    if touch:
    for button in buttons:
    if button.contains(touch):
    if button.name in status_backgrounds:
    back_button_group.hidden = False
    button_group.hidden = True
    social_status_label.hidden = True
    pyportal.set_background(status_backgrounds[button.name])
    pixel_pattern.color = button.fill_color
    git.io/socialbattery

    View Slide

  19. BLUETOOTH
    CONTROLLED LED
    JACKET
    ‣Based on a design by
    Sophy Wong
    ‣Change colors,
    patterns, & more from
    my phone or watch!
    ‣nRF52 Feather +
    battery in small
    package
    @nnja • nina.to/pycon2021

    View Slide

  20. DEMO
    @nnja • nina.to/pycon2021

    View Slide

  21. ble = BLERadio()
    uart_service = UARTService()
    advertisement = ProvideServicesAdvertisement(uart_service)
    while True:
    ble.start_advertising(advertisement)
    while ble.connected:
    animation_sequence.animate()
    if uart_service.in_waiting: # Get a Bluetooth Packet if one is sent
    packet = Packet.from_stream(uart_service)
    if isinstance(packet, ColorPacket):
    selected_color = packet.color
    if isinstance(packet, ButtonPacket):
    if packet.pressed:
    if packet.button == ButtonPacket.RIGHT:
    animation_sequence.next()
    print(
    "Selecting next animation: ",
    animation_sequence.current_animation.__class__.__name__,
    )
    code: git.io/ledjacket

    View Slide

  22. IoT Projects: IoT weather station (Brent Rubell) & PyPortal
    Azure IoT Guide

    View Slide

  23. RESOURCES
    @nnja • nina.to/pycon2021

    View Slide

  24. FOLLOW AWESOME
    MAKERS
    Odd Jayy
    Becky Stern
    Sophy Wong
    Geek Mom Projects
    Stargirl Flowers
    Noé Ruiz & Pedro Ruiz
    & so many more!

    View Slide

  25. GEEK MOM PROJECTS @ PYCASCADES 2021
    link: watch on YouTube

    View Slide

  26. PROGRAMMABLE LED
    BAGS
    ‣by Geek Mom Projects /
    BrightWearables
    ‣supports microbit +
    MicroPython
    ‣or Adafruit CLUE +
    CircuitPython (with
    Bluetooth!)
    ‣transparent window for
    display
    @nnja • nina.to/pycon2021

    View Slide

  27. GUIDES / HELP
    ‣ Instructables
    ‣ Sparkfun
    ‣ Adafruit Learn
    Guides
    ‣ Adafruit Discord
    (CircuitPython
    Channel)
    ‣ Hackaday (advanced)

    @nnja • nina.to/pycon2021

    View Slide

  28. THANKS!
    @NNJA
    @NNJAIO
    SLIDES:
    nina.to/pycon2021
    PYTHON @ MICROSOFT:
    nina.to/ms-pycon2021

    View Slide

  29. CREDITS
    ‣ Twitch icon and Twitter icon
    icon by Icons8
    ‣ Photo by Stephen Kong on
    Unsplash
    @nnja • nina.to/pycon2021

    View Slide