It is a Design to control a camera.
I have put the camera on a stepper motor and let the pic control the motor. {ed: The PIC puts out Step and Direction signals which will direct a stepper motor controller to actually move the motor. See Stepper Motor Controllers for a list of options}
It turns the camera and, with the relays output connected to the shutter, it takes a picture...
Works fine and makes nice panorama pictures...
I am now working on one which can control two motors so the camera can also take pictures above and below the horizon..
Included is the code in CCS C, and the Schematic and PCB designed in Mentor Graphics.....
Schematic:
Sample Stepper Motor Driver schematic (not included on this board)
Code:
camstepcode.zipCamera_Stepper.c
#include "Camera_Stepper.h" // Defines #define RELAY PIN_C0 #define DIRECTION_IMT_1 PIN_A2 #define STEP_IMT_1 PIN_A3 #define DIRECTION_IMT_2 PIN_A4 #define STEP_IMT_2 PIN_A5 #define START_STOP PIN_B0 #define LEFTSOM PIN_B1 #define RIGHTSOM PIN_B2 int1 START = FALSE; int1 STOP = FALSE; int16 MAX_STEP = 1023; #int_EXT void EXT_ISR() { if(START == FALSE)// First times printed on start_stop { START = TRUE; }else { STOP = TRUE; } } void CAMERA_STEP() { int16 i, j; for (j = 0; j < 33; j++) { delay_ms(1000); output_high(RELAY); delay_ms(250); output_low(RELAY); for(i = 0; i < MAX_STEP; ++i) { output_low(DIRECTION_IMT_1); delay_us (250); output_high (STEP_IMT_1); delay_us (250); output_low (STEP_IMT_1); /* if (STOP == TRUE) { i = MAX_STEP; }*/ } } START = FALSE; STOP = FALSE; } void initSystem(void) { // System initialisation setup_adc_ports(NO_ANALOGS); setup_adc(ADC_OFF); setup_spi(FALSE); setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); setup_timer_1(T1_DISABLED); setup_timer_2(T2_DISABLED,0,1); setup_comparator(NC_NC_NC_NC); setup_vref(FALSE); enable_interrupts(INT_EXT); enable_interrupts(GLOBAL); } void main() { initSystem(); while(1) { if(START)//We need to run a round..... { CAMERA_STEP(); } if(!(input(LEFTSOM))) { output_low(DIRECTION_IMT_1); delay_us (250); output_high (STEP_IMT_1); delay_us (250); output_low (STEP_IMT_1); } if(!(input(RIGHTSOM))) { output_high(DIRECTION_IMT_1); delay_us (250); output_high (STEP_IMT_1); delay_us (250); output_low (STEP_IMT_1); } } }Camera_Stepper.h
#include <16F876A.h> #device ICD=TRUE #device adc=8 #FUSES NOWDT //No Watch Dog Timer #FUSES HS //High speed Osc (> 4mhz) #FUSES NOPUT //No Power Up Timer #FUSES NOPROTECT //Code not protected from reading #FUSES NODEBUG //No Debug mode for ICD #FUSES NOBROWNOUT //No Reset when brownout detected #FUSES NOLVP //No Low Voltage Programming on B3(PIC16) or B5(PIC18) #FUSES NOCPD //No EE protection #FUSES NOWRT //Program memory not write protected #use delay(clock=12000000)
Boards: