Friday 26 September 2014

How to make an ATtiny85-powered programmable intervalometer for Canon DSLR?

Remember that intervalometer I mentioned some time ago? Well, I made one for myself and since it's been working great for the last couple of weeks, I decided to share how I made it. If you'd like to build one yourself and shoot photos like this one:

or videos like this one (I strongly recommend downloading it as vimeo dramatically reduced its quality and frame rate - 60FPS was cut down to 30FPS):

01092014 Full HD 60FPS from Let Zweindaut on Vimeo.


, you will need:
  1. Perf board/stripboard:
  2. 8 Pin DIL IC Socket for the ATtiny85:
  3. 3.5mm stereo audio jack:
  4. NPN Transistor:
  5. 1MΩ resistor:
  6. Power source (in my case - a double AAA battery pack):
  7. Some sort of internally isolated enlosure (completely optional):


After you have all components prepared, you can start soldering, following the schematic:




I did it in following order, but it's completely up to you:
  1. I decided to start with the DIL socket:

  2. Next up, audio jack. Before you start soldering, let's take a closer look at this part:

    I am using only the shutter pin, but you can get creative and use the focus pin as well if you plan to focus automatically. The idea behind the build will remain similar.


  3. Followed by a transistor:

    Notice how transistor's collector is connected to the shutter pin, emitter to the ground pin (through a bridge) and base is not connected to anything yet. If you're having trouble telling which pin is the collector and which is the emmiter, take a look at this website.
  4. Resistor. This part connects transistor's base to ATtiny85's operational pin (in my case 0).

  5. Power source:

  6. And a ground reference (very sloppy, I know...):
  7. And it's finished!

Now, let's program it!

The program I'm using is just a slightly modified version of Arduino's sample Blink program. I added the initial delay, which will give you those few extra seconds before the shutter closes for the first time (I usually use that time to switch the camera's display off). My code looks like this:

int operationalPin = 0; // microcontroller's pin to be used
int initialDelay = 10000; // defines when the first photo should be taken, expressed in milliseconds
int shutterCloseTime = 100; // defines for how long the shutter should be closed, expressed in milliseconds
int gapBetweenShots = 3000; // defines the gap between every photo, expressed in milliseconds

void setup()
{
pinMode(operationalPin, OUTPUT);
delay(initialDelay); // initial delay
}

void loop()
{
digitalWrite(operationalPin, HIGH); // shutter closes
delay(shutterCloseTime); // keeping the shutter closed
digitalWrite(operationalPin, LOW); // shutter opens
delay(gapBetweenShots); // keeping the sutter open
}


The process of programming the ATtiny85 (actually getting the compiled code on the chip) is not covered here, but if you have an Arduino or a Teensy 3.1, you can take a look at an article I wrote some time ago on how to do it (it's here).

This concludes my tutorial, I hope it will prove useful to somebody. If you think it can be improved or have your own ideas for modifications, plese let me know in the comments section. If you'd like to share your intervalometer photos/videos, I *strongly* encourage you to do so!

Thanks and have a nice weekend!

Thursday 11 September 2014

How to use a trimpot (or any three-legged potentiometer)?



First time I saw a trimpot (trim-pot as trimmer potentiometer, 10KΩ in my case) I immediaty started wondering why the heck does it have 3 pins. Would 2 not be just enough? I started googling and, surprisingly, the answer was not that easy to find. I'll share what I found out, but first, let me answer the title question: how to use a trimpot?
  1. First of all, if you flip the trimpot over, you will see 3 pins, just as on the diagram I clumsily prepared:


    That is the back of your trimpot. Well, you get the idea.

  2. Let's describe what's on the diagram. The two horizontally aligned pins (let's call them A and B) are your reference points and the third pin is called wiper.
  3. Now, the idea behind the trimpot is *brutally* simple:
    • Resistance between A and B is always constant (in my case, 10KΩ)
    • Restistance A-wiper and B-wiper varies depending on the trimpot's knob (or screw, whatever you have) so that if A-wiper is 10% of trimpot's nominal value, B-wiper will be (100% - 10%) of trimpot's nominal value.
And that's it, there's nothing more when it comes to trimpots. However, if you want some examples or if you're genuinely interested in what I have to say, please read on!


To follow up, let me list a couple of interesting facts about trimpots. Great majority of them has 3 pins, but there actually are trimpots with just two pins, like this one:


Why 3 and not 2 then? From what I've read, two most popular reasons are:
  • To keep soldered trimpots in place while adjusting their values. A lot of people simply ignore either pin A or B.
  • To utilise the fact that when the resistance on one side increases (e.g. A-wiper), the other one decreases (e.g. B-wiper), and vice-versa.
Additionally, as it turns out, trimpots are not really designed for adjusting their values too frequently - they are expected to work following the adjust-seal-forget formula. If you expect the resistance to change often, potentiometers are probably a better choice.

To illustrate how trimpots exactly work, I ran a couple of simple measurements (top: wiper, left: A, right: B). Before I start, though, please keep in mind that neighter my multimeter nor the trimpot are perfect, so expect some measurement imperfections. Also, the multimeter measures resistance in .




Trimpot's knob goes all the way down the B-wiper side. Whole resistance is allocated between A and wiper.
A-wiper measurement B-wiper measurement

Trimpot's knob goes all the way down the A-wiper side. Whole resistance is allocated between B and wiper.
A-wiper measurement B-wiper measurement

Trimpot's knob is somewhere in the middle of the range. Whole resistance is shared equally between A-wiper and B-wiper.
A-wiper measurement. I expected something around 5KΩ, but 5.00KΩ exactly is pure concidence. B-wiper measurement. 5.07KΩ - that's more like it!

Trimpot's knob is somewhere on the B-wiper side which means this side's resistance will be lower compared to the A-wiper side. Additionally, 7.00KΩ + 3.06KΩ = ~10KΩ, which is the nominal value of the trimpot.
A-wiper measurement. B-wiper measurement.

And finally, even though the trimpot's knob goes all the way down the B-wiper side, A-B resistance is always constant.
A-B measurement.