IR SignalThe first step was to understand the IR protocol. Sony uses a standard protocol for all of their devices (SIRC), but without knowing the version (12/15/20-bit) used, the device address and the commands, it would be quite difficult to determine the correct code for the shutter. Luckily, the codes were posted on a forum in Pronto format.
The Pronto codes were then decoded to obtain the commands with help from the Pronto IR Format Manual.
Format: 0000 (wFmtID = Raw Oscillated Code) 0067 (wFrqDiv = 103 => 4MHz / 103 = 38.8 kHz) 0000 (nOnceSeq) 0015 (nRepeatSeq) Start: 0060 0018 (Start Sequence) Command (7-bit): 0030 0018 (bit = 1) 0018 0018 (bit = 0) 0030 0018 (bit = 1) 0030 0018 (bit = 1) 0018 0018 (bit = 0) 0030 0018 (bit = 1) 0018 0018 (bit = 0) Device (5-bit): 0018 0018 (bit = 0) 0030 0018 (bit = 1) 0018 0018 (bit = 0) 0030 0018 (bit = 1) 0030 0018 (bit = 1) Extended (8-bit): 0030 0018 (bit = 1) 0018 0018 (bit = 0) 0018 0018 (bit = 0) 0018 0018 (bit = 0) 0030 0018 (bit = 1) 0030 0018 (bit = 1) 0030 0018 (bit = 1) 0030 0018 (bit = 1) 0030 03f6 End of code???
SIRC uses T = 600 us timeslots, which corresponds to ~24 pulses at 38.8 kHz.
HEX DEC T
0018 = 24 = 1*T 0030 = 48 = 2*T 0060 = 96 = 4*T
The signal was constructed in MATLAB and then output on an arbitrary function generator (Instek AFG-2125) with an IR LED connected to its output. The command executed successully on a NEX 6.
HardwareIn order to ensure a small board size, an ATTINY9 (SOT-23-6) was selected as the microcontroller. The microcontroller has two signal outputs: a carrier (~40 kHz) and a data signal. The carrier signal is generated by the system clock output (CLKO), therefore the device must be clocked at 40 kHz. This can be accomplished by dividing the internal oscillator and purposely detuning it by changing the oscillator calibration register. The signals are logically AND-ed in order to modulate the signal for transmission. Due to current output limitations of the microcontroller, an output driver is used to power the IR LED.
Tests were done with two transistors in series to AND the signals, but the VCE voltage was too high and the circuit only worked for supply voltages above 3V. The circuit provided uses a simple BJT transistor circuit to amplify the carrier signal to drive the LED. The data signal is configured as an open-collector output and drives the base low to disable the LED. While the output is disabled, the base resistor wastes power, but this was required to ensure operation at the voltage provided by the battery.
- Schematic (.pdf|.ms12)
- PCB Layout
SoftwareThe data signal (not modulated) is generated by bit banging a GPIO. A timer could not be used because the time required to service an interrupt does leave enough time to process the signal. Instead, a loop was implemented that takes exactly 24 cycles. The code is written in assembly in order to precisely determine the number of cycles per loop iteration. Interrupts and sleep modes are not used during signal generation to elminate any code with unpredictable cycle counts, however the device does sleep between transmissions.
- Source Code (Atmel Studio)
EnclosureA keychain LED flashlight was used for the first prototype. The LED was replaced with an infrared LED and the circuit was dead bugged inside.
An enclosure was also designed that could easily be printed with a low cost 3D printer.