The original Super Mario Bros sound effects 
Sunday, April 27, 2014, 16:26
Posted by Administrator
I have created a playist of all the original Super Mario Bros sound effects looped for one hour on youtube. It amazes me to this day how iconic these sounds have remained. People who haven't even played this game recognize many of the sounds easily.


Super Mario Bros Sound Loops

Also check out the related link for an awesome post by Jake VanderPlas who made the image above by doing some neat python hacking on the smb sprite sheets.
add comment ( 11852 views )   |  permalink   |  related link   |  $star_image$star_image$star_image$star_image$star_image ( 3 / 764 )
Online Sales Physical Notification with a Raspberry Pi 
Friday, January 24, 2014, 15:15
Posted by Administrator
Selling no longer wanted things from my apartment online with Amazon and Ebay is one of my new favorite hobbies. I take pride in getting quality items out for sale in a timely manner but it has been a constant drag to be checking my email account hundreds of times a day to see if I have sold anything. I’ve been mentally working on an idea to have my ceiling mounted LEDs turn on every time I have a new sale to ship out. I finally sat down to implement this project a few nights ago and was shocked when it only took me about 20 minutes to get everything working the way I wanted.

The hardware component of this is shown below:

Image Removed

This is the set of LED’s that I have attached to the ceiling with thumbtacks and some cardboard. I’ve lately added the green strand of LED leaves that I got at the dollar store. I’ve been controlling these lights with the same “LazierGeek” app I use to turn my binary clock on and off with. The only difference now is that I also let the following scripts turn on the light if they want to.
curl -u username:password --silent "https://mail.google.com/mail/feed/atom" | tr -d '\n' | awk -F '<entry>' '{for (i=2; i<=NF; i++) {print $i}}' | sed -n "s/<title>\(.*\)<\/title.*name>\(.*\)<\/name>.*/\2 - \1/p

This is a very hand bash script making use of curl that I found online which scrapes Gmail’s atom feed for unread emails and does some sed manipulation to trim down the output to just the senders name and subject. To get this one working just replace the username and password section with your appropriate account information. In conjunction with this script I made the following Python code to run it occasionally.
#!/usr/bin/env python
"""
Unread email notifier - Spike Snell - 2014
Version 1.5
"""
# Import what we need to drive the light
import time, sys, subprocess
import RPi.GPIO as GPIO
from datetime import datetime

# Set Up the GPIO to use our notification light
GPIO.setwarnings(False) # Set warnings to false
GPIO.setmode(GPIO.BOARD) # Use board pin numbering
GPIO.setup(5, GPIO.OUT) # Setup GPIO Pin 8 to OUT

# Loop Forever and Drive the Notification Light
while True:

GPIO.output(5,True) # Turn off the light by default

# Get the current local machine hour in 24 hour format
h = int(datetime.now().strftime('%H'))

# Make sure it is after 0700 and before 2100
if h > 6 and h < 21:
# The time is just right so check for sales with bash script
proc = subprocess.Popen(["bash","unread.sh"], stdout=subprocess.PIPE)
(out, err) = proc.communicate()

# Check if there are recent unread mail subjects that indicate a sale
if out.find("ship now:") > 0 or out.find("item sold!") > 0:
GPIO.output(5,False) # Turn on the light

time.sleep(600) # Wait ten minutes
To run this notifier I use the command " sudo nohup python unread.py & " this lets me run the script in the background as a nohup ( no hang up ) process where the output is logged to nohup.out so that I can monitor the state of it remotely if I wish. Every 600 seconds ( 10 minutes ) this script will wake up from its slumber and fire the Gmail scraping bash script. If any of the subjects match text information indicating that an online sale has occurred it turns the LEDs on. If no sales have occurred lately it sets the LEDs to their off position. One handy feature of this is that after I have checked my email to see what sale occurred the lights automatically turn themselves off after a while since the email is no longer unread at that point. I might increase the delay in checking for sales since I’m a little hesitant to be polling Gmail for information this frequently and don’t want to be a nuisance to a service I rely so heavily on.

The only complaint I have about my notification system so far is that it is annoying when it comes on in the middle of the night when I am trying to sleep and wakes me up. I'm probably going to modify this code tonight so that it doesn't come on at night even if a sale has occurred but then operates normally if it is daytime.

So far this sales notification light has been working splendidly. Future expansions could include making the light blink to indicate how many sales have occurred or to have the script also text my phone to let me know that something sold. I’d love to hear any ideas or comments that the rest of you have about this small project.

-- Edit 2.11.14

I have updated the Python portion of the code to reflect my latest version which doesn't turn on at night. This one is much more straightforward because the indicator light's off position is the default state. Periodically the light will turn off briefly and then back on when going through another cycle if there is an active sale; this operational feature is to make it even more obvious that a sale has occurred.
5 comments ( 73384 views )   |  permalink   |  related link   |  $star_image$star_image$star_image$star_image$star_image ( 3 / 6615 )
Raspberry Pi Binary Clock 
Sunday, July 14, 2013, 09:08
Posted by Administrator
I have been fascinated by number systems for most of my life. I especially like binary since it is so incredibly fundamental to the deep underpinnings of our technological society yet incredibly simplistic. I take a special delight whenever technology is combined with art and what better way to demonstrate this concept than through a binary clock.

I had been formulating this project in my head for months and gradually assembled the materials required. Amazon had a great deal for buying 100 white LED's + resistors so I made sure to snatch those up. I also accumulated a couple solderless breadboards and variety of m/m m/f wires to make everything easier.

To drive the logic behind this project I decided on going the easiest route possible by using a Raspberry Pi since their GPIO handling Python libraries are so pleasant to work with. I also decided on not doing any sort of multiplexing to drive the LED's and just addressing them all individually through separate GPIO pins. At first I was going to include seconds on the clock but decided against it due to both the additional wires that would be required and to the aesthetic appeal of not having lights constantly blinking on the finished clock.

I also decided against my original idea of using ping pong balls to be light diffusers for the LED's. While this technique does work fairly well the light distribution proved not to be as uniform as I would have liked. The LEDs I have tend to do a sort of short distance projection effect which leaves a circle of light on whatever is in front of them. Without the ping pong balls the final design was also able to be quite a bit smaller and more compact.

After getting some time off of work and a few days of getting bored of not tinkering with any code I decided to get around to building out the binary clock. The first thing I did was take some black construction board and drill holes for all of the LEDs. I placed this board inside of a picture frame and then attached all the appropriate wires. An unexpected bonus was that the picture frame backing was able to be remounted on-top of the wires which served to prevent them from dislodging. One of the lights had to be replaced as it was DOA.

Image Removed

After this I started assembling all of the ingredients into the breadboard and connecting all of the wires into free GPIO pins on the Raspberry Pi. This proved to be the most tedious part of the project. Since I used a spare IDE cable to access the GPIO pins everything is in reverse on the other end of the cable and about halfway down due to the extra pins that an IDE cable has. I tested these out one by one and recorded what light went to what GPIO pin on a notebook. During this initial prototyping phase I duct taped everything down to a dresser as seen below.

Image Removed

Finally everything was in place and it was time to get to programming. I had expected this to take most of the time of the project as I have not worked with Python very much in the past but it ended up taking the least time of all. I sat down to start it on a Saturday night around 21:00 and ended up finishing it off well before 22:00. Most of the time spent was in learning more about Python conditionals and not building the clock itself. Every time I write anything in Python it amazes me how few lines are necessary and how easy it is to learn the small amount of overhead needed to write the code.

Admittedly things were made much easier for me since I was able to make use of the script I had written in the past for my last bash binary clock project. I removed much of the code and limited it to producing just a string of the current hours and minutes in binary.

Image Removed

After this it was just a matter of initialising all the GPIO ports to be in their OFF state as a number of them are turned on by default when the Raspberry Pi boots up. An array of all the lights in order is used to address all the lights as they correspond to the output of the bash script. The lights are set on and off accordingly and this process is repeated every three seconds. Three seconds seems like a good trade off on accuracy vs system load as I don't like the idea of this having to run every second since I still intend to use it as the primary Raspbmc media player in the bedroom.

The code for the clock came out much shorter than anticipated.

Image Removed

I also made another small script to turn all the lights off. It is quite similar to the one above except it basically just goes through up past the initialization step and stops.

Too make things really fancy I decided I wanted to be able to control the operation of the light with an Android smartphone. A free app called LazierGeek made this pretty easy to accomplish. I've set up one shortcut to run the remote ssh command:

sudo nohup python clock.py &

Which starts a background process of the clock without the need for an active session. To stop the clock and turn off all the lights I run another appropriately lazy command:

sudo pkill python; sudo python alloff.py

Which kills Python ( Effectively stopping the clock ) and then runs the initialization script on all the lights to get them in their off state.

At this point the clock was still duct taped down to my dresser. After a few days of taking extra care not to disturb any of the wires I decided that it was time to put it in a box for extra mobility and durability. A spare empty shipping package was selected for this purpose and I began to cover the entire thing with black duct tape. I also cut a hole in one side of the box to fit the picture frame screen as well as a smaller hole in the back for all the wires to come out. After a great deal of coaxing I got everything off of the dresser and smushed into the box where I taped everything down.

Image Removed

The box was then sealed with more tape.

Image Removed

At this point I'm debating leaving it like this, or putting this box within a spare computer case to make it look even sharper. In some ways I like the duct tape's charm and how it serves to draw attention away from some of the lights being positioned a bit wonkily.

Thoughts and comments are welcome.
3 comments ( 28649 views )   |  permalink   |  related link   |  $star_image$star_image$star_image$star_image$star_image ( 3 / 5951 )

<<First <Back | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Next> Last>>