theyosh / TerrariumPI

Home automated terrarium/aquarium or other enclosed environment with a Raspberry Pi
https://terrarium.theyosh.nl
GNU General Public License v3.0
408 stars 98 forks source link

Help with the Raspberry camera #234

Closed Barbara1984 closed 5 years ago

Barbara1984 commented 5 years ago

I have since the update, the problem that my camera no longer displays, maybe someone can give me a tip?

grafik

grafik

theyosh commented 5 years ago

What does the screen session says: screen -r

I do not know what it could be. As this is new in this version, it could be that I missed a package to the installer.

theyosh commented 5 years ago

Hi,

do you have any updates? Are there errors in either the screen session or logfile?

stuartabrown commented 5 years ago

Hi - I can provide some more information as I have this, or a similar, issue.

I am using a PS3 USB camera connected to my PI. I have set up both web can and tried to set up streaming. Below is the issue as it appears in Chrome screen shot 2019-01-18 at 19 16 32 and the settings screen shot 2019-01-18 at 19 16 43

and here is the error as it shows through Safari (same error code as OP I think) screen shot 2019-01-18 at 19 18 08

In order to try to set up live stream I ran these commands https://github.com/theyosh/TerrariumPI/issues/223#issuecomment-444647717 but found that nothing needed to be installed.

screen -r shows WARNING - terrariumWebcam - Raw image 'Webcam test' at location rpicam_live is not available!

theyosh commented 5 years ago

Hmm, could you perform the following tests and past the output:

  1. as normal user pi run the command: which raspivid
  2. as normal user pi run the command: which ffmpeg
  3. as normal user pi run the command: ls -l /dev/shm/webcam/
theyosh commented 5 years ago

And have you enabled the camera setting with raspi-config? https://thepihut.com/blogs/raspberry-pi-tutorials/16021420-how-to-install-use-the-raspberry-pi-camera

stuartabrown commented 5 years ago

Thanks @theyosh . I have enabled the camera settings - the UI isn't the same as in the tutorial you linked when i run sudo raspi-config, but from my options I have been to interfacing options > Enable camera and enabled.

  1. which raspivid - /usr/bin/raspivid
  2. which ffmpeg - /usr/bin/ffmpeg
  3. ls -l /dev/shm/webcam/
    total 0
    drwxr-xr-x 2 pi pi 1760 Jan 18 19:14 a94df035fc91a158c1f9d7a1c769ca66
    drwxr-xr-x 2 pi pi  480 Jan 18 19:14 de2b8d7f52f0d204cc7667a23b2a7902
theyosh commented 5 years ago

@stuartabrown the output looks good. Was the camera already enabled or not? If you had to enable it, a reboot is required. Then I would expect the webcam to work

stuartabrown commented 5 years ago

Yes it was already enabled, I had to do it (I thought) for the first webcam shown in https://github.com/theyosh/TerrariumPI/issues/234#issuecomment-455659417. Have rebooted anyway but still doesn't work. Maybe PS3 camera is not compatible?

stuartabrown commented 5 years ago

in case it helps there a two resources that 404 when the page loads screen shot 2019-01-20 at 17 24 46

theyosh commented 5 years ago

It looks like the webcam software is not starting... needs some more time to make some kind of a test setup.

theyosh commented 5 years ago

Ok, if you do a new git pull the raspi live cam software can run in test mode.

To run in test mode, make sure the terrariumpi self is not running, and run then as normal user:

/home/pi/TerrariumPI/live_rpicam.sh after a few seconds the following output should be shown

screenshot from 2019-01-22 22-07-22

This indicates that it should work. Press Ctrl+c to stop.

So try this and see what happens. Please post errors here so I can try to figure out why it is not working

stuartabrown commented 5 years ago

Many thanks @theyosh. I've pulled the latest release, stopped TerrariumPI and run the command, output is: `mmal: mmal_vc_component_create: failed to create component 'vc.ril.camera' (1:ENOMEM) mmal: mmal_component_create_core: could not create component 'vc.ril.camera' (1) mmal: Failed to create camera component mmal: main: Failed to create camera component mmal: Camera is not detected. Please check carefully the camera module is installed correctly

pipe:: Invalid data found when processing input`

As per https://github.com/theyosh/TerrariumPI/issues/234#issuecomment-455659417 the same camera is used for both the working static images and trying the webcam (location set as rpicam_live)

theyosh commented 5 years ago

Ah, that's it! You can use the camera only once. So either live, or static. Not both. That will give problems for both webcams.

Somehow I missed that....

But then, if it is not running, then it is strange you will get the error... are you sure nothing else is somehow using the webcam? Other software?

stuartabrown commented 5 years ago

OK I tried deleting both and running just the rpicam_live one but still didn't work. I ran your new test command at this point and got the same output. I can add the same camera and see static images at location /dev/Video0, so back to the same scenario.

Don't worry too much about this issue on my behalf, I just tried it with a PS3 USB camera because I had one to hand, I really need to buy some proper cameras for the job. Out of interest what cameras do you use? I need something with a reasonably short fixed focus (good focus at under 1m) or that can autofocus. Also of course I need it to be near bright lights and still be able to see detail around the enclosure!

theyosh commented 5 years ago

euh,,, I guess that /dev/video0 is your PS3 USB cam and not the Pi cam. Or else, there is another program controlling your RPI cam. The RPI cam should not provide a /dev/video0 location.

Because the error is telling that the camera is already in use or not configured. In your case I expect now that some other software (motion... perhaps) is running and using the RPI cam.

stuartabrown commented 5 years ago

I only have one camera (PS3) not two. That cam just doesn't seem to work with rpicam_live even if I don't also have that same camera set with location /dev/video0.

Would you recommend https://www.raspberrypi.org/products/camera-module-v2/ when I do this properly? Good for close focus (under 1 metre) and ok with bright lights? I think from looking at your set up it is what you use?

I also bought some of these today https://uk.farnell.com/vishay/veml6040a3og/colour-sensor-3-6v-16bit-digital/dp/2504135?st=veml6040 do you know if they work with your software? Saw them mentioned in a UVA/UVB issue here

AndrejWeber commented 5 years ago

Hey Stuart, The datasheet shows, that the sensor cannot detect uva or uvb. Wavelength of 280-315 nm is uvb, 315-400nm uva. The sensor can only detect 425-650nm

theyosh commented 5 years ago

If @AndrejWeber says it is not working.... it is not working :) His knowledge about electronics is way better!

I have currently: https://www.vishay.com/ppg?84304

And that says it does UV, and I do measure some values. Only I do not know what the right values should be.

The one you have, can 'see' what the ambiance color is. Could be handy for some sunset / rise actions... Or if you want to have more green light using a RGB light... but that is not supported with my software.

Some boards: https://www.ebay.ca/itm/VEML6075-UVA-I2C-MikroBUS-Board-Ultraviolet-Light-Intensity-Sensor-Module-UVB/222573772988?hash=item33d26e40bc:m:mlE3HP-sK-gNNrBR3HaHzYQ:rk:3:pf:0 https://www.adafruit.com/product/3964 https://learn.sparkfun.com/tutorials/qwiic-uv-sensor-veml6075-hookup-guide/all

stuartabrown commented 5 years ago

thanks @AndrejWeber @theyosh . I have also purchased the 6075 for UVA/UVB measurements :).

There is a lot of talk about trying to provide reptiles with as close to natural daylight as possible (e.g. http://www.reptilesmagazine.com/Reptile-Health/Habitats-Care/Reptile-Lighting-Information/). The 6040 is an attempt to measure the rest of the visible light spectrum (that coming from LEDs, halogen etc) in addition to do I will get from from the 6075 for UVA/B.

I will have a few left over 6040 modules if anyone fancies experimenting ;)

stuartabrown commented 5 years ago

@theyosh @AndrejWeber - my VEML6075 arrived! Surely this is not what you have attached to your pi? They're tiny! I must have order the wrong produce surely. There are four of them in the below image! img_20190124_163003

AndrejWeber commented 5 years ago

😂 Good luck by soldering Otherwise, it is smal enough to hide it somewhere.

stuartabrown commented 5 years ago

I know. I was on web chat complaining to them that they had sent me an empty package! Then I found this tiiiny strip lurking at the bottom lol. I think I should have purchased https://uk.farnell.com/vishay/veml6075-sb/uva-uvb-light-sensor-module/dp/2891902

theyosh commented 5 years ago

Hmm maybe I had to explain a bit more... sorry. But this is what you want: https://www.ebay.com/itm/Ultraviolet-Light-Intensity-I2C-MikroBUS-Board-Sensor-Module-VEML6075-UVA-UVB/401361373182

I always look first for someone that has it working with a Pi. Then I know what will work. And I can just copy the working code. That helps me deciding what hardware to buy. But occasional it does go wrong :)

I would NOT order https://uk.farnell.com/vishay/veml6075-sb/uva-uvb-light-sensor-module/dp/2891902 because for me it is unclear how the pins work. And it is rather big. The ebay versions are really small and nice to incorporate in the terrarium.

theyosh commented 5 years ago

But, can we keep go back to the camera issue? Now we get all kind of discussions in 1 issue that are unrelated..

So @Barbara1984 are you able to test with the latest git pull?

@stuartabrown Do you have it working now? Was there another program running that was using the RPI cam?

stuartabrown commented 5 years ago

no problem, my mistake. There are two options on that ebay page - 1) ultraviolet light module and 2) UVA/UVB module. I'm assuming the second one is the one you have, correct?

While I'm ordering stuff from China what are you using to measure Lux? Any other interesting sensors that you've seen used?

theyosh commented 5 years ago

There is a hardware wiki: https://github.com/theyosh/TerrariumPI/wiki/Hardware#light

For Lux I advise to look for MiFlora devices on the internet. Chirp devices have problems in high humidity environments.

stuartabrown commented 5 years ago

@theyosh - to be clear, as per https://github.com/theyosh/TerrariumPI/issues/234#issuecomment-455659417 I don't have an official RPi camera. I have one PS3 camera connected by USB. That does not work with location rpicam_live. It does work with /dev/Video0.

To be honest though I don't really mind because I am going to get a couple of RPi cameras to provide a stream. Can I use more that one camera? Assume one on csi and one on usb? I just tested the PS3 camera because I had one to hand.

So, if @Barbara1984 does't reply I am happy for you to close this ticket. Alternatively if you would like to figure out the issue I'm happy to help with whatever testing you would like.

theyosh commented 5 years ago

That is clear. rpicam and rpicam_live will only work with a real rpi cam. USB can ony be used as static image. And webcams can only be used once.

And the PI only support 1 RPI cam. As there is #229 a camera board for 4 cameras, but those can't stream at the same time. And my code does NOT support those (yet). So I use a RPI cam with a fish eye lens.

theyosh commented 5 years ago

Closing due to no response. Raspi_live cam only works with the RPI cam.