Easy Raspberry basics: Project 02c Raspberry PI camera module V2 - video streaming

of Acoptex.com in Raspberry Pi 3

Raspberry basics: Project 02c

Project name: Raspberry PI camera module V2 - video streaming

Tags: Raspberry, Raspberry camera V2, Raspberry PI camera module, Raspberry PI 3

Attachments: script

In this project, you need these parts :

1.Raspberry PI 3 model B 1 pc

2. Raspberry PI camera module V2 1 pc

3. Micro SD card with NOOBS and SD card adapter 1 pc

4. Micro USB power supply (2.1 A, max 2.5 A) 1 pc


TV or monitor and HDMI cable
Keyboard and mouse


5. TV or monitor 1 pc

6. HDMI cable 1 pc

7. USB keyboard 1 pc

8. USB mouse 1 pc


We will learn about video streaming - how to stream live video into a web page that you can access in any device that has a browser and is connected to the same network as the Raspberry Pi 3. 

Understanding the Raspberry PI camera module V2

The Raspberry Pi Camera Module v2 replaced the original Camera Module in April 2016. The v2 Camera Module has a Sony IMX219 8-megapixel sensor (compared to the 5-megapixel OmniVision OV5647 sensor of the original camera).

The Camera Module can be used to take high-definition video, as well as stills photographs. It’s easy to use for beginners, but has plenty to offer advanced users if you’re looking to expand your knowledge. There are lots of examples online of people using it for time-lapse, slow-motion, and other video cleverness. You can also use the libraries we bundle with the camera to create effects.

You can read all the gory details about IMX219 and the Exmor R back-illuminated sensor architecture on Sony’s website, but suffice to say this is more than just a resolution upgrade: it’s a leap forward in image quality, colour fidelity, and low-light performance. It supports 1080p30, 720p60 and VGA90 video modes, as well as still capture. It attaches via a 15cm ribbon cable to the CSI port on the Raspberry Pi.

The camera works with all models of Raspberry Pi 1, 2, and 3. It can be accessed through the MMAL and V4L APIs, and there are numerous third-party libraries built for it, including the Picamera Python library. See the Getting Started with Picamera resource to learn how to use it.

The camera module is very popular in home security applications, and in wildlife camera traps.

There’s also an infrared version of the camera (called Pi NoIR) which gives you everything the regular Camera Module offers, with one difference: it doesn’t use an infrared filter. This gives you the ability to see in the dark with infrared lighting.

You can read more about camera module here.

Understanding the Raspberry PI 3 model B

The Raspberry Pi 3 is the third-generation Raspberry Pi. It replaced the Raspberry Pi 2 Model B in February 2016.


  • Quad Core 1.2GHz Broadcom BCM2837 64bit CPU
  • 1GB RAM
  • BCM43438 wireless LAN and Bluetooth Low Energy (BLE) on board
  • 40-pin extended GPIO
  • 4 USB 2 ports
  • 4 Pole stereo output and composite video port
  • Full size HDMI
  • CSI camera port for connecting a Raspberry Pi camera
  • DSI display port for connecting a Raspberry Pi touchscreen display
  • Micro SD port for loading your operating system and storing data
  • Upgraded switched Micro USB power source up to 2.5A

Signals and connections of the Raspberry PI 3 model B

Signals and connections of the Raspberry PI camera module V2

You can see on the back of ribbon cable one side has a piece of blue plastic and other has some traces on it. Line up traces on the ribbon cable with traces on the Raspberry PI 3 camera port. There is the tab which you can lift up and pull it by its edges. By doing that it will open up so you can insert the ribbon cable end with traces into the camera port. When it's in press tab to fix the ribbon cable.

Step by Step instruction

You should have the Raspbian or Raspbian Lite operating system installed in your Raspberry Pi 3

  1. Connect the Raspberry PI camera module V2 to the Raspberry Pi 3 camera port (CSI camera port). Make sure that Raspberry PI 3 switched off.
  2. Connect Raspberry PI 3 board HDMI port and to your TV or Monitor HDMI port with HDMI cable.
  3. Make sure that your monitor or TV is turned on, and that you have selected the right input (e.g. HDMI 1,  etc).
  4. Plug in your USB mouse and USB keyboard to Raspberry PI 3 USB ports.
  5. Connect Micro USB power supply to Raspberry PI 3 board micro USB input.
  6. The Raspberry PI desktop will start up.
  7. Open the Raspberry Pi Configuration tool from the main menu. Go to Raspberry icon-> Preferences -> Raspberry PI configuration
  8. Ensure the camera software is enabled. If it’s not enabled, enable it and reboot your Raspberry PI 3 board to begin.
  9. There is another way to do it. When The Raspberry PI desktop start up go to Terminal.
  10. In the Terminal window, type the following command: sudo raspi-config
  11. You should see the Raspberry Pi software configuration tool. Select the Interfacing Options.
  12. Select P1 Camera and Yes to enable it and Finish.Reboot your Raspberry Pi 3.
  13. You need to know your Raspberry Pi 3 IP address in order to access your video streaming web server. Use the following command in the Terminal's command line: ifconfig
  14. You will see some information together with Raspberry Pi 3 IP address. In our case it is
  15. Create a new file and name it rpi_camera_cctv.py by using this command: nano rpi_camera_cctv.py
  16. Copy the attached code to your newly created file.
  17. Press Ctrl+X, type Y and press Enter to save your file.
  18. Use this command to run the script: python3 rpi_camera_cctv.py

  19. You can access your video streaming web server at: http://Raspberry Pi IP address:8765. Replace with your own Raspberry Pi IP address, in our case Any device that has a browser and is connected to the same network that your Raspberry Pi 3 has access to the video streaming. The Raspberry Pi 3 can be used to monitor your home as CCTV system.


We have learnt about video streaming - how to stream live video into a web page that you can access in any device that has a browser and is connected to the same network as the Raspberry Pi 3. 


  • No libraries needed in this project


  • Attached on the begining of this project

Other projects of Acoptex.com
Medium Basics: Project 083w Sipeed Maixduino board - Using PlatformIO IDE of Acoptex.com in Sipeed Maixduino 08-08-2019
Medium Basics: Project 083e Sipeed Maixduino board - Uploading MaixPy of Acoptex.com in Sipeed Maixduino 04-08-2019
Medium Basics: Project 083f Sipeed Maixduino board - Using MycroPython of Acoptex.com in Sipeed Maixduino 04-08-2019

Published at 11-05-2018
Viewed: 1230 times