Skip to main content

Network RS232


With an ever increasing number of off the shelf electronic modules and boards available at low prices, designers are inclined to use these instead of making all their electronics from scratch. In many cases this makes sense as developing  say, a PID motor controller or a GPS receiver from scratch requires considerable skill, time and effort. A surprising number of modules still have an interface based on RS232. No wonder, as RS232 is easy implemented on a microcontroller with two I/O pins and a line driver such as the MAX232. In the case where the master is a PC, the serial port is relatively easy to access on both Windows and Linux. Usually modules implement a text terminal interface that decodes single line commands with arguments and generate a reply like this:

Tx: cmd arg0 arg1 ... argX/n
Rx: cmd arg0 arg1 ... argX/n
replyline0/n
replyline1/n … replylineY/n

A complication occurs when there are a number of RS232 modules in a project, as each requires a serial interface at the master. A hardware solution in the form of an RS232  multiplexer would be a solution but wouldn’t  it be nice to get this functionality for free! By deviating from the original aim of RS232 as a point-to-point link, we can have an RS232 network in which all the modules share both transmit and receive lines to one master inter-face. All modules operate at the same speed, start and stop bits with no flow control.

Circuit diagram :

Network RS232-Circuit Diagram

Network RS232 Circuit Diagram

When idle, all the modules are listening for commands from the master and have their transmitters disabled. Each module is configured with an identifier consisting of a number that the master sends as a single line (e.g. ‘2/n’ selects module 2). If a module receives an identifier that matches its own, it is selected and can decode commands and drive its transmitter for the duration of the reply. Conversely, if the identifier does not match it must not decode commands and ensure its transmitter remains disabled.

In addition to some firmware sup-port, the RS232 driver electronics must be able to tri-state the transmitter while keeping the receiver operational. Sadly, the classic MAX232 driver is unsuitable but the ICL3321 and MAX242 are possible candidates for our purpose. These have low-power shutdown modes that power-down the charge pump and transmitters but keep the receivers enabled for monitoring RS232 activity.

The number of modules in your RS232 network is limited by the (nominal) 5 kΩ pull-down at the receiver input of the line driver device. Multiple modules increase the loading on this signal, reducing the maximum operating speed and cable length. Using the circuit shown here, running an application with five modules at 9,600 bps located within 1 meter  of each other did not present any problem.

Modules need a means of enabling the network mode and setting the unique identifier. This can be done via switches, jumpers or, if I/ O pins are scarce, by storing the configuration in the user EEPROM/Flash provided by many  microcontrollers. If the latter is done, it is reasonable to assume the module will only be configured with normal RS232. Special configuration commands can then be provided that are always decoded irrespective of the identifier match.

It is unlikely that commercially available modules can be tweaked to support ‘network’  RS232 unless the vendor has used a suitable RS232 line driver and is prepared to provide the firmware code. However, it is possible to implement on DYI modules and perhaps module designers can take note and enhance the functionality of their future designs.


Comments

Popular posts from this blog

A basic Arduino Solar PV Monitor

I have just recently had solar pv installed, mainly to future proof my energy costs, I do not expect it to be like drilling for oil in my back garden, however the return looks to be encouraging. The install gives you another single unit meter, from this you will see the total amount the panels produce, but that is about it. I wanted to know how much the production was as it was happening, I discovered the light blinks on the front of the meter will flash 1000 times for each kWh of electricity which passes through. The rate of the flashing of the LED tells you how much power is currently passing through the meter. [ ]

Build a Key Operated Gate Locking System Circuit

This simple key-operated gate locking system allows only those persons who know the preset code to open the gate. The code is to be entered from the keypad within the preset time to operate the motor fitted in the gate. If anyone trying to open the gate presses a wrong key in the keypad, the system is disabled and, at the same time, sounds an alarm to alert you of an unauthorized entry. Figs 1 and 2 show the block and circuit diagrams of the key-operated code locking system, respectively. Connect points A, B, C, D, E, F and ground of the circuit to the respective points of the keypad. Keys S7, S16, S14 and S3 are used here for code entry, and the remaining keys are used for disabling the system. It is very important to press the keys in that order to form the code. To start the motor of the gate, press switches S7, S16, S14 and S3 sequentially. If the keys are pressed in a different order from the preset order, the system will lock automatically and the motor will not start. Fig. 1: Bl...

Simple But Automatic Load Sensing Power Switch

This circuit will automatically switch on several mains-powered "slave" loads when a "master" load is turned on. For example, it will switch on the amplifier and CD player in a stereo system when the receiver is turned on. It works by sensing the current draw of the "master" device through a low value high wattage resistor using a comparator. The output of that comparator then switches on the "slave" relay. The circuit can be built into a power bar, extension cord or power center to provide a convenient set of "smart" outlets that switch on when the master appliance is powered (turn on the computer monitor and the computer, printer and other peripherals come on as well). Automatic Load Sensing Power Switch Circuit Diagram Parts List: Notes: This circuit is designed for 120V operation. For 240V operation, resistors R2 and R6 will need to be changed. A maximum of 5A can be used as the master unless the wattage of R1 is increased S1 provid...