GitHub Contribution Tracking Desk Light
by pintchom in Circuits > Raspberry Pi
101 Views, 1 Favorites, 0 Comments
GitHub Contribution Tracking Desk Light
Hello, this is a desk light to shame you for not coding enough. This little box communicates with GitHub (requires internet connection) to retrieve your GitHub contributions and displays it on a 7X8 LED matrix. Every column represents a week. Scroll through your commit history with the mildly inconvenient buttons at the bottom of the display. Built on a Raspberry Pi Pico W and lit up with an Adafruit 8x8 NeoPixel Grid.
This instructable will only cover the hardware steps for completing this project as the code can be found from a variety of sources online as well as below.
Git Repo: GithubCommitTracker
Downloads
Supplies
Raspberry Pi Pico W: Raspberry Pi Pico WH - Pico Wireless with Headers Soldered
8x8 NeoPixel Matrix: Adafruit NeoPixel NeoMatrix 8x8 - 64 RGB LED Pixel Matrix
Any external buttons (x2) Example: Tactile Button switch (6mm) x 20 pack
Prepare LED Matrix
The original idea of the project was a bigger 16x32 grid to not even need to scroll through your commits. In order to save money and time, opted for a smaller option. An upside of the 8x8 matrix I linked in the supplies above is that it's super power efficient and super easier to setup. Get 3 wires (ideally red white and black). On the back of the grid there will be 3 pin slots (GND, 5V, and DIN). Solder the black wire to the GND pin, your ground, the red wire to the 5V pin, your power, and the white wire to the DIN pin, your input. After you've attached these 3 wires, all you need to do now is attach the other end of the black wire to a ground pin, the red to 3.3V power (didn't seem to need 5V), and the white to GP28 (or whatever input pin of your choice) on your Pico. All done! Test to make sure your LED's are properly connected by running the following code
Something to keep in mind is that the grid does not actually come configured as a matrix and is instead just a list of length 64 corresponding to the top left corner, ending in the bottom right corner.
Prepare Buttons
Next are the buttons. Grab two red and two black wires. In my case, I used simple two pin non-polar buttons that only require ground and power. Attach the black wire to one side of the button, and the red to the other, and repeat for the second button. Then attach both black wires to a ground source on your pico, and the red wires to 3.3V power on your pico. That's it! For this project it's important to use debounced buttons as you only want a click to register one time when clicking a button (moving backwards or forwards through your GitHub timeline). Code for setting up debounced buttons is in the GitHub.
Print Case & Grid / Cut Acrylic
This step is fairly straight forward, print the encasing for the light. The GitHub above contains STL files with the prints I used for printing as well as for reference. I would recommend tweaking them a bit because some of the measurement were a tiny bit off and the enclosure doesn't have a closing mechanism lol. I also cut a foggy acrylic panel to distribute the light slightly better. The measurements were just 72mmx72mm but I would recommend a little bit bigger to cover the entire face of the encasing. Measurements in the STL's in the GitHub above.
Assemble
Finally, you can assemble your box, shove your pico inside, and plop the grid on the railings above it. Make sure the buttons stick out so you can actually interact with them.
Code Config
Since this project relies on communicating with the GitHub api, make sure to set your os environment variables to globally use your GitHub private key, the username you wish to track, and your network information. run the following commands within your CIRCUITPY volume
After this, clone the repo and make sure to run
To install required packages and dependencies onto your Pico
This also assumes you install CircuitPython onto your pico from Adafruit.
And that's it! Fire it up and see how it goes
Errors to Look Out For
Sometimes connecting to wifi via the Pico W encounters some undefined errors. Monitor your boards output in a tio window and if any errors occur, check your wifi make sure it is active and running smoothly, and refresh the code (CTRL+C -> CTRL+D)