Sunday, 11 August 2019


A practical example of using the RTSP protocol via the cloud

Let's talk about a practical example of using the RTSP protocol for CCTV.
Imagine a situation where you have some analog security cameras connected to a digital recorder (DVR) and your intention is to have redundant video recordings. You just need to choose a service that allows you to store everything on a server in the cloud (somewhere in the Internet).
There are several cloud services available in the market such as CamCloudCameraFTP, and Angelcam and you can choose the one that best suits your needs.
In this example I will use the services of Angelcam that works with different device brands and also work well with the RTSP protocol.
==> For more details, I recommend reading the other lesson: CCTV camera cloud recording: Using online IP camera storage

Configuring the router to work with the cloud

Before doing the tests with the command in the cloud, it is necessary to configure the router, this procedure is extremely simple, just use the IP information and port of the IP camera.
Basically, you have to inform the router that it should direct traffic coming from the Internet to the IP camera whenever the request is to a particular logical port which in the case of the RTSP protocol is by default the 554 .
See the image below that shows the configuration of the router, note that the configuration for this model must be made in the "Applications and games" menu the IP camera address is 192.168.2.107 and the port is 554.
Obviously you will have to look for other menus in different models of routers, usually you find this menu as port forwarding, port forwarding or NAT.

How to configure the cloud server

Dahua DVR can work seamlessly with this service because it allows the use of RTSP command and the information we need for configuration is available in the product's manual.
In this specific case, the device is a 4-channel Dahua DVR that uses the following RTSP command:
rtsp://<IP>:<Port>/user=<username>_password=<pass>_channel=<channel>_stream=0.sdp?real_stream
Just use this command and replace the IP, port, user and password information and that's it, everything will work according to your network. Everything must be configured on the server side of the cloud and the routing rules must be ready on the router that is on your local network.
See in the following image an example of how to configure the Angelcam's cloud. After creating a platform account in the site https://angelcam.com login with the user and password and choose the option DVR and NVR.
After this step simply type or paste the RTSP command as shown in the following image
Note that the command used includes the external IP used by the router and the 554 port that was used in the router configuration and which is the DVR standard.
It is important to understand the concept, the RTSP command sent by the cloud server arrives at the router through the external interface before being routed according to established rules and therefore, you must make sure which is the external IP of the used by the router.
The following image shows the end result of the camera connection to the server in the cloud.
In some cases you will notice that the image may suffer some quality variations due to some factors such as lack of Internet link stability, available bandwidth reduction or incompatibility of commands between the cloud server or camera.
Be sure to upgrade the IP camera firmware to the latest version available, this helps maintain compatibility with systems that use RTSP as cloud services and other brand recorders.

If you do not have a static IP on your Internet link

If you do not have a static IP on your Internet link, you can use a DDNS service available on the Internet, so the cloud service will continue to work and record the images from your camera even when there was an automatic change of the external IP of your router.

How to find your IP camera's RTSP command

The simplest way to find the command used by your camera or recorder is to consult the product's manual, if this is not possible contact your equipment supplier, if you still have problems you may try to use the ONVIF DEVICE MANAGER software following the instructions from the lesson ONVIF Device Manager Review and Download (Test IP Cameras)

Final considerations

Now you already know what the RTSP protocol is and how you can do the tests and use it in practical situations.
I recommend that you run local tests with the VLC software and the devices you have on your network to familiarize yourself with the use of this protocol

How to choose the correct power supply for your CCTV camera

To connect the CCTV cameras it is necessary to use a power supply that provides the voltage and the proper current according to the project.
In this lesson, you will learn how to choose the correct power supply for your surveillance camera, just keep reading.
In most modern installations with analog cameras, the power supply is centralized and distribute power to all installed cameras.
Below is an example of a centralized power supply, this type of power supply can be used to connect multiple cameras according to their maximum current.
The connection is extremely simple because there are labels on each of the connectors, the power supply must connected to an electrical outlet using the hot and neutral connectors, and the positive and negative connectors are connected to the cameras. There is also a connector for grounding.
It is recommended to use a power supply with 80% of its maximum capacity to avoid any overload problems. When the system is turned on, there is an initial peak current that can compromise the source if it is too close to the full capacity.
For a CCTV project, it is necessary to know which current (amperage) each camera consumes, so you can use the appropriate power supply.
This information is on the camera label or in the installation manual, in some cases, instead of the current, we find the power information in W (watts), so just do the conversion through a simple division calculation.
Below is an example of a camera that shows the power in Watts and the voltage (V), from there we can calculate which is the current that will be used.
Now that we know how much current is needed for one camera, just do the same for the others and add up the total of cameras that will be used in the project to calculate the necessary power supply, and remember to use 80% of the capacity.

Choosing the correct power supply for a group of CCTV cameras

Suppose we have 16 cameras that will be installed in a DVR and assuming that the source will be used only for the cameras, since the recorder has its source apart, we do the calculations below:
16 camera at 0.35A (350mA) each: 
​16 x 0.35 = 5,6A

Considering the maximum 80% capacity:
5,6 / 0,80 = 7A
Is necessary to have a 7A power supply for a 16 cameras project
With a 7A power supply we can connect the cameras as shown in the image below
Repeat the process for the other cameras, splitting between the other connectors that have not yet been used. In the example above there would be 8 cameras in each pair of connectors (V- V+). In practice it is best to buy a power supply that has more connectors available to make the installation easier and organized.
There are other professional power supplies that allow the connection of each camera to its own fuse-protected and LED post that indicates if the camera is powered. See the example in the image below:
This is a centralized 12VDC and 10A power supply with individual terminals for connecting up to 18 cameras. The fuses are PTC type that open as there is a high current that heats the circuit and closes when it ceases the passage of the current, so it resets itself without needing to be replaced.
A power supply like this allows the connection of 18 cameras with maximum consumption of 500mA each. (10/18 = 0.55). That would be enough for our previous example with 16 cameras that consume 350mA each.
Quick recap: 16 cameras x 350mA --> Calculation: 16 x 0.35 = 5,6A
80% maximum power supply usage --> Calculation: 6,3 / 0,80 = 7A
The image below shows the installation of 16 cameras using a power supply that allows to connect each one individually.
Good quality power supplies allow voltage variation to compensate for cable losses or high voltage that can reach the camera
A good CCTV camera can work with 10% variation in power, so we can use a potentiometer like the one shown in the picture to vary the voltage for more or less voltage.
With a variation of 10% down, we have the voltage at 10.8V and with variation of 10% up we have the voltage at 13.2V. Both are enough.

Conclusion

Now you have enough information to choose the correct power supply for your CCTV cameras, it's just a question of do some basic math to calculate the voltage and current necessary to your cameras.
You also need to choose the correct coaxial cable for the installation, so I highly recommend you to read the lesson Best coaxial cable for CCTV.

How to connect a PTZ camera to a DVR

If you want to learn how to connect a PTZ camera to a DVR, I got to tell you that you are in the right place. 
In this lesson you are going to learn how to identify the DVR and the PTZ camera physical connectors, how to wire them properly and how to setup the devices by using the RS-485 standard and the correct protocol (Pelco P or D).
Here are the steps to connect a PTZ camera to a DVR:
1. Identify the physical RS-485 connector in the camera;
2. Identify the physical RS-485 connector in the DVR;
3. Run the wire between the DVR and the PTZ;
4. Set the dip-switches on the camera to chose the parameters;
5. Log into the DVR and setup the PTZ parameters.
==> Just keep reading to understand all the details...

How to control a PTZ camera

PTZ cameras have an internal motor to control the position of the lens that can move horizontally (known as PAN) or vertically (known as TILT) and there's also a motor to control the optical ZOOM.
By controlling the PTZ movements, an operator can patrol a certain location by sending commands using a controller (joystick), a DVR (Digital Video Recorder) or software installed in a computer located in a remote monitoring center. 
To send the commands,  it is necessary to connect a two-wire cable (positive and negative) from the back of the DVR to the PTZ camera. 
In this example, the cameras are connected to the DVR with a twisted pair cable that sends the commands through a universal connection standard and a protocol that the camera and the DVR have in common (such as Pelco P or D).
The twisted pair wires must be connected to the back of the DVR into the RS-485 connector.

The RS-485 PTZ control standard

By using the RS-485 standard with twisted pair cables, it is possible to send commands to the camera at distances up to 1,200m (3,937 feet) and multiple cameras can be connected to the cables in a serial line.
In the image below, it is possible to see the connector used for the command via RS-485. Note that they are labeled “positive and negative”.
Depending on the model of the equipment, these labels may be different, there are DVRs and cameras that show: TX + / TX- or RX + / RX-.
TX is the transmitter and RX is the receiver. If we follow the logic, the DVR should be the TX that transmits the commands and the RX camera that receives the command.
The important thing to keep in mind is that positive and negative wires should be properly connected to the DVR and to the camera. The device’s manual has the instructions for that and not all manufacturers follow a standard for the names.
In addition to the physical connection using the RS-485 standard, it is also necessary to configure the camera ID and the communication protocol that will be used between the devices.
This communication protocol is developed by the manufacturer itself, so if the DVR and camera are from the same manufacturer there will be no problems, but if they are from different brands we must use a universal protocol.
There is a universal protocol called Pelco P and another called Pelco D, they are available in cameras and DVRs from different manufacturers, so if we have different brands of equipment we can use this protocol.

The Pelco-P and Pelco-D protocols

Pelco is a large camera manufacturer that created this communication protocol for PTZ cameras. This standard became popular among system integrators, so other manufacturers besides having their own protocols, also let Pelco's protocol available on their equipment for compatibility.
When both devices (PTZ and DVR) are manufactured by the same company they usually use the same protocol, so there's no need to use Pelco's.
On situation, where the devices have different brands, it is necessary to choose the common protocol between them, in this case Pelco P or D for example.
A PTZ camera usually has a switch where you can choose the protocol.
This is an example of how a camera's protocol is configured. A small arrow can be rotated to a specific position in which a number or letter represents the protocol.
Using a table from the camera manufacturer's manual you can choose the protocol that will be used, as shown in the illustration below:
SW3
Protocol
Baud rate
0
Samsung
9,600
1
Samsung
19,200
2
Pelco D
2,400
3
Pelco D
4,800
4
Pelco D
9,600
5
Pelco D
4,800
6
Pelco P
9,600
7
Samsung E.
9,600
8
Samsung E.
19,200
9
Panasonic
9,600
A
Panasonic
19,200
B
Vicon
4,800
C
Vicon
9,600
D
Honeywell
9,600
E
AD
4,800
F
Bosch
9,600
In the table you can find the manufacturers and their respective protocols and data such as communication speed (Baud Rate).
The configuration is very simple, just follow the table orientation and choose the protocol you want to use, in the case of this manufacturer the arrow positioned at number 6 indicates that the camera is configured to use Pelco P protocol with Baud Rate 9,600
It is also necessary to configure the DVR with the same parameters used in the camera.
In the above example, the parameters have been configured on the camera using a system with a rotating arrow, other cameras may, howeve,r have a set of small switches known as "Dip Switches" that can be placed in the "on and off" positions to obtain the desired setting.
A table for the correct combination of these switches ("Dip Switches") can also be found in the camera manufacturer's manual.

How to setup the DVR for PTZ control

See below a Pelco-P protocol configuration example for a DVR, just go to the PTZ menu and search for these settings for each of the cameras.
Other parameters such as Data Bit, Stop Bit, Parity, and Flow Control may appear on the menu.
In the menu above that the DVR has several types of protocols from different manufacturers that can be different according to each brand.
Not all DVRs will have these protocols that we see in this menu, but they will all have the Pelco protocol that is easily found in other manufacturers' equipment, so use it by default when you want to set up a different brand’s devices.

Conclusion

I hope you could learn how to connect a PTZ camera to a DVR, the next step is to test in your devices. Just apply the concept that you've learned here.
It's important to read the device's manual to make sure you are using the right protocol, baud rate and everything else.



No comments:

Post a Comment