Raspberry Pi – Display Fractals

An always on Fractals display using a Raspberry Pi

 

Petal to the metal on a Raspberry Pi

While we sit here and type commands in we want some cool vibe coming off the raspberry pi. So let’s install some cool vibe. It’s a screensaver that plays really sweet fractals.

sudo apt-get install electricsheep

I know, you’re asking why do we want a screen saver when we just disabled the screen save option for the monitor. It’s because we’re going to use it later. You can skip it if you like, but if you can’t get this easy program working, good luck on the rest.

In the VNC client open a terminal. Not the command line in putty, but a terminal on the actual screen on the machine you’re remotely controlling.

electricsheep

Take that choppy window and maximize it. If anything is wrong with your wifi, power supply, or whatever you should not be able to get to this point. Yes the video playback is choppy, but it’s a raspberry pi for crying out loud. Be sure to let it run for a while, disconnect, reconnect, reboot, reset and do it all over and over a few times over a few hours.

This should be fairly easy to get going, don’t waste so much effort on it. The reboots and all are a way of making sure what you’re going to be doing will work when you’re done, and looking cool while you do it. The point is that this program will push your raspberry pi to a maximum. It will make sure that any bugs will show up.

Electricsheep launches in MPlayer, if you want to configure its options they should be in this file.

sudo nano ~/.mplayer/config

Here is the documentation on mplayer options (the manual). http://www.mplayerhq.hu/DOCS/man/en/mplayer.1.html

Just some basic things. To fix the scaling problem add this if you want the player to adjust to the full screen upon maximize:

zoom=”yes”

Add this if you want the player to not have a title bar, and have it maximize on startup. You can use the esc key, or ‘q’ key to exit.

noborder=”yes”
fs=”yes”

Make sure to set your monitor aspect ratio either 4:3 or 16:9.

monitoraspect=”16:9″

I recommend these settings:

really-quiet=”1”
double=”yes”
cache=8192
cache-min=4
framedrop=”1”
hardframedrop=”0”

If you want the bottom menu to auto hide, there are options for that in raspberry pi. It makes for a much better look overall. Just right click on the bottom bar, and hit ‘Panel Preferences’. Under the ‘Advanced’ tab there is an ‘Automatic hiding’ setting.

To make electricsheep run on startup add a line to the rc.local file

sudo nano /etc/rc.local

add this right above the line that says ‘exit 0’

electricsheep

Sometimes this doesn’t work for some reason. If it does not just edit the cron jobs

crontab -e

Add this near the end somewhere.

@reboot electricsheep

I know, it’s just that easy! If you want to disable the startup just add # to comment it out. Oh, and if you need/want to kill the whole operation and get access to the VNC, just run this before launching your VNC viewer. It’s the command that all electricwolves dream about.

sudo killall electricsheep

Maybe back up the settings.

cp /home/pi/.electricsheep/preferences.xml /home/pi/.electricsheep/pref_backup.xml

To fiddle with the options try this in the cli:

cd /home/pi/.electricsheep && sudo nano preferences.xml

Documentation on this electricsheep http://manpages.ubuntu.com/manpages/natty/man1/electricsheep.1.html

It might help to set the frame_rate to 10, and play_evenly to 1, and maybe set the cache a little higher than normal, say 5000.

If you are using a 4 GB SD card, you will not be able to see very many sheep before the card fills up. In fact, it’s probably best not to do this unless you have at least an 8 GB card. If the SD card fills up things can start going very bad. If you’ve run the program a few times you may notice that there are some .avi files in the folder

cd /home/pi/.electricsheep
ls -al

The program downloads and keeps these. If you want to clear all of them out manually, and leave the preferences in place:

cd /home/pi/.electricsheep
sudo rm *.avi

Let’s say that you want electricsheep to download new sheep daily because you have a 4GB card, and you don’t want to fiddle with the thing anymore. Let’s make a script and run it as a corn.

sudo nano sheepslaughter.sh

Add these lines to the file, save and exit.

sudo rm ~/.electricsheep/*.avi
sudo reboot

Make the script executable

sudo chmod +x sheepslaughter.sh

Add this line to the cron jobs with crontab -e

@daily ~/sheepslaughter.sh

Now the spectacular fractals should display with daily variations. It may re-download the same fractals, but the sheep will vary slowly over time.

Let’s say that you are using a card that is a little bit larger. If you would like to make this operation a little more permanent there are a few last steps left. Meaning that if you want your display to just do this fractal thing all the time, there are a couple of things to consider. The thing will run fine at this point. However, if you are planning on hanging this up on a wall as some kind of ‘fractal art’ thing then there are a few more steps. It would stand to reason that the avi files would need to be flushed on a regular basis. To flush the .avi files regularly set up a cron job.

crontab -e

There should be a bunch of comments here, but nothing actually running. Add this to the bottom. It will delete all the .avi files on a daily, weekly, or monthly basis. Just change daily to whatever you want, and set the numbers higher if you’re using a larger SD card

 

#Clean out electricsheep
@weekly sudo rm /home/pi/.electricsheep/*.avi; sleep 15; electricsheep –min-megabytes 4000 –max-megabytes 4000; sleep 1h; sudo reboot

Recommendations:

8GB:     4000 and @weekly
16GB:    10000 and @weekly
32GB: 25000 and @monthly

Leave a Reply