We are in part 6 of tutorial series of Building Raspberry Pi Line Follower Robot! If you want to jump back and forth or missed any of my previous tutorials – here is the consolidated list.
All Tutorials to Build IOT Raspberry Pi Robot
- Build Raspberry Pi Robot controlled by Internet – IOT Robot
- Setup Static IP Address on Raspberry Pi
- Installing Web Server on Raspberry Pi
- Controlling Raspberry Pi LED via internet
- Raspberry Pi LED controlled by Internet
- Build REST API using Python and Flask
- Raspberry Pi Robot Logitech Camera Server
- Create Web Dashboard for IOT Robot Control
Entire project Video Tutorial
Great progress! We have basic REST APIs also ready. Now, we also want to stream live video from Raspberry Pi Robot. I am going to plug Logitech C210 camera to the robot and use it for streaming. Let’s dig more!
I have below logitech c210 camera:
Here are the steps:
To begin, first update the Raspberry Pi so you’re running on the latest version.
sudo apt-get update sudo apt-get upgrade
Next we need to install motion server.
sudo apt-get install motion
Now we should first check if the webcam is supported or not. Type below in terminal
We should see the camera listed if it is compatible with Raspberry Pi.
Next is very important thing to configure motion:
sudo nano /etc/motion/motion.conf
Below is the configuration that we need to make:
- daemon on
- stream_localhost off
- output_pictures off
- ffmpeg_output_movies off
- stream_maxrate 100 (This will allow for real-time streaming but requires more bandwidth & resources)
- framerate 100 (This will allow for 100 frames to be captured per second allowing for smoother video)
- width 640 (This changes the width of the image displayed)
- height 480 (This changes the height of the image displayed)
We need to setup up the daemon, first we need to edit the motion file.
sudo nano /etc/default/motion
Find the following line and change it to the following:
Make sure the camera is connected and run the following line:
sudo service motion start
Now you should be able to check out the Webcam Stream at the IP address of our Pi so in your browser go to the following address:
Now, you should see below output:
We can use Port Forwarding to configure and live stream over internet: