A sleek subscriber and view count display for your YouTube channel, powered by Adafruit PyPortal. This project fetches real-time statistics from the YouTube Data API and displays them with custom fonts, background, and even a celebratory sound when a new subscriber joins.
- Displays current subscriber count and view count
- Plays a sound when a new subscriber is detected
- Custom background and fonts for a polished look
- Updates every 5 minutes (configurable)
- Modular secrets management via
secrets.py
- Adafruit PyPortal
- MicroUSB cable
- Wi-Fi connection
git clone https://github.com/pir8radio/PyPortal-YouTube-Counter.gitWith the following structure:
In the root directory of your PyPortal code, create or modify the file named secrets.py with the following structure:
secrets = {
'ssid' : 'WIFI SSID HERE',
'password' : 'WIFI PASS HERE',
'youtube_token' : 'YOUTUBE TOKEN HERE',
'youtube_chID' : 'YOUTUBE CHANNEL ID HERE',
'youtube_caption' : ' ',
'timezone' : "America/Chicago", # http://worldtimeapi.org/timezones
}- Go to the Google Cloud Console
- Create a new project (or select an existing one)
- Navigate to APIs & Services > Library
- Search for YouTube Data API v3 and enable it
- Go to APIs & Services > Credentials
- Click Create Credentials > API Key
- Copy the generated key and paste it into
secrets['youtube_token']
- Visit your YouTube channel page
- Click on your profile > Your Channel
- Look at the URL:
https://www.youtube.com/channel/UCxxxxxxxxxxxxxxxxx
Copy the part after/channel/— that's your Channel ID
Paste it intosecrets['youtube_chID']
- Fonts: Use
.bdffonts compatible with PyPortal, placed in the/fonts/directory - Sound: Replace
coin.wavwith any short WAV file for subscriber alerts
- If you see
Some error occurred, retrying!, the PyPortal will auto-reload and retry the fetch - Ensure your Wi-Fi credentials and API key are correct
- Check that your fonts and background image are properly formatted and located
The script updates every 5 minutes by default. You can change the interval by modifying:
time.sleep(300) # Time in secondsThis project is licensed under a modified MIT License.
Commercial use of this software to manufacture or sell YouTube counter devices is prohibited without written permission.
See the LICENSE file for full terms.
@adafruit - This project uses Adafruit_CircuitPython_PortalBase and is based off of this original code.

