Spy Lantern Surveillance Camera

  • 31 Replies
  • 7003 Views
Spy Lantern Surveillance Camera
« on: 07 / August / 2016, 23:03:01 »
Advertisements
link > Spy Lantern Surveillance Camera

link > CHDK Forum Link

Script attached here.  Props to @msl for noticing this and @timgor for posting his script.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline timgor

  • ***
  • 150
Re: Spy Lantern Surveillance Camera
« Reply #1 on: 22 / August / 2016, 17:13:51 »
Thanks for the new thread about my project. As I promised I will tell more about my functions and how it works.
First of all my application switches automatically between daytime (P mode) and nighttime (low light mode) using "click" keys.
The camera worked good in a daytime but I had a problems in a dark conditions because camera could not do auto-focussing with shot() function. 9 of 10 pictures were not in focus.
In this way I considered to take a focus scan  (using check_focus_scan() function)  In a daytime. I just change zoom and take focus measurement by get_focus() take_focus() functions and I write those data to the zoom_file file and store it.
In a dark conditions I just use manual focusing set_focus() and night pictures are always in focus.

*

Offline timgor

  • ***
  • 150
Re: Spy Lantern Surveillance Camera
« Reply #2 on: 22 / August / 2016, 17:24:11 »
About motion detector function:
The pure motion detector function has a lot of false triggering.
This happens by two reasons:
1. The camera always trying to focus and as a result it triggers motion detector.
set_aflock(1) can fix it. After the motion is triggered set_aflock(0) is applied.
2. The camera always measures the brightness and it also triggers motion detector without real motion.
Centre-weighted Average brightness measurement in firmware setting fix this problem.

*

Offline timgor

  • ***
  • 150
Re: Spy Lantern Surveillance Camera
« Reply #3 on: 22 / August / 2016, 17:35:34 »
About deleteOlderFiles() function.
It deletes older files when memory card is full.
The difference of my function is that I don't delete it after every shot in order so save some time. I delete older files when memory get critical minimum value and delete bunch of file until maximum free space. In this case i have two parameters min_size_Mb and max_size_Mb.

When it's time to delete I delete files by IMG_%04d.JPG and IMG_%04d.MOV name.
Firmware camera has limitation when folder name is "999_****"
Camera stops and complains that memory is full but it's not really true. At this point I rename folders to beginning "000_****" and restart camera and camera can work another 2.5 years until folder gets "999_****. 


*

Offline timgor

  • ***
  • 150
Re: Spy Lantern Surveillance Camera
« Reply #4 on: 22 / August / 2016, 17:43:08 »
About video recording:

The press("video") must be pressed for a long time in order to start video with guarantee. click("video") may work for 999 time but it fails every 1000 time.

The real 100% function to start video is:

        press("video") 
        sleep(1000) 
        release("video")
        sleep(1000)

And still in this case I check video by get_movie_status() == 1 and try to start this function again.
The same problem happens when attempting to stop video.
If video would not stop then it will make infinite recording until memory card is full and it's very bad case.

That's why video_cont(nsec) function is very complicated.

*

Offline timgor

  • ***
  • 150
Re: Spy Lantern Surveillance Camera
« Reply #5 on: 22 / August / 2016, 17:44:46 »
I restart camera every 20 days and clean memory with collectgarbage("collect") even more frequently.

*

Offline reyalp

  • ******
  • 11436
Re: Spy Lantern Surveillance Camera
« Reply #6 on: 22 / August / 2016, 22:03:48 »
nice project, and thanks for the details :)

About video recording:

The press("video") must be pressed for a long time in order to start video with guarantee. click("video") may work for 999 time but it fails every 1000 time.
If you haven't already, you could try something like
press('video')
repeat sleep(10) until get_movie_status() == 1
release('video')

It's also possible that using levents would be more reliable, like
post_levent_to_ui('PressMovieButton')
post_levent_to_ui('UnpressMovieButton')
Don't forget what the H stands for.

*

Offline timgor

  • ***
  • 150
Re: Spy Lantern Surveillance Camera
« Reply #7 on: 23 / August / 2016, 10:05:25 »
Thanks, I will pay attention and continue to improve my script.
basically I have 3 main problems that i want to resolve.

1. The temperature problems. The camera elph 115 seems to work good even at 100F outside but it's not clear why it happens - due to external fan or due to small ccd temperature. I know that regular surveillance cameras use embedded fan and heater but I don't understand how fan can cool dowh camera temperature and particularly within the closed case.
2. When camera is taking video and power is suddenly disconnected - the video file will be lost and memory card can have some error. It's not bad but it would be nice to avoid this possibility.
May be It's possible to avoid this case by using large capacitor with power supply. If power supply is disconnected capacitor will continue to supply power and voltage will drop exponentially but not immediately. In this case I think it's possible to measure the voltage during the video and if it drops by 10% may be it's possible to finish video in a nice way using capacitor energy for a second.
3. I noticed that cheap memory cards do not work well. The cheap memory card can work good for a few months but sometimes it hangs up with "memory card error" . I didn't have this problem with expensive and fast memory cards yet  :-X . Still it would be nice to avoid this case with the help of program but I don't know how. I would appreciate if somebody have Idea how to reset camera automatically from the "memory card error" state.


Re: Spy Lantern Surveillance Camera
« Reply #8 on: 23 / August / 2016, 19:13:34 »
I know that regular surveillance cameras use embedded fan and heater but I don't understand how fan can cool down camera temperature and particularly within the closed case.
From your description,  I believe the function of the fan is to avoid local hot spots by moving the air around and evenly distributing the heat to the walls of the closed case.  This would help prevent temperature gradients inside the case that will occur if the internal air is not moving.

Quote
May be It's possible to avoid this case by using large capacitor with power supply. If power supply is disconnected capacitor will continue to supply power and voltage will drop exponentially but not immediately.
I think that would have to be a very large capacitor!  You might be better off with a couple of rechargeable AA cells wired to trickle charge while power is applied and to supply power when the line voltage drops.

Quote
I noticed that cheap memory cards do not work well. The cheap memory card can work good for a few months but sometimes it hangs up with "memory card error" . I didn't have this problem with expensive and fast memory cards yet  :-X . Still it would be nice to avoid this case with the help of program but I don't know how. I would appreciate if somebody have Idea how to reset camera automatically from the "memory card error" state.
Does it clear the error when you power cycle the camera? If so, you'd have to discover a propcase or other variable that holds an error number.  But figuring that out will likely be a lot of disassembly work.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 11436
Re: Spy Lantern Surveillance Camera
« Reply #9 on: 24 / August / 2016, 02:35:36 »
I know that regular surveillance cameras use embedded fan and heater but I don't understand how fan can cool dowh camera temperature and particularly within the closed case.
I agree with waterwingz, just circulating air probably has a small benefit since it prevents heat from building up around the camera. For better cooling perhaps you could circulate inside air over a heatsink that is exposed to the outside, preferably in the shade. Or allow circulation of outside air, but that might other problems.

Quote
In this case I think it's possible to measure the voltage during the video and if it drops by 10% may be it's possible to finish video in a nice way using capacitor energy for a second.
In fact, the camera should stop recording shutdown gracefully if the voltage sags below the normal canon low battery level, provided it doesn't fall too fast.

Quote
3. I noticed that cheap memory cards do not work well. The cheap memory card can work good for a few months but sometimes it hangs up with "memory card error" . I didn't have this problem with expensive and fast memory cards yet  :-X .
It could possibly be suffering form this https://chdk.setepontos.com/index.php?topic=12795.0

If you have cards that repeatably trigger the problem, we might be able to test. If it only happens once every few months it would be pretty hard though.

Quote
Still it would be nice to avoid this case with the help of program but I don't know how. I would appreciate if somebody have Idea how to reset camera automatically from the "memory card error" state.
If CHDK loads, but then get memory card error, modules will not load. The good news is this is easy to detect. The bad news is that script is in a module, so triggering reboot in this case would have to be done in the core CHDK code rather than script, and it can't be a cfg option either.
Don't forget what the H stands for.

 

Related Topics