A three-wire data measurement method for linear networking

Publisher:hzx312895379Latest update time:2014-01-08 Source: dzsc Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  0 Introduction

In   field

  (1) The interval distances are different. For example, the flow pressure of an oil pipeline can be monitored at a distance of 1 km; the damage monitoring of urban street lamps can be monitored at a distance of 25 m.

  (2) The transmission rate requirement is not high. For example, monitoring of whether street lights are damaged or the inclination of coal mine tunnels can be done every few minutes, and water quality and temperature information along rivers can even be done once an hour.

  (3) The physical order of the measuring points can be used as the logical order of the monitoring points. It is sufficient to detect the data of each point in sequence. It is not required to transmit the data of a certain number separately.

  (4) There are a large number of measuring points. For example, there are 400 monitoring points for a 10 km long street light.

  For these linear distributed measuring points often encountered on site, if a bus-type networking structure is adopted, the wiring form can be greatly simplified, and all measuring points can be connected to the bus. In fact, there are many such buses to choose from, such as CAN bus, 485 bus, IEEE1394 bus, Profi-bus bus, HART bus, and even devices with their own bus, such as the digital temperature sensor DS18B20. However, these solutions are not tailored to the above data characteristics. Some pursue high reliability, some pursue network speed, and there are also problems such as high cost, complex protocol, and the need to address each measuring point [3]. Therefore, this paper proposes a three-wire networking solution for linear measuring points based on a single-chip microcomputer. It has the characteristics of self-contained power supply, simple protocol, and flexibility, which can greatly simplify circuit design and system design.

  1 System composition and principle

  1.1 Hardware composition

  1.1.1 Overall system composition

  The structure of the three-wire measurement system is shown in Figure 1. It consists of a host and several units. The three wires are defined as power, signal, and ground. The host can control the power supply of the unit, which is completed by switch J1, which can be a hard contact of a relay or a soft contact of a VDMOS tube. When the host needs to collect data, first close J1 to power on all units, and then control each unit to upload data in sequence through the signal line R/T. Among them, 1, 2, ..., N represents N measurement units.

  

  If analog signals need to be transmitted, an analog signal bus must be added. The unit structure is shown in Figure 2.

  

  1.1.2 Unit Structure

  The internal composition of the unit varies according to the measurement parameters. Here is an example of tilt measurement using a tilt sensor, and the schematic diagram is shown in Figure 2. The power-on measurement is performed automatically. After completion, it waits for the input terminal R to receive the start pulse, and then enters the unit data transmission. During this period, the unit is directly connected to the host. When the unit data transmission is completed, it waits for the end pulse of the input terminal, and then the unit sends a start pulse to the next unit. Subsequently, the unit enters the transparent transmission (or microphone) mode, which is equivalent to direct connection. The host can communicate with the next unit, and so on.

  In the schematic diagram of the unit structure, two analog signal lines are added because the tilt sensor has both digital output (through the SPI interface) and analog output (through the Vf terminal). If you want to directly collect the analog quantity of the unit, add an analog switch and an analog signal bus. When the unit is in working state, close the analog switch and send the analog quantity to the bus. [page]

  1.2 Working Principle

  When the host starts a data acquisition, it first closes the switch J1, the bus VCC is powered, all units are powered on at the same time, and the microcontroller in the unit starts working. The unit's work is divided into three modes: standby, working, and transparent transmission. After power-on, all units enter the standby mode. The host first sends a start pulse to the nearest 1# unit. The 1# unit changes from "standby" to "working" mode. It will start the sensor and light up the indicator light L1, indicating that the unit is active. At this time, the host can communicate directly with the 1# unit and command the 1# unit to measure and read data. After completion, the host sends an end pulse to command the 1# unit to end the active state. The 1# unit enters the transparent transmission mode after sending a start pulse to the 2# unit. Therefore, after receiving the start pulse sent by 1#, the 2# unit becomes the active unit, lights up the indicator light L1, and enters the working mode. Due to the transparent transmission function of unit 1#, the host can communicate directly with unit 2# until unit 2# receives the end command, it starts the next unit, and then becomes transparent transmission itself, and so on. Each unit becomes an active unit one by one. The host always communicates directly with the active unit through the unit that has become transparent transmission mode to obtain data until all units have completed data collection.

  Therefore, in the entire three-wire network, there is only one active unit. In front of the active unit is the unit that has completed data collection and turned into transparent transmission mode; behind the active unit is the standby unit waiting to start. The host can directly contact the active unit and use flexible agreed protocols and rates, which is a major advantage of the three-wire linear networking proposed in this article.

  When the host communicates with the active unit, the serial communication mode of the microcontroller can be used directly. When the amount of data is small, a lower baud rate can be used to obtain a longer transmission distance. The pulse command used to start and stop the unit can have two forms:

  (1) Directly use serial communication to change the working mode of the unit. Just agree on the serial data command word sent by the host to the unit. For example, agree on 0X55 as the start command and 0XAA as the stop command. (2) Use pulse width control. As long as the command pulse and the communication baud rate communication pulse are clearly different and do not cause confusion, for example, the baud rate is 1200, and the start and stop pulses use a low level with a width of 30 ms.

  1.3 Characteristics Analysis

  To summarize the above, the three-wire linear networking proposed in this paper has the following characteristics:

  (1) Self-contained power supply: one of the three wires is a power line, and all units can be powered directly; (2) Low power consumption: During operation, only one unit is active. The unit in standby and transparent transmission mode can turn off the power supply of the sensor under its jurisdiction, leaving only the microcontroller powered. If the MSP433 ultra-low power microcontroller is used, the power consumption of 100 units will not exceed 1 mA.

  (3) Flexible protocol: The host communicates directly with the active unit through the transparent transmission unit, allowing the system builder to use the communication protocol agreed upon by himself; (4) Long transmission distance: The host communicates with each unit through relay. As long as each unit can effectively transmit, the entire system composed of multiple units can work normally.

  (5) Easy expansion: When analog quantity transmission is required, just add another bus, add an analog switch to each unit, and the active unit closes the analog switch. The analog quantity of the unit can be uploaded to the bus and sent to the host.

  (6) No unit numbering required: The host establishes connections with each unit sequentially. All units are exactly the same, and there is no address numbering link, which is suitable for mass production.

  2 Programming

  Below is the programming flow and instructions for the host and units.

  The host program flow is as follows:

  ①Power on→②Wait for the acquisition time to expire→③Start the power switch J1→④Issue a start command→⑤Wait for the unit to send back a response→⑥Communicate with the unit to complete the acquisition→⑦Issue an end command→⑧Determine whether the unit has completed the acquisition→⑨Turn off the power supply of J1→Return to ② and wait for the next acquisition.

  Among them, if the confirmation sent back by the unit is not received in step ⑤, it is necessary to disconnect J1 and return to step ③ to start again. If multiple repetitions are unsuccessful, error processing is required. In step ⑧, if the unit collection is not completed, it is necessary to return to step ⑤ and wait for the reply confirmation of the next unit.

  For low-frequency situations where data is collected only a few times a day, a low-power timing oscillator can be used to control the CPU power supply of the host computer with a hardware circuit. The host computer will only be powered on once when the data is collected, which greatly reduces power consumption and is suitable for data collection in the field.

  The unit procedure flow is as follows:

  ①Power on→②Wait for the start command→③Start the sensor to collect data/light up L1/communicate with the host/complete data collection→④Wait for the end command→⑤Send a start command to the next unit→⑥Enter transparent transmission mode.

  The programming block diagram of the transparent transmission mode is shown in Figure 3, and the idea is as follows:

  (1) Transparent transmission means that data can be transmitted from the receiving host to the subsequent unit, and data can also be received from the subsequent unit and transmitted to the host. (2) The normal state is considered to be a high level, and the levels on the left and right sides are continuously detected. When it is high, it means that there is no data transmission.

  (3) No matter in which direction a low level is detected, the low level is immediately transmitted to the other direction until the low level disappears, and then the low level in the other direction is canceled.

  

  3 Transmission distance

  The transmission distance is affected by two factors: the pulse width distortion introduced by the transparent transmission unit and the unit voltage drop, which are discussed below.

  3.1 Distortion of pulse width by the transparent transmission unit

  The transmission delay between units is shown in Figure 4. The command is transmitted from the N-1 unit to the Nth unit, issued at time t1 and ended at time t2, with a width of T1. The line capacitance and other factors cause the pulse to fall and rise. The flip time recognized by the Nth unit is determined by the input threshold of the unit, and the width it recognizes is T2. Similarly, this width is recognized as T3 when it is transmitted to the N+1 unit. There will be differences among T1, T2, and T3, resulting in step-by-step distortion of the pulse width. If it exceeds a certain limit, it will not be able to communicate correctly (the 11.059M crystal dedicated to the serial port will not work if it is replaced by 12M, and the error is only 8% at this time). There are two ways to solve step-by-step distortion:

  (1) To speed up the pulse rise and fall time, a pull-up resistor can be added to the signal line of the unit. The minimum value of the pull-up resistor must ensure that the current it injects is less than the maximum current that the microcontroller can absorb; the maximum value of the pull-up resistor must take into account that the time constant between it and the signal line capacitance is less than 10% of the communication pulse width. For example, for a unit distance of 100 m, according to the distributed capacitance of 100 pF/m of ordinary twisted wire, C = 100 pF×100=0.01 μF, if a baud rate of 1200 is used and the signal pulse width is 800 μs, the time constant should be less than 80 μs. Using τ = RC to calculate, the pull-up resistor R = τ C = 80 μs /0.01μF = 8 kΩ. According to experience, this value can be used for microcontroller pull-up. [page]

  (2) Intelligent identification method: the transparent transmission unit does not directly forward the level value, but after receiving the entire byte or pulse, it determines what data or pulse it is and forwards it to the next unit at the agreed baud rate or pulse width. This ensures that there is no accumulated pulse distortion.

  In fact, due to the consistency of the units, the cumulative error is not large. At a baud rate of 1200, using a 1 kΩ pull-up resistor can easily achieve cascading of hundreds of units with a unit spacing of 10 m.

  

  3.2 Power supply reduction and ground voltage drop caused by power consumption of each unit

  The impact of supply voltage reduction and ground voltage drop is discussed in three aspects.

  3.2.1 Reduction of remote unit supply voltage

  The farther away from the host, the lower the unit power supply. Assume that the distance between the first unit and the host is L1 m, the distance between each unit is L2 m, the total number of units is M, the current of the standby unit is I1, the current of the working unit is I2, the host power supply voltage is VCC, and the resistance per meter of the bus is r, then the voltage of the Nth unit VN = VCC - L1*r*[(N - 1)*I1 + I2] - L2*r*[(N - 1)*I2 + (N - 2)(N - 1) 2].

  When L1 = 100 m, L2 = 10 m, M = 100 units, I1 = 10 μA, I2 = 10 mA, VCC = 5 V, resistance per meter r = 0.01 Ω (cross-section 1.5 mm2 wire), the voltage obtained by the last unit N = 100 is 4.8 V, which does not exceed 5% fluctuation. It can be determined that this voltage is within the normal range.

  The above is the case of 100 units with a distance of 1,000 m, which has certain representative significance.

  3.2.2 Logic level differences between cells

  It is generally believed that in a TTL system, an unstable state will occur when the low level is higher than 0.5 V and the high level is lower than 3.5 V. When there is a pull-up, the low level problem is mainly considered, and the low level of the latter stage must be superimposed on the ground line voltage drop as the low level of the previous stage. Obviously, the maximum superimposed voltage appears between the first unit and the host. Under the above parameters, this superimposed voltage is about 100 m of the line plus the active current plus the standby current of 100 units, which is about 10 μA×100+10 mA=11 mA. The voltage drop generated in the 100 m line is 11 mA×0.01 m=11 mV, which is very low and can be ignored.

  3.2.3 Errors caused by adding analog signal buses

  The analog voltage reaching the host will be added with the voltage difference of the ground wires between the units. There are two ways to solve this problem. One is the correction method, which is to subtract the ground voltage difference of the units passed by according to the number of units sampled.

  For example, when sampling the 10th unit, the superimposed voltage is 100 m×0.01 Ω×11 mA+10 m×10×0.01 Ω×11 mA=22 mV. When the host samples the voltage, this value can be subtracted to approximately be the accurate voltage. The second is to use two-wire differential signal transmission. After two analog switches are selected, not only the analog signal of N units is transmitted, but also the ground wire of N units is transmitted to the host. After the differential amplifier of the host, the actual analog signal of N units is taken out, as shown in Figure 2.

  3.3 Power supply mode

  In the above diagram, the host power supply VCC is directly connected to each unit, which will cause voltage drop at a long distance. Two solutions can be used to avoid this: one is to add a turn-off DC/DC voltage regulator module to each unit, and the selected unit turns on the module to only power this unit. The advantage of this is that the standby unit does not start the DC/DC module and does not increase any power consumption. The disadvantage is that the cost is slightly higher; the second is to use a higher voltage power supply, such as 12 V, and each unit is set up to linearly step down to 5 V for use by the microcontroller and sensor. The advantage of this is simplicity and low cost, but the disadvantage is that the step-down circuit of each unit is continuously working, which will increase the static current.

  4 Conclusion

  The networking method proposed in this paper is very suitable for linearly distributed measurement points. It is convenient, practical, simple and easy to use. It can achieve a long transmission distance in low-speed situations and can also expand the transmission of analog signals. After being used in multiple projects, it has been proved that it is stable, simple, inexpensive and has certain practical value.

Reference address:A three-wire data measurement method for linear networking

Previous article:Design and implementation of Ethernet card reader based on W7100
Next article:LED Indoor Lighting Control System Based on Single Chip Microcomputer

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号