CharlyDelta
Posts: 116
Joined: Thu Jul 18, 2013 4:04 am
Location: Montreal

Re: RPi Cam Web Interface ... button to control a motor

Fri Jun 14, 2019 6:00 pm

CharlyDelta wrote:
Tue Jun 11, 2019 2:28 am
Hello...


I know how to add buttons and edit the userbuttons file. Now, by clicking on a button, I would like to operate a DC motor with an L293.

Don't mind about wiring. How do I configure those buttons to do this? A path to a solution would help me a lot.




Image

Found that on RPI CAM WEB page:
This is controlled by a userbuttons file in the main web install folder (e.g. /var/www/html). If the file does not exist then the page displays without any extra buttons. If the file does exist then it can contain the definitions for up to 6 user buttons,

The file is just a text file and contains definition lines which are just

buttonName,macroname.sh
When a button is pressed then the corresponding macro is executed.

Does that mean that you can't execute a Python file by clicking a button?

Tnx for any informations.

CharlyDelta
Posts: 116
Joined: Thu Jul 18, 2013 4:04 am
Location: Montreal

Re: RPi Cam Web Interface ... button to control a motor

Fri Jun 14, 2019 6:28 pm

CharlyDelta wrote:
Tue Jun 11, 2019 2:28 am
Hello...


I know how to add buttons and edit the userbuttons file. Now, by clicking on a button, I would like to operate a DC motor with an L293.

Don't mind about wiring. How do I configure those buttons to do this? A path to a solution would help me a lot.




Image

Partially resolved

created in macro an open.sh file,

#!/bin/sh
python open.py

but it doesn't start, a permission problem.

ras07
Posts: 32
Joined: Tue May 22, 2018 4:04 am

Re: RPi Cam Web Interface ... button to control a motor

Fri Jun 14, 2019 7:18 pm

CharlyDelta wrote:
Fri Jun 14, 2019 6:28 pm
CharlyDelta wrote:
Tue Jun 11, 2019 2:28 am
Hello...


I know how to add buttons and edit the userbuttons file. Now, by clicking on a button, I would like to operate a DC motor with an L293.

Don't mind about wiring. How do I configure those buttons to do this? A path to a solution would help me a lot.


Partially resolved

created in macro an open.sh file,

#!/bin/sh
python open.py

but it doesn't start, a permission problem.
Scripts run as the www-data user. If you switch to that user by executing

Code: Select all

sudo su www-data
and run your scripts from there, you should be able to diagnose permission problems. If your scripts successfully execute from that user, they should work in the UI when you press that button.

CharlyDelta
Posts: 116
Joined: Thu Jul 18, 2013 4:04 am
Location: Montreal

Re: RPi Cam Web Interface

Sat Jun 15, 2019 2:54 pm

Ok... now I can get motor working good,

Now I want to get temperature and humidity (from DHT22) printed in the camera page web beside the date and the hour.

How can I do this ??

Thank you for your help.

zoktar
Posts: 1
Joined: Mon Jan 07, 2013 3:33 am

Re: RPi Cam Web Interface

Sat Jun 15, 2019 2:57 pm

tk1 wrote:
Mon Mar 11, 2019 12:24 am
For the last few weeks (in my spare time), I've been trying to figure out how to get a video file from the time-lapse images. I finally figured it out (for me, the option to do it from within the otherwise excellent picam software wouldn't work).

Anyone wanting to convert the time-lapse images to an mp4, try this:

Remote to your Pi (either SSH or VNC and open a terminal), then enter this command:

Code: Select all

/usr/bin/ffmpeg -f image2 -framerate 10 -i "/var/www/html/media/tl_0000_%04d*.jpg" -r 30 -pix_fmt yuv444p -vcodec mpeg4 Documents/timelapse.mp4
Where:
-f = force format, 'image2'
-framerate = input frame rate (per second)
-i = input file(s)
%04d = 4 decimal characters (e.g. 0001) NOTE: input file must be in double quotes
-r = output frame rate (per second)
-pix_fmt = output format
-vcodec = output codec

This will create a file, timelapse.mp4, in your Documents folder.

Hope this helps and saves people the time/effort it took me to work this out.

-tk1


[email protected]:~ $ /usr/bin/ffmpeg -f image2 -framerate 10 -i "/var/www/html/media/tl_0000_%04d*.jpg" -r 30 -pix_fmt yuv444p -vcodec mpeg4 file.mp4
ffmpeg version 3.2.14-1~deb9u1+rpt1 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1+deb9u1) 20170516
configuration: --prefix=/usr --extra-version='1~deb9u1+rpt1' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-omx-rpi --enable-mmal --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --arch=armhf --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 34.101 / 55. 34.101
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.101 / 57. 56.101
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libavresample 3. 1. 0 / 3. 1. 0
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100
[image2 @ 0x1c83620] Could find no file with path '/var/www/html/media/tl_0000_%04d*.jpg' and index in the range 0-4
/var/www/html/media/tl_0000_%04d*.jpg: No such file or directory


cant figure out the input error

ras07
Posts: 32
Joined: Tue May 22, 2018 4:04 am

Re: RPi Cam Web Interface

Sun Jun 16, 2019 1:28 am

CharlyDelta wrote:
Sat Jun 15, 2019 2:54 pm
Now I want to get temperature and humidity (from DHT22) printed in the camera page web beside the date and the hour.

How can I do this ??
Easiest way to do this is to periodically write out the temperature and humidity to /dev/shm/mjpeg/user_annotate.txt, and then use the %a parameter in the annotation field to add the contents of this file to the annotation.

CharlyDelta
Posts: 116
Joined: Thu Jul 18, 2013 4:04 am
Location: Montreal

Re: RPi Cam Web Interface

Mon Jun 17, 2019 12:21 pm

ras07 wrote:
CharlyDelta wrote:
Sat Jun 15, 2019 2:54 pm
Now I want to get temperature and humidity (from DHT22) printed in the camera page web beside the date and the hour.

How can I do this ??
Easiest way to do this is to periodically write out the temperature and humidity to /dev/shm/mjpeg/user_annotate.txt, and then use the %a parameter in the annotation field to add the contents of this file to the annotation.
Thank you ras07... success !!

jenjimah
Posts: 1
Joined: Thu Jun 20, 2019 7:19 pm

Re: RPi Cam Web Interface

Thu Jun 20, 2019 7:42 pm

I have a question about using the RPi Cam Web Interface for data collection purposes (specifically for making a spectrometer or conducting NDVI calculations pixel-by-pixel), where it's important to have non-lossy data format and manual camera control.

Three main features interest me that I wasn't able to access with the web interface:
- ability to capture in .png format
- ability to capture in YUV or raw RGB format (this would be even better than .png)
- ability to do longer exposures (up to the 6s or 10s max exposure time for pi cameras V1 and V2, respectively)

I wanted to check if it was an easy tweak to get these options before deciding if I had to take an alternative route altogether.
Regarding exposure time, I was able to set it higher than the specified limit of "330000" using the shutter speed option, (e.g. pictures with "600000" shutter speed were brighter than "330000", and the EXIF data confirms the exposure was "0.6 s", but I wasn't able to get exposure to be over 1s long.

ras07
Posts: 32
Joined: Tue May 22, 2018 4:04 am

Re: RPi Cam Web Interface

Fri Jun 21, 2019 3:09 am

jenjimah wrote:
Thu Jun 20, 2019 7:42 pm
I have a question about using the RPi Cam Web Interface for data collection purposes (specifically for making a spectrometer or conducting NDVI calculations pixel-by-pixel), where it's important to have non-lossy data format and manual camera control.
Sounds like a cool project! But I don't think this is the right software for that application. The MJPEG format is inherently lossy, and RPi-CWI doesn't directly deal with the low-level camera control (it hands off to the raspimjpeg package for that). To badly oversimplify, you can think of raspimjpeg as just taking JPG images as fast as it can; then RPi-CWI can turn that into video, time-lapse, or whatever. But lossless formats and manual control aren't among its design points. Unless you can refactor your solution around those constraints (perhaps there's something to be gained from rapid image capture, even if fidelity suffers), I think you may need to look elsewhere.

I'm sure there is applicable software out there, but I'm not familiar with it - perhaps others will chime in. I'd be interested in hearing about the solution you settle on; I hope you'll report back. Good luck!

itsmedoofer
Posts: 312
Joined: Wed Sep 25, 2013 8:43 am

Re: RPi Cam Web Interface

Tue Jun 25, 2019 7:24 pm

HI,

Just a heads up the installer does not work with the new "Buster" images, missing packages..

Edit:-

It should be fairly easy to update the dependencies php7.0 needs to be replaced with php7.3 and libav-tools with ffmpeg.

However I'm not sure how much of an impact the switch to ffmpeg will make, will "avconv" have to be replaced with "ffmpeg", when it went the other way the syntax stayed the same so we could be lucky and just have to a find-replace...

I

Return to “Camera board”