Vera Serial Interface Standards
V.28 signals are used in V.24 and in part of V.35 interfaces. RS-232 is essentially equivalent to a combination of V.24 and V.28. Note that the EIA standards have effectively replaced the RS standards and now they have become TIA standards. X.21bis is a standard that incorporates a subset of V.24 but its use is in decline.
RS232 Specifications and standard. RS232 specifications, introduction Communication as defined in the 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. Data transfer can start at any given time and it is the task of the receiver to detect when a message starts and ends.
Asynchronous communication has some advantages and disadvantages which are both discussed in the next paragraph. RS232 bit streams The RS232 standard describes a communication method where information is sent bit by bit on a physical channel.
The information must be broken up in data words. The length of a data word is variable. On PC's a length between 5 and 8 bits can be selected. This length is the netto information length of each word. For proper transfer additional bits are added for synchronisation and error checking purposes. It is important, that the transmitter and receiver use the same number of bits.
Otherwise, the data word may be misinterpreted, or not recognized at all. With synchronous communication, a clock or trigger signal must be present which indicates the beginning of each transfer. The absence of a clock signal makes an asynchronous communication channel cheaper to operate. Less lines are necessary in the cable. A disadvantage is, that the receiver can start at the wrong moment receiving the information.
Resynchronization is then needed which costs time. All data received in the resynchronization period is lost. Another disadvantage is that extra bits are needed in the data stream to indicate the start and end of useful information.
These extra bits take up bandwidth. 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. Start bit RS232 defines an asynchronous type of communication.
This means, that 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. Because the line is in mark state when idle, the start bit is easily recognized by the receiver. Data bits Directly following the start bit, the data bits are sent. A bit value 1 causes the line to go in mark state, the bit value 0 is represented by a space. The least significant bit is always the first bit sent.
Parity bit 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. This is further discussed in.
Stop bits Suppose that the receiver has missed the start bit because of noise on the transmission line. It started on the first following data bit with a space value. This causes garbled date to reach the receiver. A mechanism must be present to resynchronize the communication. To do this, framing is introduced. Framing means, that all the data bits and parity bit are contained in a frame of start and stop bits.
The period of time lying between the start and stop bits is a constant defined by the baud rate and number of data and parity bits. The start bit has always space value, the stop bit always mark value. If the receiver detects a value other than mark when the stop bit should be present on the line, it knows that there is a synchronization failure. This causes a framing error condition in the receiving UART. The device then tries to resynchronize on new incomming bits. For resynchronizing, the receiver scans the incomming data for valid start and stop bit pairs. This works, as long as there is enough variation in the bit patterns of the data words.
If data value zero is sent repeatedly, resynchronization is not possible for example. 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. RS232 physical properties The RS232 standard describes a communication method capable of communicating in different environments.
This has had its impact on the maximum allowable voltages etc. In the original definition, the technical possibilities of that time were taken into account. The maximum baud rate defined for example is 20 kbps.
With current devices like the 16550A UART, maximum speeds of 1.5 Mbps are allowed. Voltages The signal level of the RS232 pins can have two states. A high bit, or mark state is identified by a negative voltage and a low bit or space state uses a positive value.
This might be a bit confusing, because in normal circumstances, high logical values are defined by high voltages also. The voltage limits are shown below. RS232 voltage values Level Transmitter capable (V) Receiver capable (V) Space state (0) +5. +25 Mark state (1) -5.25 Undefined - -3. +3 More information about the voltage levels of RS232 and other serial interfaces can be found in the. The maximum voltage swing the computer can generate on its port can have influence on the maximum cable length and communication speed that is allowed. Also, if the voltage difference is small, data distortion will occur sooner.
For example, my Toshiba laptop mark's voltage is -9.3 V, compared to -11.5 V on my desktop computer. The laptop has difficulties to communicate with Mitsubishi PLC's in industrial environments with high noise levels where the desktop computer has no data errors at all using the same cable. Thus, even far beyond the minimum voltage levels, 2 volts extra can make a huge difference in communication quality. Despite the high voltages present, it is not possible to destroy the serial port by short circuiting. Only applying external voltages with high currents may eventually burn out the driver chips. Still then, the UART won't be damaged in most cases. Maximum cable lengths Cable length is one of the most discussed items in RS232 world.
The standard has a clear answer, the maximum cable length is 50 feet, or the cable length equal to a capacitance of 2500 pF. The latter rule is often forgotten. This means that using a cable with low capacitance allows you to span longer distances without going beyond the limitations of the standard. Senor coconut el baile aleman rarity. If for example UTP CAT-5 cable is used with a typical capacitance of 17 pF/ft, the maximum allowed cable length is 147 feet.
The cable length mentioned in the standard allows maximum communication speed to occur. If speed is reduced by a factor 2 or 4, the maximum length increases dramatically. Texas Instruments has done some practical experiments years ago at different baud rates to test the maximum allowed cable lengths. Keep in mind, that the RS232 standard was originally developed for 20 kbps.
By halving the maximum communication speed, the allowed cable length increases a factor ten! RS232 cable length according to Texas Instruments Baud rate Maximum cable length (ft) 192 500 4800 1000 2400 3000 Error detection One way of detecting errors is already discussed. It is the frame detection mechanism which is used to test if the incomming bits were properly surrounded by a start and stop bit pair. For further error checking, a parity bit can be used. The use of this bit is however not mandatory.
If the existence of wrong bits is rare (when communicating with an internal modem for example) or if a higher level protocol is used for error detection and correction (Z-modem, RAS, etc) communication speed can be increased by not using the parity feature present on the UART. Parity is a simple way to encode a data word to have a mechanism to detect an error in the information. The method used with serial communications adds one bit to each data word.
The value of this bit depends on the value of the data word. It is necessary that both the transmitter and receiver use the same algorithm to calculate the value of the parity bit. Otherwise, the receiver may detect errors which are not present. Even parity Basically, the parity bit can be calculated in two ways. When even parity is used, the number of information bits sent will always contain an even number of logical 1's. If the number of high data bits is odd, a high value parity bit is added, otherwise a low bit will be used.
Odd parity The odd parity system is quite similar to the even parity system, but in this situation, the number of high bits will always be odd. Disadvantages of the parity system The parity system using one bit for each data word is not capable of finding all errors. Only errors which cause an odd number of bits to flip will be detected. The second problem is, that there is no way to know which bit is false. If necessary, a higher level protocol is necessary to inform the sender that this information must be resent. Therefore, on noisy lines, often other detection systems are used to assure that the sent information is received correctly.
These systems mostly do not operate on single data words, but on groups of words. Known coding systems are:. Hamming coding. Literature 1998 published by Dallas Semiconductor—now merged with Maxim—which describes in human readable language all aspects of the RS-232 interface. 2004 published by Texas Instruments about all kinds of practical physical aspects of currently available interface methods, including a line length vs.
Communication speed graph.
The Vera Home Automation Controller is a commercial controller running on its own hardware. It has a rather open plugin architecture and we use it as a testing ground for new controller features. The controller has a history of controlling Z-Wave devices. MySensors is supported through the and.
We keep all the Vera plugin installation instructions on this page. Features. Manages about 70-200 Z-Wave devices (depending on model).
Lots of free 3rd party plugins on their. Free cloud service with backups and remote access. Build in web-browser GUI and 3rd party apps supporting remote access Installing the Vera Plugin Once you have installed the Arduino Plugin, you will register your sensors with the Vera by using the Inclusion mode triggered by clicking on the Start button on the plugin. The default inclusion duration is one minute. When a sensor sends its presentation during inclusion mode, the Vera will add it as a new device on the Vera dashboard. Sensors send their presentation information from the setup method whenever the sensor node's Arduino is reset or power-cycled so you will need to reset your sensor node once you have click the Start button.
The Vera plug-in is compatible with both the Vera 3 and Vera Lite models running UI5 and supports both the Serial and Ethernet Gateways. All you have to do, is configure the Vera plug-in and build either a Serial or Ethernet gateway using the instructions below. First, download the latest Vera plugin files from the MySensors or. Then upload the files to your Vera. Go to: APPS Develop Apps Luup files.
Select ' Choose File' for each device file and then press the ' GO' button to upload the files to your Vera. Finally, create the Arduino Device. Go to: APPS Develop Apps Create Device. Enter ' DArduino1.xml' for the ' Upnp Device Filename' and press the ' Create Device' button. Click the Reload button in the upper right corner of the Vera dashboard to create the Arduino root plugin device. It may take a few minutes for the reload to complete and display the Arduino root plugin device on the dashboard.
Device specific settings and files Some of the sensors requires extra device files and configuration. Make sure to look here if your sensor don't show up correctly on Vera. Upload the device files the same way as you did above with the plugin files.
Barometer (pressure sensor) DBarometerSensor1.json DBarometerSensor1.xml SBarometerSensor1.xml Distance Sensor DDistanceSensor1.json DDistanceSensor1.xml SDistanceSensor1.xml Energy Meter (pulse) TIP: Perform the following steps if you want the vera device to display the correct KWh for your meter. Include your new power meter sensor on Vera. Turn off the sensor. Update the Variable1 value under the new Vera devices advanced tab. Set Variable1 to your meter's current KWh value multiplied by your PULSEFACTOR and save the Vera changes. Now turn on your power sensor. During startup, the sensor will fetch the current KWh from the Vera.
Example: If your pulse factor is 1000 and your meter's current KWh reading is 33211, set Variable1 to 33211000. Rain Gauge DRainSensor1.json DRainSensor1.xml SRainSensor1.xml Scale Sensor (weight) DScaleSensor1.json DScaleSensor1.xml SScaleSensor1.xml Water meter (pulse) DWaterMeter1.json DWaterMeter1.xml SWaterMeter1.xml TIP: Perform the following steps if you want the vera device to display the correct total water volume for your meter. Include your new water meter sensor on Vera. Turn off the sensor. Update the Variable1 value under the new Vera devices advanced tab. Set Variable1 to your meter's current total volume value multiplied by your PULSEFACTOR and save the Vera changes. Now turn on your water meter sensor.
Vera Serial Interface Standards Download
The sensor will fetch the current volume from Vera. Example: If your pulse factor is 100 and the current volume-reading on your meter is is 332. Set Variable1 to 33200. Including New Sensor(s) To add one or more new sensors to your Vera, follow the steps below:. Start inclusion mode on the Arduino Vera device by pressing the 'Start' button. Inclusion mode is normally active for 1 minute.
While the inclusion mode is active, restart each new sensor that you want to include to ensure that it sends the special presentation message to the Vera. Once the inclusion mode ends, you should see something like '2 new sensors found' in the Arduino Vera device. Once inclusion mode ends, your Vera will automatically reload the luup engine if it detected any new sensor nodes. Once the Vera reload completes (1-3 minutes), you should see your new Arduino sensor devices on the dashboard. Restart you sensor again. This create all necessary variables for the new device and will update the sketch name and version information for the sensor node.
Finally, reload the browser tab. Your new Arduino sensor devices should be on-line, connected and reporting data to your Vera! Configuring the Vera Plugin for the Serial/USB gateway NOTE: You must use an Arduino Nano for the USB version of the gateway. The Nano is the officially supported and tested model so if you try a different version, we cannot guarantee that the Vera will recognize it.
Follow the instructions on how to build the. Connect the gateway Arduino to one of your Vera USB ports using a standard USB cable.
If all of the Vera USB ports are in use, then you can plug in the gateway into a USB hub that is connected to one of the Vera USB ports. Next, you will need to configure the USB port communication settings so the Vera can communicate with the gateway over the USB serial connection. Finally, go to: APPS Develop Apps Serial port configuration. See the screenshot to the right. For the Used by device: setting, select the Arduino Gateway Plugin from the menu of available devices.
Set baud rate to 115200. Set the parity to none with 8 data bits and 1 stop bit. TIP: How to fix a serial communication failure Sometimes the Vera will have trouble connecting to a properly configured USB serial device, particularly after loosing power.
Serial Interface Software
Use the following steps to re-establish serial communication with the gateway:. Unplug the MySensors gateway from the Vera USB port. Restart the Vera LUUP Engine (Settings-Z-Wave Settings-Advanced-Reload Engine). Plug gateway into the Vera USB port.
Serial Interface Definition
Restart the Vera LUUP Engine (Settings-Z-Wave Settings-Advanced-Reload Engine). Re-configure serial port as described above (typically, you only need to reset the baud rate to 115200) Configure the Vera Plugin for the Ethernet gateway Open configuration for the Arduino Device and select the Advanced tab. Enter the ip-number:port in the ip field.
This will override any previous serial configuration in the Vera plugin; If you chose to use the default IP address and port defined in the EthernetGateway sketch, enter: 192.168.1 Images.