Difference between revisions of "QT Py"

From Land Boards Wiki
Jump to navigation Jump to search
Line 61: Line 61:
 
* Can act as PWM or capacitive touch input.
 
* Can act as PWM or capacitive touch input.
  
=== SDA / D4 - This is the I2C data pin and digital pin 4, can also be a PWM ===
+
=== SDA / D4 ===
  
 +
* This is the I2C data pin and digital pin 4, can also be a PWM
 
* There is no analog on this pin!  
 
* There is no analog on this pin!  
 
* There's no pull up on this pin by default so when using with I2C, you may need a 2.2K-10K pullup on each to 3.3V.  
 
* There's no pull up on this pin by default so when using with I2C, you may need a 2.2K-10K pullup on each to 3.3V.  
 
* All our STEMMA QT breakouts have the pullup installed on the breakout PCB.
 
* All our STEMMA QT breakouts have the pullup installed on the breakout PCB.
  
===  SCL / D5 - This is the I2C clock pin and digital pin 5, can also be a PWM ===
+
===  SCL / D5 ===
  
 +
* This is the I2C clock pin and digital pin 5, can also be a PWM
 
* There is no analog on this pin! There's no pull up on this pin by default so when using with I2C, you may need a 2.2K-10K pullup on each to 3.3V
 
* There is no analog on this pin! There's no pull up on this pin by default so when using with I2C, you may need a 2.2K-10K pullup on each to 3.3V
  
=== TX / A6 / D6 - Transmit (output) for Serial1 ===
+
=== TX / A6 / D6 ===
  
 +
* Transmit (output) for Serial1
 
* Also analog/digital GPIO 6.  
 
* Also analog/digital GPIO 6.  
 
* Can act as PWM or capacitive touch input.
 
* Can act as PWM or capacitive touch input.
  
=== RX / A7 / D7 - Receive (input) for Serial1 ===
+
=== RX / A7 / D7 ===
  
 +
* Receive (input) for Serial1
 
* Also analog/digital GPIO 7.
 
* Also analog/digital GPIO 7.
 
* Can act as PWM or capacitive touch input.*  
 
* Can act as PWM or capacitive touch input.*  
  
=== SCK / A8 / D8 - Hardware SPI clock pin ===
+
=== SCK / A8 / D8 ===
 +
 
 +
* Hardware SPI clock pin
 
* Also analog/digital GPIO 8. Can act as PWM output.
 
* Also analog/digital GPIO 8. Can act as PWM output.
  
=== MISO / A9 / D9 -  Hardware SPI MISO microcontroller in serial out pin ===
+
=== MISO / A9 / D9 ===
  
* Also analog/digital GPIO 9. Can act as PWM output.
+
* Also analog/digit* Hardware SPI MISO microcontroller in serial out pin
 +
al GPIO 9. Can act as PWM output.
  
=== MOSI / A10 / D10 - Hardware SPI MOSI microcontroller out serial in pin ===
+
=== MOSI / A10 / D10 ===
  
 +
* Hardware SPI MOSI microcontroller out serial in pin
 
* Also analog/digital GPIO 10. Can act as PWM output.
 
* Also analog/digital GPIO 10. Can act as PWM output.
  
=== NeoPixel connected to digital pin 11 for signal ===
+
=== NeoPixel ===
  
 +
* Connected to digital pin 11 for signal
 
* If you would like to turn off the pixel for low power usage, set pin 12 low.
 
* If you would like to turn off the pixel for low power usage, set pin 12 low.
 
* By default pin 12 is set high for you by Arduino/CircuitPython
 
* By default pin 12 is set high for you by Arduino/CircuitPython

Revision as of 09:18, 4 May 2022

QT Py 4600-06.jpg

Features

  • ATSAMD21E18 32-bit Cortex M0+ - 48 MHz 32 bit processor with 256KB Flash and 32 KB RAM
  • Native USB supported by every OS - can be used in Arduino or CircuitPython as USB serial console, MIDI, Keyboard/Mouse HID, even a little disk drive for storing Python scripts.
  • Can be used with Arduino IDE or CircuitPython
  • Built in RGB NeoPixel LED
  • 11 GPIO pins:
    • True analog output on one I/O pin - can be used to play 10-bit quality audio clips in Arduino (CircuitPython does not have storage for audio clips)
    • 9 x 12-bit analog inputs (SDA/SCL do not have analog inputs)
    • 1 x Optional AREF on A1
    • 9 x PWM outputs (A0 is analog out, A1 is not PWM capable)
    • Hardware I2C port with STEMMA QT plug-n-play connector
    • Hardware UART
    • Hardware SPI
    • Hardware I2S
    • 6 x Capacitive Touch with no additional components required
  • 3.3V regulator with 600mA peak output AP2112
  • Optional SOIC-8 SPI Flash chip on bottom
    • GD25Q16
    • Access the SPI flash in Arduino on SPI1 and chip select pin 17.
    • In CircuitPython, a 'haxpress' version of the runtime will need to be installed, so it knows to look for the larger filesystem.
    • There is more hardware support in the haxpress CircuitPython build because we can add more code to the internal flash instead of using it for a filesystem
  • Reset switch for starting your project code over or entering bootloader mode
  • USB Type C connector
  • Really really small

Links

Pins

3V

  • Regulated output from the onboard regulator. You can draw 500mA

5V

  • 5v out from the USB port.
  • You can also use this as a voltage input but you must have some sort of diode (schottky, signal, power, really anything) between your external power source and this pin with anode to battery, cathode to 5V pin.
  • Note that you cannot power the USB port by supplying 5V to this pin: there is a protection diode that prevents the 5V from reaching the USB connector.
  • This is to protect host computer USB ports, etc.

A0 / D0 - Digital/analog GPIO pin 0

  • Can act as a true analog output with 10 bit precision, but does not have PWM. Can also be a capacitive touch input.

A1 / D1 - Digital/analog GPIO pin 1

  • Can be a capacitive touch input or an AREF pin.

A2 / D2 - Digital/analog GPIO pin 2

  • Can act as PWM or capacitive touch input.

A3 / D3 - Digital/analog GPIO pin 3

  • Can act as PWM or capacitive touch input.

SDA / D4

  • This is the I2C data pin and digital pin 4, can also be a PWM
  • There is no analog on this pin!
  • There's no pull up on this pin by default so when using with I2C, you may need a 2.2K-10K pullup on each to 3.3V.
  • All our STEMMA QT breakouts have the pullup installed on the breakout PCB.

SCL / D5

  • This is the I2C clock pin and digital pin 5, can also be a PWM
  • There is no analog on this pin! There's no pull up on this pin by default so when using with I2C, you may need a 2.2K-10K pullup on each to 3.3V

TX / A6 / D6

  • Transmit (output) for Serial1
  • Also analog/digital GPIO 6.
  • Can act as PWM or capacitive touch input.

RX / A7 / D7

  • Receive (input) for Serial1
  • Also analog/digital GPIO 7.
  • Can act as PWM or capacitive touch input.*

SCK / A8 / D8

  • Hardware SPI clock pin
  • Also analog/digital GPIO 8. Can act as PWM output.

MISO / A9 / D9

  • Also analog/digit* Hardware SPI MISO microcontroller in serial out pin

al GPIO 9. Can act as PWM output.

MOSI / A10 / D10

  • Hardware SPI MOSI microcontroller out serial in pin
  • Also analog/digital GPIO 10. Can act as PWM output.

NeoPixel

  • Connected to digital pin 11 for signal
  • If you would like to turn off the pixel for low power usage, set pin 12 low.
  • By default pin 12 is set high for you by Arduino/CircuitPython

Pins

3V

  • Regulated output from the onboard regulator. You can draw 500mA

5V

  • 5v out from the USB port.
  • You can also use this as a voltage input but you must have some sort of diode (schottky, signal, power, really anything) between your external power source and this pin with anode to battery, cathode to 5V pin.
  • Note that you cannot power the USB port by supplying 5V to this pin: there is a protection diode that prevents the 5V from reaching the USB connector.
  • This is to protect host computer USB ports, etc.

A0 / D0 - Digital/analog GPIO pin 0

  • Can act as a true analog output with 10 bit precision, but does not have PWM. Can also be a capacitive touch input.

A1 / D1 - Digital/analog GPIO pin 1

  • Can be a capacitive touch input or an AREF pin.

A2 / D2 - Digital/analog GPIO pin 2

  • Can act as PWM or capacitive touch input.

A3 / D3 - Digital/analog GPIO pin 3

  • Can act as PWM or capacitive touch input.

SDA / D4 - This is the I2C data pin and digital pin 4, can also be a PWM

  • There is no analog on this pin!
  • There's no pull up on this pin by default so when using with I2C, you may need a 2.2K-10K pullup on each to 3.3V.
  • All our STEMMA QT breakouts have the pullup installed on the breakout PCB.

SCL / D5 - This is the I2C clock pin and digital pin 5, can also be a PWM

  • There is no analog on this pin! There's no pull up on this pin by default so when using with I2C, you may need a 2.2K-10K pullup on each to 3.3V

TX / A6 / D6 - Transmit (output) for Serial1

  • Also analog/digital GPIO 6.
  • Can act as PWM or capacitive touch input.

RX / A7 / D7 - Receive (input) for Serial1

  • Also analog/digital GPIO 7.
  • Can act as PWM or capacitive touch input.*

SCK / A8 / D8 - Hardware SPI clock pin

  • Also analog/digital GPIO 8. Can act as PWM output.

MISO / A9 / D9 - Hardware SPI MISO microcontroller in serial out pin

  • Also analog/digital GPIO 9. Can act as PWM output.

MOSI / A10 / D10 - Hardware SPI MOSI microcontroller out serial in pin

  • Also analog/digital GPIO 10. Can act as PWM output.

NeoPixel connected to digital pin 11 for signal

  • If you would like to turn off the pixel for low power usage, set pin 12 low.
  • By default pin 12 is set high for you by Arduino/CircuitPython

CircuitPython

  • Adafruit CircuitPython 6.1.0 on 2021-01-21; Adafruit QT Py M0 Haxpress with samd21e18
  • CircuitPython is a derivative of MicroPython.
  • QT Py Haxpress used with 2MB Flash EEPROM
  • blink.py for QT Py
  • Mu editor
  • CircuitPython looks for a code file on the board to run
    • There are four options: code.txt, code.py, main.txt and main.py
    • CircuitPython looks for those files, in that order, and then runs the first one it finds
  • How do I check how much memory I have free?
import gc
gc.mem_free()
  • Reports about 19KB of free space

Will give you the number of bytes available for use.

Land Boards Code

Digital I/O Example

import board
import digitalio
import time

led = digitalio.DigitalInOut(board.D13)
led.direction = digitalio.Direction.OUTPUT

while True:
    led.value = True
    time.sleep(0.1)
    led.value = False
    time.sleep(0.5)

Flash EEPROM 2 MB

QT Py 4600-07.jpg