Using Terminal Server to Test Xbee Serial Adapters
From Digi Developer
Using Digi TS Products to Test XBee Serial Adapters
Testing your application on a realistic field systems is always a challenge - even if you have 20 serial end devices, you may not have the hardware to simulate realistic field behavior. Plus those 20 end devices will not purposely create bad responses, so it will be difficult to fully test your application in both good and bad situations.
An excellent way to test large numbers of serial devices is with a Digi ConnectPort TS8/TS16 terminal server, which even comes with the same embedded Python environment which you use on the X4 or X8. Thus you can create custom Python test code running directly within the terminal server to mimic your XBee devices. Some TS8/TS16 models support RS-232 only, while other models are configurable on a port-by-port basis to be RS-232, RS-422 or RS-485. Internally, Digi uses terminal servers to drive a 1000 mesh node test system with serial messages.
Example Application
A python application runs on a Digi ConnectPort X4, managing a tank farm. Once per hour, ultrasonic level sensors use Digi XBee modules set for API-mode to send the latest level readings. These level readings are timestamped and stored in non-volatile memory. Once per day the application builds a report and uploads the timestamped level data back to a central server to be used for supply forecasting and delivery planning.
Physically simulating a level with an ultrasonic level sensor is easy - point the sensor at a plywood paddle or cardboard box, which is moved manually nearer or farther away to simulate distance and thus level. However, it is impractical to manually move paddles or boxes hourly, 24-hours per day, 7-days a week. Thus it is impractical to do long-term application testing while physically simulating 8 (or even 80) tanks requiring fresh data hourly.
Using a Digi terminal server to simulate serial end devices in the practical solution. Python code simulating tanks emptying and filling connect to the desired number of Digi XBee RS-232 Adapters, then sends the appropriate serial data message (production or publish) via each XBee device hourly.
The X4 tank management application is never aware of the ruse - it receives and timestamps realistic level data hourly, 24-hours a day, 7 days a week. Better, the custom python simulation program can randomly simulate lost messages or improperly formatted responses. If the X4 tank management application also generates alarm call-outs, the custom program simulating the tanks can also send low (or high) level responses to trigger alarms, then confirm the X4 application correctly handles the alarm situation.
Cables
Most Digi terminal server products use a 10-pin RJ-45 connector. Since the XBee RS-232 Adapter has a 9-pin DTE port, use the Digi cable part number 76000645 with the description RJ45/DB9 Female Crossover 48".
