Tuesday, September 22, 2015

RS-232 cable Wiring & Testing

COM Port (OR) RS-232 cable Wiring & Testing


As A technical background eSecurity Professional, many time got call “my Access Controller communication has RS232 enable How we connect with Computer (COM Port), is there any layout” Sometime “Successfully testing via my Laptop but Customer computer not responding, any distance or new programming is there”. I remember in year 2006 me also facing this type of problem with an Access Controller; I would be like to share the myth.

Com Port (Com1 / Com2 etc)= Serial Port = RS232 = Consol.

The wiring of RS232 has always been a problem. Originally the standard was defined for DTE (data terminal equipment) to DCE (data communication equipment connection), but soon people started to use the communication interface to connect two DTEs directly using null modem cables. No standard was defined for null modem connections with RS232 and not long after their introduction, several different wiring schemes became common. With Digital Equipment Corporation tried to define their own standard for serial interconnection of computer devices with modified modular jack connectors. This interfacing standard became available on most of their hardware, but it wasn't adopted by other computer manufacturers. Maybe because DEC used an non-standard version of the modular jack.


Very interesting is the RS232 to RJ45 wiring standard proposed by Dave Yost in 1987, based on earlier wiring schemes used at Berkeley University. He tried to define a standard comparable to DEC, where both DTEs and DCEs could be connected with one cable type. This standard was published in the Unix System Administration Handbook in 1994, and has since that moment been a wiring standard for many organizations. We will discuss this standard in detail here.
The RS-232 standard 9600bps port will drive 13 metres of shielded cable. RS232 standard is an asynchronous serial communication method. The word serial means, that the information is sent one bit at a time. Asynchronous tells us that the information is not sent in predefined time slots. RS232 sending of a data word can start on each moment. If starting at each moment is possible, this can pose some problems for the receiver to know which is the first bit to receive. To overcome this problem, each data word is started with an attention bit. This attention bit, also known as the start bit, is always identified by the space line level. Directly following the start bit, the data bits are sent. Data bits are sent with a predefined frequency, the baud rate. Both the transmitter and receiver must be programmed to use the same bit frequency. After the first bit is received, the receiver calculates at which moments the other data bits will be received. It will check the line voltage levels at those moments. With RS232, the line voltage level can have two states. The on state is also known as mark, the off state as space. No other line states are possible. When the line is idle, it is kept in the mark state. For error detecting purposes, it is possible to add an extra bit to the data word automatically. The transmitter calculates the value of the bit depending on the information sent. The receiver performs the same calculation and checks if the actual parity bit value corresponds to the calculated value. The stop bit identifying the end of a data frame can have different lengths. Actually, it is not a real bit but a minimum period of time the line must be idle (mark state) at the end of each word. On PC's this period can have three lengths: the time equal to 1, 1.5 or 2 bits. 1.5 bits is only used with data words of 5 bits length and 2 only for longer words. A stop bit length of 1 bit is possible for all data word sizes.
Goals of the Yost device wiring standard
The mess with RS232 wiring is widely known. It was the reason for starting this website. Dave Yost wanted to solve that mess once and for all, reaching as much as possible of the following goals:
  1. All cable connectors should have the same connector type (RJ45)
  2. All cable connectors should have the same connector gender (male)
  3. DTEs and DCEs should have the same connector wiring
  4. All cables should be identical (except for length)
  5. No need for null modems or other special cables for specific situations
These goals are very close to the goals DEC wanted to achieve. The Yost standard has however one basic advantage. Because RJ45 connectors are used, eight pins are available which makes it possible to transfer almost all RS232 signals. Therefore the Yost standard can be used with much more equipment.
Yost DTE adapter wiring
Now we know how the cables are wired, it is time to define the adapter wiring for various equipment. Depending of the type of equipment, DB9 or DB25 connectors are used. Layouts for both connectors to a RJ45 socket for DTE equipment is shown here. The colors are defined by the Yost standard. The DTR to DSR connection is optional. Please use the manual of the device or software to decide if this loop is necessary. It doesn't harm most of the time if you connect both lines, even with systems that don't use the DSR input signal.
Test COM port by using HyperTerminal.
The HyperTerminal application has been distributed with the Windows operating system versions for a long time now, and for administrators and technical support Representatives, it can be a very useful tool. HyperTerminal allows a user to make a connection to a "host" system from a Windows computer using an available COM port. This will enable you to verify whether or not a port is active and open.  If you have never looked at HyperTerminal, take a couple of minutes to read through the following and see how it can make your life easier.
The HyperTerminal application is started by default from the Start | Programs | Accessories | Communications | HyperTerminal location. When you start HyperTerminal, you are asked to name the connection you are about to configure. This is useful as once you have configured your connection, you can then save all the settings to a configuration file of the same name. This configuration file can be used to implement equivalent settings for subsequent connections. After selecting a connection name, click OK.
On the Connect To dialog box, you are introduced to the different types of connection that HyperTerminal offers. By default, a dial-up connection using a modem is selected (assuming you have a modem present). If you have installed an external modem in addition to an internal modem that modem should also be present in the drop down menu as a choice.
 If you click the downwards arrow on the Connect Using field, you may see one or more COMx (where x is the number of the COM port. i.e COM5) options depending on the number of serial ports available on your computer. The COMx options are typically used for attaching to something like a UNIX computer via serial cable or to a router via its serial console cable. 

To test a specific COM port select that COM port you wish to test. Once the COM port is selected you will not be able to access the other options on this dialog box. They will appear grayed out.

Click OK and select these options:
9600 Bits Per Second, 8 Data Bits, No Parity, 1 Stop Bit, and Hardware Flow Control.
Before clicking OK on the COM3 Properties Dialog Box look at the lower left corner of the HyperTerminal Window. Notice it says "Disconnected" See graphic Below.
Now click the OK button on the COM3 Properties Dialog box. Watch the lower left corner of the HyperTerminal Windows. If the COM port is available and can be opened you will see the status change to Connected. See graphic below.
 If you select OK and get an error saying "Unable to open COMx (where x is the COM port number). Please check your port settings". The COM port you are testing is being used by some device or is not functioning correctly.
Start at the beginning of the COM port test and test another available COM port.
If you receive the error we discussed on every port you select then there are no available ports and you will need to either troubleshoot further or speak to your hardware manufacturer and ask your manufacturer to recommend a hardware solution appropriate for your situations.

Test COM port by using Loopback tester
This is a simple and useful tool for testing RS-232 ports in DTE equipment are working working or not. This plug is connected so that every sent character is echoed back.
 If you Short DB9 (Com Port / RS232) Pin 2 & 3, & Press any Word via Keypad, you can get Eco of that Key. IF you got replied then your Com port is Working Normal, IF not then need to either troubleshoot further or speak to your hardware manufacturer and ask your manufacturer to recommend a hardware solution appropriate for your situations.

Differences between RS-232 and full-duplex RS-485

From a software point of view, full-duplex RS-485 looks very similar to RS-232. With 2 pairs of wires -- a dedicated "transmit" pair and a dedicated "receive" pair (similar to some Ethernet hardware), software can't tell the difference between RS-485 and RS-232.
From a hardware point of view, full-duplex RS-485 has some major advantages over RS-232 -- it can communicate over much longer distances at higher speeds.
Alas, a long 3-conductor cable intended for RS-232 cannot be switched to full-duplex RS-485, which requires 5 conductors.
RS-232 is only defined for point-to-point connections, so you need a separate cable for each sensor connected to a host CPU. RS-485 allows a host CPU to talk to a bunch of sensors all connected to the same cable.

Differences between RS-232 and half-duplex RS-485

But a lot of RS-485 hardware uses only 1 pair of wires (half-duplex). In that case, the major differences are
  • Each RS-485 node, including the host CPU, must "turn off the transmitter" when done transmitting a message, to allow other devices their turn using the shared medium
  • The RS-485 hardware generally receives on the receiver every byte that was transmitted by every device on the shared medium, including the local transmitter. So software should ignore messages sent by itself.
A long 3-conductor cable intended for RS-232 can often be switched to half-duplex RS-485, allowing communication at higher speeds and at higher external noise levels than the same cable used with RS-232 signaling.
RS-232 is only defined for point-to-point connections, so you need a separate cable for each sensor connected to a host CPU. RS-485 allows a host CPU to talk to a bunch of sensors all connected to the same cable.
Alas, half-duplex RS-485 networks are often more difficult to debug when things go wrong than RS-232 networks, because
  • When a "bad message" shows up on the cable, it is more difficult (but not impossible) to figure out which node(s) transmitted that message when you have a shared-medium with a dozen nodes connected to the same single cable, compared to a point-to-point medium with only 2 nodes connected to any particular cable.
  • Transmitting data bidirectionally over the same wire(s), rather than unidirectional transmission, requires a turn-around delay. The turn-around delay should be proportional to the baud rate -- too much or too little turn-around delay may cause timing problems that are difficult to debug.

Differences between RS-232 and both kinds of RS-485

RS-485 signal levels are typically 0 to +5 V relative to the signal ground.
RS-232 signal levels are typically -12 V to +12 V relative to the signal ground.
RS-232 uses point-to-point unidirectional signal wires: There are only two devices connected to a RS-232 cable. The TX output of a first device connected to the RX input of a second device, and the TX output of the second device connected to the RX input of the first device. In a RS-232 cable, data always flows in only one direction on any particular wire, from TX to RX.
RS-485 typically uses a linear network with bidirectional signal wires: There are typically many devices along a RS-485 shared cable. The "A" output of each device is connected to the "A" output of every other device. In a RS-485 cable, data typically flows in both directions along any particular wire, sometimes from the "A" of the first device to the "A" of the second device, and at a later time from the "A" of the second device to the "A" of the first device.

Friday, September 18, 2015

Point To Point Communication for IP Camera

Point To Point with Nano Tp-LocoM5

Many Installers are requesting methods to connect their Security Systems. From running cable race ways in commercial buildings to installing conduit above or below ground in residential installations, running wired connections can take a lot of time – which equals more money to spend in labor. This article can serve as a guide on how to maximize the use of our Nano Station Loco M5. In this article we will be going to be utilizing an IP Megapixel system.

Example: IP camera System
Items Needed:-
TP-Loco M5
Any IP camera
Any NVR
Category 5, 5e or 6 Cable / Patch Cables
PoE Switch

Before installing any hardware we first need to configure the Nanos. Lets start by Configuring the Nano that will act as an Access Point. This is the one that will be located at the Main Network.
Nano (Access Point)
Navigate to http://192.168.1.20 on your web browser. If you get this page . Click on “Continue to this website (not recommended)”
This is the correct page you should see displayed on your browser. Once you are here you can log in using UBNT as Username and Password.
Select your Country and agree to the terms of use by ticking the radio button.
Once you have gained access to the Main GUI, navigate to the Wireless Tab
Match the Settings displayed.
Wireless Mode: Access point
WDS : Enabled
SSID: UBNT_Bridge
Security : WPA2-AES
Preshared KEY: UBNT2014
Hit Change but not apply.
Network Mode: Bridge
Static Ip: 192.168.1.159
Match your Gateway as well as the DNS server. In this example we left this out as many networks are different.
Finally hit apply.
Once you have applied the settings your Nano will restart and you can install the Access Point at the Main location where the Main network is.
Nano (Station)
Lets go ahead and open an internet browser.
Navigate to http://192.168.1.20
Use the following credentials to log in.
Username: UBNT Password: UBNT
Select your Country & Language
Check the radio button to Agree the terms of use as.
Once you are loge in navigate to the Network Tab
Use the Following settings
Wireless Mode: Station
WDS : Enabled
SSID: UBNT_Bridge
Security : WPA2-AES
Preshared KEY: UBNT2014
Navigate to Network
Use the Following settings
Network Mode: Bridge
Static Ip: 192.168.1.160
Match your Gateway as well as the DNS server in this example we left this out as many networks are different.
Navigate to the Ubiquity tab
Make sure to match these settings and hit apply.
Once you have completed both Nanos you can install them making sure that they both have line of sight between the devices, some minor adjustments can be done to ensure a good connection.
The Nano’s will lock onto the network by themselves or you can click on the SELECT button this will open up a tab that will display any Access Points in the area select the correct one and lock onto it.
Once you have completed setting up your Point to Point Bridge we can focus on the location.
In this illustration you can see that the Nano (Access Point) is in line of sight with the Nano (Station) that has an IP camera connected to it.
The Connections are simple

Site Side
1.        Connect the camera that you need to add into your Main network onto its own PoE Switch “POE Port”
2.        Attach the “LAN” Cable on the single port PoE switch to the “LAN” on the PoE switch from the Nano (Site)
3.        Attach the “PoE” Cable to the Nano Station “LAN” port.
Main Side
1.        Connect the Nano Station to its PoE switch  (“LAN” to “PoE”)
2. Attach an Ethernet cable from your Router LAN port to the “LAN” port located on the Nano stations PoE switch.

*NVR connections are simple simply attach your NVR to the Router  by attaching a cable in between the LAN port on the NVR to the LAN port of your router.

Mounting Options:
The Nanos come already designed to be attached to a pole, there is a supplied Nylon Zip Ties.

Troubleshooting Tips:
If you have successfully connected all of the devices and you cannot seem to ping your camera on any device on the Station side, make sure that the WDS is enabled in both the AP and Station.
If signal is poor you can use the AirView Application to check your signals. If you are not that tech savvy you can use the Signal bars behind the units or simply log in to both and tweak your nano’s position.
Once you have completed mounting your camera and Nano stations as well as configuring your Nano’s, your system should be up and running.
Also, to view your cameras outside your network, some port forwarding is needed. Ports that need to be opened are 37777,37778 and HTTP ports.

Friday, September 4, 2015

About PSIM

What is PSIM?

PSIM stands for Physical Security Information Management, however it certainly requires further explanation about why it is important. Firstly, the future of all security systems is IP based, this means that CCTV, Access Control, Intruder and Fire Alarms will be computer based. Analogue and standalone systems are becoming more redundant and technology is moving rapidly towards converging all these IP based systems onto a single software management platform.
Assuming your security systems are IP based, then PSIM software packages will make an incredible difference to way you secure your school, business or public sector space. This means facility or building management staff can centralise all systems onto a single platform and remotely manage the building.
The key attributes of a PSIM system are:
1. Collection: Device management independent software collects data from any number of disparate security devices or systems
2. Analysis: The system analyses and correlates the data, events, and alarms, to identify the real situations and their priority
3. Verification: PSIM software presents the relevant situation information in a quick and easily-digestible format for an operator to verify the situation
4. Resolution: The system provides Standard Operating Procedures (SOPs), step-by-step instructions based on best practices and an organisation’s policies, and tools to resolve the situation
5. Reporting: The PSIM software tracks all the information and steps for compliance reporting, training and potentially, in-depth investigative analysis
6. Audit trail: The PSIM also monitors how each operator interacts with the system, tracks any manual changes to security systems and calculates reaction times for each event
PSIM is considered essential for Control Rooms or Command and Control Operations, as the software, provided all the systems are IP based, converge all the disparate systems onto a single platform to provide full management. Common security systems integrated onto a PSIM platform are:

- IP Access control systems
- IP CCTV systems
- Fire detection
- Video wall
- Intrusion detection systems
- Perimeter Intrusion detection systems
- Radar based detections
- GIS mapping systems
- Intercom or IP Phone systems
- Automated barriers & bollards
- Building management systems


The aggregated data, information and footage from the various systems provides the operator with intelligence to effectively manage situations (i.e fires, intruders etc) or day to day management of the building (i.e remote door locking etc). Ultimately, this means the need for large teams of facility staff can be reduce and the building managed centrally by key operators. A key reason for the development of PSIM has been the technology improvements of the systems listed above, which has meant software developers have been able to integrate and converge these systems onto single platforms. Technology in security systems is improving dramatically, prices are falling for systems and the software required to manage them is now available. It really makes sense to move forward and use PSIM to its full potential, let Sunstone help you embrace the future.