Remote Trigger with Arduino, a Shield in a Box

After the prototype remote trigger I presented in my previous post has been tested succesfully I decided to make my own shield for the arduino and put the whole system in a box, that I could take with me for shooting panoramas. What you see in the following pictures is my attempt to make a portable system for all types of remote triggering my NEX 5. I called this project The Ultimate Trigger V1.

Creative Commons License The Ultimate Trigger V1 is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

I tried to make the shield somehow modular in design. This means I can attach different types of servos, I can attach a different IR receiver and I can change the attached wireless RF receiver without using a soldering iron.

This image shows the guts of the whole system. On the left side from top to bottom:
The arduino board with the attached shield. Several items are connected via cables to the shield: The IR remote receiver with its red-black-blue cable going to the upper lid of the box on the right. The IR receiver itself is glued to the lid with instant adhesive. The servo can be connected via the red-black-green cable going towards the outside of the lid. The third party wireless RF remote receiver (dismantled compared to my last post) sits in the bottom right part of the left lid and is attached to the shild also via a cable. Last but not least you see the 9V battery powering the arduino and the shield. The wireless RF receiver has its own battery.

Ultimate Trigger V1 - Box Open
Ultimate Trigger V1 - Box Open

When the box is closed you see on the upper side (which is in my definition the side next to the camera and thus close to the servo) the three pins, where a servo can be attached. Furthermore you see on the side facing the operator the three LEDs showing the status of the device.

Ultimate Trigger V1 - Box Top
Ultimate Trigger V1 - Box Top

On the bottom side you see from left to right: The IR receiver, the arduino USB port and the arduino power port.

Ultimate Trigger V1 - Box Bottom
Ultimate Trigger V1 - Box Bottom

Like the image before this one shows the bottom part of the box (from left to right): The IR receiver, the arduino USB port and the arduino power port.

Ultimate Trigger V1 - Box Bottom Details
Ultimate Trigger V1 - Box Bottom Details

The following images show the system without the box. First the shield connected to the arduino. The battery, servo, RF receiver and IR receiver are all disconnected.

Ultimate Trigger V1 - Shield On Arduino
Ultimate Trigger V1 - Shield On Arduino

This image shows the top view of the plain shield.

Ultimate Trigger V1 - Shield Top
Ultimate Trigger V1 - Shield Top

This image shows the bottom view of the plain shield.

Ultimate Trigger V1 - Shield Bottom
Ultimate Trigger V1 - Shield Bottom

Remote Trigger with Arduino

One problem with the Sony NEX 5 camara series is the lack of a decent remote shutter mode. You are able to switch it to IR mode and use the IR remote control to take a picture. However you can’t combine any of the other available trigger modes like bracketing or high speed trigger with the IR remote control. I wanted to change this and started this project described here: The ultimate remote trigger for the Sony NEX 5 using a servo and an arduino board. I called this project The Ultimate Trigger V1.

Creative Commons License The Ultimate Trigger V1 is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

The remote control has four different possibilities for taking a picture:

  • Software – Via code running on a host computer sending commands to the COM port where the arduino is attached
  • Arduino – Via code running on the arduino itself (not implemented at the moment)
  • IR remote – Via an arbitrary IR remote control
  • Cable – Via an attached remote release cable

The following image shows the finished breadboard version. You see the arduino board in blue on the left above the yellow 9V battery. Between the arduino board and the battery is the attached wireless remote receiver. In the middle you find the white breadboard with the necessary electronics. On the NEX you see the servo attached via a cable strap and a rubber band. On the right you see the wireless remote transmitter and the IR remote transmitter.

Ultimate Trigger V1 - Overview
Ultimate Trigger V1 - Overview

This image shows the breadboard in detail: On the breadboard you find from top to bottom:

  1. The attached servo (a JR type model with brown, red and orange cables)
  2. The attached wireless receiver. This could also be any other type of Minolta, Konica-Minolta or Sony remote cable release. The receiver is a third party RF wireless type.
  3. The IR receiver able to receive most types of consumer IR remote controls.
  4. Three status LEDs with the necessary series resistors.
Ultimate Trigger V1 - Details
Ultimate Trigger V1 - Details

This image shows the breadboard design in detail. It has been made with Fritzing.

Ultimate Trigger V1 - Breadboard
Ultimate Trigger V1 - Breadboard

This image shows the schematics of the electronics (also made with Fritzing).

Ultimate Trigger V1 - Schematic
Ultimate Trigger V1 - Schematic

The following code for the arduino sketch makes use of two libraries: Servo (included in the arduino IDE) and IRremote!

/*
 * Ultimate Trigger V1
 * by Markus Matern aka PanoTwin Markus
 * 
 * Release: 20120107
 * 
 * This code is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/
 * or send a letter to:
 * Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
 */
 
#include <Servo.h>
#include <IRremote.h>
 
// Servo configuration
const int servoPin = 11;
const int minimumAngle = 0;
const int maximumAngle = 179;
const int zeroAngle = 100;
const int wakeUpAngle = 107;
const int shootAngle = 110;
Servo myservo;
 
// Wireless remote configuration
const int triggerWhite = 10;
const int triggerBlue = 9;
int whiteVal = LOW;
int blueVal = LOW;
 
// IR receiver configuration
int RECV_PIN = 8;
IRrecv irrecv(RECV_PIN);
decode_results results;
 
// Diagonstic configuration
const int ledStatus = 7;
const int ledTrigger = 6;
const int ledError = 5;
 
void setup() {
  // Diagnostic setup
  pinMode(ledStatus, OUTPUT);
  digitalWrite(ledStatus, HIGH);
  pinMode(ledTrigger, OUTPUT);
  digitalWrite(ledTrigger, LOW);
  pinMode(ledError, OUTPUT);
  digitalWrite(ledError, LOW);
 
  // Servo setup
  myservo.attach(servoPin);
  myservo.write(zeroAngle);
 
  // Wireless setup
  pinMode(triggerWhite, INPUT);
  // make sure the input pin is not undefined
  digitalWrite(triggerWhite, HIGH);
  pinMode(triggerBlue, INPUT);
  // make sure the input pin is not undefined
  digitalWrite(triggerBlue, HIGH);
 
  // IR receiver setup
  irrecv.enableIRIn(); // Start the receiver
 
  // Serial setup
  Serial.begin(9600);
}
 
void shoot(){
  StatusTrigger(1);
  myservo.write(wakeUpAngle);
  delay(1000);
  myservo.write(shootAngle);
  delay(1000);
  myservo.write(zeroAngle);
  StatusTrigger(0);
  delay(1000);
}
 
void wakeUp(){
  StatusTrigger(1);
  myservo.write(wakeUpAngle);
  delay(1000);
  myservo.write(zeroAngle);
  StatusTrigger(0);
  delay(1000);
}
 
void minAngle(){
  StatusTrigger(1);
  myservo.write(minimumAngle);
  delay(1000);
  myservo.write(zeroAngle);
  delay(1000);
  StatusTrigger(0);
}
 
void maxAngle(){
  StatusTrigger(1);
  myservo.write(maximumAngle);
  delay(1000);
  myservo.write(zeroAngle);
  delay(1000);
  StatusTrigger(0);
}
 
void Blink(int blinkLed,
           int milliseconds,
           int blinkCount)
{
  for(int i = 0; i < blinkCount; i++)   {
      Status(blinkLed, 1);
      delay(milliseconds/blinkCount/2);
      Status(blinkLed, 0);
      delay(milliseconds/blinkCount/2);
    }
  }
  void BlinkBeforeTrigger(int milliseconds) {
    Blink(ledTrigger, milliseconds, 3);
  }
  void StatusTrigger(int newStatus) {
    Status(ledTrigger, newStatus);
  }
  void StatusError(int newStatus) {
    Status(ledError, newStatus);
  }
  void Status(int pin, int newStatus) {
    if(newStatus){
      digitalWrite(pin, HIGH);
    } else {
      digitalWrite(pin, LOW);
    }
  }
  void loop() {
    // remote control via serial communication
    if (Serial.available() > 0) {
    int b = Serial.read();
    switch(b) {
      case 't':
        shoot();
        break;
      case 'w':
        wakeUp();
        break;
      case '0':
        minAngle();
        break;
      case '8':
        maxAngle();
        break;
      default:
        Blink(ledError, 600, 3);
        break;
    }
    Serial.flush();
  } else if (irrecv.decode(&results)) {
    switch(results.value)
    {
      // Sony Shutter (2 Sec)
      case 0xECB8F:
        StatusTrigger(1);
        Blink(ledTrigger, 2000, 4);
      // Note: No break here!
      // fall through to shoot!
      // Sony Shutter
      case 0xB4B8F:
        shoot();
        break;
      case 0:
        break;
      default:
        StatusError(1);
        Serial.println(results.value, HEX);
        Blink(ledError, 600, 3);
        StatusError(0);
        break;
    }
    // Receive the next value
    irrecv.resume();
  } else {
    // Check the wireless remote trigger
    int newWhiteVal = digitalRead(triggerWhite);
    int newBlueVal = digitalRead(triggerBlue);
 
    if (newWhiteVal != whiteVal) {
      if (newWhiteVal == HIGH) {
        //Serial.println("White High");
        myservo.write(zeroAngle);
        StatusTrigger(0);
      } else {
        //Serial.println("White Low");
        StatusTrigger(1);
        StatusError(0);
        myservo.write(wakeUpAngle);
      }
      whiteVal = newWhiteVal;
    }
    if (newBlueVal != blueVal) {
      if (newBlueVal == HIGH) {
        //Serial.println("Blue High");
        StatusError(0);
      } else {
        //Serial.println("Blue Low");
        myservo.write(shootAngle);
        StatusTrigger(1);
        StatusError(1);
      }
      blueVal = newBlueVal;
    }
  }
}

Bad Hindelang seen from Nusche

This panorama shows Bad Hindelang from the viewpoint Nusche, that’s just halfway to the urban district of Gailenberg. It is a sort of an experiment because it is one of my first hand held shots with the Sony NEX-5 camera using the 16mm pancake lens and the fisheye converter. I took eight pictures around, two zenith and two nadir shots. I took eight images, because with only a Philopod setup this is easier to shoot than only six shots around, which would give you enough overlap for the lens combination. The original equirectangular image had a size of 12000×6000 pixels.
[pano file=”https://www.panotwins.de/wp-content/panos/MMatern_20111002_5810_NuscheZwischenKastanienHerbst.xml” preview=”https://www.panotwins.de/wp-content/panos/MMatern_20111002_5810_NuscheZwischenKastanienHerbst.jpg”]
Geotag Icon Show on map

Cylindrical Panorama from a Video Source

In a post on the HD View blog I read some intersting stuff about generating a panorama from a video source. I made some short videos from my pole recently when making this panorama. I downloaded version 1.4.2 of MICE immediately to try this feature. However the first problem was, that the original mt2s-Video stream from my Sony NEX-5 could not be loaded with MICE. The fastest way to try the feature was to recode it to a 640×480 pixel WMV video stream. This could be opened easily. After setting the start and the stop slider in the video preview window the rest was almost done automatically. I’m quite satisfied with my first result. However I’ll try again with some better video resolution when I find time to recode my original video footage.

[pano file=”https://www.panotwins.de/wp-content/uploads/2011/04/MMatern_20110326145821_VideoPanorama.swf”]

Geotag Icon Show on map

Multirow Spherical Panorama made with the Sony NEX-5

Some weeks ago a question came up, whether it is possible to stitch a panorama from so called sweep panoramas made with the Sony NEX-5. The short answer is: NO. You can read the detailed answers in my two recent posts: #1 and #2.

Here is now the result with the same camera and lens: A Sony NEX-5 with the pancake 16mm lens. I mounted the camera on a tripod and shot a multirow panorama with three rows, each row using eight portrait shots. I used a custom panorama head that I set up quickly for the new camera/lens combination (it has not been aligned perfectly for the NPP).

I set the image quality for shooting to RAW. The resulting images were processed using Bibble 5 Pro. Almost the only processing done with Bibble was correcting the CA of the lens. Further processing like correcting lens vignetting and adjusting the a, b and c parameters for the lens was done with PTGui Pro.


Fountain in Schwabing

Geotag Icon Show on map

Spherical pano stitched from sweep panoramas, an experiment

This post also deals with the answer to Huck’s question whether it is possible to make a full spherical panorama from sweep panoramas made with the Sony NEX-5:

The camera can pan vertically 185 degrees. It can catch the nadir and zenith. It would have more than 45 degrees horizontally so about 5 shots should get you everything. If these could be stitched you could have a spherical panorama with 5 shots. Have you ever tried this? Do you know if it could be done?

As an introduction to the subject please read my answers to Huck’s question here before you continue.

Sweep Pano Head Setup

I mounted the camera on a weird looking panorama head. The setup may not have been perfect in the NPP, but good enough because there were no objects near the setup. I switched the camera to the panorama mode “Vertical Up” in “Wide” mode. One resulting sweep panorama has 2160×5536 pixels. To get enough overlap I took eight of them, starting from the bottom to the top. I locked the exposure for every stripe around the horizon by pressing down the shutter half way. The finished panorama was about 12000×6000 pixels in size.

Here is the best result I could achieve with the source material. You find my PTGui project for the panorama for starting your own stitching experiments here.

[pano file=”https://www.panotwins.de/wp-content/panos/MMatern_20101008_1188_PanoramaSmall.xml” preview=”https://www.panotwins.de/wp-content/panos/MMatern_20101008_1188_PanoramaSmall.jpg”]
Geotag Icon Show on map

The result may not look that bad at first sight, but when looking closer you will see heavy distorted parts (due to the really weird a, b and c parameters from the optimizer) and moving poeple cut in parts:

To make a long story short: The poor result does not warrant the huge effort!

I got a much better result taking individual shots from the panorama head. With the 16mm pancake lens in portrait mode you can make a complete sphere with a final size of about 20000×10000 pixel: You need three rows: 6 shots tilted 60° up, 8 shots at the horizon and again 6 shots tilted 50° down. This closes the hole at the zenith and leaves one at the nadir. However this can easily be fixed by removing the tripod and making a down shot using the view point correction technique described here or here.

When you download the sample sweep panoramas and try it for yourself, please let me know when you were able to stitch a better result from the source material. And what’s most important: Try to describe the process in detail!

Spherical pano combined from sweep panoramas

Huck asked me whether it is possible to make a full spherical panorama from sweep panoramas made with the Sony NEX-5:

The camera can pan vertically 185 degrees. It can catch the nadir and zenith. It would have more than 45 degrees horizontally so about 5 shots should get you everything. If these could be stitched you could have a spherical panorama with 5 shots. Have you ever tried this? Do you know if it could be done?

My short answer is: No!

You may ask why? I don’t think you get the results you expect, or hope to get!

I try to make this more clear with the following statements.

  1. When using the camera in landscape mode five shots cover 360 degree, however there is almost no overlap of the shots. So you need at least 6 shots. But this is only true for normal single shots, not for sweep panorama stripes (see the next statement)!

  2. Rectilinear Panorama Detail

    Sweep Panorama Stripe Detail

    When using the vertical sweep panorama mode you get stripes that are only 2160 pixel wide, compared to the 4592 pixel of a normal landscape shot. The image is scaled down inside the camera and furthermore it is cropped on the sides! Thus you need at least eight stripes to cover the full sphere! See the different scale of the following two images showing the same spot of the result panorama.

  3. Some panorama stripes just don’t stitch! In my living room I was not able to get a sweep panorama done, because the camera just was not able to find features for stitching! I tried some of the stripes for about ten times. Always at the same point towards the end I got an error message from the camera. This was usually when the ceiling started, where only few features can be found.
  4. You can’t control the quality in the sweep panorama mode, because the following settings get disabled:
    • ISO
    • JPG Quality
    • Shutter
    • Aperture

  5. Sweep Pano Head Setup

    When using a pano head it gets really complicated, due to the fact that you are shooting in landscape and not in portrait mode (however it would be less complicated, when using an L bracket designed for the NEX-5).

  6. There is no matching lens type available for stitching! I tried my best to stitch a panorama using PTGui Pro but failed. At the moment I’m quite sure that none of the available lens types is the right one! I tried all of them, even the ones, that don’t make real sense. I got the best results using the fish eye lens setting, but somehow this is still wrong.
  7. When shooting handheld you may make curves, that will be straightened in the finished panorama stripe. No stitcher will ever be able to correct this.
  8. The exposure is taken from the start of the panorama, unless you point the camera to a different part of the scene, press the shutter half way down and return to the start.
  9. It’s not easy to hold the shutter all the way when sweeping the pano head.

I hope to get some more information online over the next weekend.

QR Code Business Card