website/content/blog/arduino-nikon-remote/index.md

64 lines
3.8 KiB
Markdown

+++
title = "Timelapse and space birds"
date = 2025-09-01
description = "Photo trigger and presence detector"
insert_anchor_links = "left"
[taxonomies]
tags = ["Arduino", "electronics", "photo"]
+++
## A robin in the stars
Robins, sparrows, blackbirds and titmouses visit the garden all day but fly away a soon as a hominid approaches.
Then how to picture them without a telephoto lens?
By crafting a trigger with an infrared distance sensor!
![A robin, standing on the corner of a wooden garden table, is looking through a small round flat recipient in front of it, next of which are scattered a few seeds. In the recipient appear stars and nebulae.](dream1.webp)
![The robin looks more closely in the recipient, still staying at a distance. In the stars there is a penguin with a wing out of the recipient.](dream2.webp)
![The robin now shows its back to the camera. It's just above the recipient. Two penguins came out of the recipient, in which a starry sky is still visible. One of them jumped on the corner of the table, wings and legs deployed. The other one is following, standing on the corner, looking toward the ground.](dream3.webp)
[More high-res photos are available here.](/img/birds/)
## Humble timelapse
There is also a periodic mode, to make a timelapse.
In the video, brightness varies because I forgot to disable automatic white balance.
<iframe title="Timelapse - trees and sky - 2020-10-31" width="560" height="315" src="https://flim.txmn.tk/videos/embed/3acae4de-2669-4b48-867d-41a980bfce9c" frameborder="0" allowfullscreen="" sandbox="allow-same-origin allow-scripts allow-popups allow-forms"></iframe>
## The trigger
My camera (Nikon D3000) has an infrared sensor but I don't have the remote that works with it.
Fortunately someone published an Arduino program for replicating the remote's signal: [_Nikon Remote Emulator_ by Gough Lui](https://goughlui.com/2013/12/06/teardown-and-project-clone-nikon-ml-l3-ir-remote-and-emulation/).
You only need a microcontroller and an infrared LED (salvaged from an old TV remote).
The bird detector is an infrared distance sensor GP2D12, capable of (very approximately) evaluating distance from 20 to 80cm.
It's mounted on an articulated arm, at a distance from the camera (to be able to tune the focal and avoid frightening the birds).
The switch allows to choose a mode (either detector or fixed interval), and a potentiometer to choose a value (distance in the detector mode, duration in the interval mode).
The program also triggers the camera every few minutes to prevent it from going to sleep mode (which would require a manual reset).
The case is designed for an Arduino Micro but an ATtiny402 would be more than enough.
The articulated arm can be fixed on the camera's tripod.
![Articulated arm made of double metal rods. On one end, a collar fixes the apparatus on the tripod. Between the two segments, a knee-like joint. On the second segment, the case containing the Arduino, the LED, the switch and the potentiometer. On the last end, the infrared sensor, connected to the case by three wires.](remote.webp)
* [nikon_ir_trigger.ino](nikon_ir_trigger.ino) (Arduino program)
* [timelapser.scad](timelapser.scad) (3D model [OpenSCAD](https://openscad.org/), for 3D printing)
* [pitch.scad](pitch.scad) (screw pitch and bolt support)
## Credits
The montage with the robin includes two images of which I am not the author:
* _Adelie Penguin (Pygoscelis adeliae) group on iceberg, Antarctic Peninsula, Antarctica_, image shared everywhere on the Internet without attribution, and I can't find the original publication.
* [Westerlund 2, photographed by the Hubble Space Telescope (heic1509a)](https://esahubble.org/images/heic1509a/)
Images edited with Gimp, optimized with YOGA Image Optimizer.
No animal was hurt during the photo shootings.
The participants did not sign any image rights but were remunerated in seeds.