Extended time lapse with Internet connection and power saving - page 11 - General Help and Assistance on using CHDK stable releases - CHDK Forum supplierdeeply

Extended time lapse with Internet connection and power saving

  • 108 Replies
  • 8913 Views
*

Offline Sdack

  • ***
  • 194
Re: Extended time lapse with Internet connection and power saving
« Reply #100 on: 03 / January / 2018, 21:49:10 »
Advertisements
Hi guys,

While setting up my first mains powered, wirelessly internet-connected rig. I ran into a problem that confused me. 

Attached is a schematic of the set up I tried, wherein I split a cable carrying two amps of 5V DC into two, with one side powering my Raspberry Pi and the other feeding a relay controlled by the GPIO pins of the aforementioned RPi.   At the scheduled time, the  Pi switched the relay on, passing the 5V through to the camera via a buck converter (5V down to 3.7).  However some kind of interference caused the current on the relay to drop (the activation light is very dim) and the camera wouldn't start.


A workable solution to this was achieved using two separate 5V DC cables out of the dual USB wall wart.  However I'm wanting to mount more cameras in external weatherproof cases, at several meters distance from wall sockets and wondering how best to go about it.

  • Run AC 240v to the cases and enclose two AC-DC USB converters to feed the two units
  • Run Cat5 ethernet supplying DC Power over USB (I assume I could tweak a buck converter at the delivery end to the required voltage despite any voltage drop due to cable length)
  • Run AC 240v to the cases and a single AC-DC converter with better wiring split to avoid the interference / crosstalk or whatever it's called that caused the initial problem described above

*

Offline reyalp

  • ******
  • 12078
Re: Extended time lapse with Internet connection and power saving
« Reply #101 on: 03 / January / 2018, 23:01:15 »
Maybe not related to your problem, but 2 amps for both the PI and the camera strikes me as on the low side. The camera alone may want something close to that at peak load.
Don't forget what the H stands for.

*

Offline Sdack

  • ***
  • 194
Re: Extended time lapse with Internet connection and power saving
« Reply #102 on: 04 / January / 2018, 00:09:25 »
Maybe not related to your problem, but 2 amps for both the PI and the camera strikes me as on the low side. The camera alone may want something close to that at peak load.
Thanks Reyalp,
I suspected, in my ignorance, I'd created some kind of interference effect that could easily be solved by splitting the lead in a different manner or by the addition of some kind of transistor or snubber diode or something.

I chose the Pi Zero W because it draws very little ampage:
http://raspi.tv/2017/how-much-power-does-pi-zero-w-use
but I'll see if I can get a wall wart capable of delivering more than 2amps. 

Cheers
Sdack
« Last Edit: 04 / January / 2018, 00:19:58 by Sdack »

*

Offline Sdack

  • ***
  • 194
Re: Extended time lapse with Internet connection and power saving
« Reply #103 on: 06 / March / 2018, 20:38:03 »
Hey guys,

I hope you can spare a moment for me here, I'm scratching my head over my latest rig build using the awesome Multilapse script.

So far I have a  fresh install of Rasbian Stretch Lite, on a Raspberry Pi Zero W, with duplicated copies of both working Multilapse and chdkptp folders from an identical and working machine.

On the new build, when invoking chdkptp.sh manually I can connect with and operate my Ixus 160 camera just fine.  I can also run multilapse from the command line, if I have the camera continually powered on.  However when I run multilapse with the camera powered via a relay connected to the GPIO, multilapse fails to activate the GIPO claiming that it can't find the turnon and turnoff scripts:
multilapse.log output:
Code: [Select]
Reloading config file!
Making sure camera is OFF
sh: 1: /root/turnoff: not found
Waiting 5s...
Turning camera ON
sh: 1: /root/turnon: not found
Waiting 5s for boot...
Connecting
ERROR: no matching devices found

However the relevant scripts - turnon and turnoff are sitting in the /root/ folder where they should be.

I've chmodded to 777 all the directories and the turnon and turnoff scripts but it doesn't help.

If I invoke a script manually

Code: [Select]
python /root/turnon
It operates the GPIO's just fine, so I can't understand the issue

Cheers
Sdack


*

Offline ftm

  • *
  • 43
Re: Extended time lapse with Internet connection and power saving
« Reply #104 on: 06 / March / 2018, 21:59:09 »
Could this be a python path issue? What is the first line of the turnon and turnoff scripts?

*

Offline Sdack

  • ***
  • 194
Re: Extended time lapse with Internet connection and power saving
« Reply #105 on: 06 / March / 2018, 22:21:46 »
Hi,

Thanks for your interest.. here's the full script

Code: [Select]
#!/usr/bin/python

import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT)
GPIO.output(17, 1)

FYI I do have python 2.7 AND 3 installed but I checked the /usr/bin folder and and the simple command "python" is linked to version 2.7 which I think should work.

Cheers
Sdack

*

Offline reyalp

  • ******
  • 12078
Re: Extended time lapse with Internet connection and power saving
« Reply #106 on: 07 / March / 2018, 01:11:42 »
There's nothing special about multilapse, the error almost certainly means there is an incorrect name or permission issue somewhere.

The "sh: 1: " error could mean that either that the shell started started by os.execute couldn't find /root/turnoff, or that when it attempted to run /root/turnoff, it couldn't find /usr/bin/python

You have verified that you can run the files outside of chdkptp, so you could try calling it from chdkptp interactively, like !os.execute('/root/turnoff')
If that doesn't work, maybe !os.execute('ls -l /root/turnoff') will give you a hint. Another thing to try is if you can execute something else, e.g. a shell script or a python script in a different location.

edit:
One thing that can cause this kind of errors is files with DOS style line endings. For example, if turnon was saved in DOS format, then trying to run it would invoke /usr/bin/python with a CR character at the end, which will not be found.

This would be most likely to happen if windows was involved somewhere downloading or copying the files.

You should try executing the scripts directly from the command line without python, using
/root/turnon from a shell prompt.
« Last Edit: 07 / March / 2018, 03:00:30 by reyalp »
Don't forget what the H stands for.

*

Offline Sdack

  • ***
  • 194
Re: Extended time lapse with Internet connection and power saving
« Reply #107 on: 07 / March / 2018, 04:42:10 »
Hi Reyalp,

Thanks for the pointers,  I'll try them tomorrow, I have a sick daughter at the moment so can't get into it straight away.

You gave me several lines of enquiry and I feel sure one of them will turn up trumps.

Sdack
« Last Edit: 07 / March / 2018, 18:50:03 by Sdack »


*

Offline Sdack

  • ***
  • 194
Re: Extended time lapse with Internet connection and power saving
« Reply #108 on: 07 / March / 2018, 20:15:29 »
D'oh!

it was the line endings...

I installed and invoked the command dos2unix on both 'turnon' and 'turnoff' and I'm all good now

Reyalp.. you're a legend!

Thanks

Sdack

 

Related Topics