supplierdeeply

limiting factors of CHDK for extended time-lapse

  • 87 Replies
  • 9272 Views
*

Offline Sdack

  • ***
  • 189
Re: limiting factors of CHDK for extended time-lapse
« Reply #80 on: 08 / November / 2018, 05:05:50 »
Advertisements
Hey @waterwingz,

I know it's been a while but I've been chipping away at my ultra low power IXUS 160 system and I'm at a point where I'm testing the Arduino AND Raspberry Pi solution properly.

You may remember the plan is for the Arduino to power up the camera on a loop (ten second on, 50 seconds off) for 55 mins out of 60.  Then, for the other 5 mins of each hour the Raspberry Pi switches on takes over the camera power relay and uses chdkptp to connect, for file handling and uploads.

During those Arduino powered ten seconds, I use your awesome OneShot.lua, on Autostart, so as soon as the camera is powered up, it invokes the script.. inside of which I've set a 2,000 ms delay, so the camera can scan the USB port and, if the Raspberry Pi is connected, switch into chdkptp mode.

However, now I've got it all wired up, I find the script halts, simply due to the USB cable being connected even with the Raspberry Pi switched off.
Any suggestions?
Thanks in advance
Sdack


*

Offline Sdack

  • ***
  • 189
Re: limiting factors of CHDK for extended time-lapse
« Reply #81 on: 08 / November / 2018, 05:19:45 »
Another, related, niggle.. when powering up the IXUS from the Raspberry Pi, I get a chdkptp error that 'a script is already running'.
So even though the OneShot script halts because it sees a connection at the USB port, the USB port won't allow chdkptp because of the script.
It's a classic "Catch 22".
I hope there's a workaround.
Sdack

Re: limiting factors of CHDK for extended time-lapse
« Reply #82 on: 08 / November / 2018, 10:18:39 »
However, now I've got it all wired up, I find the script halts, simply due to the USB cable being connected even with the Raspberry Pi switched off.
Any suggestions?
First of all,  I assume you are using the latest version of the script I posted  : One Shot v3 ?

If you disable the display blank option, do you see the message "USB cable detected" on the LCD after your two second startup delay completes?

Please elaborate on what you mean by "the script halts".  Does it seem to stay running but is stuck after the "USB cable detected" message is printed? Or does it terminate (i.e. end) and return the camera to CHDK <ALT> mode?  Or does the camera power off?

What happens if you gently pull the USB cable out of the camera while it is "halted"?   What about if you press any key or the zoom lever?

I'm guessing you are still getting power from the Raspberry Pi's USB port even though the Pi is "off".  So by saying the Pi is off do you mean halted in software?  Or is the power physically disconnected?  What happens if you unplug the USB cable at the Pi end?  What happens if you unplug the Pi's power connection?

Another, related, niggle.. when powering up the IXUS from the Raspberry Pi, I get a chdkptp error that 'a script is already running'.  So even though the OneShot script halts because it sees a connection at the USB port, the USB port won't allow chdkptp because of the script.
What setting are you using for
Code: [Select]
If USB active then [ Ignore Wait Exit ]
I'm guessing you picked Wait but should be using Exit?

Edit : you will probably need to disable the "Shutdown on Exit?" option for this to work. If you don't, the camera will turn off and it won't be available for a PTP connection.  So if this solves the problem,  I'll modify the script so it only (optionally) shuts down after shooting an image - not after a PTP session.  You can invove shutdown after a PTP session via a command from the Pi.
« Last Edit: 08 / November / 2018, 10:30:02 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline Sdack

  • ***
  • 189
Re: limiting factors of CHDK for extended time-lapse
« Reply #83 on: 08 / November / 2018, 14:13:37 »
@waterwingz ,
Thanks for your swift and useful insights to my issue.

I will check carefully through your list of questions and tests this morning and report back my findings.

I seem to be using V2 of one-shot.lua EDIT: I found V3 and will test it now.
Best wishes
Sdack

« Last Edit: 08 / November / 2018, 14:32:55 by Sdack »


*

Offline Sdack

  • ***
  • 189
Re: limiting factors of CHDK for extended time-lapse
« Reply #84 on: 08 / November / 2018, 16:29:02 »
Quote
First of all,  I assume you are using the latest version of the script I posted  : One Shot v3 ?
I am now!
Quote
If you disable the display blank option, do you see the message "USB cable detected" on the LCD after your two second startup delay completes?
Yes I do see that message
Quote
Please elaborate on what you mean by "the script halts".  Does it seem to stay running but is stuck after the "USB cable detected" message is printed?
That's exactly what it does
Quote
What happens if you gently pull the USB cable out of the camera while it is "halted"?   What about if you press any key or the zoom lever?
OK here's for the settings and functionality
SCENARIO ONE
parameter USB ACTIVE set to EXIT, with no cable at the USB port
AND
parameter SHUTDOWN ON EXIT
I get the desired super quick OneShot image and subsequent shutdown as required during the Arduino powerup loop

However, when I add the chdkptp cable with the above settings, the camera rear screen flickers momentarily with a script message saying cable detected and then it appears to shut down.
===========================================
SCENARIO TWO
parameter USB ACTIVE set to WAIT, with no cable at the USB port
AND
parameter SHUTDOWN ON EXIT

I also get the desired Arduino OneShot activation and shutdown

However, when I add the chdkptp cable with the above settings, the script shows the message cable detected and halts, ie sits there still powered up apparently waiting for something.  This is with the Raspberry Pi powered off.
===========================================
I tried your suggestion of gently pulling out the USB cable while it was 'waiting' but the camera screen went black and I couldn't tell if it had shutdown or simply switched off the screen.

I next tried disconnecting the Raspberry Pi's power cord but leaving the USB cable connected and this time the OneShot script didn't halt ie. it worked as if the cable were not connected.  This seems a vital clue
Quote
I'm guessing you are still getting power from the Raspberry Pi's USB port even though the Pi is "off".
 
And I think you're right but it can't be the positive wire because it's disconnected by a relay so Pi is not switched on.. could there be a path to ground through the USB cable AND the power cable? 

I had a problem like this a while back when I tried using a low side, N channel Mosfet instead of a relay.. The Mosfet would turn the camera on once but wouldn't go off again.  Eventually I figured out that pulling the USB cable out shut the camera down.

I'm sure I can add a relay to disconnect the ground wire of the Pi as well as the positive wire, to work around this.

However, I just found another issue.. with the WAIT option enabled as in the second example above, the Pi can connect to the IXUS using chdkptp but after this, any command gets the following result:
Code: [Select]
[email protected]:~# chdkptp/chdkptp.sh
___> connect
connected: Canon IXUS 160, max packet size 512
con> rec
ERROR: a script is already running
con>

Any suggestions?
Thanks in advance
Sdack



Re: limiting factors of CHDK for extended time-lapse
« Reply #85 on: 08 / November / 2018, 20:16:45 »
I'm sure I can add a relay to disconnect the ground wire of the Pi as well as the positive wire, to work around this.
I doubt that will make any difference.  It seems more like the power filtering capacitors on the Pi board are holding up the +5V line at the USB connector after the power is switched off. If you insert a 100 ohm resistor on any of the USB jacks between pin 1 and 4 I'm guessing this strange behavior will go away.  It's possible you will actually need the resistor on the jack connected to the camera but I'm betting any jack will do.

Quote
However, I just found another issue.. with the WAIT option enabled as in the second example above, the Pi can connect to the IXUS using chdkptp but after this, any ....
I answered this in  my previous post :

Another, related, niggle.. when powering up the IXUS from the Raspberry Pi, I get a chdkptp error that 'a script is already running'.  So even though the OneShot script halts because it sees a connection at the USB port, the USB port won't allow chdkptp because of the script.
What setting are you using for
Code: [Select]
If USB active then [ Ignore Wait Exit ]
I'm guessing you picked Wait but should be using Exit?

Edit : you will probably need to disable the "Shutdown on Exit?" option for this to work. If you don't, the camera will turn off and it won't be available for a PTP connection.  So if this solves the problem,  I'll modify the script so it only (optionally) shuts down after shooting an image - not after a PTP session.  You can invove shutdown after a PTP session via a command from the Pi.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline Sdack

  • ***
  • 189
Re: limiting factors of CHDK for extended time-lapse
« Reply #86 on: 12 / November / 2018, 02:52:28 »
Dear @waterwingz,

Sorry for slow reply, it was a hectic busy weekend and Monday.  Back now and determined to figure this out.  Please bear with me..  I've been having an extended senior moment.. confusing the settings for shutdown on Exit with if USB active then XXX
Quote
What setting are you using for
Code: [Select]
If USB active then [ Ignore Wait Exit ]I'm guessing you picked Wait but should be using Exit?
You are absolutely correct in your assumption that I've been using the wrong one.  I've been thinking that Wait , means "allow the chdkptp connection to take over the camera"  But clearly the Pi simply gets, and prints the 'script already running' message.

So, now I find the pi able to power up the camera and connect via chdkptp using the Exit option.

So if you could please modify OneShot, as you suggest, so that it shuts off the camera, only after a non USB connected session, that would be awesome.

As for the persisting power at the USB port, do you have any suggestion how I can deal with that.  Please forgive my damnable ignorance but, when you suggest the following:
Quote
insert a 100 ohm resistor on any of the USB jacks between pin 1 and 4 I'm guessing this strange behavior will go away.  It's possible you will actually need the resistor on the jack connected to the camera but I'm betting any jack will do.
Please could you make it a bit clearer which pins (jacks?) of the USB lead, I need to connect with the resistor?
Thanks again for your patience.
I have such high hopes for this system.  It will draw zero power, other than the RTC clock, overnight and then a mere twelfth of the watts of my normal pi powered rigs.
Best wishes
Sdack

Re: limiting factors of CHDK for extended time-lapse
« Reply #87 on: 12 / November / 2018, 14:21:50 »
So if you could please modify OneShot, as you suggest, so that it shuts off the camera, only after a non USB connected session, that would be awesome.
Done ... try the attachment.  Tested on my S100.

I next tried disconnecting the Raspberry Pi's power cord but leaving the USB cable connected and this time the OneShot script didn't halt ie. it worked as if the cable were not connected.  This seems a vital clue
So, does how are you powering your Pi?  And how does it turn off?  If pulling the power cable makes OneShot work properly, then you are clearly not removing the power completely from the Pi when you say that it is turned off.

Quote
Please could you make it a bit clearer which pins (jacks?) of the USB lead, I need to connect with the resistor?
This may not be necessary, depending on you answer my quesion about how you are powering the Pi.



Ported :   A1200    SD940   G10    Powershot N    G16


 

Related Topics