All things Raspberry Pi and Time Lapse

Archive for the ‘General’ Category

Hypnocube

I recently found the Hypnocube 4Cube, which is a grid of 64 RGB (Red/Green/Blue) LEDs laid out 4 LEDs wide, by 4 LEDs long, by 4 LEDs high. Pictures are at the bottom of this post. I wrote a little bit about in in my previous post here (bottom of the post). I decided to buy one and I am glad that I did! It was a very fun kit to build. It looks amazing at night with the lights off and the LEDs flashing different patterns and colors. I did a time lapse video as I built the cube and that is posted here (http://vimeo.com/59026344). The video is pretty long (10 minutes) but I think it is worth it to see some of the details in building. The pdf with building instructions is available from Hypnocube to download here (it is the 4Cube link – and the jig instructions are right below that).

I wrote a script (below) that used ImageMagick from the Linux command line added the date stamp onto the pictures. Basically it changed directories into the folder, then for each file it got the date and time from that picture, then put that stamp onto the picture. After this step I used an action in Photoshop to crop the images and do some basic image adjusting.

#!/bin/bash
var=$1
for x in $var
do
cd $x
for y in `ls`
do
name=`identify -format %[EXIF:DateTime] $y | cut -d “:” -f1-5`
convert $y -pointsize 50 -fill white -annotate +1000+1000 “$name” $y
done
cd ..
done

Their manual only includes instructions for Windows. But that wasn’t where I wanted to have it connected. After some searching around I figured out that the Hypnocube was located at /dev/ttyACM0 by running “dmesg | grep tty” and it was listed there. Then I installed the “screen” command and then typed in the command “screen /dev/ttyACM0 38400” and it works just like a putty session from Windows. Then to exit out of screen “CTRL+a+d” and it will exit. To return back to the session “screen -r” and it goes back to the session again. This works from a Fedora Linux desktop and also from a Debian based Linux distribution on a Raspberry Pi. This offers some really cool options like controlling the Hypnocube from my Android by using ConnectBot which is a ssh client for Android. So I can ssh into the Raspberry Pi or my desktop and then using the screen command I can “login” to the Hypnocube. Then using their commands I can switch to the next visualization or the previous one. I can lock it on the current one or pause it.

Pictures….

IMG_0009 IMG_0035IMG_0057IMG_0040IMG_5989IMG_5994IMG_5992IMG_9900IMG_9877

Gertboard LED test scripts

I originally tested the Gertboard using the C code. But then when it came to modifying it I am not very familiar with C. So I downloaded the Python code available here from raspi.tv and it worked great! I was able to modify it and made some of my own visualizations and rewrote some of the current ones for the fun of it. The first couple are pretty basic. The last one shown in this video (about 0:52 seconds ) randomly chooses one of the LEDs and then creates two different “lives” on either side of that LED. Each time through the loop each life can move up or down. So one can move up and the other move down, or they might both move in the same direction. This continues until one of them tries to move to LED 0 or 13 which doesn’t exist, and then they die. But the other one continues until it also tries to move to 0 or 13. On the screen it prints out how many times it moved. Best I have seen using the LEDs is over 200. But just running the code on the computer without the delay I have seen over 640 moves without dying.

http://vimeo.com/58221381

Interesting and fun stuff!!

Building a Gertboard

Finally edited the time lapse of building my Gertboard. It took about 4-5 hours from start to finish. I missed a small portion of soldering the header pins because the camera ran out of battery. The surface mount components were the hardest, but after that it was pretty straight forward and really fun! Here is the link to Vimeo and the Time Lapse (https://vimeo.com/56662328). After finishing the board I ran the test scripts that were written in C and it worked except for the motor controller. For some reason it would not turn the motor. Still working on figuring out what I am doing wrong there…

Finished shot of the Gertboard connected to the Raspberry Pi.

gertboard

GPIO Computer Case Fan and LED Cube

My 5V computer case fan arrived and I was very interested to see if I could power it from the Raspberry Pi. So I turned everything off, and plugged it into the GPIO cable. I had put the case back together with this cable because that makes it easy to access the GPIO. I went to fan manufacture and found that the Red wire was 5V input, the Black wire was ground, and the Blue wire was for the frequency readings. So I used some of the recent F/F jumper cables and plugged GPIO pin 1 into the Red for power and GPIO pin 3 into the black for power. Powered the Raspberry Pi on and right away the fan started up! Success! Now to go on and figure out a way to leave it plugged in and via software be able to control when the fan powers up. And possibly try to get the Blue wire working as well.

This site http://elinux.org/RPi_Low-level_peripherals has a diagram of the GPIO pins.

First picture is the Raspberry Pi powered off… Hard to see, but the fan blades are stopped.

IMG_0928_edited

Next two shots are powered and show the lights on the Raspberry Pi and the fan is a blur.

IMG_0930_edited IMG_0936_editedAnd the next is the jumpers that came from Adafruit…IMG_0937_edited

I stumbled across this site today http://hypnocube.com/ and was wondering about a Raspberry Pi controlled version…. They have a kit to buy that is currently $150 for the 4x4x4 cube. Sounds as if custom programming is limited to minimal so that is a bummer. There is a video here of someone who has done this with a Raspberry Pi. His notes about it are here. And there are some videos of people running it off an Arduino. Here is the youtube link to a demonstration of some of the things an 8x8x8 cube (blue) can display. This video and others from the same channel showing what the cube can do are amazing! A tutorial can be found here on a 4x4x4 cube using an arduino.

Pandora Internet Radio – In a portable box

Great tutorial here on Instructables on how to build a portable Internet radio box. This project includes some soldering, but has good instructions. I am going to look into installing pianobar as that looks like it could be really useful and right at home on the Rasberry Pi.

Gertboard Arrived!

My gertboard arrived today! So I setup the soldering stuff and went to work on the practice board from Elenco that I bought from Amazon. And I found out real quick that the soldering iron that I have is not high enough quality. The tip did not get evenly hot which made it hard to solder. So I decided to buy a different soldering iron. I bought this one from Adafruit as they have Raspberry Pi and lots of other awesome electronics and DIY kits/parts. So I am assuming that since they say that this soldering iron is a good entry-level tool that it should be worth it. So now the only problem is waiting for that to ship…

I was looking up some instructional videos about the gertboard and came across these three from Element14.

Advice about assembly – Surface mount – Through hole

And as mentioned in this video at approximately 6:10 he says that there was only 10 jumper wires that came with the kit, and there are 12 LEDs. So there is not enough jumper cables to connect all 12 LEDs at the same time. So in addition to the soldering iron I bought a pack of these F/F jumper wires and also a pack of M/M jumper wires.  This gives me the option of creating my own M/F jumper wires by combining one of each. And these come in packs of 40 so I should have plenty!

Adafruit is a really awesome website. And Sparkfun is really amazing too!

Here is a picture of what all arrived in the package from Newark. Gertboard on the left. Small components in bags in the center. And some of the bigger chips in anti-static bags on the right.

IMG_0914

Next two images are of the GPIO cable coming out of the case that I posted about previously.

IMG_0909 IMG_0910

The next two images are of the bare Gertboard. First one is the top of the board, and the second is the bottom of the board.

IMG_0912 IMG_0913

Pro Time Lapses

This video on Vimeo is absolutely amazing! It is a combination of day and night shots that were taken in Yosemite National Park. This next video is also a collection of shots from Arizona and Utah. Both of these videos are absolutely worth the time to watch them. The second video is by a guy named Dustin Farrell and he has some great tutorials on shooting and post processing.

Yosemite – https://vimeo.com/35396305

Arizona and Utah – https://vimeo.com/29950141

Gertboard Update

I do not understand Newark… But this time I am not complaining! They shipped my Gertboard yesterday and it is on its way to me! I have decided that if I ever buy anything from Newark the best plan is to buy it, then forget about and do not check the ship date on their website. Just wait for an email with the confirmation or better yet wait till it shows up on my doorstep. My previous post here explains some of the problems I had when I originally submitted this order. In Newark’s defense I basically have only bought items that were in extremely high demand, but some customer contact would have been nice. Looking forward to that package arriving!

Raspi.tv and gertboard

There is an awesome site here at Raspi.tv where there is lots of good information regarding raspberry pi information. The page here on that site shows how to control a fan and a light from a raspberry pi. This is a project I was wanting to work on after I got a gertboard and learned more about controlling things in the physical world. Also along those lines is how he is controlling a fan from the gertboard here.

As far as the gertboard I ordered… I finally contacted Newark because the ship date has changed about 5 times (sometimes farther away, and other times to a past date) and they said that they should ship in about 2 weeks. Maybe. However, on their site the ship date is now showing Feb 2013… The good news is that I am actually getting a un-built kit. Newark is no longer selling these, but may start to offer a pre-built gertboard. It looks like a site from the UK may still offer the un-built kit, but they don’t ship to the US.

ImageMagick scripts

I found this post here about a guy who took all of his shots from a year and compiled them into a single image. This sounded like a cool idea, but I could never find the code for how this was accomplished. But I figured that it shouldn’t be too hard so I set about doing it for myself. I have 21 images so far and I compiled them into these two images. One from right to left. And the other from bottom to top.

Once I have more images it should look better as each section will be considerably smaller. I achieved these results using a command line program called ImageMagick on Linux. It was a very simple install ‘yum install ImageMagick’ (notice the capital letters) since I am using Fedora and that was all. Debian based distros may be something like ‘sudo apt-get install ImageMagick’ but I have not tried it. The weird thing though was that I was actually using the command line tool ‘convert’ from the command line instead of ‘ImageMagick’. Great documentation available at their site about the usage here. And documentation specifically about the cropping here. The command line usage looks like this:

convert input_file XxY+X+Y output_file

The program uses the X and Y axis for where to crop. The top left corner of the image is 0x0. The +X+Y is offset from that initial 0x0. Check out the scripts below for actual usage in the script. I did the math before I ran the script and that is where the 92 and 73 come from. I took the dimension of the image and divided by the number of images that I had. So the first image is 2048 wide and I had 21 images. Then I rounded that number down to get the 92 that was used in the script.

This first script is for the top image cutting columns of the image.

#!/bin/bash
# jamesmiller
# get list of files in current directory
files=`ls | grep “^rasplapse*”`
# set the initial crop point
x_factor=0
# for each file in the current directory
for x in $files
do
# ImageMagick convert program to crop the image
convert $x -crop 92×0+$x_factor+0 column_$x
# add to the initial crop point so the next image
# is not the same strip as the previous image
x_factor=$((x_factor + 92))
# add a border of white
#convert column_$x -border 1x column_$x
done
# get the list of newly created images
column_files=`ls | grep “^column*”`
# add all of the strips of images into one image
convert $column_files +append column_file.jpg

This script is for the bottom image cutting rows of the image.

#!/bin/bash
# jamesmiller
# get list of files in current directory
files=`ls -r | grep “^rasplapse*”`
# set the initial crop point
x_factor=0
# for each file in the current directory
for x in $files
do
# ImageMagick convert program to crop the image
convert $x -crop 0x73+0+$x_factor row_$x
# add to the initial crop point so the next image
# is not the same strip as the previous image
x_factor=$((x_factor + 73))
done
# get the list of newly created images
row_files=`ls -r | grep “^row*”`
# add all of the strips of images into one image
convert $row_files -append row_file.jpg

The very last line of each script is what compiles all of the strips of images into one image. NOTE: these scripts are meant to be executed in the folder containing the images. And they may need to be modified to suit other uses depending on the file naming structure and so forth.

I also tried these scripts using the pictures that were taken every 2 minutes. But even separating them out into three different pictures it didn’t turn out that neat. There was very little change across the picture because not that much moved in a single day.

Looking forward to using this technique on more pictures like the pictures shown above once I have more images!

Tag Cloud