IoT based Raspberry Pi Cloud Camera: Stream Video from the Raspberry Pi Camera to Cloud

IoT based Raspberry Pi Cloud Camera

A Camera is used to record visual images in the form of photographs, film, or video signals. Here, we are also going to do the same by interfacing the camera with the Raspberry Pi. In this project, we are going to stream our Pi camera video live over the internet using Pi.

To stream Pi camera video over the internet we will use the below-mentioned methods:

  • Stream video live to the web browser using MJPG-streamer application.
  • Stream video to Adafruit IO dashboard.

 

By using MJPG-streamer application we can stream our video live without any delay, you can access this live video using any device that is connected to the same network with Pi.

But in the case of Adafruit IO, the camera will detect the motion and upload the images on Adafruit IO dashboard in every 2 seconds.

Here, in this tutorial, we are going to demonstrate you both the methods of streaming the live video over the internet.

 

Components Required

  • Raspberry Pi
  • Pi camera

 

Raspberry Pi Camera

 

Raspberry Pi Camera Setup

To interface Pi Camera with Raspberry Pi, follow the steps below:

Step 1:- First, turn off your Pi and then locate the camera connector, a long black connector between the HDMI port and Ethernet port. The connector is marked with ‘CAMERA’ on the board.

 

Step 2:- To connect camera pull up on the ends of the black plastic connector and insert camera cable as shown in below image. Camera cable’s metal pads should face the metal pads inside the connector. Now press down on the ends of the black connector.

Camera Connector on Raspberry Pi

 

Step 3:- Now after this will need to enable the camera. Go to the interfacing options using the below command:

sudo raspi-config

 

Step 4:- After this, a screen will open, and on that screen click on ‘Interfacing Options’.

Interfacing Camera with Raspberry Pi

 

Step 5:- Now in the next screen click on ‘Camera’.

Enable Camera to use with Raspberry Pi

 

Step 6:- Confirm the selection by choosing ‘Yes’.

Camera Enabled to use with Raspberry Pi

 

Step 7:- Now exit from this window by selecting the ‘Finish’ option. 

In the next window, a dialog will appear asking to reboot the system, select the ‘Yes’ option.

 

Step 8:- After the reboot, test the camera to check whether its working or not by using the following command:

raspistill -o cam_test.jpg

 

Step 9:- If the camera works properly, the on-board red LED of the camera will glow whenever you click as photo.

 

Step 10:- If you see the command fail error, go back and check that you have enabled the camera or not and make sure the camera cable is connected firmly with the board.

You can also see our other projects for interfacing Raspberry Pi with different sensors.

 

Method 1: Stream video to Adafruit IO dashboard

Step 1 Adafruit IO Setup

For Adafruit IO setup, first sign up on Adafruit IO website by clicking on ‘Get started for Free’ at the top right corner of the screen.

Now after this you need to create a feed, which you can do by clicking on ‘Feed’.

Click on ‘Actions’ to proceed and then click on ‘Create a New Feed’.

Note: For detailed description about creating a feed, follow the link.

 

After creating a feed now you need to create a ‘Dashboard’. To create dashboard click on the “Create Dashboard” button in the upper right corner and give name to the new dashboard like Pi Camera Dashboard.

Creating Adafruit IO Dashboard for Interfacing Camera with Raspberry Pi

 

Now to add block click on ‘+ sign’ on the top right corner of the screen and scroll down to the image block and click on Create.

Choose Image Block in Adafruit IO for Interfacing Camera with Raspberry Pi

 

In the ‘Choose feed’ window, click on the feed named camera_feed and click on ‘Next step’.

Chosse Feed on Adafruit IO for Interfacing Camera with Raspberry Pi

 

After that click on Create Block to create the image block. Also, you can use Adafruit IO for developing various IoT projects.

 

Step 2 Raspberry Pi Setup

To setup the Pi, you need to install the Node.js on your Raspberry Pi. For installing the Node.js go to home directory using ‘cd ~’ command and then download a pre-built Node.js package from the node-arm project and install it.

cd ~
wget http://node-arm.herokuapp.com/node_latest_armhf.deb
sudo dpkg -i node_latest_armhf.deb

 

For checking, whether the Node.js is installed or not use the below commands:

node –v
npm –v

 

This will show you the current version of Node.js.

v4.2.1
2.14.7

 

After installing the Node.js, now you need to install adafruit-io-camera on your Pi. This tool is used to monitor the Pi camera and send pictures to an Adafruit IO feed.

sudo apt-get update
sudo apt-get install -y imagemagick
sudo npm install --global --no-optional forever forever-service adafruit-io-camera

 

After this use your ‘Username’ and ‘AIO Key’ to provide a path to your Adafruit IO account.

adafruit-io camera config --username YOUR USERNAME --key AIO KEY

 

Enter your username and AIO key on the place of ‘YOUR USERNAME’ and ‘AIO KEY’ respectively.

 

Now start your camera using the following command:

adafruit-io camera start -f camera_feed -m false -r 2

 

Here ‘camera_feed’ is the name of feed that you have created earlier. You can change it according to your feed name.

Once the camera tool loads, the terminal should look like this:

Successfully Connected Camera with Pi

 

Now navigate to your Adafruit IO dashboard. It takes some time for the camera to start and upload images on the dashboard.

Streaming Live Video on Internet using Adafruit and Pi

 

Method 2: Stream video live to the web browser using MJPG-streamer application

In this method, we will use MJPG-streamer application to stream our Pi camera video on web browser.

First of all, create a new folder on your Pi, by using the below command:

mkdir projects
cd projects/

 

Now to install MJPG-streamer application we first need to install source control system called git by using the below command:

sudo apt-get install git

 

Now download MJPG-streamer application using this command :

git clone https://github.com/jacksonliam/mjpg-streamer.git

 

To install MJPG-streamer application use these commands:

cd mjpg-streamer/
cd mjpg-streamer-experimental/
sudo apt-get install cmake
sudo apt-get install python-imaging
sudo apt-get install libjpeg-dev
make CMAKE_BUILD_TYPE=Debug
sudo make install

 

Now we need to set a path for libraries, so that the program can easily find libraries. Don't forget the dot ('.') at the end of the command.

export LD_LIBRARY_PATH=.

 

Now after completing the setup, run the MJPG-streamer.

./mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so -hf"

 

Then, navigate to your browser and browse for the following address:

http://Hostname:8080

 

Change the hostname with your Pi’s IP address.

Hence, we have successfully streamed our video live on the internet using Adafruit IO and MJPG-streamer.

You can also use other IoT platforms like ThingSpeak, IFTTT, Blynk, Firebase, Artik, Particle Cloud, for designing amazing IoT projects.

8 Comments

Workout at home and shop weighted vests & body weightsm,iamazonsurmountwayweightedvest_2021 Weight Vests are adjustable weighted vests that are great for adding additional load to your exercises. Available in 10 lb. vest and 20 lb. vest.rom weighted running vests to adjustable options, these are the best weighted vests for taking your workouts to the next level,Adding a weighted vest when you walk increases the load on your body turning a low intensity exercise into a weighted vest workout.Adjustable Weighted Vest Men and Weighted Vest Women/Endurance & Strength Training.

There are definitely a whole lot of details like that to take into consideration. That could be a nice point to bring up. I provide the ideas above as general inspiration but clearly there are questions just like the one you deliver up the place a very powerful thing will probably be working in trustworthy good faith. I don?t know if best practices have emerged around things like that, but I'm sure that your job is clearly identified as a good game. Each girls and boys really feel the impact of just a second抯 pleasure, for the remainder of their lives.

I must get across my love for your kind-heartedness supporting those individuals that need help with your subject matter. Your special commitment to getting the solution up and down became especially powerful and has regularly allowed most people just like me to get to their desired goals. Your amazing warm and friendly help can mean a whole lot to me and a whole lot more to my office colleagues. Warm regards; from all of us.

Youre so cool! I dont suppose Ive learn something like this before. So nice to search out any person with some unique thoughts on this subject. realy thank you for starting this up. this website is something that is wanted on the web, somebody with a little bit originality. helpful job for bringing one thing new to the internet!

My husband and i ended up being really fulfilled Emmanuel could carry out his survey from the ideas he got using your web page. It's not at all simplistic just to be freely giving helpful tips which many people could have been making money from. So we realize we have got the writer to thank for this. The most important illustrations you've made, the simple web site menu, the relationships you will assist to instill - it is mostly extraordinary, and it's really letting our son and us believe that this subject matter is interesting, and that's extraordinarily essential. Thanks for the whole lot!

I was more than happy to search out this internet-site.I wished to thanks in your time for this wonderful learn!! I definitely having fun with each little little bit of it and I have you bookmarked to take a look at new stuff you blog post.

Add new comment

The content of this field is kept private and will not be shown publicly.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.