All things Raspberry Pi and Time Lapse

The Hypnocube was a great project and I am very happy with it. It is amazing to just turn on and watch it! But I was never able to figure out how to program it to my own custom animations. I have not used that programming language before, and it is quite complex! Then I stumbled across this great tutorial on Instructables where it is shown how to create a project that connects to Twitter and changes color based on the “mood” that it found. The main hardware is an arduino, a shield to connect to wifi, an RGB LED, and a frosted acrylic container. This seemed like a great project, but I decided that I would use it for gmail notifications and other ideas instead. Based on this tutorial here at Adafruit I already knew how to turn on and off the LED to accomplish this using a Rasbperry Pi. And instead of building my own acrylic box I bought this one from Amazon. It came clear, so I also bought some 400 grit sandpaper. By rubbing the sandpaper in a circular path, the box soon had that “frosted” look. The instructables project was where I got the idea on how to frost the acrylic. He was frosting the sheets of acrylic before he made the box, which would have been easier to do I am sure. The tight corners made it difficult to get it totally frosted in some places. But the advantage of my box is that it doesn’t have the glue in the corners. And since it was cheap I am happy with the route that I took. And after spending some time sanding I got all of the hard to get spots enough that it doesn’t show.

The Raspberry Pi has enough pins to individually control 7 normal LEDs. So for my project that means two RGB LED’s and one more regular LED. I put the two RGB LEDs side by side then added two more white LEDs on either side to form a diamond shape. Both white LEDs are controlled together, so they are both on or both off. However since the Raspberry Pi only has one PWM pin, I would only be able to get full values of each of the color. So for example RED would be on, while GREEN and BLUE were off. Or RED and GREEN were on, but BLUE was off. Or all three were on. But I would not be able to get a mixture of those, like RED being at 40% and GREEN at 90% and BLUE at 20%. However there is some software that makes that possible. It basically turns the full values on and off really fast to simulate PWM. The link for that code is here on GitHub. So now I will be able to make any mixture of those RGB values. It works great and is very simple to use.

The next issue was the fact that my Adafruit breadboard wires are really short and that would look pretty terrible to have them all lose. And the LED box would have to be really close to the Raspberry Pi.  Then I thought about a regular network cable and did some research on the type of wire was used in them. Turns out it is very similar to the breadboard wires. So I ask on the Raspberry Pi forum if it would work to use a network cable instead of the short breadboard wires and was told that it should work just fine. Voltage drop was the only issue mentioned as a possible problem, but after measuring it, I can say that there was no voltage drop. A regular Cat5 network cable has 8 wires. And I would be using all of them. The six pins of the RGB LEDs and the one pin for the two white LEDs would use 7 wires. That left the 8th wire to be used for ground. I used a mini breadboard to handle the resistors and the connection to the Raspberry Pi and it works better than I thought it might! So now the LED box can be a few feet away from the Raspberry Pi.

After assembling everything in the box came the time for writing the code. I started with the example from Adafruit, but changed it to suit my LED setup. So now every 5 minutes the script check to see if there is an email, and if so it flashes red and white for about 30 seconds. Another script that I worked on was to get it to fade between the three main colors. That takes about a minute to make a full cycle through the colors and looks pretty amazing.

All of this was fun and awesome, but it had to be run from the command line. I decided to fix that. There is a great tutorial that explains how to install Lighttpd (A lightweight webserver) and PHP here. I just ignored the parts about MySQL as I do not need that right now. Once that was all setup and configured I wrote a simple basic webpage with a button for each of the main colors. I also added a button to turn it all off, and another to fade through all the colors – it calls the script that fades the colors . I accomplished this through a PHP page that executes the correct shell script. So now from any web enabled device that is connected to our wifi network, anyone can turn on the LED box easily and simply.

Below are some pictures showing how the box looks when lit different colors (no these are not just photoshopped to “show” the different colors) and the last one shows the wiring nightmare underneath!

IMG_9939 IMG_9943 IMG_9952 IMG_9953 IMG_9954 IMG_9955 IMG_9957 IMG_9960

And here is a quick screenshot of the web interface to control the LED box…

Screenshot_2013-03-18-22-26-15

Anyone have any other ideas for the LED light box?

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!!

Finished and Uploaded!!

The video of the compilation of over 3 months is edited and uploaded! It has been 3 months since I setup the Canon PowerShot camera and Raspberry Pi in the greenhouse to watch the plants grow. And grow they did! The greenhouse starts out empty and in 15 seconds the plants are ceiling height. It was just under 90 frames total because some of the frames were too dark to use. And unfortunately some of the current images are pretty dark. But it worked!! And now I know what to change so that the images are not as dark for next time. Let me know what you think in the comments!

https://vimeo.com/57635944

 

Now I am looking at setting up for a year – as was my original goal…

 

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

RasPiLapse

Below is a link to the raspberrypi.org site that has an article about Rick Adam who has created a timelapse dolly for way less than a professional rig would cost. The setup uses a raspberry pi to drive the motor and take the picture. Impressive project!

http://www.raspberrypi.org/archives/2957

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.

Tag Cloud

Follow

Get every new post delivered to your Inbox.