Design of electronic detection ruler for turnout based on digital inclination (angle) sensor

Publisher:和谐共处Latest update time:2012-02-20 Source: 世界电子元器件 Keywords:Sensors Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

introduction

The electronic detection ruler of the turnout is an important guarantee for the safety of train operation. Its main purpose is to measure the track 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 railway safety measures.

The system designed in this paper can measure the horizontality and gauge of the standard track with a 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 by 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: track 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 stopper, a measuring slider, and a liquid crystal display. The high-precision displacement measurement sensor and the measuring slider are used to measure the track 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 measurement 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 a 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.

Instrument structure

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.

System design block diagram

Digital inclination (angle) sensor

The digital inclination (angle) sensor is made based on the principle that the effect of gravity on the fluid causes changes in membrane potential. 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 interfaces with the microcontroller via 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 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.

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 an SMBUS/I2C interface, 2 full-duplex UARTs with enhanced baud rate configuration, and an 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 on site.

The C8051F060 has a large number of digital resources that can only 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 also be assigned to a digital peripheral or function (for example: UART0 or INT1). The system designer controls the pin assignment of digital functions, limited only by the number of available pins. This flexibility in resource allocation is achieved by using a priority crossbar 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 crossbar decoder assigns the pins of ports 0 to 3 to the digital peripherals on the device (UART, SMBus, PCA, timers, etc.) in order of priority. The order of port pin assignment starts from P0.0 and can be assigned all the way to P3.7. When the corresponding enable bit of the peripheral in the crossbar configuration registers XBR0, XBR1, XBR2, and XBR3 is set to logic 1, the crossbar assigns the port pins to the peripherals. All pins in ports 0 to 3 that are not assigned by the crossbar 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 crossbar is controlled by the digital peripherals that use these pins. Writing to the port data registers (or the corresponding port bits) has no effect on the state of these pins.
[page]

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 the digital tilt (angle) sensor. UART0 is an enhanced serial port with frame error detection and address recognition hardware. UART0 can work 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, and 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 work in query or interrupt mode. It has two interrupt sources: a transmit interrupt flag TI0 (SCON0.1, set when the data byte is sent) 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 the C8051F060 microcontroller is configured as the input pin of the external interrupt source (/INT0), receiving the zero reset signal of the displacement sensor to reduce the cumulative measurement error caused by multiple back and forth movements. /INT0 is configured as a falling edge trigger input.

P0.5 of the C8051F060 microcontroller is configured as the count input pin (T3) of timer/counter 3 to receive the displacement pulse of the displacement sensor. P0.6 is configured as the count direction control pin (T3EX) of timer/counter 3 to determine the moving direction of the displacement sensor. When the C/T3 bit is set to "1", the timer is configured as a counter (i.e., a negative transition on the T3 input pin causes the counter/timer register 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 the 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 Sensors

The DC20 grating ruler displacement sensor is used as the track gauge measurement tool. The DC20 grating ruler is sealed with double-layer 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 ruler for a long time and its high-level measurement accuracy.

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

Displacement sensor output signal waveform

Debug Circuit

The on-chip JTAG debugging circuit of C8051F060 allows non-intrusive (no on-chip resources), full-speed, in-system debugging using products installed on the final application system. The debugging system supports observing and modifying memory 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, USA. 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 CPU requires three lines, namely SCLK (7), I/O (6), and RST (5). The connection between DS1302 and CPU is shown in Figure 5.

Connection between DS1302 and CPU

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, 1MHz I2C bus; 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 packaging and other packaging forms. The EEPROM circuit is shown in Figure 6.

EEPROM Circuit

[page]

RS232 level conversion circuit

MAX232 is a single-power dual RS232 transmitter/receiver chip, powered by a single +5V power supply. It only needs to connect 4 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 charge pump boost and voltage inversion circuits, which generate V+ and V- power supplies for EIA level conversion. C7 is a 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.

Digital inclination
LCD display circuit

JM19264A is a graphic dot matrix LCD module with 192*64 dots. It is connected with a 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 electronic detection ruler of the line turnout is composed of a JM19264A LCD screen, an RS232 interface and a 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 screen 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 greater than the standard value, and the "-" represents a value less than the standard value. The LCD screen display and keyboard layout are shown in Figure 8.

LCD display and keyboard layout

The use of electronic detection ruler for turnouts

When using the electronic detection ruler of the track switch for measurement, the left end of the electronic detection ruler of the track switch 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-shock structural design

Since the electronic detection ruler of the line turnout 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 screen and keyboard outside the metal box, so as to avoid the internal components from being directly impacted and collided by the outside, and improve the impact resistance of the device.

System programming

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

Some source code programs are 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; //Zero point, reset 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 interrupt for(i=0;i {
SFRPAGE=0x00;
SBUF0=*(senddata+i); //Send data
while(TI0==0); //Send flag bit to see if it generates
TI0=0;
}
ES0=1; //Enable interrupts
}

Conclusion

The electronic detection ruler for turnouts takes into full account all possible external conditions in the research, demonstration and selection of the scheme, circuit design, software control and other aspects, and achieves high-precision digital measurement of rail gauge and levelness, which can help eliminate potential driving safety hazards 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.

Keywords:Sensors Reference address:Design of electronic detection ruler for turnout based on digital inclination (angle) sensor

Previous article:Design of instantaneous frequency measurement module based on multi-channel phase-shifted clock
Next article:Research on efficient code instrumentation technology in coverage testing

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号