Participating in this forum is undoubtedly an enriching experience.
I have had access to knowledge on aspects previously unknown to me.
@dgalland has suggested to me to use the pigpio library on the server. The use of this library supposes a more regular and stable control of the motor and a higher speed.
@dgalland also pointed out to me the possibility of using a function that calculates a numerical index of focus quality. In the preview images now appears such an index that gives us objective data on the focus of the captured images.
@cpixip has suggested a function for the normalization of the HDR images obtained using the Mertens algorithm, which produces final images with better contrast.
I have incorporated these contributions with notable success into this new version of the software. Thank you both for your contributions.
For my part, I had observed that during long scanning sessions, exceptions of the type PiCameraRuntimeError (‘Timed out waiting for capture to end’) were thrown.
These exceptions meant the interruption of the work and the restart of the software.
I have not been able to determine the exact cause of the problem, so I have decided to catch the exceptions in the server software, so that it recovers automatically and continues with the work as if nothing had happened.
I have to tell potential interested parties to read the new instructions carefully. Especially the setup of the server has changed a lot.
Greetings to all members of the forum.
Instructions.pdf (45.4 KB)
DSuper8-Client.zip (791.0 KB)
DSuper8-Server.zip (15.2 KB)
DSuper8-conf-pigpiod.zip (999 Bytes)
DSuper8 Wiring Diagram.pdf (45.5 KB)
@Manuel_Angel I haven’t used your software yet, but would like to thank you for sharing the information. Hope that when the time comes, it would help me as reference for Mertens and for the RPi Camera. Great work, and I appreciate you sharing it in the forum.
@Manuel_Angel thanks a lot for sharing your development. Appreciate. I’ve installed the new software… success. Just a warning to whom want to do a fresh install. The latest Raspi OS proposed is based on Debian11 , called “Bullseye” ,many libraries are not updated yet.Better stay with the previous OS “Buster”.
@PM490, thanks for your kind words. Of course you can count on everything that is within my reach to carry out your project.
Thanks @sciallino, I do not know much about the matter, but from what I understand, with the new version of Raspberry Pi OS there have been important changes in the software related to the camera and the old PiCamera library does not work, so that, at the moment, the ones we use PiCamera must remain in the Buster version of the operating system.
Howdy, thank you for the update!
Am having a problem with running the daemon. It is in the correct location /lib/systemd/system.
pi@raspberrypi:/ $ systemctl start pigpiod
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start ‘pigpiod.service’.
Multiple identities can be used for authentication:
- , (pi)
Choose identity to authenticate as (1-2): 2
polkit-agent-helper-1: pam_authenticate failed: Authentication failure
==== AUTHENTICATION FAILED ===
Failed to start pigpiod.service: Access denied
See system logs and ‘systemctl status pigpiod.service’ for details.
Upon reviewing the pigpiod log details I get the following
Dec 03 16:18:53 raspberrypi systemd: Starting Daemon required to control GPIO
Dec 03 16:18:53 raspberrypi pigpiod: 2021-12-03 16:18:53 initInitialise: C
Dec 03 16:18:53 raspberrypi pigpiod: Can’t initialise pigpio library
Dec 03 16:18:53 raspberrypi systemd: Started Daemon required to control GPIO
Dec 03 16:18:53 raspberrypi systemd: pigpiod.service: Main process exited, co
Dec 03 16:18:53 raspberrypi systemd: pigpiod.service: Failed with result 'exi
ALSO, I just happend to select (when prompted) identity 1 instead of 2 (root) and did get further along. I had gotten to the third Daemon status command and then received this error
pi@raspberrypi:/ $ systemctl status pigpiod
● pigpiod.service - Daemon required to control GPIO pins via pigpio
Loaded: loaded (/lib/systemd/system/pigpiod.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2021-12-03 16:42:01 EST; 1min 52s ago
Process: 2965 ExecStart=/usr/bin/pigpiod -l -n 127.0.0.1 -p 8889 (code=exited, status=0/SUCCESS)
Main PID: 2966 (code=exited, status=1/FAILURE)
Dec 03 16:42:01 raspberrypi systemd: Starting Daemon required to control GPIO pins via pigpio…
Dec 03 16:42:01 raspberrypi pigpiod: 2021-12-03 16:42:01 initInitialise: Can’t lock /var/run/pigpio.pid
Dec 03 16:42:01 raspberrypi pigpiod: Can’t initialise pigpio library
Dec 03 16:42:01 raspberrypi systemd: Started Daemon required to control GPIO pins via pigpio.
Dec 03 16:42:01 raspberrypi systemd: pigpiod.service: Main process exited, code=exited, status=1/FAILURE
Dec 03 16:42:01 raspberrypi systemd: pigpiod.service: Failed with result ‘exit-code’.
Any advice would be much appreciated!
To start and stop the daemon, give the commands in root mode:
sudo systemctl start pigipiod
It is advisable to enable autostart at each server startup:
sudo systemctl enable pigipiod
Okay, I think I’m a bit clueless and in over my head. When you say give commands in root mode that has nothing to do with being in the root directory, right? Adding SUDO to the beginning of a command is what you mean by giving commands in root mode, am I correct in assuming this? I tried to look all this up on Google but didn’t see anything that clarified any better.
Anyways, I did the command as you mentioned above. And the following occurred:
pi@raspberrypi:~/Public/DS8server $ sudo systemctl enable pigpiod
pi@raspberrypi:~/Public/DS8server $ python3 DS8Server.py
Can’t connect to pigpio at localhost(8889)
Did you start the pigpio daemon? E.g. sudo pigpiod
Did you specify the correct Pi host/port in the environment
E.g. export PIGPIO_ADDR=soft, export PIGPIO_PORT=8888
Did you specify the correct Pi host/port in the
pigpio.pi() function? E.g. pigpio.pi(‘soft’, 8888)
Traceback (most recent call last):
File “DS8Server.py”, line 39, in
from controlProcess import DS8Control, MotorDriver
File “/home/pi/Public/DS8server/controlProcess.py”, line 52, in
File “/usr/lib/python3/dist-packages/pigpio.py”, line 1344, in set_mode
return _u2i(_pigpio_command(self.sl, _PI_CMD_MODES, gpio, mode))
File “/usr/lib/python3/dist-packages/pigpio.py”, line 993, in _pigpio_command
sl.s.send(struct.pack(‘IIII’, cmd, p1, p2, 0))
AttributeError: ‘NoneType’ object has no attribute ‘send’
One other thing, I actually had to use SUDO with a move command just to get the pigpiod.service in the appropriate directory otherwise I would get a permission failure. Anyways, I’ve noticed that all the other services in the lib/systemd/system folder have an owner/group of root/root, however the pigpiod.service that I moved into this folder is pi/pi. Does any of this matter?
I am sorry I did not express myself clearly.
On Linux machines “root” is usually the generic name of the system administrator.
When I say run commands in root mode, I am referring to running commands with administrator privileges.
One way to do this is with the sudo command, which once configured allows the user who uses it to escalate administrator privileges.
When you have run the sudo systemctl enable pigipiod command, you have actually enabled automatic startup at system boot, but at that moment the daemon is not running and for this reason it has given the error.
To start the daemon immediately: sudo systemctl start pigipiod
To check the status of the daemon (you don’t have to do it as an administrator): systemctl status pigipiod
In order not to overload the thread, from now on we can communicate by private messages.