Design of electronic detection ruler for railway turnout based on digital inclination sensor

Publisher:自由探索者Latest update time:2012-01-05 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Introduction

The electronic detection ruler of the line turnout is an important guarantee for the safety of train operation. Its main purpose is to measure the gauge and levelness of the track, in order to prevent the deformation of the rail state due to the influence of the external environment temperature. In addition, it can also eliminate the adverse factors such as large errors and low work efficiency caused by manual mechanical measurement, thereby further improving the railway safety measures.

The system designed in this paper can measure the levelness and gauge of the track with a standard gauge of 1435mm, and can realize automatic detection and automatic storage. After communicating with the computer through the RS232 interface, all measurement data can be queried and analyzed using special software, and reports can be printed.

System working principle and hardware design

The functions of the electronic detection ruler of the line turnout include two items: gauge and levelness. The structure of the instrument is shown in Figure 1. It consists of a digital inclination (angle) sensor, a high-precision displacement measurement sensor, a single-chip microcomputer and peripheral circuits, a horizontal ruler, a vertical stop, a measuring slider, and a liquid crystal display. Among them, the high-precision displacement measurement sensor and the measuring slider are used to measure the gauge. The track gauge consists of two parts, one is the standard length part s1 on the horizontal ruler (this part is a fixed value), and the other is the measured length s2 starting from point A at the end of the standard length (this part is measured by a high-precision displacement measurement sensor). The total track gauge s=s1+s2. Considering the influence of temperature, the single-chip microcomputer has its own temperature sensor to compensate for the influence of temperature on the measurement data. The digital inclination (angle) sensor on the horizontal ruler measures the horizontality (angle) of the horizontal ruler, and the height difference between the left and right rails can be measured by the angle and the track gauge. The LCD display part displays information such as track gauge, height difference between the left and right rails and time. The relevant data can be saved in the instrument, or read out through the RS232 interface to communicate with the computer to form a summary, and the relevant data can be saved and printed in the computer.



The electronic detection ruler of the line turnout mainly measures the gauge and horizontality of the rail through displacement sensors and digital inclination (angle) sensors. The sensor signal enters the single-chip microcomputer through the RS232 interface and the special function counter. After the single-chip microcomputer calculates the gauge, the two sets of data of the inclination and gauge measured by the inclination sensor are used to calculate the height difference between the two tracks according to the sine function. The single-chip microcomputer compares these two sets of data with the set threshold value to determine whether the measurement point is qualified. The LCD screen displays the output data results, and the keyboard can set the threshold value and the position of the measured point, and has the functions of deleting and saving data. The system design block diagram is shown in Figure 2.

Digital inclination (angle) sensor

The digital inclination (angle) sensor is made based on the principle that the effect of gravity on the fluid causes the membrane potential to change. It is a new type of inertial sensor with the characteristics of small size, high sensitivity, good linearity, long life, wide dynamic range, high stability, and super impact resistance.

The digital inclination (angle) sensor is connected to the microcontroller interface through RS232. The red line is the power input, the black line is the ground (RS232 ground is shared with the power ground), the yellow line is the RS232 input of the sensor, and the green line is the RS232 output of the sensor. The input power supply voltage is 7V-24V, and the recommended value is 9V. The sensor should be installed vertically, and the angle between the installation surface and the vertical surface should not exceed 2°. See Figure 3 for the installation diagram.

C8051F060 MCU

In order to reduce peripheral devices and improve system stability, the C8051F060 device with built-in temperature sensor is used. It is a fully integrated mixed-signal system-level MCU chip, using Cygnal's patented CIP-51 microcontroller core. CIP-51 is fully compatible with the MCS-51 instruction set. C8051F060 has 1 SMBUS/I2C interface, 2 full-duplex UARTs with enhanced baud rate configuration and 1 enhanced SPI interface. Each serial bus is fully implemented by hardware and can generate interrupts to CIP-51. C8051F060 has five general-purpose 16-bit timers; a programmable counter/timer array with 6 capture/compare modules; an on-chip watchdog timer, a VDD monitor, and a clock oscillator. C8051F060 is a truly independent system-on-chip. All analog and digital peripherals can be enabled/disabled and configured by user firmware. The FLASH memory also has the ability to be reprogrammed in the system, which can be used for non-volatile data storage and allows the 8051 firmware to be updated in the field.

The C8051F060 has a large number of digital resources that need to be used through the four low-end I/O ports P0, P1, P2 and P3. Each pin in P0, P1, P2 and P3 can be defined as a general-purpose port I/O (GPIO) pin, and can be assigned to a digital peripheral or function (for example: UART0 or INT1). The system designer controls the pin assignment of digital functions, which is only limited by the number of available pins. This flexibility in resource allocation is achieved by using a priority cross switch decoder. Regardless of whether the pin is assigned to a digital peripheral or as a general-purpose I/O, the status of the port I/O pin can always be obtained by reading the corresponding data register.

The priority cross switch decoder assigns the pins of port 0~3 to the digital peripherals on the device (UART, SMBus, PCA, timer, etc.) in priority order. The assignment order of port pins starts from P0.0 and can be assigned to P3.7. When the corresponding enable bit of the peripheral in the cross switch configuration registers XBR0, XBR1, XBR2 and XBR3 is set to logic 1, the cross switch assigns the port pin to the peripheral. All pins in ports 0 to 3 that are not assigned by the cross switch can be used as general-purpose I/O (GPIO) pins and accessed by reading or writing the corresponding port data registers, which are a set of SFRs that can be addressed either bit by bit or byte by byte. The output state of those port pins assigned by the cross switch is controlled by the digital peripherals that use these pins. Writing to the port data register (or the corresponding port bit) has no effect on the state of these pins.

The P0.0 pin of the C8051F060 microcontroller is configured as TX0 of UART0, and the P0.1 pin is configured as RX0 of UART0. UART0 is used to communicate with a digital tilt (angle) sensor. UART0 is an enhanced serial port with frame error detection and address recognition hardware. UART0 can operate in full-duplex asynchronous mode or half-duplex synchronous mode and supports multi-processor communication. The received data is temporarily stored in a holding register, which allows UART0 to start receiving the second input data byte before the software has read the previous data byte. A receive override bit is used to indicate that the new received data has been latched into the receive buffer while the previous received data has not been read. Control and access to UART0 are achieved through the relevant special function registers, namely the serial control register (SCON0) and the serial data buffer (SBUF0). The same SBUF0 address can be used to access the transmit register and the receive register. Reading SBUF0 will automatically access the receive register, while writing SBUF0 will automatically access the transmit register. UART0 can operate in polling or interrupt mode. It has two interrupt sources: a transmit interrupt flag TI0 (SCON0.1, set when the data byte is transmitted) and a receive interrupt flag RI0 (SCON0.0, set after receiving a data byte).

P0.2 of the C8051F060 microcontroller is configured as TX1 of UART1, and P0.3 pin is configured as RX1 of UART1. UART1 is used to communicate with the host PC. The control of UART1 is basically the same as that of UART0.

P0.4 of C8051F060 microcontroller is configured as the input pin of external interrupt source (/INT0) to receive the zero reset signal of displacement sensor and reduce the accumulated measurement error caused by multiple back and forth movements. /INT0 is configured as falling edge trigger input.

P0.5 of C8051F060 microcontroller is configured as the count input pin (T3) of timer/counter 3 to receive the displacement pulse of displacement sensor. P0.6 is configured as the count direction control pin (T3EX) of timer/counter 3 to determine the moving direction of displacement sensor. When C/T3 bit is set to "1", the timer is configured as counter mode (i.e., negative transition on T3 input pin causes the register of counter/timer to add 1 or subtract 1). When the subtract 1 enable bit (DCEN3) in the timer configuration register is set to "1", the timer can count up or down. When DCEN3=1, the counting direction of the timer is controlled by the logic level on T3EX pin. When T3EX = 1, the counter/timer counts up; when T3EX = 0, the counter/timer counts down. T3EX must be enabled in the digital cross switch and configured as a digital input.

Displacement sensor

The DC20 type grating scale displacement sensor is used as a track gauge measurement tool. The DC20 type grating scale is sealed with a double layer of protective rubber strips to ensure the best sealing performance. The reading head rolling system adopts a 450 type five-bearing rolling system to ensure that the optical sensing system can slide smoothly on the grating scale for a long time and stably and its high level of measurement accuracy.


The displacement sensor output signal waveform is shown in Figure 4.

Debug circuit

The on-chip JTAG debugging circuit of C8051F060 allows non-intrusive (without occupying on-chip resources), full-speed, in-system debugging using products installed on the final application system. The debugging system supports observing and modifying memories and registers, and supports breakpoints, watchpoints, single-step, and line and stop commands. When using JTAG debugging, all analog and digital peripherals can operate with full functionality. The JTAG interface uses 4 dedicated pins on the MCU (TMS, TCK, TDI, TDO).

Perpetual calendar clock chip circuit

After each measurement, the measurement time is recorded so that a report can be generated on the host PC. DS1302 is a high-performance, low-power real-time clock circuit with RAM launched by DALLAS Corporation of the United States. It can time the year, month, day, weekday, hour, minute, and second, and has a leap year compensation function. The operating voltage is 2.5V to 5.5V. DS1302 has a 31×8 RAM register for temporary data storage. It uses a three-wire interface to communicate synchronously with the CPU, and can use burst mode to transmit multiple bytes of clock signals or RAM data at a time.

The connection between DS1302 and the CPU requires three lines, namely SCLK (7), I/O (6), and RST (5). The connection between DS1302 and the CPU is shown in Figure 5.

EEPROM circuit

The measured data is stored in the EEPROM. AT24C512 is an EEPROM with an I2C bus capacity of 512Kbit (64K×8) launched by ATMEL. The main features of this chip are as follows: storage capacity is 65536byte; compatible with 100kHz, 400kHz, and 1MHz I2C buses; 100,000 programming/erase cycles; single power supply, read and write voltage is 1.8V~5.5V; ESD protection voltage>4kV; data can be stored for 40 years; write protection function, when WP is high, it enters the write protection state; CMOS low power technology, the maximum write current is 3mA; 128byte page write buffer; automatic timed write cycle; with 8-pin DIP and 20-pin SOIC packages and other packaging forms. The EEPROM circuit is shown in Figure 6.

RS232 level conversion circuit

MAX232 is a single-power dual RS232 send/receive chip, powered by a single +5V power supply. It only needs to connect 4 external capacitors to form a standard RS232 communication interface. The interface circuit of the microcontroller, computer, and digital tilt (angle) sensor is shown in Figure 7. C3, C4, C5, and C6 in the figure are the charge pump boost and voltage inversion circuits, which generate V+ and V- power supplies for EIA level conversion. C7 is the VCC to ground decoupling capacitor, and its value is 0.1μF. Capacitors C3~C7 must be installed as close to the MAX232 chip pins as possible to improve anti-interference ability.

LCD display circuit

JM19264A is a graphic dot matrix LCD module with 192*64 dot matrix. It is connected with the single-chip microcomputer to form an application system with powerful functions, simple structure and rich human-computer dialogue interface. In this instrument, the single-chip microcomputer adopts direct access interface circuit and LCD display circuit for control.

LCD display content and keyboard layout

The external part of the line turnout electronic detection ruler is composed of JM19264A LCD display, RS232 interface and 4*4 keyboard. The right end is a rotatable and movable shaft. The displacement signal generated by the movement of the shaft is input into the single-chip microcomputer. The single-chip microcomputer refreshes the LCD display data every 0.5s. The "+" after H represents the left end is high, and the "-" represents the left end is low. The "+" after L represents a value larger than the standard value, and the "-" represents a value smaller than the standard value. The LCD display and keyboard layout are shown in Figure 8.

Use of electronic detection ruler for line

turnouts When using the electronic detection ruler for line turnouts for measurement, the left end of the electronic detection ruler for line turnouts is close to one side of the rail, and the other end uses a screw to move the central axis to contact the other side of the rail. After pressing the confirmation key on the keyboard, the system will accurately measure the required data. After the measurement is completed, press the save key to save the data of the point. After connecting to the PC via RS232, all information of the measured point can be obtained.

Anti-vibration and anti-impact structural design

Because the electronic detection ruler for line turnouts is light and portable, it is also easy to collide and fall. In order to make the system work reliably, vibration and impact should be avoided directly on the sensor element, so the design structure adopts a metal box structure. The control device is firmly installed in the metal box, leaving only the external interface, LCD display and keyboard outside the metal box to avoid direct external impact and collision of the internal components, thereby improving the impact resistance of the device.

System programming

Silicon Laboratories IDE is used to integrate editing, compilation, simulation, and download software packages, and the software is written in C language. After the system is powered on, the microcontroller must be initialized first, including the I/O port and cross switch of the microcontroller, the initialization of the timer, the initialization of the two serial communication ports, the initialization of the LCD, etc. The entire program consists of the device initialization program, the LCD initialization program, the serial port interrupt program, the external interrupt 0 processing program, the display program, the keyboard scan processing program, the track gauge and level calculation program, the perpetual calendar clock chip DS1302 read and write program, the EEPROM AT24C512 read and write program, etc.

Part of the source code program is as follows:

Displacement measurement sensor zero-crossing signal interrupt entry program
void Init0_ISR() interrupt 0 // External interrupt 0, edge triggered
{
uchar distance_flag; // Displacement measurement sensor movement direction flag save word
SFRPAGE=0x01;
TMR3H=0; // Crossing the zero point, reset the counter to zero.
TMR3L=0;
P05=1;
distance_flag=P0;
distance_flag=distance_flag&0x20; // Displacement measurement sensor B signal foot
if(distance_flag==0)
{
distance_positive_flag=0;//Displacement measurement sensor movement direction flag is 0, indicating negative movement
}
else
{
distance_positive_flag=1; // Displacement measurement sensor movement direction flag is 1, indicating positive movement
}
}
Send command subroutine to digital inclination (angle) sensor
void sendserial(unsigned char *senddata,unsigned char len2)
{
uchar i;
ES0=0; //Disable interrupts for(i=0;i {
SFRPAGE=0x00;
SBUF0=*(senddata+i); //Send data
while(TI0==0); //Send flag bit to generate
TI0=0;
}
ES0=1; //Allow interrupts
}

Conclusion

The electronic detection ruler of the line turnout fully considers various possible situations of the external environment from the research, demonstration and selection of the scheme to the design of the circuit and the control of the software. It realizes high-precision digital measurement of the rail gauge and horizontality, which can eliminate the hidden dangers of driving safety caused by track changes in advance. The accuracy and high-speed measurement of the device improve the safety of the railway and reduce the labor intensity of employees.

Reference address:Design of electronic detection ruler for railway turnout based on digital inclination sensor

Previous article:PAC platform provides a new generation of measurement and control solutions for the oil and gas industry
Next article:Easy step-down conversion using simulated ripple mode

Latest Test Measurement Articles
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号