CHDK Forum

Using CHDK => Script Writing => LUA Scripting => Topic started by: c_joerg on 22 / December / 2019, 11:12:29

Title: Interval Script with power down (M3 / M10)
Post by: c_joerg on 22 / December / 2019, 11:12:29
I try to write an interval script with power down for my M3 following Reply #475.
https://chdk.setepontos.com/index.php?topic=12542.msg137151#msg137151

How should the script look like?
I have now written a script that only takes one picture and then executes a power_down_for_seconds (). I then enabled autostart for the script. That also works so far.
But how can I disable the autostart now? If I remove the battery, the script will start again immediately. I have now replaced the file CCHDK4.CFG. Is there any other way?

How can I get information from the previous recording now? About a file?

What happens to the script parameters if I change them? Are the current ones then used?

Update:
  Add Script Version 0.5

  Version 0.6
     - Add M100
     - Restart in record mode

  Version 0.7
     - Add stop on low  battery

  Version 0.8
     - Add M3 121a
Title: Re: Interval Script with power down (M3 / M10)
Post by: srsa_4c on 22 / December / 2019, 12:24:19
I guess the script has to be coded to handle the various circumstances.
You can enable/disable autorun via set_config_value (https://chdk.fandom.com/wiki/Script_commands#set_config_value). You could also store the script state in an ini file - there's a library for that in CHDK/lualib.
Title: Re: Interval Script with power down (M3 / M10)
Post by: c_joerg on 23 / December / 2019, 07:18:44
You can enable/disable autorun via set_config_value (https://chdk.fandom.com/wiki/Script_commands#set_config_value).
 

Thank you very much. That was a good tip. Can I use any reference for the ID 120?
Code: [Select]
set_config_value(120,0)
If I activate Autostart for the script in the CHDK Menu, this value is deactivated after a restart. So that it remains activated permanently, I first have to switch on Autostart and then leave the ALT mode. Only then will the parameter be saved. Is there any other way to save this parameter permanently?
I notice this Problem also, when the camera crashes.

You could also store the script state in an ini file - there's a library for that in CHDK/lualib.

That would be the next step.
I disabled the automatic senor cleaning at start up. First version of the script attached.
 
Title: Re: Interval Script with power down (M3 / M10)
Post by: c_joerg on 25 / December / 2019, 08:01:37
My first Version of an Interval script with power down options for EOS M3 and M10

Operation:
The script checks whether an ini file is available (A / CHDK / DATA / PowDownInt.ini)
If there is no INI file, then
- If an INI file with default values is created
- Autostart for scripts is switched on
If an INI file is available, the information it contains is read.

The INI file contains the number of recordings already made and a time stamp for the next shoot. The Power Down Options is designed so that the script has to wait approx. 2-3s before the next shoot.

After the picture has been taken, the power down function is called. The power down time is the interval time minus 10sec. Switching the camera on and off takes about 8 seconds. The rest of the time is a reserve for synchronization.

The script terminates when the number of shoots has been reached, the menu button has been pressed or the storage capacity of the SD card is too small.

If the termination is successful
- deleted the INI file
- Autostart for scripts switched off

If the termination occurs in another way (e.g. removal of the battery), the INI file must be deleted manually.

A LOG file is also created (A / CHDK / DATA / PowDownInt.csv).

This script only makes sense for long interval times. The automatic sensor cleaning and IS should be switched off.

Update:
  Script can be found in first post
Title: Re: Interval Script with power down (M3 / M10)
Post by: c_joerg on 09 / November / 2020, 04:29:47
I have now done the first long test with my M3.Two weeks with an interval of 5 minutes. Around 4000 pictures were taken during this time.

I checked ‚GetCameraInformationData‘ and the Power On Counter increase by 4000.
https://chdk.setepontos.com/index.php?topic=12542.300

The switch-off time jitters. At 5 minutes, that's about 5 seconds. But that is not important for recordings of this kind.

I expanded the script in the first post. You can activate time synchronization if you want. You can also switch an LED for external synchronization.

The video shows the first test as a 25 minute and a 5 minute interval.

@Mlapse
As you can see on the log file, the tick counter is reset ever restart.


Title: Re: Interval Script with power down (M3 / M10)
Post by: Mlapse on 09 / November / 2020, 06:13:50
As you can see on the log file, the tick counter is reset ever restart.

thanks c_joerg
if I understand the log and what you are writing, the tick counter is reset every 5 minutes. very impressive.
downtime is a lot shorter than with the regular reboot, that takes 20 seconds or more if you have a large sd card.

so it seems it is time for me to find another digic6 cam to try this properly with my setup.
i'm not sure yet if a G or M series is best suited for my purpose, so it might take some time to figure that out.
Title: Re: Interval Script with power down (M3 / M10)
Post by: c_joerg on 09 / November / 2020, 06:26:22
i'm not sure yet if a G or M series is best suited for my purpose, so it might take some time to figure that out.

Not sure if a G support the power down function.
Right now, the script works only for EOS M3 and M10.
I think, it will also work with M100...

Title: Re: Interval Script with power down (M3 / M10)
Post by: Mlapse on 09 / November / 2020, 06:41:09
Not sure if a G support the power down function.

i am a bit worried about the life expectancy of the M series.
but this at least narrows down my choices :)
So i'll go looking for another M cam
Title: Re: Interval Script with power down (M3 / M10)
Post by: c_joerg on 09 / November / 2020, 07:20:11
i am a bit worried about the life expectancy of the M series.

Not me…
There is no better value for money. I have already seen an M10 + EF-EFM adapter for well under 100 €. An adapted EF lens can then continue to be used.
Title: Re: Interval Script with power down (M3 / M10)
Post by: Mlapse on 09 / November / 2020, 08:51:26
i do agree that the M series is better value for money, bigger sensor, more lens options, less old technology.
looking at used ones, a second hand 2 year old hardly used M10 is offered for slightly less than an 8 year old scratched and abused G1x.

however, i'm more concerned about the wear and life expectancy of the shutter/curtain.

when my m10 was still working i could feel that shutter on the cam with every shot, i do not feel that on the s or a series cams....
maybe the a series don't even have a mechanical shutter, but the s does.
I assumed this slam-shake was because the shutter is bigger, thus has more mass and might move quicker to open or close.
banging in the side with every shot.
and that gave me the idea it might not last as long as something with a smaller sensor and thus lighter shutter.

the G would therefore be something in the middle, bigger than the 1/1.7 of the S, but a lot smaller than the aps-c of the M.
I do agree this is all speculation since i have not tested this, but i do know my s series easaly make it over 100K shots, i have one that made more than 1M shots.

Title: Re: Interval Script with power down (M3 / M10)
Post by: c_joerg on 09 / November / 2020, 09:09:38
maybe the a series don't even have a mechanical shutter, but the s does.
If the camera has a flash, it also has a mechanical shutter.

The S and G series have a mechanical central lock.
The M3 has a mechanical focal plane shutter and the first curtain is electronic.

Title: Re: Interval Script with power down (M3 / M10)
Post by: Mlapse on 09 / November / 2020, 09:20:15
The S and G series have a mechanical central lock.
The M3 has a mechanical focal plane shutter

ok, so those shutters are not designed the same way, I would not know what this difference means in the physical world.
but in my opinion, the fact that i can feel it bang against the end does not bode well from a durability point of view.

however, that won't stop me from trying to see how long it takes :)
Title: Re: Interval Script with power down (M3 / M10)
Post by: philmoz on 09 / November / 2020, 15:20:28
Not sure if a G support the power down function.


When I saw the posts on the M series power down and restart function I thought that would be a great way to fix the non-working 'Restart' function on recent G series cameras.
Unfortunately I have not been able to find the equivalent code on either the G5X or G7X2. It may be there; but it's hiding pretty well from me :)


Phil.

Title: Re: Interval Script with power down (M3 / M10)
Post by: srsa_4c on 09 / November / 2020, 16:55:51
When I saw the posts on the M series power down and restart function I thought that would be a great way to fix the non-working 'Restart' function on recent G series cameras.
Unfortunately I have not been able to find the equivalent code on either the G5X or G7X2.
That feature requires a camera with "subcpu" (a low-power MCU, separate from the DIGIC). To my knowledge, the EOS M series are the only modern cameras with subcpu.
Title: Re: Interval Script with power down (M3 / M10)
Post by: philmoz on 09 / November / 2020, 17:36:21
When I saw the posts on the M series power down and restart function I thought that would be a great way to fix the non-working 'Restart' function on recent G series cameras.
Unfortunately I have not been able to find the equivalent code on either the G5X or G7X2.
That feature requires a camera with "subcpu" (a low-power MCU, separate from the DIGIC). To my knowledge, the EOS M series are the only modern cameras with subcpu.


There are 'SubCPU' related strings in the firmware and some similar functions exist between M & G; but nothing resembling the power down / restart code (that I could find). As you say, most likely the hardware support is not there.



Title: Re: Interval Script with power down (M3 / M10)
Post by: c_joerg on 12 / November / 2020, 13:36:21
Update script in first post
 Version 0.6
     - Add M100
     - Restart in record mode
Title: Re: Interval Script with power down (M3 / M10)
Post by: c_joerg on 31 / December / 2020, 13:08:30
My second attempt with the CHDK script PowDownInt.lua.  The script runs very stable.

Again, with the Canon EOS M3 and the EF-M 15-45mm at 25mm.
Tv = 1 / 30s, F10, ISO100.

The whole thing ran for almost 4 weeks with an interval of 60 minutes. Unfortunately, the peppers stopped growing.

In this case I had a lot of flies. In the first half I tried to reduce this by a median of 3 images. The second half shows the unedited images.

Title: Re: Interval Script with power down (M3 / M10)
Post by: c_joerg on 12 / March / 2021, 14:01:29
I wanted to know how long the script runs with one battery charge on the M3. The battery is approximately 3 years old. The camera runs about a day and takes 1400 pictures (1 minute interval).

After I had recharged the battery, CHDK no longer ran. Something had happened to the SD card. Perhaps the last write access was canceled. After I reformatted the SD everything is fine again.
Title: Re: Interval Script with power down (M3 / M10)
Post by: c_joerg on 20 / March / 2021, 09:16:29
Update Script in first post. Add stop on low  battery.

Another try with the M3 and a 5 minute interval. I have a little fewer shots than a minute. This is probably due to the stop when the battery is low .
Title: Re: Interval Script with power down (M3 / M10)
Post by: c_joerg on 29 / April / 2021, 14:27:21
Update Script in first post with M3 121a.
Title: Re: Interval Script with power down (M3 / M10)
Post by: c_joerg on 13 / February / 2022, 12:06:06
I wanted to try dandelion seeds again like I did in my 2019 attempt.
https://chdk.setepontos.com/index.php?topic=13700.0
This time with the EOS M3 and the EF 100mm f2.8 Macro USM.

Unfortunately the seeds still didn't germinate after 15 days and 5500 shots. I then canceled the whole thing.  :(

Title: Re: Interval Script with power down (M3 / M10)
Post by: c_joerg on 13 / February / 2022, 12:08:18
One more attachment
Title: Re: Interval Script with power down (M3 / M10)
Post by: laasworld on 25 / March / 2022, 12:05:15
Hi! This script (v8) appears to work fine for my M10 running v1.1.1a and the current "trunk" v1.6. I just had to add "111a" as another option to line 101.

Thanks a lot for the script, nicely done! If I'm ever willing to park my one and only camera body, I might try to image my own plantings =D