Chapter 1003: In addition to electricity, there is also agreement (first chapter)
Considering that this thing can even realize bus transmission, multiple sensors can be connected to one line, which greatly saves the number of interfaces of the acquisition equipment and simplifies the system structure.
What is this? This is money!
"Old classmate, you are amazing!"
Gao Zhendong smiled. How could it not be amazing? The Citi Electronics Industry Association carefully selected it. It is trustworthy! But they haven't formulated it yet. So I, Gao, will accept it on behalf of my comrades in industrial control in China.
He also gave Xue Chongli a direction: "If you have any requirements for components during the research process, you can contact the 1274th Ministry of Machinery. Especially the 1218 and factories. If you have any requirements, you can also import some."
In general, it is not difficult to build an RS-485 circuit using discrete components. The main trouble lies in determining the appropriate specifications. Once the specifications are determined, implementation is not that difficult.
"Okay." Xue Chongli knew what Gao Zhendong meant. With his endorsement, it would be easier for him to get his words from the 12th Ministry of Machine Building if he went to find someone.
"This is the hardware interface. As for the software interface, here, take a look at this. You are responsible for implementing this transmission protocol in the microcontrollers at both ends."
This has already involved the bus and transmission protocol, and it cannot be done without a microcontroller. In fact, many digital sensors can be seen as analog sensors with a microcontroller added. After converting the acquisition parameters into digital numbers, they are sent to the next level through the digital interface, such as to the data acquisition and transmission equipment here.
Gao Zhendong did not choose the ModBus protocol which became extremely popular in industrial control decades later, but chose a very niche protocol that is widely used in water conservancy.
SDI-12 is a transmission protocol based on ASCII code. Except for the need to perform timing operations of level rise and fall on the transmission line to ensure no conflict due to bus reasons, everything else you can see is ASCII code. You can read the data packet directly at a glance.
Of course, the current ASCII code is not called ASCII code. It is called "direct reading data exchange code" in the country.
Compared with ModBus, the biggest advantage of SDI-12 is that it is much simpler. It does not have as many modes and complex regulations as ModBus, and is very convenient for simple data transmission. Since it uses ASCII code transmission, its representation accuracy is almost infinite, and the data packet is extremely concise. Although the original SDI-12 has a problem, its sensor address is represented by only one ASCII code and the address capacity is limited, but the sum of '1'~'9', 'A'~'Z', and 'a'~'z' is actually enough.
Xue Chongli also kept up with the progress of computer development. Looking at the protocol description document Gao Zhendong gave him, he praised it highly: "Well, this is good, simple and clear, and the data packet is not large."
The data packet is not large, which is very important in that year. The running memory of the microcontroller is calculated in bytes. Every comrade who works on microcontrollers wants to split it in half, but it is not as arrogant as a few decades later when the on-chip RAM is calculated in KByte.
SDI-12 does not use the common TLV (Topic-Long-Value) structure because it is too long. Its sensor response data is roughly like this.
"1+12345.6!", a pure ASCII string.
'1' is the sensor number, the '+' sign can be either positive or negative, followed by the sensor value, and '!' is the end character. It's that simple.
For Xue Chongli, the entire set of SDI-12 transmission protocols is actually quite simple. The trouble is to operate the RS-485 bus to implement the timing signals on the signal line to complete the entire process of starting, handshaking, transmission, and ending.
"The data transmission itself is very simple, but the timing signal is a bit troublesome." Xue Chongli said, but he also knew that this was already the simplest, and his old classmate had tried his best to eliminate unnecessary complex functions in this regard.
Gao Zhendong nodded: "Yes, but you can start with something simple. Even on this remote serial bus, you can first implement data transmission, timing signals and so on, and leave it for later."
"Is this okay?" Xue Chongli, who has not yet conducted in-depth research on SDI-12, does not have a deep understanding of this thing.
"Yes, actually the data transmission part can be taken out and used separately. Anyway, your sensor to data acquisition terminal is in master mode, which can actually save a lot of handshake and conflict handling processes. You can make a subset first, and then make the full set."
In fact, the simplified version of SDI-12, or even the pure data transmission part after cutting off the hardware handshake regulations, was later widely used in soil, water conservancy, environmental protection, meteorology and other fields, because it was originally formulated by the Citi Environmental Protection Bureau.
To other comrades, their conversation was a bit like listening to a foreign language, but Xue Chongli seemed to understand Gao Zhendong's words a little bit.
"Can handshake and conflict handling be omitted in master-slave mode?"
Gao Zhendong nodded and drew a bus connection diagram for the master-slave mode.
"Look here. In this mode, only the data acquisition transmitter as the host can initiate communication. Other sensors will only initiate communication after receiving inquiries to themselves. In this way, handshake and conflict handling are much simpler. There is almost nothing to deal with. The only thing that needs to be handled is the address query command. Don't let all sensors reply to the address at the same time. In this case, you can even disable the address query command on the host side."
Gao Zhendong's habit of making do with what he can comes back again. The technical conditions these days are limited, so he has to save on some things if possible and leave some room for upgrades.
"Well, it's much simpler this way. I'll wait until I have enough experience and ability, and then I'll go further." Xue Chongli is not stupid. After Gao Zhendong explained this, he knew what he should do. "Right, you can first make a 1.0 version, and then improve it to 1.1, 1.2 and higher versions. Just pay attention to maintaining backward compatibility, so that the things you have made before will not be wasted."
"Okay, when I get back I will immediately ask the leader to organize a team and get this thing done." Xue Chongli was full of confidence.
Director Hou also expressed his opinion in time: "Yes, we will ask the institute to strengthen its forces when we return, and develop this system as soon as possible, and strive to use the first batch in key reservoirs, dams, and dikes within half a year."
Half a year... Gao Zhendong thought about it and nodded: "Well, it's okay, no more than half a year. You don't have to start with digital sensors. For your purposes, the accuracy of 4~20mA is sufficient. For most sensors, this thing is cheaper and simpler."
Xue Chongli wrote it down. This was very timely, but there was a new problem.
“可是4~20mA是支撑不了总线结构的,这样一来,对采集器上的4~20mA通道数量就有了新要求啊,A/D转换可不便宜。”4~20mA那是用一路就要多一路接口,一台采集器上至少要2~4路这种接口才够用。
Gao Zhendong shook his head. "One A/D converter is enough. You can use digital circuits to control multiple relay switches to ensure that only one of the multiple interfaces enters the A/D conversion circuit at the same time. The interface doesn't cost much. For example, if you use a 3-8 decoder circuit chip, you can control up to eight analog acquisition channels through three IO ports, and you can ensure the uniqueness of the channels."
Originally, Gao Zhendong wanted them to ask 1218 to look at the solid-state relay, but considering that the electrical performance of the solid-state relay is not as good as that of the electromagnetic relay on this issue, he gave up.
As Gao Zhendong was so proficient in these aspects, Xue Chongli truly felt the gap between himself and his old classmate.
"Ah, I see. Well, I'll think about this carefully when I get back."
"Well, okay. I believe you can figure out these details if you spend some time thinking about them. Next, let's talk about Shui Yuqing."
Director Hou has a much greater say in this matter. Before coming here, he had specifically communicated with the hydrologists in the institute. When the hydrologists heard that there was a way to obtain rainfall data in a very short time and at a lower cost, their interest reached its peak.
The rainfall data they are using now, in addition to the rainfall data from the nearby hydrological station and occasionally the Meteorological Bureau, is manually observed on the dam.
However, this kind of data is not enough for them, especially the larger the reservoir, the larger the catchment area of its basin. At this time, it is only the rainfall data of one point on the dam, which is of little significance for hydrological information forecast and is too sparse.
The hydrological station itself is a very expensive facility and it is impossible to build it everywhere.
Director Hou still remembers the words of the comrade in charge of hydrology: "If we can get the rainfall data of each point in the basin within a few minutes, our reservoir dispatching will enter a new chapter."
So what he was most interested in was rainfall.
"Mr. Gao, our colleagues in the hospital are very interested in the rain gauge. Could you please tell us about it first?"
Gao Zhendong had no objection. After all, the data collection and transmission equipment had already been explained, so he could choose any of the remaining water and rainfall sensors.
"In water conservancy, my suggestion for unmanned automatic monitoring stations is to use a tipping bucket rain gauge."
"A tipping bucket rain gauge? It's something like a siphon rain gauge."
Gao Zhendong shook his head: "It looks like it, but the measurement principle is completely different."
The self-counting rain gauge sounds good, but it actually collects rainwater and combines it with a float, which drives a pen to draw a rainfall curve on a graph paper driven by a spring. When the water collection cup is full, it is automatically emptied by the siphon principle, and then starts again from the bottom of the vertical axis of the graph paper.
This is already considered advanced equipment these days, and there are also those that rely purely on manual observation.
"The siphon rain gauge has a problem, it is not intuitive, and it is not possible to directly get the accumulated rainfall. The tipping bucket rain gauge can solve this problem by automatically counting through the collection device."
(End of this chapter)