The Adafruit Qt Py is an adorable development board with a lot of potential given the current price ($6 as of writing this). You might wonder with the small size, what if I need more outputs? In this tutorial we'll show you how you can expand the Qt Py's outputs using the 74HC595 serial shift register to drive a 7 segment display including the CircuitPython code to make it all work.
As always 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:
Getting Everything Wired Up:
To get started, we first want to wire up our board. Connect your circuit just like the wiring diagram below. See the wiring steps if you need help.
Wiring Steps:
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. For the sake of this post, we've included the code to display up to the number 5. You can easily expand this for 0 to 15 (F). In the editor window, we are going to paste the following code:
After you put this code in the MU Editor, Save the file as "code.py" and open the serial terminal in the editor. You should be able to enter a single numbers between 0 and 15 and hit enter. Once you hit enter, you should then see the serial prints of the bits being loaded and the seven segment display update on your breadboard.
Final Thoughts
This use of the shift register is just one of many for expanding outputs on smaller development boards. You can drive a large number of devices, and even hook multiple shift registers together to create even larger output pin options.
Thanks for working through this tutorial with us. Comment if you've done this tutorial or need help. As always, share on social media and let us know what tutorials you want to see! -Seth
1 Comment
|
AuthorsSeth is embedded software engineer and open source hardware developer. Archives
March 2023
Categories |