Modification of 4-20mA two-wire passive digital display meter Part 12 (Work submission)
[Copy link]
Add Bluetooth remote control setting circuit to 4-20mA two-wire passive digital display meter
Author:7905
1. Introduction
First give the final working effect photos of the work:
The work of this project is in the upper left corner of the photo: The RSL10 module is plugged into a homemade optocoupler isolation circuit board, which is then connected in series with the modified target instrument ( 4-20mA two-wire passive digital display) and then connected to the 4-20mA current loop of the measured signal source which is also the power supply. When the zero current is 4mA during actual operation , the target instrument displays 4.000mA in current mode ; the overall voltage drop of the work circuit board is 2.513V ; send a range change or unit setting command to the RSL10 on the work circuit through the mobile phone APP , and the target instrument (currently its own voltage drop is more than 1V ) will be changed by the Bluetooth remote control to change the setting status, such as switching to different ranges or different units of the measured physical quantity.
2. System Block Diagram
Schematic diagram of the overall application of the project:
In actual industrial field applications, various 4-20mA two-wire sensor transmitters normalize the measured physical quantity and transform it into 4-20mA current, and then send the corresponding voltage signal to the industrial computer or PLC through the sampling resistor for subsequent control processing; in order to facilitate human-computer interaction, a large number of digital display instruments that can display the measured loop current or the physical quantity corresponding to the current in real time have appeared on the market - that is, the target instrument to be modified in this project: 4-20mA two-wire passive digital display meter. Most of these instruments can be set up and changed through their own buttons. The instrument I want to modify needs to be connected to the computer and modified and set up through dedicated PC software. With the help of this RSL10 application competition, I want to transform it into a function that can be modified and set up on the spot through the mobile phone Bluetooth APP .
The goal is simple and clear to describe, but the realization also requires the evaluation and demonstration of the overall plan to ensure that the goal is achieved. At present, among all the Bluetooth modules I have encountered, the RSL10 has the smallest package volume ( the SIP51 package is as small as 8*6 mm), and the operating voltage is as low as 1.1V. The specification book states that the RX peak current is 3 mA at 3V . It is undoubtedly the best choice in the industry for this project application. According to the most straightforward circuit design thinking, the RSL10 circuit is connected to the original instrument circuit, and the Bluetooth command is directly converted into an IO port line to control the programming port of the original instrument for setting, as shown in the following scheme 1:
After receiving the development board and getting familiar with it for a while, I did an experiment on the power consumption of the RSL10 Bluetooth online listening standby mode: when powered on and not connected to the APP , the standby power consumption is about 1.1mA . The measured minimum working drive current of the target instrument is 2.8mA (it can still be displayed). In theory, it seems to be connected, but after actually connecting them together and integrating them into one, 4mA is directly applied , and the instrument can't light up. Judging from the characteristics of the microcontroller at the moment of startup, the instantaneous current will far exceed the normal value. It is probably strange that this circuit with two microcontrollers and three cores ( RSL10 contains dual cores) can work at 4mA . This road is blocked. The next idea is to imitate the target instrument to take power from the loop bus to boost the voltage to form its own circuit power supply (relative to the target instrument, the circuit is modified at the rear), or to generate a negative voltage power supply (relative to the target instrument, the circuit is modified at the front). The purpose is to "even" the two sets of circuit power rails to meet the communication requirements. The scheme diagram is as follows:
If you think about it carefully, there is a hidden risk: the characteristic of drawing power from the measured current determines that the output voltage drop of the power will fluctuate as the current changes. The measured target instrument has a voltage drop of about 1V at low working current (its internal circuit increases to 2.8V+ ). If you make a power supply system yourself, whether it is the voltage reduction in the front circuit of the original instrument or the voltage increase in the rear circuit, it is impossible to achieve the same reference level point for the two independent power supplies, which will cause the level reference of the IO port lines of the two communicating parties to be misaligned, causing the risk of a sharp increase in current, and this road is also blocked. The key point of the problem is that the two sets of circuits must communicate, and the level reference at both ends of the communication port line cannot be kept stable, so we can only find a communication method that does not rely on the unified reference level, so we think of solution three, as shown in the figure:
This is also the final choice of this project. It can be seen that no matter whether the modified circuit is pre-placed or post-placed, there is no need to worry about the fluctuating ground voltage difference with the target instrument. This is the process of choosing the method of communication through optical coupling to avoid current short circuit; keen on adhering to the simple and effective principle of "do not increase entities unless necessary", after deciding to use optical coupling communication, the power supply of some circuits does not need to be stepped up or stepped down. Only the forward voltage drop generated by a simple silicon diode in series is used as the working power supply, and even the LDO is saved. As long as RSL10 can drive the optical coupling under limited current, it will be fine. Such a plan seems so simple that it seems to have no design. The "humble" periphery can also achieve the "high" circuit function, which obviously relies on the excellent performance of RSL10 integration. Hardware implementation schematic diagram:
The software consists of two parts: the mobile phone side and the RSL10 side. The RSL10 program directly uses the peripheral_server_uart in the official example , but changes the Bluetooth name to
" RSL10_Jul05_7905 ", the serial port baud rate is changed to 2400 , and the rest remain unchanged, so there is no need to draw a block diagram; the mobile phone software is compiled using the Chinese E4A object-oriented programming , and the block diagram is as follows:
3. Functional description of each part
The interface of the instrument's host computer configuration software is as follows:
From the interface, it can be seen that the software first has a function area for setting the range size and physical unit. Other serial port settings and instrument calibration, reset, etc. are ignored for the time being (used for factory calibration or calibration of instruments before leaving the factory). This project only aims to change the instrument's range size and physical unit settings through Bluetooth remote control. Clicking the drop-down list in the upper left function area of the software displays the following:
The default display is current, so the start and end values are automatically filled in as 4 and 20. In this state, the instrument is a 4-20mA ammeter. If other units are selected, such as KPa , the zero point and full scale value of the instrument can be set by yourself. After filling in, click the "Download Settings" button below, and the new state will be written and saved in the instrument, such as 0-100KPa , etc.
The corresponding relationship between specific array elements and range values or units in the data sent by the original PC setting software can be obtained through the following tabulation and observation method:
It can be seen that the array element corresponding to the unit is the fourth byte; the seventh and eighth bytes are the range, and the seventh byte is the high eight bits. Data acquisition is to open two serial port software, one is the original configuration software to send data, and the other software receives it. In this way, any information of interest can be sent and "intercepted" through the different "special point" configuration results of the sending software through the "download settings". The high and low level signals under the two power supplies are transmitted by the optocoupler isolation as shown below:
In the figure, " 2V-IO-2 " represents the sending port of RSL10 , and " 3.3V-IO-2 " represents the receiving port of the microcontroller on the target instrument.
The mobile APP interface is relatively simple, and the meaning is self-explanatory. The interface is as follows:
4. Source Code
Because the RSL10 code directly adopts the official routine, only two related name and baud rate changes are made, so the source code is not listed. The mobile E4A program source code is always in the "unreviewed" state when it is uploaded to the specified address according to the submission suggestion, so I plan to upload the document separately with this submission post. Please see the attachment.
5. Demonstration video of the work’s functions
Final function demonstration video address:
1. 2021 ON Semiconductor RSL10 Application Competition - Digital Display Meter Renovation Project Completion Video - RSL10 Bluetooth Module Power Consumption Test - EEWORLD University Hall
2. 2021 ON Semiconductor RSL10 Application Competition - Digital Display Table Renovation Project Final Demonstration Video_Bilibili_bilibili
Video introduction: In the video, I used three auxiliary instruments, a keyed constant current output current source meter, an ammeter, and a voltmeter. The positive output of the current source meter first passes through the series ammeter (used to observe the total circuit current), then connects to the self-made optocoupler isolation board + RSL10 combination circuit of this project, and then connects to the target instrument in series and returns to the negative pole of the current source meter; the voltmeter is connected across the input and output power supply of the self-made circuit to observe the working voltage drop value of the actual circuit under different loop currents. The target instrument is usually initially set to current measurement mode, so the loop current value is displayed as soon as it is powered on. The current source output value is changed. First, the midpoint of the measurement is passed, that is, 12mA , to see the target instrument indication value, then it rises to the full-scale value of 20mA to see if the indication value is accurate, then returns to the midpoint, and then returns to the zero point of 4mA ; the second round of demonstration is to change the target instrument to 500KPa pressure measurement status through the mobile phone APP . After the change is completed, the zero point value display changes from 4 ( mA ) to 0 , the midpoint value display is close to 250 , and the full-scale value is close to 500. After returning to the midpoint and back to the zero point, the third round of demonstration changes the range to 100 and the unit to Celsius. After writing to the instrument, verify the 0 , 50 , 100 ( within 0.3 % ) Celsius displayed under zero, mid, and full-scale currents ; the last round of demonstration is to directly click the mA option in the APP drop-down list , and it can be seen that the range value is automatically filled back to 20 After the data is written into the instrument successfully, the instrument returns to the measuring and displaying ammeter state.
6. Project Summary
From the beginning of the project to the first half of the project, I always thought that the focus of the project was on the power supply processing and communication method selection of the modified circuit. If these two verifications were passed, the project would be completed. The prerequisites and necessary conditions are all met: the original computer host setting software is available; the target instrument is available normally; the RSL10 module hardware is ready-made, the routines are ready-made, and the development tools are complete; the power consumption of RSL10 itself is also satisfied: " Supply Voltage Range: 1.1 3.3 V ; Peak Rx Current = 3.0 mA (3 V VBAT) ", and the overall prediction should be able to achieve the goal. In fact, before the PCB was put into production, I had used related components to build a scaffolding and welded to do a simulation circuit test: using 5 silicon diodes in series to make a voltage drop to take power to the RSL10 module, and using an optocoupler for isolation to send data to the computer, there was no problem. After the board was made, I couldn't wait to let RSL10 send data to the instrument through the homemade optocoupler isolation board according to the data intercepted from the original PC software serial port of the instrument, but there was no response. The progress of the project was brought back to square one step by step: I suspected the optocoupler problem, the unstable power supply of the bus power supply, the distortion of the data waveform after isolation, etc. I tried various ways to deal with them one by one, but it didn't work. I remembered what Hua Luogeng said, "Be good at retreating, retreat enough, retreat to the most original place without losing the importance" - let's do the experiment again step by step, so there were later posts on doing basic experiments, isolating the data level, isolating the data byte, and even letting the MEGA88 microcontroller used for simulation receive the "original" intercepted data sent by isolation to determine whether there is an error, no problem! I was confused about the transmission protocol, not knowing whether it was a software or hardware problem. During the process, there were some "weird" phenomena that I had never encountered before: the computer simulation serial port also failed, sometimes it did not receive data, and sometimes it did not work even though the baud rate was clearly set. After setting it to any receiving baud rate, the data sent could be received and displayed correctly. I still don't understand what went wrong; later I simply changed a computer to do the experiment to avoid this big pit! After changing the computer, the serial port was "trusted", and I did another experiment: let the computer use the original host computer software to send data to change the instrument settings, which was normal, but using other serial port software to send the same intercepted data did not work, no response! The baud rate is the same, and two serial port host computer software are opened at the same time, one receives data, and the other exchanges the test by sending the same data from the original host computer and other software. As a result, the received data is indeed the same! Without making a self-made circuit, sending legal data from the computer using other software does not work, and I am stuck. In the depression, I even respect the effect of the original instrument designer's use of anti-piracy technology! Such specific and unproblematic problems really exist. I thought about it day and night but couldn't figure it out. "Without magic, there is no way." I was just letting the computer send and receive data unconsciously, watching the data frames updated on the screen. I don't know when I got a flash of inspiration: I found that the data frames received from the original software seemed slightly different - it seemed to be a little slower. I checked it with an oscilloscope and it was true: there was a little delay between the bytes of data sent by the original software! The truth was revealed! It was really easy to get! The breakthrough point is: let the mobile phone APP add a 100 millisecond delay between each byte when sending data .
The 4-20mA two-wire passive digital display meter is called "passive" because it does not require an external power supply when working in the measuring state, and can maintain the normal operation of its own circuit by relying solely on the 4-20mA signal energy of the measured circuit loop; it is called "two-wire" because as a measuring instrument, its external interface has only two lead wires. When working, it can measure and display the current flowing through the connected circuit by connecting these two lead wires in series. 4-20mA is the signal specification of the industrial field (including civil) application bus that is still widely used in the industry so far - that is, the DC current in the range of 4-20mA represents the size of various physical quantities being measured, such as pressure, temperature, liquid level, flow, material level distance, etc. For example, to monitor 0-100 ℃ temperature change, we can use 4 mA to represent the corresponding low point (zero point) of 0℃, and use 20 mA to represent the corresponding high point (full scale) of 100℃. In this way, a one-to-one proportional relationship is established between the current value and the temperature value. We can calculate the corresponding temperature value according to the size of the electrical signal - the current value. The same is true for other physical quantities such as pressure, level, flow, liquid level, etc. Because this 4-20mA current loop bus method is widely used, a special instrument for measuring and displaying this current loop signal has emerged in the market. Because it is a digital electronic instrument, in addition to directly measuring and displaying the current size, it can also achieve the functions of attached range conversion, unit conversion or range percentage display by changing the settings. Yes, for example, if you originally want to measure and display the pressure range of 0 to 100KPa , you want to change it to measure and display the pressure range of 0 to 1000KPa . According to the principle, the corresponding measured signal has not changed, and it is still 4-20mA current, but the physical quantity value corresponding to each unit current has changed. The instrument can automatically calculate and convert according to the settings to achieve the purpose of directly displaying the size of the measured physical quantity. By extension, you can use the same instrument to measure the water level of 0 to 5 meters deep. Similarly, it can be directly replaced. The only thing to be changed is to change the preset range size or physical unit in the instrument. It can be seen that this type of instrument has a wide range of applicability. In addition, it does not require additional power supply, which is also an advantage. The 4-20mA meter I have is a digital meter with the functions described above. However, if you want to change the range or physical unit setting, you need to take the meter to the production calibration station and connect it to the computer through special software to change the parameters. For various different working conditions, for example, some meters are installed on tall pipelines of industrial and mining enterprises, and some are installed in narrow corners of factory machine rooms. Dust and oil pollution are possible. Many of them are not conducive to close disassembly and installation by staff. Moreover, if you take it down to the office or even take it back to the manufacturer to change the parameters, it will cause the on-site circuit to be disconnected and stopped, and the actual parameter change process is only It is a short process. It only requires connecting to a computer and writing a string of parameters into the instrument. It can be done in minutes, but it takes a relatively large amount of manpower and time to dismantle and install the instrument, which is a waste of effort. Moreover, some working conditions do not allow power outages to support the dismantling of online instruments. For this reason, we can use the resources provided by this competition to conduct an instrument transformation test, and strive to save the useless process of dismantling and installing instruments, and do not need to climb high or drill low on site to change parameters, which is time-consuming, labor-intensive and manpower-consuming. Instead, the staff only need to walk to the vicinity of the instrument and use the Bluetooth remote control of a smartphone to complete the same task, so that the on-site parameter settings can be easily changed online. The application is convenient and the prospects are broad. There are challenges as well. As mentioned earlier, this instrument does not have its own power supply. Moreover, in order to work properly, the power consumption of the whole machine must be less than 4 mA, because the measured signal current, that is, the minimum source of power, must be as low as 4 mA . The instrument's own circuits, including the microprocessor, conversion circuit, and display circuit, all need power to work properly. Even a few microamperes of current are precious. The original instrument circuit design is estimated to have "squeezed out" every bit of surplus energy below 4 mA . It is quite a challenge to add wireless communication function. Finally, it was successfully solved by adopting the optocoupler isolation communication solution, and this passive 4-20mA digital display meter was transformed into a function with Bluetooth remote control setting.
Post sharing link summary:
2021 ON Semiconductor Avnet RSL10 Bluetooth SoC Development and Design Competition First Post
2021 ON Semiconductor Avnet RSL10 Bluetooth SoC Development and Design Competition Second Post ( Initial Modification Routine )
2021 ON Semiconductor Avnet RSL10 Bluetooth SoC Development and Design Competition Third Post ( Revised Routine ) - No pictures, please post again
2021 ON Semiconductor Avnet RSL10 Bluetooth SoC Development and Design Competition 4th Post (Bluetooth Current)
2021 ON Semiconductor Avnet RSL10 Bluetooth SoC Development and Design Competition, Fifth Post (Prototyping and Board Submission)
Modification of 4-20mA two-wire passive digital display meter Part 6 (general schematic diagram)
Modification of 4-20mA two-wire passive digital display meter Part 7 (Software Introduction)
Modification of 4-20mA two-wire passive digital display meter Part 7 (Optical coupler experiment)
Modification of 4-20mA two-wire passive digital display meter Part 8 (hardware photos)
Modification of 4-20mA two-wire passive digital display meter Part 10 (Small task completed)
Modification of 4-20mA two-wire passive digital display meter Part 11 (Process summary)
VII. Others
For colleagues in the industry, it is obvious that the extended significance of this successful transformation is that common two-wire instruments can be simply and reliably upgraded to instruments with Bluetooth communication function through this method, and the upgraded instruments do not need to make any circuit structure changes. Of course, this idea can also be used to redesign a new two-wire 4-20mA Bluetooth instrument that is "separated" by optical coupling and integrated. It has a two-way communication function comparable to HART communication smart instruments, but it does not have to be limited by the actual physical wiring constraints, and does not have to worry about the relevant matters of joining the HART Communication Foundation. In the application, there is no need to purchase an expensive HART communication handheld operator. All you need is a smartphone that everyone has and is not too antique. 2021-7-12
|