BS2 to RS-232-to-RS-485 Converter to Pelco D PTZ Camera?
I've poured over the forums but did not find a whole lot of information regarding control of a Pelco protocol PTZ camera other than using SSR's. So I plan to give it a try sometime later this year.
The Pelco D protocol uses the RS-485 format. I've not heard that the BS2 can output RS-485 format so I plan to use an RS-232 to RS-485 converter, and drive the PTZ camera from that converter. Correct me if I'm wrong.
The data I've found so far shows the Pelco D protocol using the following parameters:
Baud: 4800
Parity: none
Start Bit: 1
Data Bits: 8
Stop Bits: 1
The Table 5.106 (page 418) of the BSM describes how to develop a Baudmode. Using the above info, I have 188 after Step 2. However, I'm not sure how to factor in the above info to answer Steps 3 (True or Inverted) or Step 4 (Driven or Open).
The Note under Table 5.107 includes the following, "If the dedicated serial port (Tpin=16) is used, the data is inverted." If I decide to use I/O pins other than Pin 16 I suppose the answer to Step 3 is True=0.
I've read pages 424 - 427 but I did not resolve Step 4.
What would be the correct Baud mode for the above parameters? What circuit factors would affect this in regard to the RS-485?
falcon
The Pelco D protocol uses the RS-485 format. I've not heard that the BS2 can output RS-485 format so I plan to use an RS-232 to RS-485 converter, and drive the PTZ camera from that converter. Correct me if I'm wrong.
The data I've found so far shows the Pelco D protocol using the following parameters:
Baud: 4800
Parity: none
Start Bit: 1
Data Bits: 8
Stop Bits: 1
The Table 5.106 (page 418) of the BSM describes how to develop a Baudmode. Using the above info, I have 188 after Step 2. However, I'm not sure how to factor in the above info to answer Steps 3 (True or Inverted) or Step 4 (Driven or Open).
The Note under Table 5.107 includes the following, "If the dedicated serial port (Tpin=16) is used, the data is inverted." If I decide to use I/O pins other than Pin 16 I suppose the answer to Step 3 is True=0.
I've read pages 424 - 427 but I did not resolve Step 4.
What would be the correct Baud mode for the above parameters? What circuit factors would affect this in regard to the RS-485?
falcon
Comments
You can use a commercial 232-485 converter on the programming port (pin 16) which has the required inversion circuitry to make life a little easier. As long as the converter has the on-board ability to provide the standard rs-232 voltage levels, it is largely a plug-and-play exercise. Having to flip pin 2-3 is usually the only necessary change with some converters. Many have a switch to allow this to be changed easily.
An alternative is to use a 75176 chip (or one of the similar, more modern chips) which converts from the Stamp i/o pin TTL levels directly to rs-485.
By using the 75176 chip, you'll gain a better understanding of serial communication in general which is always a good thing. Also the chip is very low cost compared to the commercial converter.
Cheers,
I appreciate your assistance.
I ordered a couple cheap RS232 to RS485 converters. I will also throw a 75176 chip in my cart the next time I make a DigiKey order.
Can you expand on the "flip 2-3- pin" part? Or point me to a thread or link to help explain it. I've not heard of that.
I will ultimately use two XBee modules as follows: BS2 (or Prop)→XBee Ser 1(Out)→XBee Ser 1(In)→RS232 to RS485 converter→PTZ camera. Will this create any additional
falcon
Its nothing to get too concerned about at this point.
As you're aware, there is one pin designated Tx and one designated Rx on the serial connector. There are two general configuarations of that connector that manufacturers use: DTE (data terminal equipment) and DCE (data communucation equipment). In one, Tx is pin 2, Rx is pin 3; in the other, its reversed. Its quite common during set up of a serial link to have to flip or interchange pin 2 and 3 to get the Tx at one end to be connected to Rx on the other and vice versa.
The ultimate serial guide is Jan Axelson's "Serial Port Complete".
The XBee solution should work fine. But, get the system working via a wired connection first to minimize startup problems.
Cheers,
I was able to get Pan Right/Left and Tilt Up/Down working with the Parallax 5-Position switch, and two other SPST switches for the Zoom In/Out.
The code is pretty simple but it is a building block. Changing the speed of movements requires changing one byte and updating the Check Sum byte. That will have to wait.
Here is the schematic
Stamp to PTZ Camera via RS-485.bmp
falcon
To recap, I have a project where I am using a BS2 to control a Pelco-D PTZ camera. The camera requires RS-485 input. I have this working using an SN75176 BUS Transceiver chip (Thankyou Stamptrol) with the help of a Parallax AppKit.
Signal chain: The BS2 interfaces with the SN75176. The SN75176 converts the BS2 TTL-level output to RS-485. The RS-485 drives the Pelco_D Camera. This much works fine.
I now want to use two XBee transceivers to make this wireless. Should the XBees be placed between the BS2 and the SN75176 (to transmit TTL-level), or between the SN75176 and the Camera (to transmit RS-485)?
See this attachment: Stamp to PTZ Camera via RS-485.bmp
Are there any specific XBee settings that need to be configured for either of these options? Or will the XBee just transmit whatever pulsetrain it receives?
Any and all comments are welcome.
falcon
The SN75176 will have to go after the Xbee receiver, to convert the single-ended output to a differential signal that the Pelco is expecting. RS485 is not protocol specific, it is merely an electrical specification for transmitting data over a twisted pair.
BS2 ---> Xbee ~~~~ Xbee ---> SN75176 ===> Pelco
That makes sense.
That being said, on th BS2, P0 is the Driver enable pin to the SN 75176 and P1 is the SEROUT data. I suppose I would then feed the P1 (SEROUT) to the XBee DIN pin? Would the BS2 P0 (Enable) then be connected to any Digital I/O pin on the XBee?
I've been pouring over the XBee tutorial but do not see an example of a continuous stream of multiple BYTE data being sent between two XBee's.
falcon
You'll have to hard wire the DE pin on the SN75176 to be in transmit mode so when data comes across the RF link, it goes out on the twisted-wire pair. I don't think you need to connect it through the Xbee, but since I've never done that I could be mistaken. The Parallax documentation says you can operate the Xbee as a simple point-to-point serial link, which seems to fit your application.