• Documentation
  • NEED HELP?
  • Documentation
  • NEED HELP?

Dragonfly

home/Documentation/Dragonfly
Expand All Collapse All
  • Introduction
  • Architectures
  • Requirements
    • Dragonfly Kit
    • Enviroment
  • Create your account
  • Install Dragonfly
    • Install on Ubuntu
    • Install on Windows 10
    • Install on Windows 10 Pro (inside WSL)
  • Launch Dragonfly
    • Launch on Ubuntu
    • Launch on Windows 10
    • Launch on Windows 10 Pro (inside WSL)
  • Configure Dragonfly
    • Configuration parameters
    • Connect the camera
      • USB camera
      • Remote USB camera
      • Raspberry Pi camera
      • Drone's camera
      • Smartphone/tablet camera
      • IP cameras
      • Other video streams
    • Calibrate the camera
      • Monocular cameras
      • Stereoscopic cameras
    • Configure the Camera field Of View (FOV)
  • Use Dragonfly
    • Mount the camera
    • Perform the mapping
    • Perform the geo-referencing
    • Retrieve the positions
    • Display the positions
  • Heatmaps and analytics
  • Maps management
  • API
  • Update Dragonfly
  • Licenses
  • Knowledge Base / FAQs

Raspberry Pi camera

5567 views 6

A Raspberry Pi (RPI) is a cheap, flexible and power-efficient platform that can easily be used as a wireless remote camera for Dragonfly. It can easily stream a video over Ethernet, WiFi or LTE with the proper equipment.

1 – RPI Hardware

The required hardware to create a Raspberry Pi streaming kit is the following one:

  • Raspberry Pi motherboard: two different options are available:
    • Raspberry Pi 3 B+: this is the most recent and powerful version of the RPI. For streaming, its main advantage is to have an integrated 5 GHz WiFi controller, which provides a much better connection than the older 2.4 GHz WiFi controller of the other boards.
    • Raspberry Pi Zero W: this is the most compact and power efficient version of the RPI. It is also cheaper than the Raspberry Pi 3 B+, but it only comes with a weak 2.4 GHz WiFi controller.
  • Micro SD card: 16 GB are sufficient to run the OS smoothly. We recommend to purchase a class 10 card to make sure the RPI will not be too slow.
  • Fish eye CSI camera: any wide angle CSI camera with a frame-rate above 30 fps @ 640 x 480 can be used. Our recommendation is this SainSmart Wide Angle Fish-Eye Camera.
  • (OPTIONAL) the following equipment can be useful in some cases:
    • USB power bank: the power consumption of a RPI is very low and can run hours on small power banks. The power bank MUST provide an output of at least 2 Ampere.
    • Case for the RPI: there are a bunch of cases for the different RPI models. They are often already provided with ready-to-go kits.
    • Case/enclosure for the RPI camera.
    • HDMI cable, USB keyboard and USB mouse: useful if you want to use the user interface to configure the RPI the first time. It is also possible to configure the RPI in headless mode though, as explained below.

Can I use the USB stereoscopic camera from ASTAR?

No, it can’t be used with Raspberry Pi ​​up to 3B+ because the USB 2.0 ports do not deliver enough power. It might work on a Raspberry Pi 4 (it needs to be tested).

2 – RPI setup

2.1 – Camera physical connection

Those marked in BLUE are the slots to be used to connect the SainSmart Wide Angle Fish-Eye Camera to the RPI.

Raspberry Pi 3 B+ board

Raspberry Pi Zero W board

2.2 – Setup Raspbian Buster

OPTION 1 – Using the RPI graphic interface

Install the operating system

  1. Download to your computer the latest version of Raspbian Buster with desktop from here. We can only guarantee correct operation on Stretch and Buster.
  2. Download to your computer Etcher from here.
  3. Insert your micro SD card in your computer, and use Etcher to flash it with the downloaded image of Raspbian Buster with desktop.
  4. Insert the micro SD card in the Raspberry Pi.
  5. Plug your RPI to a monitor, plug a USB keyboard and mouse, and power the RPI.
  6. Follow the configuration wizard and connect your RPI to a Wi-Fi network.

Enable the SSH server and the Camera interface

You need to plug the camera to your RPI before following the instructions below.

  1. Open the LX Terminal on your RPI.
  2. Run the command:
    sudo raspi-config
  3. Select Interfacing Options > SSH and enable the SSH server.
  4. Select Interfacing Options > Camera and enable the Camera interface.
  5. Select Advanced Options > Expand filesystem.
  6. Go back to the main screen click on Finish and confirm the reboot.

OPTION 2 – Without the RPI graphic interface (headless mode)

Install the operating system

  1. Download to your computer the latest version of Raspbian Buster Lite from here. We can only guarantee correct operation on Stretch and Buster.
  2. Download to your computer Etcher from here.
  3. Insert your micro SD card in your computer, and use Etcher to flash it with the downloaded image of Raspbian Buster Lite.
  4. Open a terminal window and cd to the micro SD card using the following command:
    cd /Volumes/boot
  5. In the boot drive, create a file called ssh. Just an empty file with exactly that name.
    touch ssh
  6. In the boot drive, create a file called  wpa_supplicant.conf.
    touch wpa_supplicant.conf
  7. Take an editor of your choice and add this to wpa_supplicant.conf and change YOUR_SSID and YOUR_PSK parts according to your environment:
    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    country=<your_ISO-3166-1_two_letters_country_code>
    
    network={
        ssid="<YORU_SSID>"
        psk="<YOUR_PSK>"
        key_mgmt=WPA-PSK
    }
  8. Insert the micro SD card in RPI and power it ON.
Problems connecting to the Wi-Fi?
If you have problems connecting your RPi to the WiFi network please look at this thread.

Enable the Camera interface

You need to plug the camera to your RPI before following the instructions below.

  1. Open the terminal on your machine (Linux or macOS).
  2. Find the local IP assigned to your RPI (from now on ip_of_the_pi) using one of the methods of this guide OR launching this command (after having installed nmap):
    #Replace 192.168.0.1 with the base address of your class C network.
    sudo nmap -sP 192.168.0.1/24 | awk '/^Nmap/{ip=$NF}/B8:27:EB/{print ip}'
    
  3. Run the following command and put raspberry as a password when requested:
    ssh pi@<ip_of_the_pi>
  4. Run the command:
    sudo raspi-config
  5. Select Interfacing Options > Camera and enable the Camera interface.
  6. Select Advanced Options > Expand filesystem.
  7. Go back to the main screen click on Finish and confirm the reboot.

2.3 – Setup Gstreamer

We use Gstreamer to stream the video. To install it enter the following commands on your RPI:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get -y install libgstreamer1.0-dev
sudo apt-get -y install libgstreamer-plugins-base1.0-dev
sudo apt-get -y install libglib2.0-dev
sudo apt-get -y install gstreamer1.0-libav
sudo apt-get -y install gstreamer1.0-tools
sudo apt-get -y install gstreamer1.0-plugins-good 
sudo apt-get -y install gstreamer1.0-plugins-bad
sudo apt-get -y install gstreamer1.0-plugins-ugly

2.4 – Make your RPI a RTSP server

To make the RPI video stream a RTSP stream accessible you have to enter the following commands on your RPI:

  1. Check which Gstreamer version has been installed at point 2.3 using this command:
    dpkg -l | grep gstreamer
  2. On this site look for the URL of the Gstreamer RTSP server compatible with the Gstreamer version installed at point 2.3
  3. Install the Gstreamer RTSP server using the following commands but please remember to edit the commands with the version of the Gstreamer RTSP server found in the site linked above:
    wget https://gstreamer.freedesktop.org/src/gst-rtsp-server/gst-rtsp-server-1.14.4.tar.xz
    tar -xf gst-rtsp-server-1.14.4.tar.xz 
    cd gst-rtsp-server-1.14.4
    ./configure
    make
    sudo make install
  4. Install the raspivid wrapper gst-rpicamsrc using these commands:
    cd ~
    sudo apt-get install git
    git clone https://github.com/thaytan/gst-rpicamsrc.git
    cd gst-rpicamsrc/
    ./autogen.sh 
    make
    sudo make install
  5. Check, if gst-rpicamsrc is installed launching this command:
    gst-inspect-1.0 | grep rpicamsrc

3 – Activate the RTSP streaming

  1. On the RPI launch this command (edit the command with the version of the Gstreamer RTSP server installed):
    cd..
    cd gst-rtsp-server-1.14.4/examples
    ./test-launch "( rpicamsrc bitrate=8000000 awb-mode=tungsten preview=false ! video/x-h264, width=640, height=480, framerate=30/1 ! h264parse ! rtph264pay name=pay0 pt=96 )"
  2. The command above should return this:
    stream ready at rtsp://127.0.0.1:8554/test
  3. Leave this terminal open and DON’T STOP THIS COMMAND.

4 – Make the video stream available to Dragonfly

  1. Launch Dragonfly.
  2. Click on the Configuration tab:
    • Set the Camera source parameter to the following string (where ip_of_the_pi is the local IP address assigned to the RPI):

      gstreamer:rtspsrc location=rtsp://ip_of_the_pi:8554/test latency=0 buffer-mode=auto ! rtph264depay ! avdec_h264 ! videoconvert ! appsink sync=false
  3. Click on Save and Restart.

Was this helpful?

6 Yes  No

Onit Group srl
Sede Legale (Register Office):
Via dell’Arrigoni n° 308, 47522 – Cesena (FC) – Italy
Tel: +39 0547 313110

P.IVA: 03240560403 – C.F.: 04057301006 FC
REA: 292006 – SDI: T04ZHR3
Privacy/cookies

© Onit Group srl – All Rights Reserved