Oak Development Technologies
  • IcyBlue
  • Oak Blog
  • Prototyping
  • Livestream
  • Open Source Projects
  • Contact
Tutorials, Announcements, and More from...

Oak Development 
​Technologies

Connect with us on Facebook, Twitter & Instagram!

(Tutorial) Small Size & Smaller Power - Using the Adafruit QT PY and ODT TPS22917 Acorn

9/27/2020

0 Comments

 
Picture
In our previous tutorial with the TPS22917 Acorn, we showed you how to get started with the module using Arduino and the Arduino Nano. In this tutorial, we'll show you how easy it is to get the TPS22917 integrated into your project, all while showing off the new SAMD21 development board the QT PY by Adafruit.
Before we get started, if you have never used a CircuitPython board like the QT PY, be sure to check out Adafruit's learning site to quickly get started with your new board. --> Adafruit Learning Site: Getting Started With CircuitPython

What You'll Need:

To get started, you'll need the following parts:
  1. CircuitPython compatible development board (QT PY as used in this tutorial)
  2. USB-C data cable
  3. TPS22917 Acorn (Can be bought HERE)
  4. An LED
  5. A 330ohm Resistor
  6. A solderless breadboard
  7. At least 6 jumper wires
  8. Mu Editor (Get that HERE)
​

Getting Everything Wired Up:

The wiring on this project is the same as our Adruino tutorial, but instead of connecting the GPIO pin to D12, we will connect it to A0 on the QT PY Board. If you're using any other kind of CircuitPython board, just pick any digital pin on your board as it will work with any digital pin. Be sure to wire up your circuit like the diagram below:
Picture

The Code: 

You'll want to make sure your CircuitPython board is ready to use with the CircuitPython .uf2 installed. If you need to, reference the Getting Started With Circuit Python link at the top of the article. 

First we are going to open the MU Editor. If your board is ready to use with Circuit Python, you should get no popups warning you about your board not being connected. In the editor window, we are going to paste the following code:

# TPS22917 Acorn Circuit Python Easy Integration Example
# import board, digitalio, and time libraries
import board
from digitalio import DigitalInOut, Direction
import time

# set up our control pin as pin A0 on the QT PY
ctrlPin = DigitalInOut(board.A0)
# This sets the direction as OUTPUT so we can control the TPS22917
ctrlPin.direction = Direction.OUTPUT
# set the initial ctrlValue to 0 so the pin is off
ctrlValue = 0
print("We're about to cycle the control pin on and off")

# execute an infinite loop so we can cycle through turning the led on and off
while True:
    if ctrlValue == 0:
        print("digital pin on")
        ctrlValue = 1
        ctrlPin.value = ctrlValue
    else:
        print("digital pin off")
        ctrlValue = 0
        ctrlPin.value = ctrlValue
    
    # then we will wait for 1 second so we can see the results.
    time.sleep(1.0)
    print("it does seem to work")

Picture
After this, we will press the "Save" button and save our file as "code.py" so the board can execute the file.

Once the code starts running we can press the "Serial" button to see the print statements we added to the code to make sure we know what is happening in real time.
Picture
As the code continues to run, we can see visually on our breadboard that the LED is being turn on and off thanks to our CircuitPython code.
Picture
Picture
Thanks for making it through this tutorial! CircuitPython is a great tool for those learning to build electronics projects and we are happy to be part of the movement to bring CircuitPython boards to those who need them the most.

We announced on CircuitPython day (9/9.2020) that we were bringing our very own version of the SAMD21E microcontroller to start our offering of CircuitPython compatible microcontrollers. Our CP Sapling board will launch just before Black Friday (November 27th, 2020) with a special discount code for the launch.

Thanks again and comment if you did this tutorial, any questions you have, or suggestions for future tutorials!

-Seth
0 Comments



Leave a Reply.

    Authors

    Seth is embedded software engineer and open source hardware developer. 

    Archives

    May 2021
    April 2021
    January 2021
    November 2020
    October 2020
    September 2020

    Categories

    All
    New Products
    Product Spotlight
    Tutorials

    RSS Feed

Powered by Create your own unique website with customizable templates.
  • IcyBlue
  • Oak Blog
  • Prototyping
  • Livestream
  • Open Source Projects
  • Contact