Archive for August, 2011

Aug 21 2011

Making Time Lapse Videos – Initial Fumbling

Published by Ron under Electronics

You can create your own Time Lapse videos using all open source stuff. Well, almost all.

On Windows I’m using ffmpeg (command line program) and InfranView(for bulk image processing).

Photos were shot with a Canon DSLR (Rebel XTi) in “medium” resolution. Used my 555/556 based timer to trigger the shutter.

  1. Ttake the photos. The more the better.
  2. Drop them into a clean folder.
  3. FFMPEG needs the files ordered by file name, starting with _0001. Your camera probably incremented them another way. To fix this, use InfranView.
  4. Open Infraview and go to Batch mode.
  5. Select “Batch rename”.
  6. In the Name Pattern enter “img_####” (result will be img_0001, etc).
  7. Select all the images (“Look in”) and press “Add All” to bring them into the Input files section.
  8. Change Output directory. I use a subdir under my source folder.
  9. Press Start Batch. It will take a little bit to do all the renaming and moving.
  10. Now open up a command window. I run this from the \ffmpeg\bin\ directory:

    ffmepg -r 12 -i c:\timelapse\1\out\img_%04.jpg -sameq -s hd720 -vcodec libx264 -crg 25 test.mp4

    Where -r is frames per sec (you can adjust, or leave out), -i is the location of the input files (where you batch output them to using infraview). The %04 means that names should be formatted like: img_0000.jpg. If you have three digit suffixs (ex. img_001.jpg) you’d use img_%03.jpg. The test.mp4 is the output file name.

    I cheated and used someones settings for the rest — these worked for me, others did not. I do not pretend to understand them! Still experimenting. I got a lot of errors and warning when using simpler examples.  And I got a lot of “black screen” videos. Dunno why.

  11. The resulting mp4 should play on your computer. I found that uploading the YouTube resulted in screwed up YouTube videos (the sync is messed up or something). To resolve this, Evelyn processed the file into a FLV (YouTube friendly) format. Then it was fine. Go figure. Again, I do not pretend to understand it. :-)

Here are some links that helped me out:

http://www.diyphotography.net/how-to-create-time-lapse-movies-with-lots-of-open-source-software
http://notes.theorbis.net/2010/05/creating-time-lapse-with-ffmpeg.html

Even if you don’t do time lapse, InfranView is worth a look. If you process a lot of photos, it saves a LOT of time. Bulk re-sizing, conversion, renaming, etc. Makes it easy to take those gigantic 12 MP files down to something you can upload to Facebook. :-)

The Windows versions of this stuff:

http://ffmpeg.zeranoe.com/builds/ — make sure to download the 32 or 64 bit “static build” (latest release)

http://www.irfanview.com/

No responses yet

Aug 21 2011

Macro Sled – The Beginnings

Published by Ron under Electronics

Evelyn recently hacked apart an old CD-ROM drive (to get motors). The remaining tray / laser assembly was left without a purpose. But not for long. While poking around on the DIY photography sites I found things called macro sleds.

These devices move small objects very small distances. You take a photo of the object (say, a mounted fly) at each step of the sled. Take photo, move back 1 mm, take photo, move back 1 mm, repeat. You then take these photos and stack them (using special software designed for this purpose). The end result is a super-sharp macro photograph — it’s called focus stacking.

Check out this site: Motorized Macro Rail (photo is from this site)

And yea, there are other ways of getting the photo, but they don’t allow me to re-use junk hardware. ;-)

So, I’ve started messing with the old drive parts to make the tiny sled:

I reverse engineered the motor drive circuit / feedback mechanism. Three wires for the feedback: Power, Ground, and Data. If the circuit is powered, the emitter is lit. Data goes high/low as the spindle rotates. When hooked to an Arduino/Atmega328 target board I saw about 205 ticks for the full length of travel.

Problem is that the DC motor runs fast. A split second to move the laser/lens assembly (sled) from one end to the other. I tried getting feedback, but it spun so fast that I couldn’t grab the readings. (Manually, I counted about 205 — with the motor full powered it clicked off only about 40 times.)

Now this person seems to have it working, with the DC motor: Macro Sled. But the other person (link above) swapped the DC for a stepper, due to the speed issues. I want to use the DC, because it’s original equipment and looks nice. But will I will be able to either drive it slowly enough (maybe with PWM?) or in short enough times?

The experiments continue…

No responses yet

Aug 21 2011

What? No Woodworking?

Published by Ron under Ron's Rambling

Sorry, no woodworking projects recently. It’s summer in Austin and my shop/garage does not have air conditioning. It’s been a brutal summer, with weeks on end with temps 100+. So, no fun to be in the shop, even the night is still too hot — 90 at 11 PM.

Even if the heat wasn’t so bad, the shop was. Bad, that is. We recently cleared out our storage unit and a lot of stuff ended up in the garage. We’ve now stored what we wanted to keep, given away the stuff we don’t need anymore, and Evelyn gave everything a clean sweep. Just in time, as we’re ramping up for Halloween. This year’s theme: Monster Mayhem. A scale model of Tokyo, with Godzilla and friends.

I’m hoping that things cool down a bit. I have a heavy duty tool stand to put together and a new mini-mill to play with. Unfortunately, it’s been sitting there, baking. :-(

No responses yet

Aug 21 2011

Time Lapse – The Basic Model (555/556)

Published by Ron under Electronics

You’ve figured out how to manually trigger your camera’s shutter, maybe using an old mouse. Now you want to start doing something more interesting, like time lapse. To do this you need either (a) a camera that has the feature built in — a lot of point and shoots do or (b) and external interferometer. For reasons I don’t quite understand, with the billion features they put into modern DSLRs, they still don’t include at least a basic interferometer feature. After all, you’re just telling the camera to take a photo every X seconds/minutes.

We had to build our own. Some use microcontrollers to do  this, but I wanted something which used discrete components. This was my next step in learning and didn’t want to rush into the Arduino/Atmega328 world just yet.

While hunting around I found this person’s project. It’s well documented and it works: DIY Interferometer

I took his design and made two minor changes. First, I eliminated the high/low setting. I think it’s a good idea, but I knew that my next project would be Arduino based, so no need to complicate the discrete project. (If you look at his schematic, I used the 10k/220uf “Low”.) Second, I removed the manual focus/shutter buttons. Again, my goal was bare-bones.

I won’t go into a ton of detail here, because his write-up is excellent. A 556 is used (you can use two 555s) for it’s two timers. The first side/timer does the “beats” — this is how often it triggers and is based on setting a potentiometer. Varies from about 25 seconds to a couple of minutes. The second side/timer is used to hold the shutter down for about a second. He found that if you just use the one 555 that it’s timer pulse is just too quick — sometimes the camera misses it. So he uses the other timer to “hold” that pulse for a second.

The whole project got stuffed into a little Hammond project box, with the 9V battery as a supply. (One of the nice things about the 555/556 is it has a huge VCC range.)

You plug the camera in via the 3.5mm (1/8″) to 2.5mm cable adapter. Again, I’m using a Canon DSLR, which uses the simple connector. There’s a power switch, a status LED (goes on when shutter triggers–good for debugging), and a pot which adjust the time. I was seeing about 25 secs on the low end.

Here’s a closer look at the open end. I didn’t have the patience / desire to cut holes in the insert, so I left a gaping hole. Good enough.

I set up the camera outside (on a tripod) and connected up the unit. Set it for about 60 second increments (manually checked with a stopwatch). Then let it run for about an hour. Success! Photos taken and ready for processing into a movie.

After I built this unit it confirmed a couple of things: I’d want to make a microcontroller version. The 555/556 is a “guess the time” setup — you move the dial, time it, try again. It’s not easy to get a repeatable setting. (It’s fine between ticks — it’s the initial setting that’s a drag.) With a microcontroller I can have an LCD display, etc. The fancy stuff that makes it more user friendly.

Regardless of its limitations, it’s a handy gadget to have. It teaches you about timing photos and brings you one step closer to the more complicated devices. And since it’s dead simple and small you don’t have to worry about it much. Good for spur of the moment lapse photos. Is there such a thing? ;-)

No responses yet

Aug 21 2011

Low Lux Illuminator

Published by Ron under Electronics

After messing a bit with light painting I thought it would be useful to build a RGB-like illuminator. Something I could use to highlight a person or object — like a fill light — while the painting is being done.

At first I was going to do this with just potentiometers — something like a 5K — but I didn’t get the range that I wanted. So, it looked like it was time to do it with a microcontroller. I don’t like throwing in a chip just because, but in this case the cost/benefit made sense.

Here’s my first take on the control panel. Each sliding pot gets connected to an Analog Read pin on the chip (using Atmega328 and the Arduino environment on an Evil Mad Science target board–highly recommended):

In the above photo you can see the 9 LEDs — they are jumbo 10mm ones. Two red, two yellow, two white, one green, one blue, one pink. I doubled up on yellow, red, and white because they are pretty dim, especially compared the the mega bright blue and green.

To the right of the LEDs is the target board (no chip installed yet). Below is the board with sliding pots (6). I put little indicator LEDs above the pots so I could tell what color I was shifting (this unit will be used in the dark, so labels won’t do much good).

The pots are setup in a voltage divider setup. You connect one end of the pot to VCC and the other to GND (everything is running 5v). The sliding contact gets connected to one of the analog input pins. The Arduino/Atmega328 has 6 of those pins, so I was in luck — I was controlling 6 colors.

I hooked it up and things seemed to be okay. Except when Evelyn came over and touched them — they were warm! In my attempt to get rid of some surplus parts I had gone with a batch of 200 ohm slide pots. And, forgetting Ohms Law and voltage dividers, I was creating a nice little heat generator. It was only a matter of time before they blew.

A valuable lesson was learned: never forget Ohms Law. It’s not a theory, it’s a law. :-) My silly circuit was wasting goodness knows how many watts as heat. (I didn’t have a supply problem because it was connected to a USBTinyISP, powered by the computers’s USB port. If I ran on batteries they would get eaten up in waste heat.)

So, I ordered the proper (and current production) sliding pots from Mouser. These are 10K ohm and have a nice feel.

In the above photo you can see the new pots (with some nice LEDs on the control board — waiting for yellow and red to be back in stock, so the 3mm are temporary).

Eight wires go from the slide pot control board to the target board. There are 6 analog lines and 2 for power.

There are seven wires going from the target to the LED illuminator board. Six digital, for the six colors, and ground. I cheated here a bit and have the reds, yellows, and whites in series with each other (red-red, yellow-yellow, white-white). They use a different drop resistor value. It was a big of trial and error to get all the LEDs at a pretty even brightness. I had to also drop the resistance on the pink LED — they always seems to run dim. Big power hogs.

The output LEDs are connected to PWM pins on the Arduino-like target board. This allows the Atmega328 to smoothly change colors. It also makes for very simple code. In the main loop() have the code read a pin, then analogWrite a value to the output pin. Very easy. Here is a snip:

val = analogRead(inGreen);   // read the input pin
analogWrite(ledGreen, val / 4);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255

I have that set of code repeated 6 times, one for each color / input pin / output pin. Output LEDs are on pins 3, 5, 6, 9, 10, 11. Each has a drop resistor, based on voltage drop of LED, source supply (5V), and desired top-end brightness (about 30ma).

This is what it looks like powered up:

Now I just have to figure out a way to get this packaged up in a nice case. And figure out a way to mount the LEDs near/on the camera’s hot shoe (not for power, just as a mounting point).

No responses yet

Aug 21 2011

Light Painting

Published by Ron under Electronics

If you have a camera which will hold the shutter open as long as you press it, and some LEDs, you can light paint.

Painting with light is simple: Go in a dark room, put camera on tripod. Open shutter. “Draw” in space with your LED. Close shutter. (Most SLRs have a “bulb” mode — all this means is that the shutter stays open as long as you press the button.) It’s a great project for messing around, requires no gizmos, and would be fun with kids.

Here are some examples:

The top photo was done with a 10mm “jumbo” green LED, but a regular one would work. The bottom (bat) photo was done with an RGB color cycling LED. You can buy these individually and hook them up to a battery with a resistor. The middle (heart) photo was done using a toy RGB LED “wand”. It color cycles. Since it’s diffused into a wand you get nice wide paths of color.

While playing around with this we tried hi-lighting our faces — trying to make a portrait, but the LED(s) used to do the drawing would overwhelm us.  We needed an external LED, very dimly lit, to brighten up the persons face. In this photo I shined a pink LED at Evelyn while she did the light painting. I held the LED about where the camera flash would be. Camera about 4-6′ away.

This experiment gave me an idea: I could build a low lux illuminator. Something I could color mix to get the right color and brightness.

No responses yet

Aug 21 2011

Photography and Electronics

Published by Ron under Electronics

One of my favorite things about electronics is how nicely the hobby can cross pollinate into other hobbies. Play the guitar? Make your own effects pedals. Cooking? A custom timer. A remote thermometer. Photography? Time lapse circuits, lighting, motion control.

We’ve been getting into more serious photography recently, thanks to the motivation of a friend. It’s prompted us to play around with stuff like time lapse, light painting, and other stuff. It’s fun just messing around and learning new stuff. We’re often stuck looking for project ideas, and photography is a realm with a ton of possibilities.

And it’s easy to start simple, and ramp up. Here are a couple of manual photo triggers I recently put together:

The black orb is a dollar store massage machine. A motor, and off balance weight, and some batteries — all ripped out. In their place, I put a surplus tandem switch and a 1/8″ audio jack. Press down a little, camera goes into metering mode. Press completely, shutter release.

The mouse was hacked in a similar way. I took out some of the guts, keeping the buttons. Pressing the side buttons sets camera to metering. Middle button does shutter. (Note that you only need to do the shutter — it’s not necessary to do both. You might meter beforehand if have the camera in auto, so it has time to figure out the right settings for the shot.)

We have a Canon DSLR, which uses an 1/8″ plug for remote triggering. Nice simple hard-wiring — no IR to deal with. Connecting the triggers is done via a hacked apart cell phone headset cable. I used the cell phone because it is a 2.5 mm (small) connector, and they are a drag to solder. :-) On the other end I soldered and easier to find (and work with) 1/8″ (3.5 mm) connector. Not pretty, but who cares, it was free.

The manual photo trigger is pretty boring, but it was an important proof of concept: I know how to control a camera with a remote switch, so now I can automate the process. Baby steps.

There are plenty of DIY photography sites out there with tutorials on how to do this, so if you’d like more detail, look around.

No responses yet