Episode: 3039 Title: HPR3039: Making a Raspberry Pi status display Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr3039/hpr3039.mp3 Transcribed: 2025-10-24 15:33:43 --- This is Hacker Public Radio Episode 3039 for Thursday 26 March 2020. Today's show is entitled Making a Raspberry Pi Status Display. It is hosted by Dave Morris and is about 27 minutes long and carries an explicit flag. The summer is a project making use of my Pi 3A Plus, an old monitor and magic mirror 2. This episode of HPR is brought to you by An Honesthost.com. Get 15% discount on all shared hosting with the offer code HPR15. That's HPR15. Better web hosting that's Honest and Fair at An Honesthost.com. Music Hello everyone. This is Dave Morris. Welcome to Hacker Public Radio. Today's show that I'm doing for you is relating to Raspberry Pi project that I have been working on since the end of 2019. I had something on my to-do list for a while which was to make some sort of a status display using a Pi and some sort of a screen. I wanted to show the state of various things including some of the HPR stuff that I helped to look after. And what I thought I'd do would be to have a Pi with a monitor and control the whole Shebang over SSH. No keyboard or anything like that. I started on the project of the Christmas period 2019. I decided to use the Raspberry Pi 3A Plus which is a, I guess some people were calling it a souped-up Pi 0. Bigger than the 0 but it's got more power and facilities but it doesn't have the connectivity that a full-blown Pi has. It doesn't have USB connectivity to any extent. Yannick did a review of this particular model in show 2,711 which I've linked in my notes here. So I wanted to use this Pi and I also wanted to use an old Dell monitor from about 15 years ago and I bought a family PC. It's a strange square monitor. I think lots of monitors were square on a smallish rectangle not the widescreen things you get nowadays. But it worked. So I thought, well why not? I had imagined as I was thinking about this that I'd write some software of my own, some sort of a web package which I could access through a browser and I would, in that, that software I would run various tasks to monitor the state of things and really firmed up any ideas. But I've written a few web-based tools in the past of no great sophistication. I thought this could be the thing to do. However, I started off by looking around to see what there was and I stumbled across all of the various things that people do to build what they, what tend to be called smart mirrors. Particularly software I came across was called Magic Mirror, well actually Magic Mirror 2 because by then it had developed on to a second level. So the purpose of this Magic Mirror 2 thing, which I'm calling MM2 for abbreviation throughout the notes here, is you can use it to make a smart mirror and a smart mirror is basically a mirror that you would hang in your, in a room or in the hallway or something. But you, the, the glass or the acrylic panel that formed the mirror would have a two-way skin on it. So you could see a source of things behind it. So what you would do is you make this fairly thick mirror with, with fairly chunky sides to it and inside behind the glass you'd put a monitor, possibly a strip down, well yeah in most cases people strip them right down to the bare minimum. I've seen people using old laptop monitors and that sort of stuff. What people tend to do is to use them to display information about the date and the time and the way they're in that sort of thing. There are lots of mirror, smart mirror building projects that you'll find on YouTube and all sorts of other websites. I haven't listed any in this in the notes here because I thought you could, if you're interested in doing this, you could easily find them by doing an appropriate search. The software, the MM2 software that I'm using, is actually written in JavaScript for use with Node.js. I'd been interested in getting into Node.js at some point. So that made it quite attractive, hadn't done so. But this looked like a project I could begin to learn my way around Node.js. And alongside it is the electron package. It's been designed in a modular form with quite a few useful modules built into it and an API which makes writing further modules by the community possible. And because it had been around for a few years, there was a pretty wide range of third party modules available. I think it's in active development still the whole magic mirror too thing. And people seem to be developing modules for it at a reasonable rate. The software needs a Raspberry Pi, it's designed to run a Raspberry Pi, but it has to be a Model 2, 3, or 4. You could squeeze it onto a zero, they say, but I'm not sure I would try personally. You need to install full Raspberry, an operating system, not Raspberry Lite, because it needs a lot of the stuff that you want to get with the full Raspberry. So installing it is nothing too difficult actually. I was surprised how simple it is. It's really well documented. It's one of these cases where you recommended to use the curl thing that will download it from a website. And you simply pipe what you get into bash. And you run all this lot under pseudo. Now I'm never comfortable with doing this, having worked in IT and computers for over 40 years now. I've always been a bit suspicious about what could happen under these signals. It just seemed like bad, bad thing to do. So I didn't do that. I actually looked at the script that I got after downloading it to see what it was doing or going to do. And I just ran the individual components by hand. But that's just paranoia on my part. Didn't seem to be particularly dangerous. You do need to install Node.js, which you can do on Raspberry through the app to command. You need to clone the MM2 GitHub repository and you need to use the Node.js NPM utility, which is for installing Node.js things. And then you can build a whole lot. I won't go into detail with this because the documentation is good. I've left a link to it to the various components of it. So as I'd set up the pie with its SD card, I had configured it to run SSH and set up a shared key that I could share across all of my Raspberry Pi's, make it easier to just connect them without even logging in. That's how I run them all. It's partly based on the show that Ken Fallon did about this some time ago. There'll be a reference to it in the notes. I don't have the details in front of me. Now, you can log into the Pi over SSH and start up the Magic Mirror 2 software. But it's a bit awkward doing things that way. And it's recommended that you install a thing called PM2, process manager for Node.js. And this makes it easier to start and stop the Magic Mirror software. Configuration of the software uses two main files. Probably just one actually. If you don't want to do what I'm going to describe. The first file is called config.js. I've given the path where it's normally installed in the default setup. It's a JavaScript data structure which contains configuration details for Magic Mirror 2 itself. And also each of the modules that you're using. And usually this file gets created for you from a sample file. Config.js.sample which you can then edit. You have to be careful when you're editing it. I've fallen over this few times. Particularly things like you see an example in the module documentation for what you should add to make this module run. And whoever's written it has put a typo in there. If you don't notice it, you copy that into the master config file and things break. But there is now a tool which you can use to check the consistency of this configuration file. Which I've noticed here. You run it under npm and you type run space config colon check. I tried that. I've not used it much but I've tried it. And it does a great job. Comes back and says everything's looking good or whatever. The other file that I've been fiddling with is called custom.css. This is the CSS that controls the look of the interface. And it can be changed to modify the way things look. And you can change fonts, colours, backgrounds, all sorts of stuff. I've been fiddling around. Probably a bit more than the other one. But I wouldn't necessarily recommend that you do that unless you want to do what I'm doing. The reason I've modified it is because in my case I'm not making a mirror. But I'm setting up things as a display on a monitor which is going to run all day. Each of the modules displays in a semi-transparent box over a static background image in my case. There's a picture later on in the notes. There are a few pitfalls in making these changes because the overall thing has been designed to have a black background with white lettering and boxes and that type of stuff over the top of it. That you can see but it does through the mirror, through the two way mirror. But it doesn't intrude. It doesn't stop it being a mirror. So the pitfalls are because the expectation is it's what is going to be white lettering on black. And I'm changing to black lettering on white or sometimes coloured lettering on white. And you can get caught out if you're not. You haven't dug into what attributes need to change with stuff being represented as white on white. And you wonder why am I not seeing? Was there nothing in this particular part of the display? And that's because it's a white text on a white background. Anyway, I've included my config.js file and custom.css file along with the episode. Just in case you want to look at them because you're trying to get into this thing. And once some examples, I haven't commented them excessively. But I will go through the modules shortly just to explain what they do. So what I'm actually using at the moment is a bunch of their default modules that come with the package. And a number of third party ones. There's a brief description in the notes. Each of the default modules is documented on the MM2 website. And it tells you what properties you need to add to the modules array in config.js. Third party ones have documentation on their GitHub pages. I've shown in this sort of generic example of how you would add a module to the array. Not sure how helpful that is. You must have the modules array in the config file. And you add an object to that per module. And they're all different and documented and stuff. You need to study them reasonably carefully in order to configure them properly. So here's my list of what I'm actually using in terms of modules. The first one is called update notification. And what this does is it detects whether there are updates to the Magic Mirror to software or any modules. And it will simply pop up a display that says there are updates available that you can want to go and apply. Usually the update stuff is documented and the individual modules. Third party modules explain how to do stuff. Not very difficult. So I've got a module called calendar. I think I started doing this in alphabetical order for what good it does. The calendar allows you to merge multiple i-cow calendars into the module. This is a default module. I've included my Google calendar, which I found out how to do. It's a private key that I haven't displayed in the file. And there's a few other calendars from various places, such as holidays and that type of thing. So you'll see in the picture that it's flagging some Patrick's Day, which is just coming up. And the next HBR community news is in three weeks or something. I hope you'd be able to just point this thing out. An i-cow file in the same directory as the calendar module lives. But it doesn't seem to understand how to do that. It only knows how to read something, which is a web URL or URI. I've got a nice multi-eastern astronomical calendar. I would have liked to add it to this. Probably not a good idea, because it would have made it very, very busy. But still, that was the idea. I'm sure there's a way around this. I haven't found it yet. There's a clock. The clock can be analog or digital. I like the digital format, and I like the 24-hour format. It shows me the date as well. And it's just sitting in the corner of the monitor, ticking away. Which is cool. There's an actual clock beside it, but the plan is to make this monitor take over from the actual clock. At some point, it is more accurate, actually. There's a module that shows the current weather. And it shows the wind speed, the sunrise sunset times. Current weather clarity, sunny, whatever. Temperature, and it feels like. So there's 8.5 degrees centigrade at the moment. It feels like four degrees. Whatever that means. It's actually quite windy out there today, sir. Probably a bit chilly. Not been out much today. I'm in lockdown due to coronavirus. I'm sure many people are. But that's quite useful. In order to access the current weather, you need to, at the moment, connect to OpenWeatherMap.org. And you have to log into that and get an API key, in order to use it. There is development of a new interface, which lets you connect to other weather services. But this is sufficient for my needs at the moment. There's a weather forecast module, which also uses OpenWeatherMap. It needs the same API key. And that showed you predicted weather for days into the future. For the next week, I think it is. There's a newsfeed module, which is quite useful. It's capable of pulling news headlines from multiple sources. And I've selected the Guardian and a couple of BBC feeds. World feed and that sort of thing. I'm finding it quite useful. I don't watch the television. And I don't follow any news sources other than things on the internet. So this is actually quite useful for me, just to keep me abreast of what's going on. In a hopefully, in a way, which is not filtered by the various agendas that different news sources have. I don't know how to handle that one these days, where everything is being filtered through some political filter. So now moving on to the third party modules. First one is called, and they all have funny names. They all begin capital, MMMM, iPhone, MQTT in this particular case. I've given the link to the GitHub repository. So I use MQTT a lot on my home network, as much as I planned to, but I did. I did a show on this in 2016, where I talked about making a device to light RGB LEDs, with a Pi Zero signal when there were things like new HPR shows or comments, which needed attention, or indeed email from my kids. It's another thing it checks for. I use Crown Jobs to check for these events. And it sends MQTT messages to a broker sitting on this device, and there are others. There are several brokers around the house. So I want to be able to add this magic mirror thing into the MQTT network, make a message recipient. So I decided to use this particular module, and I installed the Mosquito package on the Pi, back to the broker, and then set up this module to accept messages with particular categories. So there are things like MMM2 slash comments, MMM2 slash shows. That's for HPR comments and HPR shows. There's some others as well, but I haven't really used them to any great extent yet. I get comments, count of comments, and shows when there are any need attention. I can't do that with the LED thing. There are some, or they're not. I did toy with making the LEDs flash and stuff, but that seemed such a weird idea, really. To sit there and count the number of flashes, find out that there were two comments pending or something. I didn't seem like a good solution. So this one actually just shows a number. It's currently reading zero. So this particular module is quite good. It's pretty simple to use, and it has a lot potential for great deal more. There are other modules in this area that I won't talk about, but just to say that you can make the Magic Mirror generate MQTT events of its own. It's endless just to other systems. People use it to detect temperature of rooms in the house, or toyed with having one that noticed when somebody rang the doorbell. I could even make it pop up a picture of who's at the door, I guess. That's maybe a project for later. The second module in this list, which is not many, is... There's only three, just looking at it. It's called Capital MMM, iPhone Lovian Buses, in a mixed case. Lovian Buses is the company that provides bus service. Not the only one in Edinburgh, but it's the main one, which is subsidized by the Edinburgh Council and stuff. They have created an API to the real-time bus information. I have this on my phone, so I can tell when the next bus is to, in a particular stop order, and I can... Also, the bus stops have got a display on them, which show the same information. It's all coming from a central server. This particular module, given that I have an API key, which I applied for, it's free to go while to arrive, since it seems to be a manual process. But now that I've got it, I've set the module up to monitor the bus stop nearest to my house. I use the bus a lot because I've got free bus pass, so it's monitoring it. At the moment, there are only two buses go to bus services. One's due in six minutes, the other one in 22 minutes. The six-minute one runs every 15 minutes, isn't it? Yeah, 15, I think. It takes me into the centre of Edinburgh. So that seems to be... I've only been running it for about a week or so, but it seems to be a pretty useful thing. It's the sort of thing that you'd be checking to see when would be wise to go and get the next bus, because it shows... I'm saying now it's one in five minutes, but after that, you wait 13 minutes, 23, and 33 minutes. So it means it's 10 minutes, and that's 10 minutes intervals. But it's useful if you're planning a trip into town. So I probably won't be doing for a while due to the jolly lockdown and everything. So finally, I have a module called MMM-Hyphen Remote-Hyphen Control. And what this does is to create a web address to which you can connect, and it will allow you to monitor and modify things within the MM2 installation. So I use it from my phone, but you can actually connect it with a PC. You configure who can connect to it through the configuration file. I don't know if there's any authentication per se. Not really looked at that yet, but you could certainly restrict what addresses within your home network could connect to it. I configure things that are of a reasonably static nature, like all my Raspberry Pi's and stuff, with static addresses. It's relatively easy. I could configure my phone with the static address, actually, and I haven't done yet. So that's a DHCP address. So I would just say, you know, allow the phone. And maybe my desktop to access this. The interface allows you to look to see if there are updates. I think you can apply the updates through it as well. I've not tried this. You can shut down the Pi if you want to, but I haven't really explored all the possibilities. It looks quite nice. It's only ever only been using it for maybe about 10 days. And I've not really got into fiddling with it yet. It's not the most gorgeous thing to use. I thought it was down to the fact that my phone's running an old version of sandwich and mod called Resurrection Remix. And the browsers that I'm using are not very nice. But it seems to be just as unpleasant when I connect to it with my desktop machine. So I don't know. Something a bit, something not quite right. Maybe it's not configured right or something. But it has potential. I'm not 100% certain I'm going to use it. I might be more tempted to control this thing through some other device. People have got modules which let you connect a button to the GPIO on the Raspberry Pi. So you can do multiple buttons. So you can have them to do the various functions you might want to do. I don't know. What's the best? But the fact that there's so many choices is amazing. So there's a picture in the notes which shows the display in full, full blast. Took it on Sunday, March 15th in the afternoon. I've configured up the CSS so there's a background picture. I think it's one of my son's pictures from Travels a few years ago. Not sure where it's come from. And it shows the temperature and all that. All that good stuff. There's not many buses on a Sunday so it only shows the number 44. And you can see it's got one of the headlines that rotate around at the bottom. I didn't. I tried trying to photograph the monitor. By the way, I had my little Dell monitor died. I'm using a larger LG monitor, a wide screen one, which doesn't get used much otherwise. It's not a very big monitor. It sits on a shelf above my desktop machine. So that works out quite well. But I cheated in producing this picture. I connected to the Magic Mirror Pi and did a screenshot of the browser just to get a better picture. My photography skills are not good enough to have done this very well. So finally then, further development. So I'm pretty happy with this Magic Mirror 2. So I'm not sure I'm going to be moving away from it. There's not much else that would do the same job that I would want to move to at the moment. I need to do more tuning. Like I said, there's probably some white on white text amongst the various things here. I need to fix that. Possibly do some font changing in places as well. See how I go. I'd like to learn how to write my own module. One idea was to rotate between set of static pictures on the background. There are modules that will do that. But they tend not to be quite what I want. I want to point out a directory of pictures. And at the moment, that directory of pictures being used is the wallpaper on my desktop machine. And it's on a Raspberry Pi with a SSD on it. And the directory is being NFS mounted. So I would NFS mount it to the Magic Mirror machine and rotate through there. I think that would be my general idea. And there's nothing I found that can do that for me. It's going to be going for web-based picture services and stuff. One thing I really like to do is to automate the turning off of the monitor night. At the moment, I just go to the power switch on the front of it and switch it off when I go to bed. But I've got monitors here that if I do that, my kids can play bitterly because they whistle. They're still power to the circuitry in the monitor. They tend to whistle. I don't hear it, but they do. So I'd like to turn the power off completely. And the plan is to create a remote control switch controllable by MQTT. Maybe the pie that's running in Magic Mirror 2 could do that. And turn it back on again in the morning. This monitor has got VGA connector on the back. The other one didn't have that. I like to take the pie in its case and put it on the back of the monitor. In order to do that, I need to make some brackets. I can't find any that I could buy easily. So I'm looking at doing some sort of 3D printed bracket for that purpose. So that's on the project. There's a vast range of possibilities. But anyway, I thought I'd just share this stuff with you in case you might be interested in perhaps getting into it yourself. So hope you found that interesting. And that's it for today. Okay, bye. You've been listening to heckaPublicRadio at heckaPublicRadio.org. We are a community podcast network that releases shows every weekday, Monday through Friday. Today's show, like all our shows, was contributed by an HBR listener like yourself. If you ever thought of recording a podcast, then click on our contribute link to find out how easy it really is. heckaPublicRadio was founded by the digital dog pound and the infonomicon computer club. And it's part of the binary revolution at binrev.com. If you have comments on today's show, please email the host directly. Leave a comment on the website or record a follow-up episode yourself. Unless otherwise stated, today's show is released on the creative comments, attribution, share a like, 3.0 license.