The number of the motor vehicle "restriction by the last digit" makes many car owners with poor memory confused about the restriction date. Especially for those who have more than one car at home, it is easy to say but difficult to do to remember the restriction date of two cars and the number of the two cars. This article introduces a motor vehicle restriction controller with the last digit, which can solve the above troubles of drivers.
1. Circuit composition and principle
The controller circuit is shown in Figure 1. It consists of an input circuit, a date generation circuit, an LCD display circuit, an output control circuit, a single-chip microcomputer, and a power supply. The tail number of the license plate is input into the DS1302 chip through the DIP switch S1. When the driver starts the car, the controller will automatically compare it with the restricted license plate number. If the day is a restricted day, a prompt message will be displayed on the LCD screen, and the starter motor switch line will be cut off to prevent the car from starting; if the day is not a restricted day, the car can be used normally.
1. Input circuit
Since the license plate number, date and time do not need to be input frequently, the input circuit uses a DIP switch S1 and four 10kΩ resistors to form a keyboard circuit. The DIP switch is shown in Figure 2. Its advantages are small size and high reliability. Switch 1 in S1 is a restriction selection switch. When it is in the OFF position, the restriction control is cancelled and the controller does not work. Only when it is in the ON position, the motor vehicle tail number restriction controller will work. Switch 2 is a function selection switch, which can select different input functions. Switch 3 is a digital "plus" key, and switch 4 is a digital "minus" key. By using switches 2, 3, and 4 in combination, the initial year, month, day, hour, minute, second and the tail number of your own license plate can be set for the controller.
Figure 1 Motor vehicle license plate restriction controller circuit
Figure 2 DIP switch
2. Date generation circuit
The chip model of the date generation circuit is DS1302, and its pin diagram is shown in Figure 3. It is a high-performance, low-power clock chip, including a real-time clock/calendar and a 31-byte static RAM, which can count seconds, minutes, hours, days, weeks, months, and leap years in real time. The 31-byte high-speed RAM can store data for a long time through an external rechargeable battery. During normal operation, the DS1302 chip can also charge the battery slowly. It can work reliably under a 2.5-5.5V power supply, and consumes less than 300nA at 2.5V. When the main power is turned off, the clock can keep running continuously. The DS1302 chip has 8 pins, and pins 2 and 3 X1 and X2 are crystal pins, and the frequency of the crystal is 32.768kHz. Pin 1 is the main power pin VCC2, and pin 8 is the backup power pin VCC1. When VCC2 is less than 0.2V of VCC1 voltage, VCC1 supplies power to the DS1302 chip. Pin 5 is the reset pin, and RST is valid at low level. Pin 7 is the serial clock pin SCLK. Pin 6 is the serial data input/output pin I/O, which works with SCLK to exchange data with the microcontroller. Pin 4 is the power ground.
Figure 3 DS1302 pin diagram
Figure 4 Power supply circuit
3. LCD display circuit
The LCD display circuit uses 12232F, which has 8192 16×16 dot Chinese characters and 128 16×8 dot ASCII character sets built in. It is mainly composed of row driver/column driver and 128×32 full dot matrix LCD display. It can complete graphic display and can also display 7.5×2 (16×16 dot matrix) Chinese characters. It exchanges data with the microcontroller in serial mode. 1 2 2 3 2 F has 8 pins, pin 1 is the power ground VSS. Pin 2 is the power positive VDD (3.0~5.5V). Pin 3 is the contrast adjustment V lcd. Pin 4 is the serial synchronous clock input pin CLK, and the SID data is read on the rising edge. Pin 5 is the serial data input pin SID. Pin 6 is the chip select pin, which is valid at high level. Pin 7 is the backlight positive BL+. Pin 8 is the backlight negative BL-.
4. Output control circuit
The output control circuit is composed of R2, VT1, VD1, and K1. VD1 is a protective tube to prevent the induction voltage generated by K1 from damaging VT1 when VT1 is turned off. When the control system determines that the car with the tail number is restricted today, P1.3 of IC2 outputs a high level to saturate VT1, K1 coil is energized, the normally closed contact is disconnected, and the motor vehicle start switch line is disconnected, so that the motor vehicle cannot start. At the same time, the LCD screen displays the message "Cannot drive today" to remind the driver to pay attention.
5. MCU and power supply
In order to facilitate everyone's production, this controller uses AT89C2051 as the control core. Since its internal program memory is Flash, it is very convenient and quick to modify the internal program, as long as you are equipped with a programmer that can program 89C2051. The debugger can use the method of repeated cycles of program editing, compiling, solidification and inserting into the circuit board for testing. For most people, this debugging method is not difficult. AT89C2051 is a 20-pin 8-bit high-performance microcontroller compatible with 8051. In Figure 1, C1, C2, crystal and the internal circuit of the microcontroller form a clock circuit. C3 and R3 form a power-on reset circuit. The power supply of this controller is taken from the Acc line of the car, and a stable 5V power supply voltage is provided through the 7805 voltage regulator. The power supply circuit is shown in Figure 4, where C1, C2 and C3 are filter capacitors.
2. Program Structure and Principles
The program is written in C language, and its program structure includes parameter input module, display module and control output module. In the parameter input module of the program, the programming of DS1302 clock chip is mainly involved. Through the input module program, the initial value of year, month, day and time is set for DS1302, and then the tail number of the license plate is entered.
The program first checks the P3.1 pin connected to switch 2 of S1. Every time a pulse is detected, the value of the "Function Selection" variable increases by 1. The specific parameters to be input are determined by the value of the variable "Function Selection", see the attached table.
Figure 5 Program flow chart
Appendix Function Key Description
Then check the P3.2 pin connected to switch 3 of S1. Every time a pulse is detected, add 1 to the corresponding variable. For example, the "Function Selection" variable = 7, which means that the license plate number should be entered. Every time the P3.2 pin receives a pulse, the license plate number variable is increased by 1. Every time a pulse is input to the P3.3 pin connected to switch 3 of S1, subtract 1 from the corresponding variable.
The display module mainly involves programming the 12232F chip, including liquid
In the control output module program, first detect the P3.0 pin, which is connected to the switch 1 of S1. When P3.0=0, it means that the restriction is cancelled, so that the P1.3 pin outputs "0", the transistor VT1 is cut off, the relay K1 does not work, the normally closed contact of K1 is in a closed state, the car starter switch line is connected, and the driver can start the car. When P3.0=1, it means that the restriction is to be carried out. At this time, the program takes out the date of the day from the DS1302 chip, calculates the restricted number of the day, and compares it with the tail number of the car. If they are the same, P1.3=1, the transistor VT1 is saturated and turned on, the relay K1 is energized, the normally closed contact of K1 is disconnected, the motor vehicle starter switch line is disconnected, the driver cannot start the car, and the LCD screen displays the message "You cannot drive today" to remind the driver. If they are different, P1.3=0, transistor VT1 is cut off, relay K1 does not work, the normally closed contact of K1 is in a closed state, the car start switch line is connected, and the driver can start the car. |
Previous article:Common methods and countermeasures for MCU cracking (I)
Next article:Trial Notes on PIC12F675 Microcontroller
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- 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
- MSP430 digital tube display problem
- Ask: How to test the WIFI function of the product from both software and hardware aspects
- About ARM's interrupt service routine
- Study stickers
- 24 "Millions" Raspberry Pi Car - Bullseye Benchmark Test of Raspberry Pi 64-bit System
- Sensors and measurement and control circuits
- A strange problem of TMS320F2812 caused by an eCAN bug
- [Evaluation of EVAL-M3-TS6-665PN development board] 2. Detailed explanation of functions
- A brief discussion on PCI_Express architecture.rar
- Free application: Allwinner heterogeneous multi-core AI intelligent vision V853 development board