How to stream a USB camera via Android and iPhone with a Raspberry Pi board

Streaming USB 3.0 camera technology onto handheld devices such as Android and iPhones, utilizing a Raspberry Pi board, can significantly improve remote access capabilities. This technology enables users to perform monitoring, inspection, and surveillance tasks directly from their portable devices, offering the utmost convenience and flexibility across various applications.

In this blog, we’ll look at how you can stream a USB color camera in a handheld such as an Android and iPhone device using the Raspberry Pi board.

Camera Streaming via Android and iPhone with a USB – using Raspberry Pi boards

The USB 3.0 camera in this setup is the See3CAM series from e-con Systems. These cameras are reputed for their UVC compliance, ensuring plug-and-play support on Windows and Linux platforms. Therefore, the installation process becomes simpler, as it eliminates the need for manually installing additional device drivers.

For Android devices, the integration has been thoroughly tested with the See3CAM_130 color camera on Android version 13. This testing ensures compatibility and smooth operation, allowing Android users to leverage the advanced streaming capabilities of the camera seamlessly.

Similarly, the system’s compatibility extends to iOS devices, with successful testing conducted on the iPhone 13. Hence, iPhone users can also benefit from the high-quality camera streaming technology without any compatibility issues.

The streaming functionality is powered by the motion library on a Raspberry Pi-4B, utilizing HTTP for video transmission. Unlike RTSP, HTTP provides a versatile method for transferring video or other data across the internet, facilitating smooth and accessible streaming from the camera to client devices over the network.

The Raspberry Pi 4B serves as a best-fit platform for the setup due to its compact form factor, USB 3.0 capability, and energy efficiency. Running on the Raspbian OS, the Raspberry Pi 4B offers a steady foundation for deploying the camera streaming solution.

Tested on the below e-con Systems’ cameras:

Connect the Android Phone to the Raspberry Pi

Prerequisites:

  • Raspberry Pi 4B kit
  • Raspbian OS
  • USB-A to USB-C cable
  • Android phone with an installed VLC media player

Key steps to follow:

  1. Power ON the Raspberry Pi 4B kit.
  1. Connect the Android to Raspberry Pi 4B dev kit in the USB 3 Port.
  1. A notification pop-up will show up on the Android phone. Select “This Device” in USB Preferences and select “USB Tethering”.

  1. Turn on the mobile data in the Android phone to properly connect to the Raspberry Pi (The Raspberry Pi and the Android device should be connected to the same network).
  1. Check the IP address of the device using the below command.

$ ifconfig

How to run the stream on the Android phone:

Install the below dependencies in the Raspberry Pi kit.

$ sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstrtspserver-1.0-dev

Enabling mobile streaming using “motion”:

Network streaming

Install the motion application using the below command.

$ sudo apt-get install motion</code >

Run the application by using the below command.

$ sudo motion</code >

Modify the configuration file of this application to change various parameters.

$ sudo nano /etc/motion/motion.conf</code >

Modify the following parameters to test the supported resolutions and save the configuration file:

  • Width (modify it with the supported width (e.g. 640)
  • Height (modify it with the supported width (e.g. 480)
  • Frame rate (valid range: 2 to 100)
On the receiver end, you should:

Open the VLC app and enter the following IP in the address bar from the same device or any device connected to the network:

http://<IP Address of RPi4>:8081</code >

In the below example, the camera stream has been received from the Raspberry Pi4 board with the IP address “192.168.107.189” on an Android phone.

Streaming window:

Connect the iPhone to the Raspberry Pi

Prerequisites:
  • Raspberry Pi 4B kit
  • Raspbian OS
  • Apple Lightning to USB-A cable
  • An iPhone with an installed VLC media player

Key steps to follow:

  1. Power ON the Raspberry Pi 4B kit.
  1. Connect the iPhone to the Raspberry Pi 4B dev kit in a USB 3 port.
  1. A notification pop-up will show up on the iPhone. Allow the Raspberry as “Trusted Device”.

  1. Turn on the mobile data in the iPhone in order to connect to the Raspberry Pi (The Raspberry Pi and the Mac device must be connected to the same network).
  1. Check the IP address of the device using the below command.

$ ifconfig

How to run the stream on the iPhone:

Install the below dependencies in the Raspberry Pi kit.

$ sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstrtspserver-1.0-dev

Mobile streaming using “motion”:

Network streaming

Install the motion application using the below command.

$ sudo apt-get install motion</code >

Run the application by using the below command.

$ sudo motion</code >

On the receiver end, you should:

Open the VLC app and enter the below IP in the address bar from the same device or any device connected to the network:

<IP Address of RPi4>:8554

In the below example, the camera stream has been received from the Raspberry Pi4 board with the IP address “172.20.10.” in an iPhone.

e-con Systems: A pioneer in embedded vision innovation

By following these steps recommended by the camera experts at e-con Systems, you’ll have access to a powerful and flexible camera streaming system. It can enhance the capabilities of handheld devices while bringing a new level of accessibility and convenience for remote monitoring and surveillance applications. As you may know, e-con Systems has over two decades of experience in designing, developing, and manufacturing custom and off-the-shelf OEM cameras, including end-to-end customization expertise.

Check out our See3CAM series.

Explore our Camera Selector page to view our full portfolio.

For more information on streaming USB 3.0 cameras onto Android phones or iPhones with a Raspberry Pi board, please write to camerasolutions@e-consystems.com.

Related posts

How to use e-con Systems’ USB cameras with MATLAB

e-con Systems’ RouteCAM_CU22 simplifies Integration with NVIDIA Metropolis

Unleashing the Power: A Guide to Model Inference and Visualizing Output with EdgeECAM50_USB