Posts Tagged ‘projects’

Time-lapse using Arduino as DSLR remote trigger – v1

Saturday, January 17th, 2015

I’ve been wanting to create time-lapse animations for a while now.

Since I’ve finally started acquiring some electronics components (actually a awful lot thereof — according to my wife :p), I am finally able to actually build some things for myself.. :)

I’ve put together a simple circuit allowing me to trigger my DSLR camera every X units of time. For now the delay between shutters is hardcoded but I might add a potentiometer later on in order to be able to modify it without having to reprogram it. I could save the delay in the EEPROM so that I don’t have to re-enter it each time I start it up.

Since I didn’t want to touch my DSLR at all, I’ve decided to build a remote trigger leveraging the infrared (IR) sensors present on my Pentax K20D.

As this is a simple prototype, I’ve just used an Arduino Uno (5v) with a small breadboard. In the future, this project might be a good candidate for my first PCB.. but we’ll see about that later :p

Current features

  • Trigger my DSLR remotely every X (hardcoded delay) through infrared
  • Light up an LED before triggering the DSRL (just for fun)

Parts

  • 1 Arduino (e.g., Arduino Uno)
  • 1 high output IR LED (I bought this one, but see the issues list..)
  • 1 green LED
  • 1 27 ohm resistor (or more, or less depending on your test results :p)
  • 1 560 ohm resistor
  • 1 breadboard
  • jumper wires

Schematic:

As you can see, the circuit is veeeeery easy to pull together. The IR led is basically just like any other led.. with the distinction that you can’t directly see its output ;-)

Source code:

// Remote DSLR Trigger

// Libraries
#include <multiCameraIrControl.h> // Camera IR control

// Circuit-specifics
const int SENDING_LED_PIN = 13;

// IR Control
Pentax K20D(9); // IR Led on PIN 9

void setup(){   
  pinMode(SENDING_LED_PIN, OUTPUT); // LED = output
}

void loop(){
      digitalWrite(SENDING_LED_PIN, HIGH);
      delay(250);
      digitalWrite(SENDING_LED_PIN, LOW);
      
      K20D.shutterNow();
 }      
  
  delay(60000); // 1 min delay between shots
}

As you can see, the code is also very straightforward thanks to Sebastien Setz’s Arduino IR control library

The library takes care of the modulation necessary so that the DSLR gets the message clearly.. ;-)

Basically, it does the following for Pentax:

Note that the library supports other DSLRs such as Canon, Nikon, etc as well as other functions depending on the models.

Issues

  • One thing that sucks with my current build is the IR distance. It doesn’t work farther than 40-50cm, which, I guess, is due to the IR LED that I’m using. It might not be as powerful as it should (though I ordered a ‘high-output’ IR LED). Some or the library users mentioned removing the resistor did help. Others have used an NPN transistor. Although I’ve tried the NPN transistor, it didn’t help (at all)..

Ideas for a future version:

The project sources including the schematics are available on GitHub

Let’s go take some pictures now.. :)

Update #1:

Okay, I’ve made my two first tries.. Not great but hey, you always need to start somewhere right?

I’ve used AviDemux to create the video but the original was too fast. I didn’t want to bother now finding a clean solution so I hacked my way through by invoking ffmpeg to help me out slow it down:

ffmpeg -i input.mkv -filter:v "setpts=2.0*PTS" output.mkv

This isn’t great because it lowers the video quality but I’ll make better videos when I get better pictures that are worth the hassle =)

Here are the resulting videos:

Update #2 (2015-01-25):

I’ve spent a bit of time finding out how to generate higher quality time-lapse videos. Check out the next post for details :)


Raspberry Pi project — Car Audio improvement #2

Sunday, May 26th, 2013

I’ve worked a bit on my little side project. The more I think about it, the more I feel like it could be more than just a car audio improvement; it could be a full blown music box, as useful in the car as outside of it.

Here’s an overview of what I currently have in mind. Note that I’m still in the brainstorming process, so I can imagine crazy stuff too.. ;-)

audioPi

A: Audio Engine

The Audio engine would be the control center for the project. Its responsibilities:

  • Detect plugged-in USB devices and scan them for music to play
  • Receive orders from (B), (C), (F)
  • Fetch music from a configured NAS or other online source (e.g., web radios, etc)
  • Manage the playlist
  • Output audio towards (K)
  • Output song information towards (I)
  • Interpret orders from (N)
  • Expose a Web UI (e.g., Lighttp + python/django)

The Audio Engine could expose its services through Web Services (e.g., restful API)

B: Remote Control Host

This component (custom hardware extension?) could further extend the Audio Engine API by interpreting and forwarding commands received from remote control devices (e.g., RF commands).

To forward commands towards the Audio Engine, it could leverage the Web Services.

C: Bluetooth module

The Bluetooth module could further extend the Audio Engine API by exposing it to paired devices. The paired devices could then send commands towards the bluetooth module, which would interpret and forward the orders towards the Audio Engine.

Related links:

D: Phone application

As an example usage of the Bluetooth module, a smartphone application (e.g., Android, iOS, Windows Phone) could leverage the Bluetooth features to pair with the Rpi and control the Audio Engine. For example:

  • control music playback (play, pause, next, previous, enable/disable random mode, …
  • shutting down the Rpi
  • viewing the current playlist, …

Related links:

E: Remote Control Device

A custom remote control device could be created that would send commands towards the Remote Control Host Device (B).
These commands could be a subset of those of (D).

Possibilities:

  • Wired
  • RF
  • IR -> use LIRC (http://www.lirc.org/)

On the

F: A2DP Module

The A2DP module would provide standard A2DP functionality.

Open questions: link with the audio engine? Override the current playlist?

Related links:

G: USB Devices

USB mass storage devices could be automatically detected & scanned by the Audio Engine (A) in order to find & play music present on them.

Open questions: how to detect USB devices as they’re plugged in? Behavior if music is already played from other sources?
Idea: create a list of all possible audio sources and how to react when one of them is added/removed…

H: Car HUD

If we suppose that the Rpi does have a Bluetooth module, it implies that it can connect to the Car. Now, even if the car does not support A2DP, it could still expose some functionality through Bluetooth. One of these might allow for some level of integration with the car’s HUD.

Although, this is more of a bonus than anything, I would place it at the bottom of my goals list for the project…

I: LED Display

A LED display could be added to the project and could be used in different fashions. For example:

J: Online audio

The Audio Engine (A) could fetch music from the Web if it gets Internet access (e.g., via Wi-Fi or Ethernet). There, possibilities are numerous: get music from a NAS, from Web radios, from online music services, etc.

The Internet access could also be used to send information about playing/played music online (e.g., towards LastFM, Facebook, etc).

K: Audio output

The project could either use the onboard audio capabilities or an USB sound card or DAC. From there it could be plugged in different types of speakers.

L: Smartphone music streaming

As explained for (F), if the project supports A2DP, music could be streamed from a smartphone or other device…

M: SD card audio

If audio files are present on the SD card, these could also be played.

N: Voice recognition

Again I consider this as bonus, but it would be nice to be able to plug in a microphone and give orders to the Audio Engine (A) by speaking to it. It could be as “simple” as recognizing orders such as “Play, Pause, Next, …”.

Related links:


The project could go even further than that, for example by providing a full blow Web interface, …


Raspberry Pi project – Car Audio improvement

Wednesday, May 22nd, 2013

Update 2013-05-24:
Thanks to Laurent, I now know more about the audio capabilities of the Pi. Sad news is that the on-board audio output ain’t that great (to say the least :p). One possible solution could be to use an USB sound card or

A second solution would be to hook an A2DP adapter to the RCA inputs of the car, such as this one from Logitech.

Although the second solution seems overall better (possible to pair different devices to the A2DP adapter and stream anything to the car’s audio system of relying on the presence of an USB stick on the Pi, I think I’ll go with the Pi at first (otherwise all the fun is gone :p).

My current idea is to use an USB sound card, maybe with the addition of an USB Wi-Fi / Bluetooh adapter so that I can obtain at least the same functionalities as with the A2DP adapter. I found some, tutorials to do what I have in mind. I’ll check that out in the coming days.. :)

Some other links that might be useful (to me that is :p):


In my last posts, I’ve explained what I currently do with the two Raspberry Pi I own. In this post, I’ll describe one project I now have in mind that I will probably start working on in the coming days.

My goal with this project is to extend the audio system of my car.

Currently, all I can do in my car is to either listen to CDs (classic or MP3, which is pretty standard by now) or the radio. Apparently, I can’t stream music towards the car using Bluetooth because either my car, its specific firmware version or my bluetooth device does not support the correct Bluetooth profile (A2DP protocol).

Rather boring eh? Clearly, the Raspberry Pi could help here ;-)

Fortunately, my car has an RCA stereo socket that I can take advantage of.

For starters, my idea is to have the Raspberry Pi hooked up on the RCA socket and automatically playing any audio files it finds (either on the SD card itself or on any plugged in USB disk). So that I don’t have to worry too much about it, I also want it to do that without any interaction, meaning that from the moment it is booted up:

  • it should start playing the music it finds
  • if a USB device is plugged in, it should scan it for audio files to queue

Optionally, it should remember the last played song and start from there, or it could just play songs randomly. For this first phase, I think that console music players such as these might help me get started: cmus, sox, …:

  • http://archive09.linux.com/feature/124907
  • http://www.tuxarena.com/2011/12/10-console-music-players-for-linux/
  • http://ubuntuforums.org/showthread.php?t=1699260

Later on (and if I’m not satisfied with what I’ve described above), I have additional ideas:

  • since I want to learn electronics, I could add some switches to support basic controls (play, pause, next, previous)
  • since I also have music on other devices with Wi-Fi, I could add a USB Wi-Fi dongle and be able to send music towards the Rpi
  • if I have the USB Wi-Fi dongle, I could also find ways to remotely control music playback using a smartphone
  • I could try to find a way to plug into the car’s display system and use it, like that thing does:

As with any project, the possibilities are endless and so are the possible paths from start to finish. We’ll see how I get there! ;-)