0

No products in the cart.

Twitter Follower Display Using PyPortal and CircuitPython

I found myself with the desire to display my Twitter follower account at my desk so that I can feed my ever-growing narcissism. In my journey around the internet I found the PyPortal Titano from Adafruit. It combines a 3.5″ resistive touch screen with an ESP32 in a thin package running CircuitPython that’s built for exactly this task.

If you too find yourself wanting to grow your need to feel wanted then read on. This guide is created using information from Adafruit’s own guide written by John Park. I have modified some of the information to be more concise and allow you to get up and running quickly.


Parts

PyPortal Titano
USB-C cable (Affiliate link)
PyPortal Case

If you have access to a 3d printer, this is a case designed by Adafruit that is free from Thingiverse.


Prepare the PyPortal

If you have already configured your PyPortal and just want the code then scroll down to the code section.

Plugin the PyPortal to your computer using the USB-C cable. Once the device boots, your computer will mount a drive called CIRCUITPY. Open the drive and delete all of the files.


Code

Click above to download the project code. Extract the zip file and drag the entire contents of the extracted folder to the CIRCUITPY drive. The PyPortal will reboot but you don’t need to wait for it. Any time you change the contents of the CIRCUITPY drive by either adding/removing files or changing code, the PyPortal will soft reboot.


Configure the Twitter account.

Note: All code changes from this point are done from the CIRCUITPY drive.

Open code.py and edit line 11 replacing spaceboyr00 with the Twitter username that you want to track. Optionally, if you would like to display this username at the bottom of the PyPortal, uncomment lines 32 through 35. In either case, save the file and wait for the PyPortal to reboot.


Configure Wi-Fi.

Open secrets.py and edit line 7 replacing SSID with the name of your Wi-Fi network. On line 8, replace PASSWORD with the password for you Wi-Fi network. Do not share this information and do not place it anywhere other than secrets.py. Save the file and wait for the PyPortal to reboot.

After about 20 seconds the PyPortal should display the follower count. If not, read back through each step and double-check the work.


Customizing images.

I have included two images in the zip file above; One for the PyPortal startup and another for the main background. I have designed these to match my own style and you can do the same. To customize either image, replace it with a 320 x 480 bitmap with the same name as the one you intend to overwrite.


Customizing text alignment.

The PyPortal positions text with the origin being in vertical center of the left edge. I have chosen to center the text but this could cause alignment issues for accounts that have more or less digits than my account. If you find that the follower count is not centered properly, adjust the first number on line 28. A lower number moves the count left and a higher number moves it right.

If you have any questions hit me up on Twitter at @spaceboyr00. If you build your own PyPortal project be sure to share it with me! I love to see what others are making!

Comments

  • ICYMI CircuitPython Newsletter: CircuitPython 5.2.0, ESP32-S2 support work and more! #Python #Adafruit #CircuitPython #ICYMI @circuitpython @micropython @ThePSF « Adafruit Industries – Makers, hackers, artists, designers and engineers!

    April 15, 2020 at 6:53 am

    […] Twitter follower display using a PyPortal Titano and CircuitPython – Blog and […]

Your email address will not be published. Required fields are marked *