The OSI model forms the basis of modern communications systems. It uses the concept of layers to explain and formalize the discrete steps in the process of sending data from source to destination.
Basic OSI Model
A complete explanation of this model is far beyond the scope of a single post here, and you should feel encouraged to read further. That said, the basic idea is that a message will begin at the Application layer (software), filter down through the stack to the Physical layer (the cable or radio wave), then bubble back up through the same stack on the destination device. Don't worry, we'll look at some examples. While not cast in stone, the OSI model nevertheless gives us a useful means of describing a communications system through all necessary steps of data transfer. That's important because anything that can be properly and completely described can then be designed into a specific application. Rabble rabble! Enough talk! Let's look at some examples. RS-232 is a simple, point-to-point, serial communication topology. It is the first type of communication that most electronics hobbyists and students will learn due to its basic wiring (3 conductors), low data rates and short transmission distances. While these features are often seen as limitations in the professional communications world, these same qualities make it ideal for a beginner to understand and employ in a project. This is how the RS-232 implementation of the OSI model might look.
Notice that the bulk of the work is handled by the Application layer. This is the software program directly controlling the COM port on your computer or embedded device such as an Arduino. You would handle any translation, scaling or message packetization (breaking one large message up into many smaller ones) in software. Your data then is placed in a device called a UART, which in turn directly controls the serial port itself. RS-485 is strikingly similar to RS-232, with two primary differences: the use of a multidrop wiring scheme and the master/slave relationship. We'll save the detailed discussion for later posts, but for now the fact that all devices share the same communications bus is sufficient for our discussion here. Its implementation of the OSI model might look something like this:
Note that we have an additional layer, Addressing. This is necessary because as we already saw, all RS-485 devices on a network share the same communications bus. They will all see the same data sent from the master device. We need some way to specify which device is intended to receive, process, and potentially respond to the message we're sending it. To follow the message through the process, your software would first determine the message to be sent (Application), attach an address to it (Addressing), then send to the UART which will transform it into electrical pulses on the cable. All slave devices will receive the message, but all but one will see an address mismatch and discard the message. Only one will see that its Address matches, so only our intended target device will respond to the message. Remember, while the OSI model itself is well documented, it is not a set of iron clad rules that must be followed in every application. It is simply a tool to allow an engineer to conceptualize the process of sending data from one device to another. By design it includes layers, capabilities and processes that do not apply to every implementation. We'll continue this discussion in Part 2.