I have been working on the camera controller part of the project. I still need to figure out exactly when to trigger the flash, but I needed to get this working so I can do that. I will post a schematic when I get something presentable, right now it is chicken scratch.
Anyway, I tried this tonight, and I think I am pretty close with it. I put a meter between the circuit and battery, and I'm confused??? The first time I power the thing up, and after it runs the walk test, it settles down to using about 22ua. But...once I trigger it to take a picture, it ends up at about 100ua or so when it is finished. I took some liberties here, not knowing what I'm doing. I wonder if anyone might see something I need to correct??? Sorry about the way it reads on here, it looks good in my editor?
'Using Picaxe 08M chip, I will attempt to build a camera controller.
'This controller will use a PIR detector to put pin3 either high or low to
'trigger the sequence of events, depending on which PIR circuit is used. The
'intention is to connect the cameras batteries to the camera on first detection,
'and otherwise leave them disconnected. This is for use with some cheap cameras
'that will run the batteries down if left in the camera for extended periods, or
'for those that might occasionally lock up..
'This may not work for some cameras, as they will ask you to set the time and
'date before letting you take a picture...and most will loose the time and date
'with the batteries out. The battery connect feature can be used for powering a
'slave flash instead, with a slight mod in the code.
'I will also be trying to time a flash unit to fire when he picture is taken.
'This is to use a camera that either has no built in flash, or to be used with
'that has one, but can be turned off. This will solve the issue of batteries
'being drained from keeping the cameras flash charged up too. This is work in progress!
low 0 'CDS power and cam power button
low 1 'cam shutter and light check
low 2 'flash and walk test LED
low 4 'pin 4 camera battery connection
disablebod 'this turns off brown out detection to save power
warm_up:
high 2 'this lights the walk test LED and flash on power up
pause 5000 '5 second pause
low 2 'turn off walk test light
goto walk_test 'go to walk test...duh
walk_test:
w0 = 60 '6 seconds...was 600' How many 100ms - 600 x 100 = 60,000ms = 60s
Do While w0 > 0 'walk test lasts till timer is timed out
If pin3 = 1 Then 'pin3 goes to the PIR, when PIR detects motion...then...
high 2 'light walk test LED to show detection
pause 1000 '1 second pause
low 2 'turn walk test LED off
Else 'if no motion is seen this time, still count down the timer anyway
Low 0
End If
Pause 100
w0 = w0 - 1 'deducting one second from walk test time
Loop 'this just says to keep the walk test running till timed out
Goto CameraMode 'walk test finished, now go to regular camera mode
CameraMode: 'camera is armed and ready to take a picture when motion is seen
poke $8f,%00000000 'this will slow the chip way down to 31 kHz to lower the power use
if pin3 = 1 then check_light 'this line says if motion is seen, go check if it is night or day
goto CameraMode 'no motion...keep watching for it
check_light:
setfreq m4 'bring the chip speed back up to 4mhz
pause 10 'waiting 10/1000 second
high 4 'turning on camera battery battery power to camera
'xxxxxxxxxxxxxx
input 1 'change pin 1 from an output to an input pin...untested
'xxxxxxxxxxxxxx
pause 10 'waiting 10/10000
high 0 'turn on CDS power and camera power on pin
readadc 1,b1 ‘read the value of CDS to see if it is daytime or dark
pause 100
'xxxxxxxxxxxxx
low 1 'turn pin 1 back to output and turn it off...untested
'xxxxxxxxxxxxx
pause 500 'wait 1/2 second while camera powers on
low 0 'turn off CDS power and camera power on pin
if b1<100 then no_flash ‘range 0-50 = 50...daytime
if b1>100 then flash ‘range 50-100 = 50...night time
no_flash: 'this runs in daytime
pause 2000 'time delay after cam powers on before shutter press
high 1 'turn on shutter button and hold
pause 500 'for 1/2 second
low 1 'turn off shutter button
pause 30000 'waiting 30 seconds for picture to be saved
high 0 'turning camera off
pause 500
low 0
pause 1000
low 4 'turning off camera battery power to camera
goto CameraMode
flash: 'if it is night time, we will use this
pause 2000 'time delay after cam powers on before shutter press
high 1 'turn on shutter button and hold
pause 500 'for 1/2 second
low 1 'turn off shutter button
'xxxxxxxxxxxxx
high 2 'turning on flash/array
pause 1000 'will need to be adjusted to get it in sync with shutter
low 2
'xxxxxxxxxxxxx
pause 30000 'waiting 30 seconds for picture to be saved
high 0 'turning camera off
pause 500
low 0
pause 1000
low 4
pause 5000 'this pause is the picture to picture delay time
goto CameraMode 'return to CameraMode and wait for motion again