/xmastree2020

My 500 LED xmas tree

Primary LanguagePythonMIT LicenseMIT

Matt Parker XMas Tree

  • My attempt to provide more functionality for Matt Parker's Christmas tree.

  • Original video: https://www.youtube.com/watch?v=TvlpIojusBE&ab_channel=Stand-upMaths

  • In order to run this on a raspberry pi, the files xmaslights-nathan.py and vid.py should be placed in the same directory. Then xmaslights-nathan.py should be run with python.

  • For best results, view the tree from the XZ plane

Files to include on the pi:

  • xmaslights-nathan.py - the file that actually draws everything to the christmas tree
    • First displays an physics simulation of a playground ball bouncing
    • Then displays a few example images to the tree (Matt Parker's face, the letter pi, and the cover of the book Humble Pi)
    • Finally displays a 30 second clip from the origional video to the tree (if the program can find vid.py)
  • vid.py - a file containing all the information necessary to draw the 30 second video clip to the pi. Generated by vidToTree.py
    • seperated because it is very large. Without this file, the program will still run, just not display the video.

Utilities provided in this repo:

  • imgToTree.py - a python script which converts an image file into a properly indexed color array for the tree
    • array is printed out into terminal and can be pasted into a python file
  • vidToTree.py - a python script which converts a .mp4 file into an 2D array of colors (or a 3D array of integers). Each element in this array is a frame of the video.
    • array is written to a file called vid.py. This file should be placed into the same directory as xmaslights-nathan.py

Simulation Enviornment files (should NOT be copied to a pi):

  • neopixel.py - a file that simulates the christmas tree using matplotlib's 3D functionality. Can be used without a raspberry pi or lights to play around
  • board.py - a file that contains a board constant used in xmaslights-nathan.py. Allows the file to compile when not on a pi