1

Does anybody know how to interface an old USB webcam with the USB Host Shield 2.0 connected to an Arduino (Uno or Mega 2560 or other models - excluding Yun).

I've got the USB Host Shield set up properly and I can run all the examples.

My goal is to make the arduino force the webcam to take a picture (the webcam itself has a button for taking pictures) every second and save it to the SD card of the ethernet shield.

I know how to read and write data to the SD card of the ethernet shield. That's not the problem.

The problem is making the Arduino talk to the USB webcam. Can anybody please share a basic .ino file with me so I can see what magic they used to do the trick?

I tried the Arduino PTP Camera Control library by felis over at: https://github.com/felis/Arduino_Camera_Control

But I'm having lots of trouble getting the included examples to work properly with my old USB webcam. I always get the 'can't read data' error in the serial monitor...

Thanks for any help!

migrated from electronics.stackexchange.com Dec 17 '18 at 5:25

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

  • This will not be practical. USB Webcams are not PTP devices - that is for already recorded images. Don't use an Arduino for this project, use something more like a Raspberry Pi, though preferably without the delicate SD card dependency - possibly even the Linux (not Arduino) side of that Yun you want to avoid, or perhaps a hackable router/NAS box which is what that is a repackaged and repurposed variation of. Cheapest and simplest of all of course would be to just get a cheap still camera that records to an SD card. – Chris Stratton Dec 16 '18 at 21:22
  • Most simple webcams use USB video device class UVC protocol. Ptp is supported on some webcams but UVC is much more common. – cde Dec 16 '18 at 21:40
  • Thanks for the comments guys. Please keep the good ideas coming. So what you're telling me is that I should look into the library called libuvc github.com/ktossell/libuvc ? Could this library actually work with the Arduino Uno / Mega and the Arduino IDE ? Or do you know of another UVC library that's compatible with Arduino ? I couldn't find anything UVC related in the Arduino Library Manager. – Alex Dec 16 '18 at 23:30
  • @Passerby If this is an old webcam, it may not use the UVC protocol. – user2233709 Dec 16 '18 at 23:42
  • Re-read the first comment: an Arduino is not remotely suitable to this task. – Chris Stratton Dec 17 '18 at 1:13

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.