Adafruit Pyportal - Iot for Circuitpython Created by Kattni Rembor

Adafruit Pyportal - Iot for Circuitpython Created by Kattni Rembor

Adafruit PyPortal - IoT for CircuitPython Created by Kattni Rembor Last updated on 2021-09-24 01:53:56 PM EDT Guide Contents Guide Contents 2 Overview 7 Pinouts 11 Microcontroller and Flash 12 WiFi 12 Display and Display Connector 13 Sensors 15 microSD Card Slot 16 Speaker and Speaker Connector 17 I2C Connector 18 Digital/Analog Connectors 19 Status LED and NeoPixel 20 USB Connector 21 Reset Button 22 What is CircuitPython? 24 CircuitPython is based on Python 24 Why would I use CircuitPython? 24 Update the UF2 Bootloader 26 Updating Your Bootloader 26 Updating Your PyPortal 30 Step 1 - Update Firmware to Latest 30 Step 2 - Update Example Code to Latest 30 Step 3 - Check Display & Add WiFi Secrets 31 Step 4 - If you are getting odd errors 31 Install CircuitPython 32 Set up CircuitPython Quick Start! 32 PyPortal Default Files 34 Installing Mu Editor 35 Download and Install Mu 35 Using Mu 35 Creating and Editing Code 37 Creating Code 37 Editing Code 39 Your code changes are run as soon as the file is done saving. 40 1. Use an editor that writes out the file completely when you save it. 40 2. Eject or Sync the Drive After Writing 41 Oh No I Did Something Wrong and Now The CIRCUITPY Drive Doesn't Show Up!!! 41 Back to Editing Code... 42 Exploring Your First CircuitPython Program 43 Imports & Libraries 43 Setting Up The LED 43 Loop-de-loops 44 What Happens When My Code Finishes Running? 44 What if I don't have the loop? 45 More Changes 46 Naming Your Program File 46 Connecting to the Serial Console 47 Are you using Mu? 47 Setting Permissions on Linux 48 © Adafruit Industries https://learn.adafruit.com/adafruit-pyportal Page 2 of 178 Using Something Else? 49 Interacting with the Serial Console 50 The REPL 54 Returning to the serial console 57 CircuitPython Libraries 58 Installing the CircuitPython Library Bundle 59 Example Files 60 Copying Libraries to Your Board 61 Example: ImportError Due to Missing Library 61 Library Install on Non-Express Boards 62 Updating CircuitPython Libraries/Examples 63 CircuitPython Pins and Modules 64 CircuitPython Pins 64 import board 64 I2C, SPI, and UART 65 What Are All the Available Names? 66 Microcontroller Pin Names 67 CircuitPython Built-In Modules 68 Frequently Asked Questions 69 I have to continue using an older version of CircuitPython; where can I find compatible libraries? 69 Is ESP8266 or ESP32 supported in CircuitPython? Why not? 69 How do I connect to the Internet with CircuitPython? 70 Is there asyncio support in CircuitPython? 71 My RGB NeoPixel/DotStar LED is blinking funny colors - what does it mean? 72 What is a MemoryError? 73 What do I do when I encounter a MemoryError? 73 Can the order of my import statements affect memory? 74 How can I create my own .mpy files? 74 How do I check how much memory I have free? 74 Does CircuitPython support interrupts? 74 Does Feather M0 support WINC1500? 75 Can AVRs such as ATmega328 or ATmega2560 run CircuitPython? 75 Commonly Used Acronyms 75 Troubleshooting 76 Always Run the Latest Version of CircuitPython and Libraries 76 I have to continue using CircuitPython 5.x, 4.x, 3.x or 2.x, where can I find compatible libraries? 76 CPLAYBOOT, TRINKETBOOT, FEATHERBOOT, or GEMMABOOT Drive Not Present 76 You may have a different board. 77 MakeCode 77 MacOS 77 Windows 10 77 Windows 7 or 8.1 77 Windows Explorer Locks Up When Accessing boardnameBOOT Drive 78 Copying UF2 to boardnameBOOT Drive Hangs at 0% Copied 79 CIRCUITPY Drive Does Not Appear 79 Device Errors or Problems on Windows 79 Serial Console in Mu Not Displaying Anything 80 CircuitPython RGB Status Light 80 ValueError: Incompatible .mpy file. 81 CIRCUITPY Drive Issues 82 © Adafruit Industries https://learn.adafruit.com/adafruit-pyportal Page 3 of 178 Easiest Way: Use storage.erase_filesystem() 82 Old Way: For the Circuit Playground Express, Feather M0 Express, and Metro M0 Express: 82 Old Way: For Non-Express Boards with a UF2 bootloader (Gemma M0, Trinket M0): 84 Old Way: For non-Express Boards without a UF2 bootloader (Feather M0 Basic Proto, Feather Adalogger, Arduino Zero): 84 Running Out of File Space on Non-Express Boards 85 Delete something! 85 Use tabs 85 MacOS loves to add extra files. 85 Prevent & Remove MacOS Hidden Files 86 Copy Files on MacOS Without Creating Hidden Files 86 Other MacOS Space-Saving Tips 87 Device locked up or boot looping 88 Uninstalling CircuitPython 90 Backup Your Code 90 Moving Circuit Playground Express to MakeCode 90 Moving to Arduino 91 Welcome to the Community! 94 Adafruit Discord 94 Adafruit Forums 95 Adafruit Github 96 ReadTheDocs 97 PyPortal CircuitPython Setup 99 Adafruit CircuitPython Bundle 99 Internet Connect! 101 What's a secrets file? 101 Connect to WiFi 101 Requests 106 HTTP GET with Requests 108 HTTP POST with Requests 109 Advanced Requests Usage 110 WiFi Manager 111 CircuitPython BLE 115 CircuitPython BLE UART Example 115 On-Board Airlift Co-Processor - No Wiring Needed 115 Update the AirLift Firmware 115 Install CircuitPython Libraries 115 Install the Adafruit Bluefruit LE Connect App 116 Copy and Adjust the Example Program 116 Talk to the AirLift via the Bluefruit LE Connect App 117 Arduino IDE Setup 121 https://adafruit.github.io/arduino-board-index/package_adafruit_index.json 122 Using with Arduino IDE 124 Install SAMD Support 124 Install Adafruit SAMD 125 Install Drivers (Windows 7 & 8 Only) 126 Blink 128 Successful Upload 129 Compilation Issues 130 © Adafruit Industries https://learn.adafruit.com/adafruit-pyportal Page 4 of 178 Manually bootloading 130 Ubuntu & Linux Issue Fix 131 Arduino Libraries 132 Install Libraries 132 Adafruit NeoPixel 132 Adafruit SPIFlash 132 Adafruit Zero DMA 133 Adafruit GFX 133 Adafruit ILI9341 133 Adafruit HX8357 133 Adafruit Touchscreen 133 Analog Devices ADT7410 134 WiFiNINA 134 Adafruit ImageReader 134 Arduino Test 135 Graphics Demos 140 TouchPaint 140 Amiga Boing! 140 Mandelbrot 140 Adapting Sketches to M0 & M4 141 Analog References 141 Pin Outputs & Pullups 141 Serial vs SerialUSB 141 AnalogWrite / PWM on Feather/Metro M0 142 analogWrite() PWM range 143 analogWrite() DAC on A0 143 Missing header files 143 Bootloader Launching 144 Aligned Memory Access 144 Floating Point Conversion 144 How Much RAM Available? 145 Storing data in FLASH 145 Pretty-Printing out registers 145 M4 Performance Options 146 CPU Speed (overclocking) 146 Optimize 147 Cache 147 Max SPI and Max QSPI 147 Enabling the Buck Converter on some M4 Boards 148 Build the PyPortal Stand 149 Prep 149 Sandwich 151 Legs 153 Add Long Screws 155 Screw It All Together 158 Bonus! Penny Roll Weight 160 Laser Cutter Files for PyPortal Stand 162 Updating ESP32 Firmware 163 Parsing JSON 164 © Adafruit Industries https://learn.adafruit.com/adafruit-pyportal Page 5 of 178 Parsing JSON from the Web 164 JSON 165 Parsing local JSON files 167 PyPortal Hardware FAQ 168 The PyPortal screen is all white or blank when powered on. 168 I'm using the STEMMA I2C connector to attach sensors and experiencing issues. 169 I'm seeing "AT" or other text being inserted at the REPL prompt. 170 What does the status NeoPixel indicate once my code.py is running? 171 Downloads 173 Files 173 PyPortal Schematic and Fab Print 173 PyPortal Pynt 3D Model 175 PyPortal Pynt Schematic and Fab Print 175 © Adafruit Industries https://learn.adafruit.com/adafruit-pyportal Page 6 of 178 Overview PyPortal, is our easy-to-use IoT device that allows you to create all the things for the “Internet of Things” in minutes. Make custom touch screen interface GUIs, all open-source, and Python-powered using tinyJSON / APIs to get news, stock values, weather, cat photos, and more – all over Wi-Fi with the latest technologies. Create little pocket universes of joy that connect to something good. Rotate it 90 degrees, it’s a web-connected conference badge #badgelife. © Adafruit Industries https://learn.adafruit.com/adafruit-pyportal Page 7 of 178 The PyPortal uses an ATMEL (Microchip) ATSAMD51J20, and an Espressif ESP32 Wi-Fi coprocessor with TLS/SSL (secure web) support built-in. PyPortal has a 3.2″ 320 x 240 color TFT with resistive touch screen. PyPortal includes: speaker, light sensor, temperature sensor, NeoPixel, microSD card slot, 8MB flash, plug- in ports for I2C, and 2 analog/digital pins. There are 3D files available for custom enclosures and the board has mounting holes which are also compatible with badge lanyard fasteners. The PyPortal Pynt is the little sister to our popular PyPortal (https://adafru.it/pyportal) - zapped with a shink ray to take the design from a 3.2" diagonal down to 2.4" diagonal screen - but otherwise the same! PyPortal Pynt has a 2.4″ diagonal 320 x 240 color TFT with resistive touch screen. Compared to the original PyPortal, the Pynt does not include a ADT7410 temperature sensor. Other than the ADT7410, the Pynt's display, processor, STEMMA conectors and WiFi have the exact same wiring as the original 3.2" PyPortal so all Arduino/CircuitPython code will run exactly the same - just smaller! © Adafruit Industries https://learn.adafruit.com/adafruit-pyportal Page 8 of 178 The M4 and ESP32 are a great couple - and each bring their own strengths to this board. The SAMD51 M4 has native USB so it can show up like a disk drive, act as a MIDI or HID keyboard/mouse, and of course bootload and debug over a serial port. It also has DACs, ADC, PWM, and tons of GPIO. Meanwhile, the ESP32 has secure WiFi capabilities, and plenty of Flash and RAM to buffer sockets.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    178 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us