“If you want peace, you don’t talk to your friends. You talk to your enemies.”
~ Desmond Tutu
“If you want peace, you don’t talk to your friends. You talk to your enemies.”
~ Desmond Tutu
I have been programming microcontrollers for some time now, mainly Arduino based but played with others like Expressif, Texas Instrument and STM ARM Cortex MCUs. I found that the IDE are either too simple (Arduino) or way different and proprietary.
I also like programming in Python, made a couple of small apps for work related stuff. I used the built in Idle at first but switched to Notepad++ soon after.
What I wished is that there would be a common IDE for everything. I have heard of Eclipse being used for Arduino but not so much of Visual Studio, until I found this extension for it called Visual Micro; after reading how easy it is to set up, I figured I should at least give it a try.
Well, I just installed it yesterday and my first impressions is that I will be using Visual Studio for all my programming from now on. What triggered this is wanting to program the newer ESP32 controller in MicroPython and figured that if Visual Studio can handle Arduinos and ESP8266 along with other programming languages it must be worth trying it out. I haven’t found a way to program ESP32 in MicroPython in Visual Studio yet, but it’s only a matter of time.
It boils down to finding whatever is easy and comfortable for yourself. I like trying different things, but also tend to like Swiss army knife approach: one multi-tool.
“The cure to eliminate fake news is that people stop reading 140-character tweets and start reading 600-page books.”
~ Piero Scaruffi
I was the recipient of a couple of 21″ 1080p LCD monitors that were slated for the recycle bin at work, these were originally used for display in the hallway showing looped videos about the company. They had some kind of proprietary multimedia board inside with an SD card slot to store the media. After a few years of being on 24 hours a day they became unreliable and they decided to get rid of them. I took a couple as I liked the custom frame that made them look like a picture instead of a TV or monitor. They sat in my office for a few months before I could find some time to play with them. The multimedia board was just plain, it could loop through pictures or videos but were not stable anymore even with new SD cards installed. I had a Raspberry PI 3 in my tool box and proceeded to connect it to see how well it worked. I was pleasantly surprised with the quality of the picture so I replaced the proprietary multimedia board with the Raspberry PI 3 using Velcro strips, the image below shows what the inner parts look like right now.
The monitor has a USB port on one side, I connected it to the PI to allow us to upload new videos through USB sticks. We also have a wireless keyboard connected to one of the PI’s USB ports. I disconnected the speakers as we don’t want any sounds from the videos leaking through by accident, we play our own music in the office.
I found it easier to run a separate power supply for the Raspberry PI rather than converting the existing 12V adapter that was used for the proprietary multimedia board. But, hey, this is Version 1.0 so there is room for improvements down the road.
So what do I do with this now? Watching movies or playing video games at work is frowned upon. Then I remembered I saw a virtual window called Winscape that was kind of cool, it has tracking via a Kinect™ sensor for proper perspective presentation, although it only works with one person in the room. I didn’t want anything that sophisticated, my office is a medium room for 3 employees but it is busy with people coming in and out constantly; my thought is that the Kinect™ sensor perspective would be more of a distraction and would freak out multiple people in the office because it can track only one person.
Decided to do something more simple. At first I played live streams of the ISS full screen, it was kind of cool, some people would comment how they don’t have a window in their office and we have one that looked into space!
That worked fine for some time, until one day I couldn’t get a steady connection anymore, found out it was due to some changes made to our WiFi guest network in my building. Tried moving the unit but no luck, it kept dropping connections sporadically. Unfortunately I do not manage the network at my work so I couldn’t choose a different WiFi channel which, in my experience, fixes 90% of issues like this one. Also a LAN connection is out of the question because it is a secure network so the guest WifI is the only option we have for non company issued equipment. I could get around all this but it is not worth the reprimand nor my job.
So, now I have this nice virtual window that can’t connect to the internet, just sad really. For this reason I decided to enable the screensaver, at least it did something, rolling through the nice pictures of the built in screen saver.
One day I stumbled upon TranquilGeo, a YouTube channel that has relaxing videos; because I can’t get a stable connection anymore, this time I ask myself: “how could I get these videos to play on the ‘Wall-pi’ ?”. Could I download them without breaking any hearts or laws? Well there are many ways you can download YouTube videos and that’s all I will say on the matter.
So now that I have a collection of videos, how do I loop them on the Raspberry PI?
An important note is that on a Raspberry PI you have to use omxplayer for videos as it specifically made for the Raspberry Pi’s GPU. VLC and other players might work for audio only, but they do not work for video.
That meant that I had to create some kind of script as omxplayer is command line based; I didn’t want to edit this script every time I added a new video to the folder, so after googling a bit, I found one that did somewhat similar, I just modified it for my need. I modified it to play any mp4 files in that folder and waits 2 seconds before playing the next one. Once it finishes going through all the files in the folder, it calls itself again to start over. I named the script window.sh:
for file in *.mp4
# do something on “$file”
Why the 2 second delay? Because I want to e able to stop the script; without the delay it just skips to the next video. This gives me enough time to do two <CTRL><C> in a row if I want to stop it.
If we want to skip to the next video all we need to do is press <CTRL><C> once.
One thing I had to do is upgrade the micro-SD card from 8GB to 64GB. The 8GB worked fine when we had a steady WiFi connection, but as we loaded high def videos we ran out of space really fast, we are up to 24GB now…
So there you have it, a recycled monitor that became a morale booster in a windowless office. It must be working because I am getting request for specific videos like Moraine Lake in Banff.
The beauty of this setup is its simplicity. Just add any videos through the USB port on the side of the screen and it will play it the next time the script restarts. We have over 35 videos since this post, each varies in length from 5 minutes to two hours, so the chance of seeing the same video during the work day are small, unless it is one of the two hours long ones, and if we want to skip it, we just press <CTRL><C> on our wireless keyboard.
We are now considering other themes, like aquariums or recorded stream from the ISS to add to the playlist.
I will try to take a steady video of it in action, until then the picture below is what it looks like mounted on our wall. This is one of the videos in our playlist just to give you an idea (with no sound in our case).
- Raspberry PI 3 (PI 2 might be good enough for this also)
- 64GB micro SD card
- 5V, 2A, power supply for Raspberry PI with micro USB connector
- HDMI cable
- LCD monitor with HDMI input
- Wireless Keyboard
I enjoy using Linux because I am a tinkerer by nature, however the extra security that comes with it can be rather cumbersome at times, especially when running scripts.
One of the peeve I have is being asked for admin password whenever I make changes or run custom scripts, and I do a lot of both.
Before proceeding, this is the only warning I will give you:
This is a dangerous practice as you may inadvertently delete or change system files. After all, this is one of the features that makes Linux safer. I have done it. Let me tell you it’s no fun reinstalling from scratch. One thing I have learned from making this mistake is to make backups of all your important stuff and the best way to approach this is to ask yourself: “If I lost my Linux computer today, what would I miss the most?” Back that shit up!
Well, that goes with any computer system actually.
Remember this quote: “Jesus saves but everyone else has to do backups.“
So, now that you have been warned, here is how to create a Linux user without being asked for a Sudo password. We simply need to edit one file, it is located here: /etc/sudoers. Before you get carried away and open it with your preferred text editor, there is a special tool to do this, it’s called ‘visudo‘, so you just type:
After you enter your Sudo password for the last time, all you need to do is scroll to the end of the file and enter the following text:
# Uncomment to allow members of group sudo to not need a password
%sudo ALL=NOPASSWD: ALL
Again, this may not be the most safe or secure way of doing things, but if you are OK with the risks, all you have to do is reboot and voilà! No more password to enter when running scheduled software updates scripts!
“It is forbidden to kill; therefore all murderers are punished unless they kill in large numbers and to the sound of trumpets.”
“Tell people there is and invisible man in the sky who created the universe, and a vast majority will believe you. Tell them the paint is wet, and they have to touch it to be sure.”
~ George Carlin