The basis for this clever project was originally someone else’s idea. I just made one of my own and put it in a nifty box. Pics put this around June/July of 2016.
The general idea is you take a Raspberry Pi computer, throw some video files on the SD card, add a button, and a little script that picks an episode file at random and plays it.
The circuit is very simple, just a 10k resistor and a button.
And the code is pretty simple, too:
/home/pi/RandomSimpsons.py
#!/usr/bin/python import RPi.GPIO as GPIO import time import os import random buttonPin = 17 directory = "/home/pi/simpsons/" GPIO.setmode(GPIO.BCM) GPIO.setup(buttonPin, GPIO.IN) def playEpisode(): episode = random.choice(os.listdir(directory)) cmd = "nohup omxplayer -b -o hdmi "+"'"+directory+episode+"' &" os.system('killall omxplayer.bin') os.system(cmd) try: GPIO.wait_for_edge(buttonPin, GPIO.FALLING) playEpisode() os.system('sudo python /home/pi/RandomSimpsons.py') #point this to the location of this file except KeyboardInterrupt: GPIO.cleanup() |
I used the May 2016 Jessie Light image. Ran apt-get update & apt-get upgrade, think I also had to install omxplayer “apt-get install omxplayer”
Copy show episodes to the /home/pi/simpsons/ folder – no subfolders, video files only
And add a line to crontab to run the script at startup: “crontab -e” then type: “@reboot /home/pi/RandomSimpsons.py”
Found this Duff Can box pattern on the net (artists page here)
Soldered up a big red button & resistor for testing… pay no attention to that ugly glob of hot glue, this is precision craftsmanship right here 🙂
Used spray glue to stick the pattern to 1/8 plywood (Holy crap this stuff takes forever and makes a horrible sticky mess!!!)
Cutout & Mitered corners, Gorilla glue
Big red button has been replaced with a smaller switch. Will cover with a “pop top” button cover…
Didn’t like the matte finish of the Duff graphics (and they got a bit chewed up during assembly…), so I made up another set, laminated, and superglued to the box.
Ports- Mini HDMI, mini USB OTG, and Mini USB power
Hooked up to the TV and ready for awesome
Clever Ryan! Where do sign up to get one? 🙂