Skip to content

... Posts

powertop + systemd + fedora 23

I don’t know when powertop was made into a service for systemd, maybe it has always been there. Today I realized all I have to do is:

sudo systemctl enable powertop

And that will automatically set my powertop tunables during boot time.

1,355 total views, 3 views today

Facebooktwittergoogle_plusredditlinkedinmail Leave a Comment

Happy New Year w/ a Raspberry Pi Zero

I signed up for the MagPi issue #40 so I could get a Raspberry Pi Zero for free. The magazine arrived in NC w/o the board, and after I emailed the US folks responsible for the Magazine subscription and only a few days later, I had another magazine with the Pi0 on it!

I am temporarily running a web server available on the Internet that is running on my Raspberry Pi Zero right now. URL: http://minecraft.the-silvas.com

Enjoy 🙂

1,048 total views, 1 views today

Facebooktwittergoogle_plusredditlinkedinmail Leave a Comment

[Updated] Wrapping up 2015…

The year is almost over and to finish things off, I thought I’d upgrade PHP and MySQL that supports this blog. Since I use Openshift Online to host this blog, the process was pretty painless and straightforward.

First, I logged into the Openshift Online console and created a new WordPress gear that uses PHP 5.4 and Mysql 5.5 by default. I then went back to my old gear and exported the SQL for that blog using PhpMyAdmin (there are other ways to do it, I am just lazy).

Second, I then imported the SQL from the old blog to the new blog.

Third, I ssh’d into the old blog and created a tar ball of all my images found in the app-root directory, and scp’d to the new blog.

Last, I updated my CNAME record to point to the new gear, and updated the configuration of the gear itself in the Openshift Online console. That’s it!

A couple of more updates:

  1. A couple of weeks ago, I merged my last two blog posts into an article and published on opensource.com: SSH into your Christmas Tree with Raspberry Pi
  2. My review of the Asus UX305 running Fedora made the top 20 articles of the year on opensource.com. Pretty cool!

Merry Christmas and a Happy New Year!

Update: This morning DEC-22, I also enabled SSL on the site with a proper certificate.

Update 2: Opensource.com released a list of best tutorials of the year, and my Christmas Light article made in there. Cool.

996 total views, 1 views today

Facebooktwittergoogle_plusredditlinkedinmail Leave a Comment

Raspberry Pi controlled Christmas Tree Lights 2015 – Part II

I got the Christmas Tree Lights up and “dancing”, but one problem came up really fast after I was done. Both wife and kids wanted a simple way to turn the Christmas Tree lights on and off in “solid” or  “dancing” mode.

So, I went through my Raspberry Pi CanaKit and decided that I was going to try to use the push buttons that came with it to solve this interesting problem.

To set up the buttons, I used this nice Youtube tutorial. Here’s the result.

Breadboard w/ 2 push buttons hooked up to the Pi
Breadboard w/ 2 push buttons hooked up to the Pi

Then I had to write up some code to make this work. At first, I based my code on the Youtube video I linked above, but I wasn’t very happy with so many loops. So, I did some more reading, and was able to come up with a better piece of code. Granted, I am sure I can improve on what I have below…

#!/usr/bin/env python

import RPi.GPIO as gpio
import os
import time

gpio.setmode(gpio.BCM)
gpio.setup(4, gpio.IN, pull_up_down=gpio.PUD_UP)
gpio.setup(17, gpio.IN, pull_up_down=gpio.PUD_UP)
lights = 0

while True:
    b1 = gpio.input(4)
    b2 = gpio.input(17)
    #button 1 (solid lights)
    if (b1 == False):
       if lights == 0:
           os.system("export SYNCHRONIZED_LIGHTS_HOME=/home/pi/lightshowpi; sudo python /home/pi/lightshowpi/py/hardware_controller.py --state=on")
           lights = 1
       elif lights == 1:
           os.system("export SYNCHRONIZED_LIGHTS_HOME=/home/pi/lightshowpi; sudo python /home/pi/lightshowpi/py/hardware_controller.py --state=off")
           lights = 0

    #button 2 (dancing mode)
    if (b2 == False):
       if lights == 0:
           os.system("export SYNCHRONIZED_LIGHTS_HOME=/home/pi/lightshowpi; sudo lightshowpi/bin/start_music_and_lights")
           lights = 1
       elif lights == 1:
           os.system("export SYNCHRONIZED_LIGHTS_HOME=/home/pi/lightshowpi; sudo lightshowpi/bin/stop_music_and_lights")
           lights = 0

    # trying not to waste cycles on the pi
    time.sleep(0.2)

The code above basically uses the python RPi python library to interact with the two GPIO pins I use for my buttons (pins 4 and 17), and if a button is pressed and the lights are already off, then turn it on, and vice versa.

Finally, and this took me a while to figure out… I actually had to modify the $SYNCHRONIZED_LIGHTS_HOME/bin/stop_music_and_lights script that comes with LightShowPi because it had a “sudo killall python” on it and that would actually kill my python script as well…

So, I modified that line to:

sudo kill $(ps aux | grep 'synchronized_lights.py' | awk '{print $2}')

And here is the final result:

1,323 total views, 1 views today

Facebooktwittergoogle_plusredditlinkedinmail 1 Comment

Raspberry Pi controlled Christmas Tree Lights 2015

Last year, I used my Raspberry Pi B+ to bring in some Christmas cheer around my house. My little Christmas tree light show became popular enough that I even published an article on OpenSource.com about it. I also had the opportunity to demo the lights in a Science Fair type event last April to some middle school kids in the North Carolina.

This year, I was flirting with the idea of taking the light show from indoor to outdoor, but my family and I ended up moving to a new house, and I just didn’t have enough time (or motivation) to take that leap. I did, however, put in a bit of time to improve last year’s set up.

Instead of 5 channels running 500 lights, I have 8 channels running 800 lights. I also modified the LightShowPi‘s configuration to customize the lights a bit more. I am running all songs in 4 channels and mirroring the other 4 channels, this (IMHO) makes the lights a little more fun with a lot less ‘blackouts’ from unused channels during certain songs.

My configuration is now headless as well (ie no monitor), and it is running on a Raspberry Pi 2. The headless configuration is nice as I don’t need as much room under the tree for a monitor anymore. The Raspberry Pi 2  (instead of the B+) doesn’t make  much difference as the performance of LightShowPi is great in either version. With the WiFi dongle, I just SSH into the Pi from my phone, and start/stop the lights and music anytime I want.

Finally, this year I also have put on a bit more thought on the the song selection trying to add a bit more variety and fun songs to the playlist. 

Below are a couple of videos I made tonight of the light show.

Maybe next year, I will finally take the show outdoors.

2,324 total views, 3 views today

Facebooktwittergoogle_plusredditlinkedinmail 2 Comments