It’s on @MichMich’s radar …
On my radar is the possibility to live a 37 hour day without having an psychotic episode.
It’s on @MichMich’s radar …
On my radar is the possibility to live a 37 hour day without having an psychotic episode.
I questioned myself a few times (and I still am) before posting this. In light of our recent loss, a family member asked if it’s possible to display pictures on MM. The answer, of course, is yes. However, I wanted a bit more flair. And while this goes way south of @MichMich’s desire to keep things back and white, for this purpose, I decided to move away from that.
Please don’t ask for the code because a) it has a lot of limitations, b) it’s a personal thing, and c) just enjoy it and should you want to tackle something similar thing, know that it’s possible and by all means, go for it.
There are no clear rules for creating topics or responding to posts on forums in general. Each one is different, each one will have its own set of rules to abide to and what you can or can’t do. However, what we can do is offer guidelines. So here goes:
Am I boring you yet? Well good, you read this far. :) Seriously folks, have fun, enjoy, post your mirror issues, questions, or other relevant topics. We’re all here to learn from one another, and showcase our work.
Go forth and code!
Now that we have the operating system on the card, we’re ready to boot up the Raspberry Pi (rpi). Put the card into the slot on the bottom of the rpi, plug in your monitor cable, turn the monitor on. Whether you are using a wired or wireless keyboard and mouse, make sure those are plugged in, then plug in power to the rpi itself.
The first boot up takes a bit longer than usual because it’s reconfiguring itself and setting all the defaults. If all went well, it should boot straight into the graphical interface. I apologize but I forgot to take a screen capture of this, but in the upper menu, click on the Terminal icon. It looks like a black monitor. This opens up a black terminal window, logged in as the pi
user.
We are now going to run through the basic configuration of the rpi itself. This will result in a rather long post with lost of screen captures. You’ve been warned. :)
Step 1
In the terminal window, type in sudo raspi-config
and hit return/enter. This will launch the Raspberry Pi Software Configuration Tool. (Navigation is done with the arrow keys
, the TAB
key allows you to jump from the selection menu to the buttons on the bottom, and the space bar
is used to select or un-select menu items.)
The first item, Expand Filesystem
is already highlighted for you, so just hit enter/return on that. This will instruct the rpi to resize the partition to use the full size of the card.
You do not need to immediately reboot, so let’s move on.
Step 2
Now we’re going to configure the Internationalisation Options
. This will configure your rpi to use the correct language, timezone, and others. Select that option (5) and hit enter/return.
Select the first option, Change Locale
(I1)
Now scroll to your preferred language using the up/down arrow keys. In my case, I’ll be using US English
as opposed to the default GB English
. Press your space bar to select your preferred language, and don’t forget to un-select the default. one. And I specifically picked the UTF
version because it supports any Unicode character. ISO-8859-1
only supports the first 256 characters.
Once you complete that step, you’re back at the main menu. Select the Internationalisation Options
again, and go to the second option, Change Timezone
(I2)
Start by picking your region, then the respective timezone that you’re in. In my case, I’m in the US
, living in the Mountain
timezone
Once again, when you finish that, it takes you back to the main menu. Get back to the Internationalisation Options
and pick the third option, Change Keyboard Layout
(I3). The default is a standard UK, full size keyboard. If that’s what you’re using, then you don’t need to do this. However, it’s still worth looking at in case you do happen to have a different keyboard. I wanted to change mine to a US keyboard instead.
By default the Generic 105-key (Intl) PC
version is selected. For most cases, that’s fine, just hit enter/return on that and it will take you to the layout option. Note the default UK settings:
Since I wanted a US layout, I selected Other
.
On the next screens, I picked the English (US)
for the country, again English (US)
for the layout,The default for the keyboard layout
, and No compose key
At the end of this, it will ask you what you want the CTRL-ALT-Backspace
combination to do. Normally it does nothing, but it can be configured so that if you hit that combination, it instantly kills the X-Server (and depending on the OS setup, will restart it fresh.) This was a more applicable when X11 was still in its infancy and things crashed a lot. Over the years, things became more stable, threads started getting removed from the main process, so applications could be killed and restarted without needing to completely kill the X-Server itself. However, it’s still around today. I have yet to have the X-Server on my rpi crash on me, ever. And if things really get completely bogged down, I just restart it remotely. Specially since this isn’t going to have a keyboard on it, there’s no sense in configuring this option, so I left it as No
.
Ok, one more time, go back into Internationalisation Options
and pick the last item, Change Wi-fi Country
(I4). This will set the correct channel frequencies available. In the US, channels 1 through 11 are common. Channels 12 and 13 are allowed, but for low power only, and channel 14 is forbidden. For the rest of the world, channels 12-13 are not restricted. And for those in Japan, well aren’t you guys special … you get to use channel 14 as well (only specific protocols.)
Step 3
Scroll down to Advanced Options
and select it. Pick the second option, Hostname
(A2). Here you will give your rpi a name. By default it’s raspberrypi
but why be like the rest of the world? You can change that.
Make sure you read the warning that pops up, then set the name to whatever you want. For example, I changed mine to magicpi
… after all, it will be running MagicMiror! (the screen shot shows the default setting)
Once back at the main screen, pick Advanced options
again and scroll down to SSH
(A4). I like having the SSH server running because it allows me to connect to the rpi from anywhere on my network using a terminal program. So I don’t need to have a keyboard and mouse connected to the rpi itself, I can log into it using a different machine. But if you don’t need/want this, you can turn off/on the SSH
server. In this case, I wanted mine turned on
Optional Camera Step
Are you using a Raspberry Pi specific camera? If so, you need to enable the rpi to work with it. Scroll down to option 6, Enable Camera
and turn it on.
Step 4
Done! When you’re back at the main screen after the last step, press the TAB
key and highlight Finish
at the bottom and hit return/enter. It will ask if you want to restart to which you will say Yes
of course.
I had to look this one up myself today. For those of you wanting to do a screen capture on your MM2 on the raspberry pi, you can install the scrot
package (sudo apt-get install scrot
) and use it to do that. Simply issuing the scrot
command from a terminal will take a screen capture of what’s being displayed and saves a PNG file in the current folder. You can also tell it where to put the file by issuing scrot /path/to/file.png
- note you must put in a file name as well for this to work.
Now obviously you can’t do that when MM2 is running, but you can do it through an SSH login to the raspberry pi. You will have to tell it which display to use: DISPLAY=:0 scrot /path/to/file.png
.
Because I develop from a remote machine (through SSH), the above command comes in handy because I can drop the file onto a shared folder and access it from my remote system.
Using scrot
beats taking a picture of the screen whenever you want to show something on your MM installation.
I don’t remove config sections … I comment them out … If I’m going to edit that file to change a flag, it’s just as easy to add a /* ... */
tag around the specific section. :)
Do not install MM as root. Do it as the 'pi'
user. Better, safer.
Submit a PR request on the Github page. Do it against the ‘develop
’ branch please.
Ready for some fun? Let’s clean up the rpi OS and remove some of the big packages and a few things that we won’t need. This is but a small list of apps, but they are by far the biggest ones aside from the X-server itself.
First, let’s look at the current state of the storage:
The df
command will show you storage across the entire file system (or it can be restricted with specific options.) The -k
option shows the values in 1K block format, while the -h
option refers to the human readable
option, which prints the sizes in powers of 1024. So we can see the /dev/root/
file system is at 48% full. That’s just the default Jessie installation!
Now, for all intents and purposes, this is just fine. It still has over 50% of the file system free and if you aren’t doing anything else with it, this is fine, you can leave it alone. However, I run all of my systems lean, meaning I will remove all (or most) of the stuff I won’t be using for the specific application. And in this case, I only removed the big space hogs that I know I will never use. There are a lot of packages that you could remove, since MM does not need them, but I didn’t care to do that … yet. So let’s move on.
Step 1
Remove unnecessary software packages. I started with the stuff I know I won’t be using and the big stuff!
idle3 java-common libreoffice minecraft-pi
scratch nuscratch penguinspuzzle python-minecraftpi
python3-minecraftpi smartsim sonic-pi wolfram-engine
The command I used to remove all of them is:
sudo apt-get remove --purge idle3 java-common libreoffice* minecraft-pi scratch nuscratch penguinspuzzle python-minecraftpi python3-minecraftpi smartsim sonic-pi wolfram-engine
NOTE: on libreoffice
I added a star at the end, making it libreoffice*
. This is because there’s a single libreoffice
package, as well as several libreoffice-*
packages, and if you don’t add the star, it will only remove the one, while leaving all the rest.
When you run that, it will collect everything that needs removing and present you with a [Y/n]
question. Notice the amount of space that’s about to be reclaimed:
You’re reading that right, a whopping 1,112MB, or 1.1GB worth of space. Let that run and remove all those packages.
Step 2
Once completed, we’ll also remove those that aren’t needed anymore:
sudo apt-get autoremove
It will present you with a list of packages that aren’t used anymore (since you just removed all those other ones above). Again, say Y(es)
to the question:
Now, for comparison, let’s look at the storage usage again:
Look at that, we went from 48% full, down to 30%, or from 3.3GB down to 2.1GB used. That’s a lot of space reclaimed!
Step 3
Moving on. It’s time to run an update/upgrade on the system packages. You do that by entering the following commands:
sudo apt-get update
sudo apt-get upgrade
Or if you want to do them both together:
sudo apt-get update ; sudo apt-get upgrade
First the update:
Followed by the upgrade:
So why two separate commands? The update
command will refresh the mirror list and available packages from the distribution mirrors. This sets up the next command, upgrade
, with the necessary files to compare against. Then the upgrade
command will compare all the packages that are currently installed with the mirror lists and show you all the ones that need to be upgraded. You did say Y(es)
to that, right?
Step 4
The last thing we need to do is make sure the firmware on the rpi is current. Performing a sudo apt-get upgrade
does not always trigger this (in fact, I have yet to see it do that), so we’ll do it manually. The command for that is:
sudo rpi-update
Note that it requires a reboot once that’s completed. A sudo reboot
will get that done for you.
Now let’s look at the storage usage once more:
That’s not too shabby at all. 2.3GB out of 7.2GB used … I’m happy with that.
You are now ready to start installing MagicMirror²!
“There’s a camera behind the mirror. We will know if you don’t wash your hands.”