• Skip to main content
  • Shop
  • Learn
  • Blog
  • Forums
  • IO
  • LIVE!
  • AdaBox
Adafruit Logo
0
  • Sign In | Create Account
  • Playground
  • Shop
  • Learn
  • Blog
  • Forums
  • IO
  • LIVE!
  • AdaBox
Sign In
0
Adafruit Logo
  • Learn Categories
    • 3D Printing
    • AdaBox
    • Adafruit Products
    • Arduino Compatibles
    • Breakout Boards
    • Circuit Playground
    • CircuitPython
    • CLUE
    • Community Support
    • Components
    • Crickit
    • Customer & Partner Projects
    • Development Boards
    • Educators
    • EL Wire/Tape/Panel
    • Feather
    • Gaming
    • Hacks
    • Internet of Things - IOT
    • LCDs & Displays
    • LEDs
    • Machine Learning
    • MakeCode
    • Maker Business
    • micro:bit
    • Microcontrollers
    • Programming
    • Raspberry Pi
    • Robotics & CNC
    • Sensors
    • STEMMA
    • Tools
    • Trellis
    • Wearables
    Explore, Groups to get your gears turning
    Explore
    Groups to get your gears turning
    Explore Groups
  • New Guides
  • Playground
justmobilize Notes

justmobilize

u/justmobilize
Badges
2

Getting Started

Adafruit Playground is a wonderful and safe place to share your interests with Adafruit's vibrant community of makers and doers. Have a cool project you are working on? Have a bit of code that you think others will find useful? Want to show off your electronics workbench? You have come to the right place.

The goal of Adafruit Playground is to make it as simple as possible to share your work. On the Adafruit Playground users can create Notes. A note is a single-page space where you can document your topic using Adafruit's easy-to-use editor. Notes are like Guides on the Adafruit Learning System but guides are high-fidelity content curated and maintained by Adafuit. Notes are whatever you want them to be. Have fun and be kind.

Click here to learn more about Adafruit Playground and how to get started.

  • By justmobilize

    SocketPoolLogger

    Have you ever needed to troubleshoot why you are having issues with your MCU and the internet? Ever been curious how internet requests work? Well this might get you a little closer.

    Introducing: SocketPoolLogger

    What is SocketPoolLogger? it's a little class, that allows you to log everything that happens with a socket.

    And instead of the normal message we get from the response.text, we get all of this:

    Save
  • By justmobilize

    Get Radio

    I've been spending a bunch of time testing code across different MCUs and networking chips. It started with my work with Connection Manager. Then I was digging into Requests and MiniMQTT . Which of course lead me to places like NTP, AzureIoT and AWS_IOT.

    As I jumped around, I needed a way to always get the right radio. Sometimes it's native WiFi, which is easy: wifi.raidio, but other times, it's some SPI based FeatherWing or maybe a M4 with and AirLift (talking to you PyPortal and MatrixPortal M4)...

    Introducing: get_radio

    It's not perfect, and I'm guessing there are things I haven't thought of, but it works for me so far.

    The only thing a normal developer, with the right libraries installed and only one radio needs to do is:

    The nice thing is it will connect for you and everything! Store your creds as WIFI_SSID? Got you covered. What about CIRCUITPY_WIFI_SSID? Got you covered there too. What about in secrets.py? Sadly not there, settings.toml is the way to go.

    Now let's say you aren't using a FeatherWing, or you are connecting things to different pins? Well your set there too!

    Save
  • By justmobilize

    Adafruit Connection Manager

    What is the Adafruit Connection Manager? It is a helper class designed around making connections to the internet easier and does this by simplifying a few things.

    First, what are the underlying pieces we need to connect to the internet?

    Sockets

    Everything that connects to the internet needs a socket. A socket is what handles the basic sending and receiving of messages between 2 devices (like your microcontroller and a web API).

    Microcontrollers, unlike desktop computers, have limited memory and can't have 100s of sockets open. The average chip can have maybe 2-3 and the bigger ones top out around 10.

    Previously the sockets were controlled at a per library level. Meaning if you used adafruit_requests (to get info from the web) and adafruit_minimqtt (to send something to AdafruitIO) they both managed sockets separately, which means that one might block the other from getting one. And on top of that, the way you interfaced with them was different!

    Here comes ConnectionManager to the rescue! Both these libraries now ask the ConnectionManager for a socket and it handles tracking what's open and what's not. And to make code even simpler, it's what's called a singleton. There is only one, where previously you needed to create your requests.Session() early in your code and use that one everywhere, now it doesn't matter.

    Socket Pool and SSL Context Helpers

    What are these?

    The socketpool is what creates the sockets for each internet connected chip, and the ssl_context is what has all the certificate information to validate that the connection is secure.

    For the Adafruit AirLift (which uses an ESP32 WiFi Co-Processor):

    circup-a.png
    Save
Search

Getting Started

Adafruit Playground is a wonderful and safe place to share your interests with Adafruit's vibrant community of makers and doers. Have a cool project you are working on? Have a bit of code that you think others will find useful? Want to show off your electronics workbench? You have come to the right place.

The goal of Adafruit Playground is to make it as simple as possible to share your work. On the Adafruit Playground users can create Notes. A note is a single-page space where you can document your topic using Adafruit's easy-to-use editor. Notes are like Guides on the Adafruit Learning System but guides are high-fidelity content curated and maintained by Adafuit. Notes are whatever you want them to be. Have fun and be kind.

Click here to learn more about Adafruit Playground and how to get started.

    • Contact Us
    • Tech Support Forums
    • FAQs
    • Shipping & Returns
    • Freebies
    • Terms of Service
    • Privacy & Legal
    • Website Accessibility
    • LLMs.txt
    • About Us
    • Press
    • Educators
    • Distributors
    • Jobs
    • Gift Cards
    "I always wanted to be someone better the next day than I was the day before"
    Sidney Poitier
    Adafruit Logo
    A Minority and Woman-owned Business Enterprise (M/WBE)