Stephen Coyle

The Pi Zero Simpsons Shuffler

The Pi Zero Simpsons Shuffler1 is simple - you press the yellow button, and it plays a random episode of the Simpsons.2

It's based on a Raspberry Pi Zero, so it's pretty cheap to make. Breaking down the cost, the Pi Zero costs £4, it uses a 32GB micro SD card which costs about £9, a Mini HDMI cable cost about £3, and it also uses few pence worth of electronic components and other bits and pieces. Naturally, I chose a bright yellow button; it's just a simple momentary switch which pulls down pin 11 to ground (there are plenty of great tutorials for this around the web, so I won't bother repeating them).3 So, the total cost is about £17 (plus the cost of buying and ripping your own DVDs of the Simpsons, of course).

Here's a quick shot of a 'prototype' using a Pi Model A, before soldering it all together on the Zero.

On the software side, it uses a simple python script. It waits for a button press, then selects a random file in a given folder, and plays the file with omxplayer. If the button is pressed while an episode is already playing, it stops it and starts a new episode. I've uploaded the script here. If you try it out, make sure that the only files in the video directory are video files, since it doesn't check that they're videos before attempting to play them. I'm using the Raspbian Jessie Lite image, it already contains all the software you need.

Do let me know if you enjoyed the project, or especially if you give it a go yourself! Or if you're feeling generous, you can buy me a coffee.

Finally, here's a short video of it in action:

  1. The PZSS? Great acronym. ↩︎

  2. Lots of people have asked for details on the button, so here's a quick schematic for mine if you're stuck: Simpsons Button↩︎

  3. A random, good episode. I'm sure it's debatable, but I've included seasons 2-10. After ten it declines precipitously in quality in my opinion... But I reluctantly permit the use of my code on later episodes. I also decided not to have it show the name of the episode, I find it fun to try and guess as early as possible (though Carla usually beats me). ↩︎