Difference between revisions of "QT Py"
Jump to navigation
Jump to search
Blwikiadmin (talk | contribs) (→Pins) |
Blwikiadmin (talk | contribs) (→Pins) |
||
Line 83: | Line 83: | ||
* 5v out from the USB port. | * 5v out from the USB port. | ||
− | * | + | * Voltage input |
− | * | + | ** Requires external diode |
− | * This is to protect host computer USB ports, etc. | + | *** Schottky, signal, power |
+ | *** Between external power source and this pin | ||
+ | *** 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 === |
− | * | + | * Digital I/O 0 |
+ | * True analog output with 10 bit precision | ||
+ | * Does not have PWM | ||
+ | * Capacitive touch input. | ||
=== A1 / D1 - Digital/analog GPIO pin 1 === | === A1 / D1 - Digital/analog GPIO pin 1 === | ||
− | * | + | * Digital I/O 1 |
+ | * Capacitive touch input | ||
+ | * AREF pin. | ||
=== A2 / D2 - Digital/analog GPIO pin 2 === | === A2 / D2 - Digital/analog GPIO pin 2 === | ||
− | * | + | * Digital I/O 2 |
+ | * PWM | ||
+ | * Capacitive touch input. | ||
=== A3 / D3 - Digital/analog GPIO pin 3 === | === A3 / D3 - Digital/analog GPIO pin 3 === | ||
− | * | + | * Digital I/O 3 |
+ | * PWM output | ||
+ | * Capacitive touch input. | ||
=== SDA / D4 === | === SDA / D4 === | ||
− | * | + | * Digital I/O 4 |
− | * | + | * I2C SDA pin |
− | * | + | * PWM output |
− | + | * No analog on this pin | |
+ | * No pull up on this pin | ||
+ | * When using with I2C requires an external 2.2K-10K pullup to 3.3V. | ||
− | === | + | === SCL / D5 === |
− | * | + | * Digital I/O 5 |
− | * | + | * I2C SCL |
+ | * No analog on this pin | ||
+ | * No pull up on this pin | ||
+ | * When using with I2C requires an external 2.2K-10K pullup to 3.3V. | ||
=== TX / A6 / D6 === | === TX / A6 / D6 === | ||
+ | * Digital I/O 6 | ||
* Transmit (output) for Serial1 | * Transmit (output) for Serial1 | ||
− | * | + | * Analog 6 |
− | * | + | * PWM output |
+ | * Capacitive touch input | ||
=== RX / A7 / D7 === | === RX / A7 / D7 === | ||
+ | * Digital I/O 7 | ||
* Receive (input) for Serial1 | * Receive (input) for Serial1 | ||
− | * | + | * Analog 7 |
− | * | + | * PWM output |
+ | * Capacitive touch input | ||
=== SCK / A8 / D8 === | === SCK / A8 / D8 === | ||
− | * | + | * Digital I/O 8 |
− | * | + | * SPI SCK pin |
+ | * Analog 8 | ||
+ | * PWM output | ||
=== MISO / A9 / D9 === | === MISO / A9 / D9 === | ||
− | * | + | * Digital I/O 8 |
− | + | * SPI MISO pin | |
+ | * Analog 8 | ||
+ | * PWM output | ||
=== MOSI / A10 / D10 === | === MOSI / A10 / D10 === | ||
− | * | + | * Digital I/O 10 |
− | * | + | * SPI MOSI pin |
+ | * Analog 10 | ||
+ | * PWM output | ||
=== NeoPixel === | === NeoPixel === | ||
* Connected to digital pin 11 for signal | * Connected to digital pin 11 for signal | ||
− | * | + | * Set pin 12 low for low power usage |
− | * By default pin 12 is set high | + | * By default pin 12 is set high by Arduino/CircuitPython |
== Programming == | == Programming == |
Revision as of 11:56, 1 June 2022
Contents
- 1 Two Versions of the QT Py
- 2 Pins
- 2.1 3V
- 2.2 5V
- 2.3 A0 / D0 - Digital/analog GPIO pin 0
- 2.4 A1 / D1 - Digital/analog GPIO pin 1
- 2.5 A2 / D2 - Digital/analog GPIO pin 2
- 2.6 A3 / D3 - Digital/analog GPIO pin 3
- 2.7 SDA / D4
- 2.8 SCL / D5
- 2.9 TX / A6 / D6
- 2.10 RX / A7 / D7
- 2.11 SCK / A8 / D8
- 2.12 MISO / A9 / D9
- 2.13 MOSI / A10 / D10
- 2.14 NeoPixel
- 3 Programming
- 4 Flash EEPROM 2 MB
Two Versions of the QT Py
- AdaFruit has SAMD21 and RP2040 versions of the QT Py
- Same pinouts/form factors
- RP2040 vs SAM version
- RP2040 is faster (125 MHz vs 48 MHz)
- RP2040 has 2 cores vs 1
- RP2040 has more Flash
- RP2040 has more SRAM
- The RP2040 version is more expensive, but about the same cost if the SAM version is used with an external Flash
SAMD21 QT Py
- Adafruit QT Py SAMD21 Product Page
- ATSAMD21E18 32-bit Cortex M0+ version
- 48 MHz, 32-bit processor
- 256KB Flash
- 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.
- 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
- Can be used to play 10-bit quality audio clips in Arduino
- 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
- True analog output on one I/O pin
- 3.3V regulator with 600mA peak output AP2112
- Optional SOIC-8 SPI Flash chip on bottom
- Can't use castellated pins if Flash on bottom is installed
- 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
RP2040 QT Py
- Adafruit QT Py RP2040 Product page
- USB Type C connector
- RP2040 32-bit Cortex M0+ dual-core
- Runs at ~125 MHz
- 264 KB RAM
- 8 MB SPI FLASH chip for storing files and CircuitPython/MicroPython code storage. No EEPROM
- Can be used with MicroPython or CircuitPython
- Built-in RGB NeoPixel LED
- 13 GPIO pins (11 breakout pads and two QT pads):
- Four 12 bit ADCs (one more than Pico)
- Two I2C ports (one on the QT connector, one on the breakout pads)
- SPI and UART peripherals, in standard QT Py locations,
- PWM outputs on every IO pin - for servos, LEDs, etc
- There are 6 GPIO in consecutive order for PIO compatibility
- 3.3V logic and power 600 mA
- Both Reset button and Bootloader select buttons for quick restarts (no unplugging-replugging to relaunch code)
Links
Pins
3V
- Regulated output from the onboard regulator. You can draw 500mA
5V
- 5v out from the USB port.
- Voltage input
- Requires external diode
- Schottky, signal, power
- Between external power source and this pin
- 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.
- Requires external diode
A0 / D0 - Digital/analog GPIO pin 0
- Digital I/O 0
- True analog output with 10 bit precision
- Does not have PWM
- Capacitive touch input.
A1 / D1 - Digital/analog GPIO pin 1
- Digital I/O 1
- Capacitive touch input
- AREF pin.
A2 / D2 - Digital/analog GPIO pin 2
- Digital I/O 2
- PWM
- Capacitive touch input.
A3 / D3 - Digital/analog GPIO pin 3
- Digital I/O 3
- PWM output
- Capacitive touch input.
SDA / D4
- Digital I/O 4
- I2C SDA pin
- PWM output
- No analog on this pin
- No pull up on this pin
- When using with I2C requires an external 2.2K-10K pullup to 3.3V.
SCL / D5
- Digital I/O 5
- I2C SCL
- No analog on this pin
- No pull up on this pin
- When using with I2C requires an external 2.2K-10K pullup to 3.3V.
TX / A6 / D6
- Digital I/O 6
- Transmit (output) for Serial1
- Analog 6
- PWM output
- Capacitive touch input
RX / A7 / D7
- Digital I/O 7
- Receive (input) for Serial1
- Analog 7
- PWM output
- Capacitive touch input
SCK / A8 / D8
- Digital I/O 8
- SPI SCK pin
- Analog 8
- PWM output
MISO / A9 / D9
- Digital I/O 8
- SPI MISO pin
- Analog 8
- PWM output
MOSI / A10 / D10
- Digital I/O 10
- SPI MOSI pin
- Analog 10
- PWM output
NeoPixel
- Connected to digital pin 11 for signal
- Set pin 12 low for low power usage
- By default pin 12 is set high by Arduino/CircuitPython
Programming
- C/C++ or CircuitPython
C/C++
MicroPython
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 Python 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)