Sunday, August 5, 2012

Getting a Logitech C270 webcam working on a Raspberry Pi running Debian


I thought it was about time I shared something after all the hours I've committed to Pi-hacking and the above title says it all. These instructions are very simple but should hopefully save you some trial-and-error.

Importantly, hat-tip to Insipid Ramblings and Hexxeh for their info and work that helped me get this far.

Firstly, I started with a slightly old version of Debian - namely the debian6-19-04-2012 image. Your results may vary depending on what version you use. I am also assuming that you have already installed the image and can successfully boot to the desktop.

So, here goes:

1. Add UVC support to the image
Download and run rpi-update as described here. This will update your image to include the initially-missing UVC support. Reboot as suggested.

2. Update your packages
sudo apt-get update
sudo apt-get upgrade 

3. Install the guvcview webcam viewer
sudo apt-get install guvcview

4. Set up your permissions and enable the driver
sudo usermod -a -G video pi
sudo modprobe uvcvideo

Reboot the Pi.

5. Open up the cam (these are the settings that worked for me)
guvcview --size=544x288 --format=yuyv

Caveats
Well, you are almost done, there are a few things to keep in mind before you rush out to buy one of these webcams for your Pi.
  • Before you view the C270 you must disconnect your mouse*. I am not sure if this is problem specific to my install but if I don't the camera will either not connect or will drop out constantly. The error I saw was along the line of not having any "periodic" USB channels.
  • The resolution is low. Clicking on the above image will open it at full size (544x288). Trying resolutions above this didn't work.
  • The webcam "must" be connected before powering up the Pi. If not you need to run sudo rmmod uvcvideo and sudo modprobe uvcvideo before it will work.
Even with this caveats, this is better than nothing and step one towards my Pi-powered mobile robot.

Hopefully this how-to helps you out and if you have more luck than I using a mouse and/or higher resolutions please let me know in the comments.

* Now, "real" Linux people would say that you shouldn't be using one anyway, but when your goal is to use a webcam, it's somewhat inferred that you'd like to see the result in a mouse-equipped GUI :-)

59 comments:

  1. Related info to the "disconnect the mouse" thing:
    http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=12097&p=145278#p145479

    ReplyDelete
    Replies
    1. Thanks very much for the info, Tomas, at least I'm not the only one who's come across this :)

      Delete
  2. Thank you very much. After a lot of hours trying to "see something", i get it with your help.

    ReplyDelete
  3. How do we use this while using tightvnc :)

    ReplyDelete
  4. Thank-you for your excellent guide on getting guvcview running on a Raspberry Pi. I can now get images from my Packard Bell webcam. I also noticed the interference when using the mouse. However, after installing this software, I am disappointed that the commands aplay and speaker-test -c 2, no longer produce any sound, only a click when entered - any ideas why this happened?

    ReplyDelete
  5. Hey. My first question would be whether this problem happens only with the camera plugged in, or always?

    ReplyDelete
  6. when i try to open the program it says illeagal instruction do you know how to fix this?

    ReplyDelete
  7. Same guide works perfectly with the C310 cam. Thx m8

    ReplyDelete
  8. On C270 with Motion 1024x576 as well.
    (V4l_2_palette 6)

    ReplyDelete
  9. Thanks guys for the feedback, glad this was of assistance :)

    ReplyDelete
  10. Thanks for the write-up. This worked fine on a new raspberry pi installation running 2013-02-09-wheezy-raspbian.zip, and following your guide.

    ReplyDelete
  11. great! working at first attempt with Logitech p9000.

    ReplyDelete
  12. This official link says that you need an external power for C270 to work with Pi. Is that your observation as well?

    ReplyDelete
    Replies
    1. Hi GJ. Yep, I needed a powered hub for it work. Bit of a pain :)

      Delete
  13. Thanks for the instructions. In my case everything worked. There was no need to disconnect the mouse and all resolutions worked fine.

    ReplyDelete
  14. I hooked up two logitech older style eyeball cams to my Pi and followed your directions. Works like a champ!. You can open both up and see two streams. They are slow but it will allow me to switch between the two remotely to look in on things.
    Great instructions and thank you!

    ReplyDelete
    Replies
    1. Oh I forgot to mention. I am using a Belkin non-powered USB hub (High speed USB 2 Ultra-mini hub).
      Upon plugging in the hub initially it causes the Pi to reboot but stable after that.

      Delete
  15. Thanks for this Robert, after wrestling with motion for a few ... I'm in higher spirits! ... that said, if you don't want to use a mouse (like me) I just enabled ssh and 'ssh -X [email protected]" to it and all X commands will come to my session (sorry windows folks) OS X and Linux it should work off the bat.

    Orlando,

    ReplyDelete
  16. This worked fine with a different webcam (MS VX-700) and is a great way of checking to see if things are working OK. Cheers.

    ReplyDelete
  17. thanks for your instruction,mine didn't work first but after removing the webcam from the hub and plugging it to the pi directly worked for me.i didn't got the mouse problem like you said and it's working like a charm

    ReplyDelete
  18. This is very nice article. I have been trying to get mine to work, although I'm being counterculture, and using ArchLinuxArm. ; P Anyhow, I think I can get it to work now.
    Thanks a lot. ; )

    Keep on Geeking, Philipbenr

    ReplyDelete
  19. Thanks for the post.Is it possible to check the Pi camera using guvcview.

    ReplyDelete
  20. Also works with the Logitech V-UAV35 QuickCam.

    Thanks!

    ReplyDelete
  21. whether above procedure works in raspberry pi b board?? or webcam suffers from any power issue????

    ReplyDelete
    Replies
    1. Hey. This was done with an original Model B (not B+ or 2B - https://www.raspberrypi.org/products/model-b/) so you should be fine. Power-wise, it really depends on the camera, but I'm generally using a powered hub on all my work now as sometimes the power issues can be really subtle if there is a problem, wasting a lot of time.

      Delete
    2. I even tried with USB hub then also logitech c310 webcam is not working ,then i tried with another webcam which is intex IT-305Wc in that iam getting video but with shakes how to resolve it?

      Delete
  22. Hi, unfortunalety this is not working on the Raspberry Pi 2 with Logitech C270 and Raspbian. In guvcview I only see a black screen, no matter what settings I use and in the terminal it states all the time "ignoring empty bufer" ... I even connected the cam via a powered hub, but no change.

    Is there any help?

    ReplyDelete
  23. It's alive! It works great on my Raspbian Jessie loaded Raspberry Pi 3. The only change is that the commandline arg is now --resolution instead of --size

    ReplyDelete
    Replies
    1. Thanks for the update, Charles! :)

      Delete
    2. Can you help me and my students get started???

      Delete
  24. This comment has been removed by the author.

    ReplyDelete
  25. In RPI 3 my c270 can't transmit audio in a video call (facebook messenger on chrome browser). The video is fine except the audio. Any fix for it?

    ReplyDelete
  26. Hi I am looking to build this with a group of my art students. I wanted to know if these instructions are still viable if I am working with Raspberry Pi's and the latest Jessie... We would love to build it, send you pics, and of course give you credit...

    ReplyDelete
  27. Connect IP camera to an external sensor, such as door contact or PIR sensor. The motion detection can generate the alarm trigger. However it is easy to create false alarm like we mentioned above. If the alarm is not accurate, we will start not trusting the notification very soon warehouse IP camera system installation

    ReplyDelete
  28. Thanks for the blog post buddy! Keep them coming...
    nude webcam chat

    ReplyDelete
  29. I was reading some of your content on this website and I conceive this internet site is really informative ! Keep on putting up. webcam couples

    ReplyDelete
  30. Very informative post! There is a lot of information here that can help any business get started with a successful social networking campaign.
    vr webcam couples

    ReplyDelete
  31. New web site is looking good. Thanks for the great effort. adult cams

    ReplyDelete
  32. A very awesome blog post. We are really grateful for your blog post. You will find a lot of approaches after visiting your post. couple cam

    ReplyDelete
  33. I like your post. It is good to see you verbalize from the heart and clarity on this important subject can be easily observed... adult cams

    ReplyDelete
  34. I’ve read some good stuff here. Definitely worth bookmarking for revisiting. I surprise how much effort you put to create such a great informative website. virtual reality cam

    ReplyDelete
  35. This article gives the light in which we can observe the reality. This is very nice one and gives indepth information. Thanks for this nice article. vr cam shows

    ReplyDelete
  36. Thanks for taking the time to discuss that, I feel strongly about this and so really like getting to know more on this kind of field. Do you mind updating your blog post with additional insight? It should be really useful for all of us. vr cam shows

    ReplyDelete
  37. I’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article... virtual reality cams

    ReplyDelete
  38. Very informative post! There is a lot of information here that can help any business get started with a successful social networking campaign.
    adult chat

    ReplyDelete
  39. Thanks for this article very helpful. thanks.
    adult chat

    ReplyDelete
  40. I wanted to thank you for this excellent read!! I definitely loved every little bit of it. I have you bookmarked your site to check out the new stuff you post. adult chat

    ReplyDelete
  41. I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us. webcam shows

    ReplyDelete
  42. Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts.

    whatsapp status videos

    ReplyDelete
  43. their assets and do you need a guidance and advice regarding security guard training and license. Get it from security guard pedia, we will provide complete guidance on how to obtain the security guard training. CCTV Melbourne

    ReplyDelete
  44. We are really grateful for your blog post. You will find a lot of approaches after visiting your post. I was exactly searching for. Thanks for such post and please keep it up. Great work. live cam shows

    ReplyDelete
  45. Hey what a brilliant post I have come across and believe me I have been searching out for this similar kind of post for past a week and hardly came across this. Thank you very much and will look for more postings from you. https://viola-bailey.com/viola-bailey/

    ReplyDelete
  46. Hi, I find reading this article a joy. It is extremely helpful and interesting and very much looking forward to reading more of your work.. use-mobile-as-a-wireless-webcam

    ReplyDelete
  47. There is so much in this article that I would never have thought of on my own. Your content gives readers things to think about in an interesting way. Thank you for your clear information. หลั่งเร็ว

    ReplyDelete
  48. Organic inclination contributes and consolidates with mental elements. One reason the "sexual fog" is so obligatory is that it is an oblivious yet maladaptive approach to repair prior bothered, nervousness loaded connections.หนังโป๊

    ReplyDelete
  49. The down to earth approach of the essayist in this blog is commendable.
    install-a-wireless-webcam

    ReplyDelete