Camera Controller V2
User Manual

This manual is for the V2 version of the Camera Controller only. Earlier versions are available here

AYUCR Camera Controller



Dimensions (HxWxD) 2.5" x 1.125" x 0.625"
Weight 15g (22g w/ battery)
Power Consumption 4-12mA typical
Battery Life 4 hours minimum
Power Requirements 12V GP23A Battery or 6V-12V via external power
RS-232 Serial Interface 2400 Baud, 8bits, No Parity, 1 Stop bit
G-Switch Rating 2.1G +/- 10%

Programable Flight Parameters

Parameter Units Explanation
Launch Detect 1/100 sec How long the rocket must accelerate at greater than 2.1 Gs to initiate liftoff. Range is 1/100 second to 2.5 seconds. A good choice is 20 (2/10 sec). Too short and the controller will be sensitive to bumps and shakes. Too long and the motor may burn out before launch is detected.
Launch Delay 1/10 sec Delay between launch detect and first picture. The default is 0 which gives shots during boost. If you only want shots starting at apogee add a delay for boost and coast here.
Number of Groups Count Pictures can be divided into any number of groups with a delay between groups. Use this to program the number of groups of pictues to take.
Number of Pictures Count This is the number of Pictures to take per group. If the Number of Groups is set to 1 (one) then this is effectively the number of pictures to take total.
Picture Interval 1/10 sec Delay between each picture in each group. The minimum is dependant on the camera used. See Trimming the Controller for more info
Group Interval seconds Delay between each group of pictures. There is no need to account for the Picture Interval when figuring the Group Interval. If the Picture Interval is 3 seconds and the Group Interval is 10 seconds the time between the last picture of the first group and the first picture of the second group will be 10 seconds not 13.
Shutter Speed 1/10 sec The amount of time the shutter is closed for during each picture. This has nothing to do with how long the shutter on the camera is opened for. See Trimming the Controller for more informatation. (not programmable in User Mode)
Servo Mode 0 or 1-255 Indicates Whether the controller is to be interfaced with an electronic shutter (0) or mechanical shutter via servo (1-255)
Keepalive Interval 10 sec How often is the shutter closed while the controller is armed on the pad. This is useful for keeping the camera from going to sleep prior to launch. A setting of zero disables Keepalive and will not take any pictures while armed on the pad.

Powering the Camera Controller

The Camera Controller is designed to be powered one of two ways. You can use a 12V remote control battery (Radio Shack part 23-154) in the on-board battery holder or connect an external 6V-12V battery via the Shutter/External Power connector. To use a 12V remote control battery insert it with the plus side facing up as shown. Important: because the battery clips are metalic you must wrap the battery with atape to prevent the battery case from shorting against the battery clips. Most batteries have a coating that may prevent shorting but this coating is easily scratched. A shorted battery will be warm or hot to the touch.

Battery Holder

The on-board battery holder holds the battery very tight. You may need a pair of pliers to remove the battery.

It is also possible to power the Camera Controller externally via the Shutter/External Power connector. A 9V battery connected this way will power the controller for much longer than the on-board battery. Depending on how the external power source is mounted it may also provide more reliable power under high G loads. On the Shutter/External Power connector pin 3 is positive voltage and pin 4 is ground. Be careful to observe polarity. In the picture below the red wire is positive and the black wire is ground.

Power and Shutter Header

Using the Camera Controller

Powering up the Controller - To power up the Controller place the red power jumper over the two pins on the power header. The LED should flash when powered up. To conserve the battery you should power the controller down unless you are flying it or programming it.

Standby Mode - The controller powers up in Standby Mode. A slowly flashing LED, about 1 flash every two to three seconds, confirms the unit is in standby mode.  This is the normal mode for controller unless the rocket is on the pad and ready to fly. In this mode the controller monitors the serial port and the arming button and ignores the g-swtich.

User Mode - Most of the flight parameters may be field-programmed without the aid of a laptop or Palm computer using User Mode. The controller is placed in User Mode by holding down the arming button while powering up the controller. The controller will respond by flashing the led quickly ten times. The quick ten-flash is the User Mode "prompt" and indicates the controller is waiting for a command.

Commands and data are entered by pressing and releasing the arming button. To enter a five press and release the button five times. Press and release the button surely at a rate of about two presses per second to ensure accuracy. A pause of approximately 1.5 seconds signals the end of user input. It should be noted that using this method a zero can not be entered. This is only really a problem for the Launch Delay parameter. In this case use a one ( for 1/10 second) or program the controller with a computer if a delay of zero is necessary.

Commands that generate output flash the LED to communicate with the user. Count the flashes to read the output. Unlike popular altimeters, numbers greater than nine are not displayed a digit at a time. A 4 followed by a 13 would be 4 flashes then 13 flashes not 4 flashes then 1 flash then 3 flashes. A zero is indicated by one longer flash.

Upon entering User Mode the LED flashes ten times quickly. This ten-flash is the prompt for one of four commands. The controller waits for the user to enter and commaned by pressing the arming button. For example, to display the current flight parameters press the arming button once and count the groups of flashes displayed by the controller. After executing any of these commands except the Exit command the ten-flash prompt is repeated.

  Command Explanation
1 Display Flight Parameters The first six Flight Parameters are displayed one at a time in order by flashing the LED.
2 Enter Flight Parameters The controller prompts, with a single flash, for the first six Flight Parameters. respond by entering a new value for each using the switch-pressing technique discussed earlier. Shutter Speed and Servo Mode can not be specified using this command
3 Picture Count Displays the number of pictures taken during the most recent flight. This is also displayed when switching from Post-Flight Mode to Standby Mode. Use this command to repeat it.
4 Exit User Mode Returns to Standby Mode

User Mode is not designd to replace using the serial port to configure flight parameters. It provides limited functionality for last minute changes in the field or when a computer or handheld is not available.

Armed Mode - To arm the controller press the arming button a single time while in standby mode. A quickly flashing LED indicates the controller is Armed. When Armed the controller waits for launch by watching the G-Switch. If it senses greater than 2.1 Gs for the duration specified by the Launch Detect parameter it will immediately enter Flight Mode and begin the picture cycle. You can disarm the controller and return to Standby Mode by pressing the arming button again.

Flight Mode - Once the controller has sensed liftoff it enters flight mode. If a Launch Delay has been specified the controller pauses that amount of time and then begins taking pictures according to the program. Once the program has run its course the unit enters Post-Flight Mode.

Post-Flight Mode - After the controller has taken the programmed number of pictures it enters Post-Flight Mode. It turns off the LED and puts itself into a low-power mode to help save the batteries. To reset the controller and return to Standby Mode press the arming button. This wakes the unit up and it will flash out the number of pictures taken during flight. After that you should notice the slow flashing LED indicating Standby Mode. As the arming button may be the only thing easily accessable from outside the rocket the picture count is designed to provide some quick feedback after flight. The picture count display only shows the number of pictures the controller tried to take. If there was a power failure in flight this number may be less than expected. This display cannot be used to diagnose problems with the camera or problems with Trimming. You should always check the camera's exposure counter to see if it agrees with the controller.

Connecting the camera

The camera shutter contacts are connected the controller via the Shutter/External Power connector. Pins 1 and 2 (yellow and green wires in the photo) are connected to the camera's shutter contacts. The Servo Mode parameter must be zero to enable electrical shutter mode.

Power/Shutter Header

Servo Control

The controller can also output a servo signal to control a mechanical shutter via a standard servo. If the Servo Mode paramenter is greater than 0 the controller will operate in servo mode. Instead of simply closing the shutter contacts for a time equal to the Shutter Speed parameter a PWM servo signal is sent to position a servo to take the picture. The servo starts at rest, moves a distance proportional to the value of Servo Mode, pauses according to Shutter Speed and then returns to rest. When at rest the controller outputs a 1ms pulse train. If Servo Mode parameter is 64 the servo will move to its 25% position to take the picture. If it is 128 the servo will move to 50%, etc. You can adjust Servo Mode and Shutter Speed to the settings that work best with your particular setup.

Trimming the Controller

Different cameras require different settings for the Shutter Speed paramater. This isn't how long the camera shutter is actually open, that's controled by the camera, but how long the shutter pulse is that is sent to the camera. The default is 3/10 of a second. Your camera may require longer or shorter. The other setting that may vary is how long the camera takes to recycle between shots. If you are trying to get shots under boost it pays to find out ahead of time otherwise the camera may not be able to keep up and drop frames.

It is best to set this with the camera turned on and no film in it. Set the controller to take a picture every 3 seconds or so. Make sure everything is connected and simulate launch. You can simulate launch by shorting the connections of the User Mode Header. Ensure that the camera takes a picture each cycle. If it does not increase the Shutter Speed until the camera responds reliably to each command from the controller to take a picture. Once you have determined a reliable Shutter Speed setting you should probably never need to change it.

Next, adjust the Picture Interval setting downward until the camera begins to drop frames. Increase the Picture Interval until the camera keeps up with the controller. This is the minimum cycle time for your camera. Make a note of this value. You can make your flights with any value for the Picture Interval parameter as long as it is at least as long as the minimum. Some cameras will be able to cycle faster without film than with. The resistance of winding the film adds to the cycle time. If you have some old film or some of that cheap film they give away when you take a roll to be developed you should test if the minimum Picture Interval changes with film in the camera.


The configurable Keepalive Interval can be used with cameras that have a battery-saving auto-powerdown mode that cannot be defeated. These "feature" will usually cause you camera to shut off while on the pad and, depending on the model, may not wake up from sleep if you press the shutter. In other words some cameras will shut off and you must press the ON button to turn them back on rather than pressing the shutter. The keepalive mode simply takes a sacrificial picture when the controller is armed on the pad periodically to keep the camera from powering down. The interval is programmable from 10 to 2550 seconds in ten-second steps. To set this parameter first make sure you really need it. Some cameras have an option to turn off this battery-saving feature. If yours does not, turn it on and time how long it takes for it to power down. Now, press the shutter (and only the shutter) and if the camera wakes up and takes a picture you do not need to use a keepalive interval. You should turn it off by setting this value to zero. If your camera fully powers down and requires pressing a power button to turn it back on then set the Keepalive Interval to be slightly shorter than the power-down time for your camera. You can test that keep-alive works by connecting the controller to the camera, arming the controller and checking that the controller takes a picture often enough to keep the camera awake.

Typical Flight Timeline

Below is a flight timeline from a sample flight to help clarify how the controller works.

Flight Parameter Value
Launch Detect 20/100 sec
Launch Delay 0 sec
Number of Groups 3
Number of Pictures 4
Picture Interval 2 sec
Group Interval 5 sec
Shutter Speed 3/10 sec
Servo Mode 0
Keepalive Interval 0
Time Event
-0.0 Altimeter is armed.  LED flashes quickly and controller waits for launch detect
0.0 Launch. Altimeter senses launch and confirms G-Switch closed for 20/100 sec
0.2 Valid launch.  There is no delay before the first picture specified so the controller immediately begins to take pictures.
2.2 Picture 2
4.2 Picture 3
6.2 Picture 4 followed by a 5 second Group Interval
11.2 Picture 5
13.2 Picture 6
15.2 Picture 7
17.2 Picture 8 followed by a 5 second Group Interval
22.2 Picture 9
24.2 Picture 10
26.2 Picture 11
28.2 Picture 12
28.5 Immediately following last picture controller enters Post-Flight Mode. LED is off and the controller waits to be disarmed.
28.5+X Arm Switch to OFF. LED flashes 12 times to indicate 12 pictures were taken.  Enters Standby Mode.

Serial Commands

The controller recognizes commands via the serial port.  These commands control all aspects of the Camera Controller and can be sent from the serial port of any computer with the serial port set to 24008N1 or 2400 baud, 8 data bits, no parity and 1 stop bit. The serial port uses a three pin interface.

Serial Port

Pin Wire Color Function
1 Yellow TxD
2 Green RxD
3 Black GND

Command Summary

Command Function
P Accept new flight parameters (for use with Palm software)
D Dump settings (for use with Palm software)
N Prompt for new flight parameters using a simple terminal interface
R Display the current fight parameters in human-readable format
M Report controller model number ("ACC" for Camera Controller)
V Report firmware version
S Test Shutter
Z Report the number of bytes sent and returned by the P and D commands (16 for Camera Controller)
A Arm the controller (error unless in standby mode)
L Initiate Launch (error unless armed)
U Disarm the controller (error unless armed)
B Enter bootloader

Program - To download flight parameters to the controller the serial programming command is "P" followed by sixteen bytes:

P p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16

where the data bytes are defined as follows

Data Byte Flight Parameter
p1 Launch Detect (1/100 sec)
p2 Launch Delay (1/10 sec)
p3 Number of Groups
p4 Number of Pictures
p5 Picture Interval (1/10 sec)
p6 Group Interval (seconds)
p7 Shutter Speed (1/10 sec)
p8 Servo Mode (0 or 1-255)
p9 KeepAlive Interval (0 or 1-255)
p10-p16 Unused but still sent and received

The program that communicates with the controller should confirm that the controller responds with two bytes "OK" to ensure the command was received successfully. The controller will report "TO" if the eight parameter bytes are not received within a few seconds.

Dump - The command to instruct the controller to send its current Flight Parameters is "D". Eight databytes in the same order sent in the Program Command will be be sent from the controller followed by the bytes "OK"

New Program - This provides a simple user interface for accepting new flight parameters. It prompts for each parameter one at a time and allows the user to change the current value using the '+' and '-' keys. Type 'N' to enter this command. The prompts are as follows:

Prompt Flight Parameter
LD- Launch Detect (1/100 sec)
DL- Launch Delay (1/10 sec)
#G- Number of Groups
#P- Number of Pictures
PI- Picture Interval (1/10 sec)
GI- Group Interval (seconds)
SS- Shutter Speed (1/10 sec)
MD- Servo Mode (0 or 1-255)
KA- Keepalive Internal (10 seconds)

To increase the current value press the '+' key. To decrease the value press the '-' key. To reset the value to zero press the '0' key. To accept the current value press Enter. To canel press Esc, any changes will be discarded. Important: make sure that "Local Echo" is off in you terminal program or you will see a lot of garbage on the screen.

Read Program - 'R' displays the current flight parameters in a human-readable format. The values are labled the same as the prompts in the New program command.

Model Number - 'M' displays the model number for the controller. For the AYUCR Camera Controller this will always return 'ACC'

Version - Enter 'V' to see the current firmare version.

Shutter Test - Enter 'S' to test the shutter. The controller will take one picture. This is useful for setting the Shutter Speed parameter.

Program Size - Enter 'Z' to get the number of bytes of flight parameters sent and received with the P and D commands. This is intended to be used by software that interfaces with the controller. If the Z command returns "ER" then the firmware is an older revision and has an 8 byte flight program. Otherwise a single binary byte is returned followed by OK indicating the length of the program. AYUCR Camera Controller - User Manual

Arm - 'A' will arm the controller provided it is already in Standby Mode. If the controller is already armed "ER" is returned indicating an error.

Launch - 'L' will initiate launch and the controller will begin taking pictures. The unit must be armed otherwise "ER" is returned indicating an error.

Disarm - 'U' will disarm the controller.

Bootloader - 'B' will put the controller in bootloader mode.

The controller may report the following errors in response to commands. "TO" is reported to indicate an incomplete command was entered. "ER" is reported if an unknown or illegal command is entered.

Advanced Uses

The camera controller can use a servo to trip the shutter on a camera. The servo mode can also be used for things like non-pyro deployment and non-pyro releases.

Using The serial port commands the Camera Controller can be interfaced to other avionics. For example, a flight computer controlling deployment could be interfaced with the camera controller to instruct it to begin taking pictures at apogee or at some predetermined altitude. This is as simple as leaving the controller disarmed on the pad and having the flight computer send an arm command ('A') immediately followed by a launch command ('L') at the appropriate time.

Using a radio-control device the controller could be told to initiate launch during countdown in order to better capture pictures or video at liftoff. The controller would be armed on the pad but launch would be initiated by sending the controller a 'L' command.


V2.0 and later includes a simple bootloader which provides a simple interface for reading and writing the processors flash program memory. The bootloader is designed to be relatively error-proof while using less than 256 bytes of program memory and about 70 bytes of SRAM. This includes the bootloader interface, serial I/O routines and low-level flash read/write/erase routines.

Issuing the 'B' enters the bootloader and starts a simple command processor that looks for and executes commands transmitted over the serial port at 2400 baud. One of several response codes are returned after each command is executed. All commands operate on pages of 32 program memory words at a time. Since each word is 16 bits (actually 14 but the two most significant bits are padding) each page is 64 bytes long. All commands are sent with an additional checksum byte for error checking.


Reads a page of flash program memory. The command is 4 bytes long, 1 byte for the command character 'R', two for the address and 1 checksum byte. This command returns [DATA] followed by [CHK] (65 bytes total)

Writes a page to flash program memory. The command is 68 bytes long, 1 byte for the command character 'W', two for the address, a 64 byte data frame and a checksum byte.

Erases a page of flash program memory. The command is 4 bytes long, 1 byte for the command character 'E', two for the address and 1 checksum byte.

Exit bootloader and reset hardware.


[ADR] - The address is two bytes long and is sent low byte first. The range of address (for the 16F819) is 0x0000 - 0x07FF for Read and 0x0020 - 0x06FF for Erase and Write. The difference is the bootloader will not allow you to overwrite it as this would produce strange results and migh break the firmware requiring a reflash using an external programmer.

[CHK] - A simple checksum of the databytes transmitted for error checking When appended to commands the checksum excludes the first command byte. The checksum for the read and erase commands applies to the 2 [ADR] bytes. The checksum for the write command applies to the 2 [ADR] and the 64 [DATA] bytes. The checksum returned after the 64 [DATA] bytes in the read command is calculated on those bytes.

[DATA] - represents an entire page of flash program memory. The page is organized as 32 low byte/high byte pairs.

Return Codes:

K - Ready to accept the next command
R - Address range error
C - Data checksum error

When a command completes successfully the 'K' prompt will be all that is sent. There is no success code. The absense of a R or C error code is enough to indicate success.

The processor will issue a range error (R) if write or erase command and the target address would overwrite the bootloader itself. Overwriting the bootloader region or the beginning of memory where the interrupt vectors are stored while the processor is executing the bootloader would probably cause weird behavior possibly rendering the chip unusable without reflashing from scratch in a dedicated programmer.

To exit the bootloader the processor requires a hard reset

The bootloader is designed to interface with a program which reads the firmware .HEX file and uses the bootloader to write the new firmware to the chip. I have written a bootloader driver in Perl and it is available on the Source page. It uses theDevice::SerialPort package and I have tested it extensively on Linux. I don't have a version for the PC but I would welcome submissions to help remedy this. The Perl code is less than 500 lines and combined with the information above should be sufficient as a guide to writing other versions. The Perl bootloader driver does the following:

This takes a little while at 2400 baud, perhaps 30 seconds. Changes to the firmware that alter the bootloader, serial I/O or flash program memory routines require reflashing the chip externally as these routines all reside in the bootloader-safe region of memory.


The command to read the page starting at 0x0020 (the first user page) is:

0x52 0x20 0x00 0x20

Notice that the address is sent LSB first and that the checksum excludes the command byte (0x52 or 'R'). The bytes above are expressed in hex. The total command length is 4 bytes. The bootloader will return the page requested as 32 two byte words, low bytes first followed by a checksum byte and then the 'K' prompt/success code. If there was an error, perhaps a checksum error indicating a problem receiving the command, the return code would be C followed by K.

The command to erase a page starting at 0x06DF (the last user page) is:

0x45 0xDF 0x06 0xE5

The return code following the operation will be 'K' A return of C followed by K indicates a checksum error.

The command to (attempt) to erase the page starting at 0x0700 (the first bootloader page) is:

0x45 0x00 0x07 0x07

This command will return R followed by K to indicate that a range error occurred.