Raspberry Pi Digital Signage

There have been many different attempts at inexpensive digital signage over the years.  My favorite, one that I use regularly where I work, is Raspberry Pi for digital signage.  Put simply, I set up a Raspberry Pi to load a continuous loop of a Google Slideshow.  This refreshes once every 15 minutes to load new content.

Here’s how we do it.

First, run all updates on your new Pi. (sudo apt-get update, sudo apt-get upgrade).  I like to also run sudo apt-get dist-upgrade and sudo autoremove to fully upgrade plus clean things up.

Next, install clutter and automation (sudo apt-get install clutter and sudo apt-get install automation).

Set your auto config to keep the Pi from going to screensaver as well as load the slideshow automatically on boot.  The file you need to edit is /etc/xdg/lxsession/LXDE-pi/autostart.  You’ll want it to look like this:

@lxpanel –profile LXDE-pi
@pcmanfm –desktop –profile LXDE-pi
point-rpi
@xset s off
@xset -dpms
@xset s noblank
chromium-browser –noerrdialogs –disable-infobars –incognito –kiosk http://web.address.com

Now edit crontab to refresh every 15 minutes (crontab -e):

#Refresh every 15 minutes
*/15 * * * * xte “key F5” -x:0

That’s it!  Enjoy your new digital signage!

Posted in Computers and Hardware, Technology | Comments Off on Raspberry Pi Digital Signage

Truer words

“We are made to persist, to complete the whole tour.  That’s how we find out who we are.”
– Tobias Wolff

Posted in Personal, Ponderings | Comments Off on Truer words

555 Metronome

My 555 metronome, all boxed up.

I wanted to make a metronome and decided on the venerable “555” chip. In this case I used an LM555CN. I had all components needed except the IC itself, so I ordered a handful (they are only about $0.75/each) and started the process. This was my first time playing with a 555, and it was great fun!

I started with this circuit from Jameco. Then I breadboarded and made changes until I was happy. The original circuit gave roughly 25-550 BPM which was pretty wild – standard metronomes are 40-208 BPM. My circuit as adjusted gives me 35-200 BPM which is close enough for my purposes.

I used Krita to edit the original schematic after making my changes to “dial in” this metronome circuit.
This is my layout for my modified 555 metronome circuit. I created this layout using DIYLC from Bancika.
Posted in Circuits and Electronics, Music, Projects | Comments Off on 555 Metronome

Original iPod Shuffle – on Linux

That’s right, I’ve finally found a way to use my old 512mb Shuffle on Linux. Thanks to keyj for making a simple python script in 2006. How it works is you put whatever you want for mp3s onto the shuffle (after mounting it in linux) then move the python script onto the root of the ipod. Then run the script in terminal after navigating to the root of the mounted iPod:

$ python rebuild_db.py

Here is a link to the python file on sourceforge.

Thank you internet!

Posted in Computers and Hardware, Hobbies, Music, Personal, Projects, Technology, Web/Internet | Comments Off on Original iPod Shuffle – on Linux

Current thoughts

“No man ever wetted clay and then left it, as if there would be bricks by chance and fortune.”

– Plutarch

It is sometimes hard to remember that we cannot just simply start a process and then leave it be and assume it will finish of its own volition. Whether referring to child rearing, gardening, politics, or any other number of things – once you start something, you must finish it.

Posted in Personal | Comments Off on Current thoughts

Rest in peace, Ashes

Yesterday we had to lay our son, Ashes, down to rest. He was 14 years old and had been with us since we were a young couple in college. I loved that cat more than I realized. He helped me through many of my struggles with panic and anxiety over the years. We miss you, Ashes.

Posted in Home and Homestead, Personal | Comments Off on Rest in peace, Ashes

RSS displayed with PHP – Updated!

A week ago I posted about using PHP to display an RSS feed. We moved to a new server that did not have DOM enabled, so I have updated my code to use curl instead of DOMDocument.  Either method does work, but this is nice and clean.  See below for my new code:


<html>
<head>
<link rel="stylesheet" href="/alert-rss.css" media="all">
</head>

<body>

<?php

//set timezone
date_default_timezone_set('America/New_York');

//set RSS feed
$handle = curl_init('https://url-of-rss-feed.com');

curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($handle, CURLOPT_FOLLOWLOCATION, TRUE); 
curl_setopt($handle, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($handle, CURLOPT_ENCODING, 'identity');

//get RSS feed from $handle
$response = curl_exec($handle);

curl_close($handle);

$xml = simplexml_load_string($response, "SimpleXMLElement", LIBXML_NOCDATA);
$json = json_encode($xml);
$data = json_decode($json, true);

//load feed
$feeds =  array();

//load only required feed items
if(isset($data['channel']['item'])) {
    foreach($data['channel']['item'] as $item) {
        $feeds[] =  array(
            'title' =>  $item['title'],
            'desc'  =>  $item['description'],
            'date'  =>  $item['pubDate'],
        );
    }
}

//set the internal point of the array to last element
end($feeds);

//pull key of array at pointer so we only display one entry
$key = key($feeds);

//set variables to display data from array
$title = $feeds[$key]['title'];
$description = $feeds[$key]['desc'];
$date = date('l F d, Y g:ia', strtotime($feeds[$key]['date']));

//set $end_date for when RSS expires - calculation entered as (hours*secondsperhour)
$end_date = date('l F d, Y H:i', strtotime($feeds[$key]['date']) + (18*3600));

//set how date variables are calculated for comparison purposes
$today = date('l F d, Y H:i');
$today_calc = strtotime($today);
$end_date_calc = strtotime($end_date);

//display what we have found if it is current
if($today_calc < $end_date_calc) {
	echo '<div id="blinky-div"><p><strong>'.$title.'</strong><br />';
	echo '<small><em>Posted on '.$date.'</em></small></p>';
	echo '<p>'.$description.'</p></div>';
//hide div if there is no current data
} else {
	    echo '<div style="display: none;">No current RSS</div>';
}
?>

</body>
</html>
Posted in Upgrade, Web/Internet | Comments Off on RSS displayed with PHP – Updated!

Display RSS feed as alert using PHP

Our school district had a need where we wanted to have the no school notice show on all of our district pages when an alert is sent out.  I wanted to automate the process so that there wouldn’t need to be any intervention last minute.  The alert system we use, Alert Solutions, has an option to output to an RSS feed.  By using this and a small amount of PHP, I was able to get the alerts to show up on the site automatically and display for 18 hours without any special intervention other than when the admin makes the notification, they have to remember to check the “RSS” box as well. 

The issue became that the RSS feed never lets go of any posts, and on top of that, it outputs the oldest at the top.  To fix this, we look for the number of keys, then pull only the latest key.  This means that we are only looking at the most recent entry.  If it is less than 18 hours old, it is displayed automatically.  Otherwise the div is set to display:none; and doesn’t show.

Below is the code I used.


<html>
<head>
<link rel="stylesheet" href="/alert-rss.css" media="all">
</head>

<body>

<?php
	//Set timezone and load array with only the fields we need
	date_default_timezone_set('America/New_York');
	$rss = new DOMDocument();
	$rss->load('https://url-of-rss-feed.com');
	$feed = array();
	foreach ($rss->getElementsByTagName('item') as $node) {
		$item = array ( 
			'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
			'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
			'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue,
			);
		array_push($feed, $item);
	}
	
	
	//Find the last entry array key so we only display current RSS feed
	end($feed);
	$key = key($feed);
	
	//Set variables to pull appropriate data from array
	$title = str_replace(' & ', ' &amp; ', $feed[$key]['title']);
	$description = $feed[$key]['desc'];
	$date = date('l F d, Y H:ma', strtotime($feed[$key]['date']));

	//Set $end_date for when RSS expires.  Calculation entered as (hours*secondsperhour).
	$end_date = date('l F d, Y H:ma', strtotime($feed[$key]['date']) + (18*3600));

	//Set how today is calculated for comparison purposes
	$today = date('l F d, Y H:ma');

	//Display what we have found if it is current
	if($today < $end_date) {
		echo '<div id="blinky-div"><p><strong>'.$title.'</strong><br />';
		echo '<small><em>Posted on '.$date.'</em></small></p>';
		echo '<p>'.$description.'</p></div>';
	//Hide DIV if there is no current data
	} else {
		    echo '<div style="display: none;">No current RSS</div>';
	}

?>

</body>
</html>

 

And here is the CSS I used:

@keyframes blink { 
    50% {
   	border-color: #ff0000; 
   	border-style: solid;
   	border-width: 4px;
   	}
   	0% {
   	border-color: #fff; 
   	border-style: solid;
   	border-width: 4px;
   	} 
}
#blinky-div {
    animation-name: blink ;
    animation-duration: .5s ;
    animation-timing-function: step-end ;
    animation-iteration-count: infinite ;
    animation-direction: alternate ;
}
Posted in Computers and Hardware, Technology, Web/Internet | Comments Off on Display RSS feed as alert using PHP

Clean your DHW tankless coil

We have hard water and we heat our water with an oil boiler and a tankless coil.  This is, admittedly, a very inefficient method of heating water but it came with the house so we are making it work.  Once a year we need to have the coil cleaned so that we get full output again.  In the past, our service company covered this under our contract, now they don’t so I have taken to doing it myself.  Here’s how I do it:

Wayne WaterBUG pump (any plastic submersible utility pump works) – $100
Washer hoses (pair) – $15
2 gallons of white vinegar – $6
New 5 gallon bucket – $3

For a total of $124 plus tax, I have everything I need to perform the cleaning.  Considering it was going to be $200 to have it done professionally, this was good.  Also, next time it is only $6 for the vinegar.

Of note, I already had the tankless coil isolator valves plumbed in, if you don’t have these you will need them and they cost about $60 for the set.

Procedure: Turn off boiler, let it cool down to at 110F or cooler.  Put pump in 5 gallon bucket.  Fill bucket with 2 gallons of vinegar.  Hook one hose from top of pump to one end of the coil.  Hook other hose from remaining coil hookup and put the loose end into the bucket.  Turn isolator valves off from water main and on to the pump and exit hose.  Plug in pump, let it run for 1-2 hours.  After that, I drained the vinegar and did the same process with clean water for a few minutes to get all the vinegar out.

It worked perfectly for us and is a known DIY solution, but I thought I’d share it here for you folks!

Posted in Home and Homestead, Wood Heat/HVAC | Comments Off on Clean your DHW tankless coil

Driveway alignment, do it yourself!

I’ve always been under the assumption that alignments should only be done by professionals on an alignment rack.  While I do still believe that this will give the best results, in a pinch, it can be done in the driveway as long as you are looking for zeroing out your toe adjustment.  It worked well for me as my Subaru Forester prefers zero toe-in anyway.

Simply use a piece of string and attach it somewhere behind the rear wheels (license plate or trailer hitch works well).  Then bring the string half way up the rear wheel and up to the front of the car, half way up the front wheels.  Adjust the tie rod end until the front tire touches the string at both points it crosses the rubber (front and rear of the front tire).

Here is someone else who uses this method and made a great YouTube video displaying how this works: https://www.youtube.com/watch?v=AuYsd7SUwTA

Posted in Cars, Trucks and Tractors, Hobbies, Home and Homestead | Comments Off on Driveway alignment, do it yourself!