John's Musings


Yeah, Me Neither

Easiest Raspberry Pi Wall Calendar Yet

What you need:

- Raspberry Pi Zero (or better)

- SD Card

- TV with at least one HDMI input

- Wall mounting bracket for TV

- HDMI Cable

- 1.5 amp power brick

- WiFi dongle (not needed if using a Pi 3 with onboard wifi)

- Micro HMDI to HDMI adapter (only needed if not using a Pi2 or 3)

- Micro USB to USB adapter (only needed if not using a Pi2 or 3)


Get a Raspberry Pi (Zero in my case for this project) and install the latest Raspbian Pixel on it. This is going to be hanging on a wall so there will be no mouse or keyboard but initially you have to set it up with one to make it easy. Might be way easier for a novice to hook up a small usb hub with a keyboard and a mouse especially since when you boot into Raspbian OS the first time and see the desktop you can easily click on the wifi icon in the upper right task bar and input your wifi credentials. It'll save you a ton of time. The only other way would be to hook the Pi to ethernet and SSH into it, set up a VNC session, enable wifi either by command line or desktop............You get the idea. Just hook up a darn keyboard and mouse for the first boot. Obviously we are using our TV here for a monitor.


Download and install the latest Raspbian Pixel on your SD card. Refer to here for directions.


You can do the next steps via SSH as well if you got your wifi enabled or connected via ethernet. But while the keyboard and mouse are hooked up, why not just do it? We'll do the wifi later in the instructions.


NOTE REGARDING SSH - THE LATEST VERSION OF RASPBIAN JESSIE-LITE DOES NOT HAVE SSH ENABLED. IN ORDER TO ENABLE IT AFTER YOU CREATE YOUR SD CARD you must add a file called ssh to /boot


Here's how I did that on a Mac. Right after the Raspian image wrote to the card I went to a terminal and typed


cd /Volumes

cd boot

touch ssh



There are a variety of ways to do this. I figured that was the easiest. If you are doing this from Windows or Linux you may need to google it to get the exact directions. Now lets configure our Pi knowing we can SSH into it if we need to.



sudo raspi-config




Go to "Interfacing Options"



Then enable VNC. (Even though I don't really go into why you're enabling VNC, and even though you don't need it for this tutorial maybe, you'll be glad later when the TV is hanging on the wall with no keyboard and mouse that you can access your Pi from a VNC session from another computer).



While you are in there after you hit the back command on the screen above go do option 1 to Expand Filesystem and option 2 to change the password.



Okay while you are in SSH or in your terminal also run the following commands:


sudo apt-get update


sudo apt-get upgrade


We're going to use Chromium browser since it is already installed on Raspbian Pixel as of Sep 2016.


Chromium browser is EXACTLY the same thing as Chrome just without fancy dancy licensing.


While you are hooked to a TV with keyboard and mouse enable your wifi. Coding it by hand isn't the end of the world but this is MUCH easier. It's pretty much done the same way as every other computer you've configured wifi with.




Now on any computer anywhere open a browser and go to dakboard and create an account. Once you create an account you can configure a webpage with your widgets. Just work down the list and play around until you get what you like. There is no right or wrong way.




You can check your progress by clicking on "My DAKboard" (4th from the bottom in left hand pane). Now go to your account page and we're going to grab the customized web page so we go straight to our calendar every time and don't need to log in. Copy the link below where it says "Private URL:". Mine is obviously partially obstructed for security reasons.



Okay back to the Raspberry Pi either on the desktop in the terminal or via an SSH shell.


Type the following:

sudo nano ~/.config/autostart/chromium.desktop

Paste in the following code (USING THE WEB ADDRESS FROM DAKBOARD I MENTIONED ABOVE)

Once again i have chopped the end of my address off just for security reasons.



[Desktop Entry]

Encoding=UTF-8

Name=Connect

Comment=Checks internet connectivity

Exec=/usr/bin/chromium-browser --noerrdialogs --incognito --kiosk http://dakboard.com/?p=850




Hit CTL key + x , answer Y for yes to save.


What we just did was to tell Chromium Browser to start up full screen every time you boot the Pi and log into your Dakboard that you configured.


NOTE: Here's a great big gotcha for you folks. Once you start Chromium browser in kiosk (full screen) mode it doesn't seem to want to get out of the way so you can do things on the desktop OS, like set your wifi for instance, or tell the computer to reboot. This is where logging in via ssh comes in handy. From a terminal on another computer on the same network do this:


ssh IPADDRESS -l user #(i.e. ssh 192.168.20.139 -l pi)


if it asks you to accept ssh keys yes/no say yes. If it tells you to get lost and your keys don't match type this to fix.


ssh-keygen -R IPADDRESS #(i.e. ssh-keygen -R 192.168.20.139)  #That deletes old ssh keys and allows you to ssh in again.


To kill Chromium browser


sudo killall chromium-browser


To relaunch just type chromium-browser or launch it from the desktop.


Moving on.

Lets keep the lights on, don't want the screen going to sleep.


sudo nano ~/.config/lxsession/LXDE-pi/autostart


Paste in the following code at the bottom of the file


@xset s off

@xset -dpms

@xset s noblank



Hit CTL key + x , answer Y for yes to save.


Sweet. Reboot to test.


sudo reboot


or


sudo shutdown -r now


This is what you should see when you reboot. Boots directly into Chromium with your Dakboard. You can add your own photos to a variety of web services. I used Dropbox.



Here's what the TV looks like. I double side taped the Pi Zero to the back. Very clean looking hanging on the wall.




I changed the layout a bit as well. I tried first hanging it in Portrait mode, which was cool, but this is also a smart TV with wireless and that deprived me of the ability to watch Hulu and Netflix while cooking if I wanted to.




If for some reason your TV screen doesn't quite go edge to edge and fill the screen issue the following command and uncomment the line (remove the #) that says disable_overscan=1


sudo nano /boot/config.txt



Hit CTL and X and then answer Y to save the changes.


If you see any pixelation make sure you have a good connection with your HDMI on the adapter end especially and you can add more GPU memory if need be. Go to raspi-config and then "Advanced" > A3 Memory Split. I set mine to 128


sudo raspi-config






Now you are basically done and can stop here. UNLESS you are a mythical POWER USER!


To get just a little more complex with this setup............Since I have this TV hanging on the wall which is always on I decided to make use of the fact it has speakers on it which are largely not being used. (It is also a smart TV so I can stream Netflix and Hulu, Vizio 24")


At home I have a music media server called Logitechmediaserver (LMS). It is available for a variety of platforms such as Windows, Linux, Mac, Raspberry Pi (ARM), and some NAS devices. My principal LMS server is installed on a Mac Mini. From there you go to mysqueezebox.com and make an account. Once you have an account you can add streaming services such as Spotify, Tidal, Pandora, TuneIn Radio, Shoutcast, among several others. Those are the ones I have used or currently use now.


You don't HAVE to put LMS on another computer. It will run on the same Pi, it may be a little slow on a Pi Zero but it'll run. Runs real nice on a Pi 3. So if this is going to be a stand alone LMS lets do this. If you intend to install LMS on another computer you can skip this. I have directions below for just adding a squeezelite player. To install LMS go to the nightly link above and right click on the ARM version and go to your terminal and type wget followed by the link (again using the latest version as of when I wrote this).



Now type (and make sure your file names are right, cut and paste with links is weird sometimes)



cd

mkdir lms

cd lms

wget http://downloads.slimdevices.com/nightly/7.9/sc/cf749e5/logitechmediaserver_7.9.0~1482423225_arm.deb

sudo dpkg -i logitechmediaserver_7.9.0~1482423225_arm.deb


The last command there will install LMS on directly on your Pi and it should start automatically. The way to access it is any browser on the same network with the IP address of your Pi plus :9000 (i.e. 192.168.1.2:9000) To find the address of your Pi type


ifconfig 


So then since you have a Raspberry Pi hooked to a TV delivering the awesome DAKboard why not put a streaming player on it and use the speakers? Granted my Vizio TV speakers sound pretty terrible however it is good enough for talk radio and I listen to a lot of talk radio. Also if you used a Raspberry Pi 3 with built in bluetooth you could conceivably hook to some bluetooth speakers for decent sound. Again, this is a kitchen rig. All I want is talk radio however it would only take swapping the Pi Zero with a Pi 3 (or Pi2 with a bluetooth dongle) to get more.


Adding squeezelite is remarkably simple. I do it like this. It needs some dependencies though to play common file formats.


sudo apt-get install libasound2-dev libflac-dev libmad0-dev libvorbis-dev libfaad-dev libmpg123-dev
liblircclient-dev libncurses5-dev


Then lets get and install squeezelite.


mkdir squeezelite
cd squeezelite 


Now go to this page to get the latest squeezelite. My tutorial will describe the current latest version. Simply change version number if it updates once this post gets dated a bit.


wget https://sourceforge.net/projects/lmsclients/files/squeezelite/linux/squeezelite-1.8.6-825-armv6hf.tar.gz
tar -xzf squeezelite-1.8.6-825-armv6hf.tar.gz sudo mv squeezelite /usr/bin/squeezelite


Okay squeezelite is now installed. Simple.


Now lets see our devices. I'm using the HDMI sound off the TV here. You could add a DAC if you wanted to.


squeezelite -l


There is quite a bit of output for a Pi Zero. The following kind of depends on what kind of Pi you have in the project. I am using a Pi zero which has really only one audio output. The HDMI. I could have chosen the one that says "sys default", the other "hw:" device works I know. Probably some others as well. If you are using a Pi 2 or Pi 3 you also have an onboard sound output which will be your sys default. To pipe sound out via your HDMI cable you pretty much have to use the one I have circled, or the plughw one below it two items. Yes you can use the sysdefault off the 1/8th inch output on the Pi but then you need another cable. Let's keep it simple, shall we?

I chose to use the one circled because it is the hardware (hw:) device for the HDMI. . Now here's what we do to set up the device and make it start at boot.




sudo nano /etc/systemd/system/squeezelite.service


It'll be empty. Paste this in (and note this is MY system), alter accordingly. After squeezelite -o add the player you selected. The -n parameter is the name of the player. Name it anything you want. The -s is the LMS server. If you leave this out entirely it will likely find it. If you want to put -s 127.0.0.1 that will work too. The -a 80:4 is something I used on another TV that sounded terrible and choppy until I added those parameters. To be honest I didn't remove it on this new TV and it works great. I'm leaving it in. You may not need it or you might need it. Because I have like 10 players in the house sometimes they conflict with each other. The -m setting is the MAC address of the player to keep them all straight. If this is your only player you won't even need to add the -m part.




[Unit]

Description=Squeezelite

After=network.target

[Service]

ExecStart=/usr/bin/squeezelite -o hw:CARD=ALSA,DEV=1 -n calendar -s 192.168.20.37 -a 80:4 -m 74:da:38:41:f8:9e

[Install]

WantedBy=multi-user.target


Hit CTL +x and then answer Y to save the file.


Now lets start it at boot


sudo systemctl enable squeezelite.service 



Now if everything went according to plan when you boot up and find your LogitechMediaServer (it is the IP address of the computer you put it on plus :9000) In my case my LMS lives on my Mac Mini of 192.168.20.37:9000


Just put that in a browser and look for your -n parameter (I named mine calendar). It should find it as a player.



You can see I circled the apps I enabled in my squeezebox.com


Tidal and Spotify you must have pay premium accounts to use. Ditto with Pandora. TuneIn and Shoutcast are free.


Now your DAKboard is a music player too!



Impress your friends. Attract women. Be the life of the party with your wall calendar and music streaming device.





48,606