1 Introduction
In China, the bus system has greatly improved the operating efficiency of bus companies since the coin boxes were used to replace ticket sellers. However, drivers often steal the fare in the coin boxes and passengers use fake coins to ride, causing huge economic losses to the companies.
In addition to personal quality factors, the main reason is that the coin box has poor security performance and single function. To address this problem, an intelligent bus coin box is designed here: the system uses the AT89S52 microcontroller as the control core, and uses the Dallas company's information button DS1991 to form a password lock control circuit, and uses the DS1991 key to open the password lock of the coin box. Each partition has a 64-bit password and identification area, with very high security performance, which can avoid the occurrence of ticket theft due to poor security performance of the password lock. The data transmission between the information button DS1991 and the microcontroller adopts a single bus protocol. Data transmission can be completed by briefly contacting the data line of DS1991 with the I/O port of the microcontroller. According to the different alloy materials used for real and fake coins, the system uses eddy current sensors to detect the authenticity of coins, which can effectively prevent passengers from using fake coins to take the bus.
2 System structure diagram and composition principle
The structural block diagram of the intelligent bus coin box based on DS1991 is shown in Figure 1:
Working principle of the system: If a legally authorized DS1991 is used to briefly contact the I/O port of the microcontroller, the microcontroller writes the data and clock data of the memory into the DS1991 key sub-storage area, and then the microcontroller opens the electronic password lock of the coin box. If an unauthorized DS1991 or other single-bus device is used, the microcontroller refuses to open the electronic password lock of the coin box. When the system detects that a fake coin has been inserted, the fake coin rejection circuit is activated, causing the fake coin to flow out of the coin box from the fake coin channel, and at the same time the buzzer sounds.
2.1 DS1991 Interface Circuit
This system uses the information button DS1991. Each DS1991 is factory engraved with a 64-bit registration code that has been tested. No two devices have the same registration code. The first 8 bits are the family code of the 1-Wire product, the next 48 bits are the unique serial number of each device, and the last 8 bits are the CRC check code of the previous 56 bits. It has a safe and reliable 1152-bit password-protected memory and a 512-bit non-password-protected memory. The 1152-bit password-protected memory is divided into 3 partitions, each partition contains 384 bits, and each key sub-area has a 64-bit password and identification area. The read/write operations of the key sub-storage area require password verification. The 512-bit non-password-protected memory is mainly used for copying encrypted data to ensure data integrity. The DS1991 memory diagram is shown in Figure 2:
DS1991 is packaged in a stainless steel case with a diameter of 16 mm and a thickness of about 6 mm. It has a two-way communication function, and data transmission uses a single bus protocol. According to the single bus protocol, only one data line and a ground line are needed to exchange information with the outside world. DS1991 is a single bus device with an open drain. The connection I/O of DS1991 must be bidirectional, and a 4.7 kΩ pull-up resistor must be connected to the I/O port. The transmission rate between the microcontroller and DS1991 can reach 16.3 kb/s, so the information transmission between the information button DS1991 and the microcontroller can be completed by briefly contacting the data line of DS1991 with the I/O port of the microcontroller (a light touch). The DS1991 interface circuit is shown in Figure 3:
The information button DS1991 acts as a bridge for data transmission between the coin box system and the bus company back-end management system. The information button DS1991 exchanges information with the microcontroller, and must be initialized and ROM operated before the memory can be read and written.
Initialization: The DS1991 initialization sequence is shown in Figure 4:
All transmission operations on the single bus start with the initialization process. The initialization process consists of a reset pulse sent by the microcontroller and a response pulse received by the microcontroller. If the DS1991 is on the I/O line, the data line will be pulled low during TPDL to generate a negative response pulse.
ROM function command: If the microcontroller detects a negative response pulse, it can issue four ROM function commands supported by the DS1991. This system has only one information button on the I/O line. After initialization, it can skip the matching of the 64-bit ROM serial code and directly perform memory read and write operations.
Read and write operations of the memory: Here we only analyze the operation of writing data into the key sub-storage area. First, the microcontroller sends a command to write the key sub-storage area, sends the key sub-storage area number and the data target address, and then receives the key sub-storage area identification code and verifies the 64-bit identification code. If the 64-bit identification code is an unauthorized identification code, the system stores the identification code of the information button and the time of access to the system, and then the single bus device is reset; if the 64-bit identification code is a legally authorized identification code of the bus company, the microcontroller sends the 64-bit password of the E2PROM memory to the key sub-storage area of DS1991. If the 64-bit password sent by the microcontroller is different from the 64-bit password in the key sub-storage area of DS1991, the key sub-storage area of DS1991 refuses to write data, and the P1.3 port of the microcontroller refuses to output an unlocking voltage, thereby failing to open the electronic combination lock of the coin box; if the 64-bit password sent by the microcontroller is the same as the 64-bit password in the key sub-storage area of DS1991, the microcontroller writes the data and clock data of the memory into the key sub-storage area of DS1991, and the P1.3 port of the microcontroller outputs an unlocking voltage, thereby opening the electronic combination lock of the coin box.
From the analysis, we know that only by using a legally authorized DS1991 (the identification code of DS1991 is legal, and the 64-bit password of the key sub-storage area of DS1991 is the same as the password in the E2PROM memory of the coin box) to contact the I/O port can the electronic password lock of the coin box be opened; DS1991 not only has the function of opening the electronic password lock, but also has the function of data collection. DS1991 collects all the data of the bus, including the legal opening record and illegal trial opening record of the coin box. The company's back-end management system reads the data obtained by DS1991, and combines the bus information to conduct statistical analysis on the opening of the bus coin box, which can be used as an important basis for bus management.
Information buttons DS1991 are generally distributed in multiple levels, and each level of information buttons DS1991 has different unlocking permissions. The highest level is the head office level, which can open the door locks of all bus coin boxes of the company. The highest level DS1991 has the greatest permissions and should be kept and used very safely. The lowest level is the vehicle level, which can only open the door lock of a certain bus coin box. The middle level information buttons flexibly allocate the unlocking permissions of information buttons DS1991 according to the management model of the head office.
2.2 Coin Processing Circuit
The structural block diagram of coin processing is shown in Figure 5:
The coin detection uses an eddy current sensor to obtain the detection signal. The working principle is: when a high-frequency sinusoidal signal is applied to the coil, the coin to be tested is placed in the magnetic field. When the changing magnetic field generated by the coil passes through the surface of the coin, eddy currents will be generated on the surface of the coin. The eddy current will generate a reverse changing magnetic field, thereby weakening the magnetic field generated by the original coil, causing the inductance of the coil to change. In this system, when the real and fake coins pass through the coil L1 respectively, due to the different alloy materials of the two coins, the eddy currents generated on the surface of the coin are different, so the change in the inductance of the coil L1 is different. The coil is connected to the capacitor three-point oscillation circuit as an inductor. The frequency of the sinusoidal signal output by the oscillation circuit is different, so only the output sinusoidal frequency of the capacitor three-point oscillation circuit needs to be measured to accurately identify the authenticity of the coin. Before the system works, it needs to learn in advance: the oscillation frequency of all real coins in the oscillation circuit is stored in the E2PROM memory of the microcontroller in advance. In the actual identification process, due to errors caused by various reasons, the frequency counted by the microcontroller has a certain error with the frequency stored in the memory of the coin. To this end, an allowable error range can be set so that the system can effectively identify the authenticity of the coins.
When a passenger inserts a coin, the coin passes through the photocoupler, blocks the light beam, generates a falling edge through the conversion circuit, and is sent to the P3.2 port of the single-chip computer AT89S52. The INTO generates an interrupt, and the system performs coin identification. The sine signal output by the capacitor three-point oscillation circuit is converted into a square wave signal through the Schmitt trigger circuit and sent to the T1 counter in the P3.4 port of the single-chip computer for counting. If the frequency counted by the counter is within the allowable error range of a certain frequency stored in the memory, it is considered that the coin being detected is a real coin; if the frequency counted by the counter is not within the allowable error range of any frequency stored in the memory, it is considered that the coin being detected is a fake coin. At this time, the single-chip computer starts the fake coin rejection circuit, the P1.4 port outputs a high potential, the coin switching electromagnet is energized, the coin channel is switched, and the fake coin flows out of the coin box from the fake coin channel. At the same time, the P1.5 port outputs a high potential and the buzzer sounds. In order to prevent coins from blocking the coin channel, this system is equipped with a board circuit. When the coin channel is blocked, the driver turns on the plate-breaking switch, the P1.6 port outputs a high potential, and the energized motor performs a plate-breaking operation on the coin channel, thereby making the coin channel unobstructed.
2.3 Real-time clock circuit
The real-time clock chip of this system uses DS1302. DS1302 is a trickle charging clock chip launched by DAL-LAS. It contains a real-time clock/calendar and 31 B static RAM, and communicates with the single-chip computer through a simple serial interface. The real-time clock/calendar circuit provides information on seconds, minutes, hours, days, months, and years, and the number of days per month and leap years can be automatically adjusted. The DS1302 communicates with the single-chip computer in a synchronous serial manner. Three I/Os are required between the DS1302 and the single-chip computer: the reset pin RES of the DS1302, the serial data I/O, and the serial clock SCLK. The DS1302 provides an accurate clock for the system. When an information button contacts the I/O port, the system will automatically record the time of access to the system, providing a basis for future inquiries.
2.4 E2PROM Memory
This system uses E2PROM memory AT24C32, which is a 32 kb serial CMOS E2PROM, with 4096 bytes inside, supporting I2C bus data transmission protocol. Two I/O ports are required between AT24C32 and the microcontroller: one for the serial clock SCL and the other for the serial data/address SDA. E2PROM memory mainly stores the oscillation frequency of real coins of various denominations in the oscillation circuit and the password, identification code and access time of the information button.
3 System software design
The software flow chart of this system is shown in Figure 6:
4 Conclusion
The intelligent bus coin box designed in this paper has three advantages:
(1) High security performance. Only with a legally authorized DS1991 can the electronic password lock of the coin box be opened. Each partition has a 64-bit password and identification code, which has very high security performance and can avoid ticket theft due to poor security performance of the coin box password lock.
(2) Improved the operational efficiency of bus companies. Using eddy current sensors to detect the authenticity of coins can effectively prevent passengers from using fake coins to take the bus.
(3) Easy to use. DS191 is small and easy to carry. The information button DS1991 can transfer information to the microcontroller with just a touch.
After the electronic password lock of the intelligent bus coin box is opened, the mechanical lock of the intelligent bus coin box is opened, and the door lock of the coin box can be opened. In the bus system, the staff who open the lock twice are different, which once again ensures the safety of the ticket money in the coin box. The technology of opening the electronic password lock with the information button is applied in the bus coin box, which largely solves the problem of ticket money theft that has long plagued bus companies.
Previous article:Intelligent explosion-proof combination switch solution based on Delta electromechanical products
Next article:Design of grain storage quality monitoring system
- Popular Resources
- Popular amplifiers
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Using MicroPython to run app-like functions on a single chip
- What software do you usually use when doing circuit simulation?
- Industry Consulting
- Problems with the ping command
- [Evaluation and experience of Zhongke Yihaiwei EQ6HL45 development platform] + Create a new FPGA project——ehiway_fpga_test0
- z I have a humble question. How many degrees should the serial numbers on the PCB assembly drawing be flipped?
- The board for showing goods + collecting dust
- lps22
- [Liquid Level Sensor Evaluation] First Look
- TLC5620 driver design based on FPGA (DA).pdf