Help with a camera controlling sequence

Thread Starter

joshzstuff

Joined Sep 22, 2010
30
Hello, I'm starting a video surveillance camera project and I would really appreciate your input as to direction and methods.

Here are the details:

-The camera I am using will be activated by a Passive Infrared sensor (PIR) (or also possibly a sound detector)
-The camera must be turned on and started by the sensor, then it must be shut off in the absence of sensor feedback.

Here is how the camera operates normally:

Cam has 2 buttons, 1) ON 2) Start/Stop

- ~2sec After the "ON" button is pressed the "Start" button can be used.
- When the "Start/Stop" button is pressed again, the video will stop & Cam goes into "STANDBY" mode for 65sec
- in "STANDBY" the "Start" button will start recording, but after 65 sec the Cam auto shuts off
(and must then again be turned "ON" before the "Start" can be used.)

Below is the sequence I devised to run the Cam off the motion sensor(s):

I will need to break into the buttons to send the pulses to the camera.

I am considering 2 paths to execute this sequence:
1) Discrete components (i.e. retrigerable monostable vibrators)
2) Programing a microcontroller

This would be my first microcontroller project, but if I do go that route, it appears the Micro could be very basic.

Any suggestions will be appreciated, thanks for reading.

P.S. What line diagram programs do you use?
I did this one in a paint program and I know there has to be a better way!
Thanks.
 

GetDeviceInfo

Joined Jun 7, 2009
2,196
There is a very large community doing just what you want. Game cams are highly commercialized.

Go the micro route. One basic reason is that you will want to condition a variety of trigger inputs. You've suggested at least two possibilities, but I can tell you, that once you get into it, you'll be happy to have the resources. One of my triggers is a variable gain PIR that self calibrates it's sensitivity, another is an RF transmitter that fires a zooming still camera with panning function.

Another reason for micro control is power management. If you plan on battery driven devices, you want to total control over your consumption.

The best reason though is the infinintely variable logic you can place between your triggers and camera. Be it timers, trigger sequencing, handling nuisance triggering, sensitivity, etc, etc.
P.S. What line diagram programs do you use?
Only the best, pencil and paper.
 

Thread Starter

joshzstuff

Joined Sep 22, 2010
30
Only the best, pencil and paper.
Hehe, yes that's where I developed it, but I wanted something more web friendly for the forum :)

There is a very large community doing just what you want. Game cams are highly commercialized.
Thanks 'info' for the tip.
Do you think it is appropriate to discuss this here or would it be better to look for such a forum?
Are you a member of a particular forum, or do you recommend one?

Go the micro route. One basic reason is that you will want to condition a variety of trigger inputs. You've suggested at least two possibilities, but I can tell you, that once you get into it, you'll be happy to have the resources. One of my triggers is a variable gain PIR that self calibrates it's sensitivity, another is an RF transmitter that fires a zooming still camera with panning function.

Another reason for micro control is power management. If you plan on battery driven devices, you want to total control over your consumption.

The best reason though is the infinintely variable logic you can place between your triggers and camera. Be it timers, trigger sequencing, handling nuisance triggering, sensitivity, etc, etc.
I was leaning that direction, and micro controllers are something I've been wanting to learn.
Can you recommend a good beginner/suitable controller for the task?
Should we move this topic to the micro-controller section, or do you think I should seek out the game-cam community?
Thanks 'Info'
 

GetDeviceInfo

Joined Jun 7, 2009
2,196
I would certainly suggest you research the online resources. Not sure what specific camera you will be using, but I'd look at the hack resources for that model as well.

I use a range of Atmel 8051 core devices. There are many tools freely available with tons of coding examples, tutorials, hardware docs, etc. The PIC is popular with many here on the forum.

I tend to be a bit secretive as some of my devices are seeing commercial use, and don't have the time for tutorial, but would certainly share some of my experiences.
 

Thread Starter

joshzstuff

Joined Sep 22, 2010
30
I would certainly suggest you research the online resources. Not sure what specific camera you will be using, but I'd look at the hack resources for that model as well.

I use a range of Atmel 8051 core devices. There are many tools freely available with tons of coding examples, tutorials, hardware docs, etc. The PIC is popular with many here on the forum.

I tend to be a bit secretive as some of my devices are seeing commercial use, and don't have the time for tutorial, but would certainly share some of my experiences.
Thanks Info,

no need to divulge any production secrets ;)
I think the PicAXE line would serve my purposes for this relatively simple project. As you suggest I think there is pretty good support for that platform here, but should this thread be moved to the "microcontroller" forum?

thanks
 

Thread Starter

joshzstuff

Joined Sep 22, 2010
30
Well, I've started my development with the PicAXE 08M, but I may have run into a bit of a snag with that chip for the program I need . . .

I am trying to program the "re-trigger" portion of my circuit.
(This appears to be something simpler in discreet hardware than on the 'basic' micros.)
I was hoping to pull this off with a PicAXE 08M however I don't think it supports parallel processing.
I have a PicAXE 18M2 coming, and the 'M2' versions are supposed to support parallel processes.

I think I know just what to do if I can use a separate (parallel) sub-command . . . However, I would much prefer to use the smaller chip.
(I've read that I may be able to use a pwm peripheral, however I don't think I want to go that route either)

So my question is:
Does this re-trigger option for the 'wait' command require the higher chip, or does anyone know a way I can do it with the PicAXE 08M?

Thanks
 

Thread Starter

joshzstuff

Joined Sep 22, 2010
30
but would certainly share some of my experiences.
Thanks,

I don't know if your acquainted with the PicAXE line and basic, but I've made some progress with my 08M MC.

Problem:
I ran into a snag where the chip won't do what the simulator does . . . I'll explain below

Here is the basic program that corresponds to the flow sheet:

Rich (BB code):
symbol StSt = b1      'Start/Stop button
symbol Power = b0    'Power button
symbol sensor = pin3    'PIR sensor 

let dirs = %00000011

main1:
wait 2
goto main

Main:

    if sensor = 0 then goto main
    if sensor = 1 then high Power  'turn Cam ON
    pause 300
    low Power  
    
    pause 2900
    
    high 1                'start Cam
    pause 200
    low 1
    endif 
                        'Changed 'gosub' to 'goto'
    goto startagain            'STACK ERROR- > nested gosubs
    


startagain:  
for w1 = 1 to 800
  pause 10
   if sensor = 1 then startagain 
next w1 
high 1
pause 300
low 1

Standby:
for w2= 1 to 5100
        pause 10
    if sensor = 1 then high 1
    pause 300 
    low 1
    goto startagain endif        'Changed 'gosub' to 'goto'
                          'STACK ERROR- > nested gosubs
'    
    next w2
    
    pause 3000
    
    goto main
The new program adds some features from the old:
- It starts the cam at first run "cam priming"
- has safety 'resets' encase the cam and the picAxe & cam timing goes out of sync (sometimes temperature affects this) "heartbeat" "safety"
- I included the principal of Technical's code with an inc that determines if the PIR is tripped by a 'nuisance' signal "nuisance"
- if the 'nuisance' condition fails the recording goes to a shorter recording first "shortRec"


I tried to label the significant parts of code, sorry if it's more complex than it needs to be (but I'm open for any criticism)

(Sorry for the lengthy code, the relevant section is "CloseRec")

Rich (BB code):
symbol Power = b0        'Power button
symbol StSt = b1      'Start/Stop button
symbol Time = b2
symbol detect = b3
symbol ready = b4
symbol retrigger = b5
symbol heartbeat = b6
symbol Ncount =b7

symbol sensor = pin3    'PIR sensor 

let dirs = %00000011

                            ;goto start     ;@sim@

main1:
wait 2                'Program delay

high 1                'diagnostic sequence
pause 200
low 1
pause 300
high 1
pause 600
low 1
wait 4

high Power                'Cam priming sequence
pause 300
low Power

pause 4500

high 1
pause 300
low 1

wait 4

high Power
pause 2000
low Power

wait 3


goto main

Main:

    high 1            'safety reset
    pause 200
    low 1

for heartbeat= 1 to 5600                    
    pause 10
    
    if sensor = 1 then goto Start
    
next heartbeat 
    
    high 1            'safety reset2 (heartbeat)
    pause 200
    low 1
    goto main


Start:
    
    high Power            'power cam
    pause 200
    low power    
    
        let Ncount = 0
        let detect = 0        
for Time = 1 to 10        'nuisance prevention
    pause 350
    if sensor = 1 then inc detect endif

    if detect > 4 then inc Ncount endif 'sensitivity setting
next Time
    
    ;pause 3500
    
    if Ncount > 0 then high 1    'nuisance pass
        pause 300
        low 1
        goto startagain endif
    

goto ShortVid                'nuisance fail

ShortVid:

high 1
pause 300
low 1

for retrigger = 1 to 400                        '@sim@
          pause 10
          
       if sensor = 1 then startagain 
next retrigger 
goto CloseRec    
    
CamStart:                'start Cam
    high 1            
    pause 200
    low 1


startagain:  
for retrigger = 1 to 800                        '@sim@
          pause 10
       if sensor = 1 then startagain 
next retrigger 

CloseRec:                'close recording
high 1            
pause 300
low 1

    pause 2550            'restart buffer
    

Standby:
for ready = 1 to 5100                             '@sim@
        pause 10
    if sensor = 1 then high 1
        pause 300 
        low 1
    
        goto startagain endif    'Changed 'gosub' to 'goto'
                         'STACK ERROR- > nested gosubs
'    
next ready
    
    pause 3000            'restart program buffer
                                ;goto start     ;@sim@
    goto main
The problem lies in the "CloseRec:" (or before it)
It works perfectly in the simulator, but it won't work on the chip

The camera will start, but it will never close again.

The only reason I could see there being a difference from the simulation was if I timed the pulses to short, but I don't think I've done that.

feel free to critique the code, I'm sure a stepped all over convention when programing it
 
Top