I’d been struggling to put one of my old Raspberry Pis to good use. For the better part of the last several months it’s been just idle, waiting to be tinkered with. I have all kinds of components to build a variety of wicked projects. But in the past, most of my attempts to make something interesting have been met with failure. So I decided to use this holiday season to finally bring something to life from the boxes of breadboards, transistors, and LEDs that are just taking up space in my Man-Corner.
Most importantly I wanted to utilize and old LCD composite monitor which stared blankly at us in the dining room each night. I came across an interesting guide to making a Pireplace that seemed doable. Something basic but fun. A video on a loop of a fireplace crackling that started on boot. Add a little LED Christmas light razzle-dazzle and now you got something interesting.
I set out to work using oshlab.com’s guide as a template. First on my list though was getting an old Raspberry Pi Model B (yep, we’re going old school) up to snuff to handle this project. I decided to use Dietpi as my OS since it offered a small enough image and could give me a minimal X environment (LXDE) to run the video from. I also put to use a 32 gigabyte USB stick to hold the mp4 video file. (plus any additional media for other projects down the line) This was necessary, since even this minimal DietPi install was pushing my 4 gigabyte SD card to capacity. I edited the /etc/fstab to mount it on boot.
Once I got all that squared away and finally got my USB WiFi dongle to work (remember that bullshit?), I started to get my project underway.
I used some random YouTube video downloader in browser to take a 1 hour fireplace video (there are quite a few to choose from), re-encode it at a lower resolution (to save space, and my first generation Pi can only handle so much), then uploaded it to my 32 gig USB stick attached to the Pi.
Next came getting the video to play. I tried the recommended omxplayer but was having some issues. So instead I went with MPlayer (a very similar, minimalist video player). That got my video playing fairly well. Then I wrote a shell script that simply executes my video playing on a loop in full screen mode through MPlayer. I placed that script in my /etc/xdg/lxsession/LXDE/autostart file so that my virtual fireplace starts burning away with no hassle after I ignite my Pi with the microUSB cable. (aka, boot the OS)
This worked wonderfully. Aside from some buffer overload issues that causes the fireplace’s sound to periodically drop out from time to time (video memory is not the original Pi’s strong suit), my Pireplace is a wonderful addition to our tiny Japanese apartment.
But of course, I wasn’t done there. Next came a Christmas light show to put everyone in the holiday spirit.
I busted out an 8×8 LED matrix and used some ready made C code from Sunfounder to drive the lights in a swirling psychedelic extravaganza. (just cut and paste, no C coding on my end) I compiled my code and then added that to my autostart as well. Light show complete!
Well, not quite finished. I still had a lot of unused GPIO pins that I wasn’t about to waste. Python skills don’t fail me now! I wired up 5 LEDs and worked on some code to get them flowing in a nice little timed pattern. Then added it to the autostart, and now my virtual fireplace Christmas wonderland is complete.