Design and development of taxi meter scheme

Taxi billing system has two functions. The taxi meter is designed with at24c02 storage chip and LCD1602 liquid crystal display. The fare is the starting price within 3 kilometers, and the price per ki

Taxi billing system has two functions. The taxi meter is designed with at24c02 storage chip and LCD1602 liquid crystal display. The fare is the starting price within 3 kilometers, and the price per kilometer outside 3 kilometers. The default is 1.8 yuan during the day and 2.2 yuan at night. This price can be set by the user. Waiting for less than 3 minutes does not count the price, and how much per minute other than 3 minutes. The default is 0.5 yuan during the day and 1 yuan at night. This price can be set by the user. All data output such as day/night conversion, waiting time on the way, unit price, and total amount are displayed on LCD1602.


1. Hardware circuit design of taxi meter

(1) Crystal oscillator circuit. There are strict timing requirements when the single-chip microcomputer is working. First fetch an instruction, then decode it in the decoder, then perform micro-operations, and then repeat this process. The instructions are executed one by one, and these all need the beat to cooperate with it, and the crystal oscillator circuit is the circuit that generates the beat. Generally speaking, the single-chip microcomputer integrates a crystal oscillator circuit, also called a crystal oscillator. The crystal oscillator circuit is indispensable to the single-chip microcomputer. It provides the clock signal when the single-chip microcomputer is working normally. When the single-chip microcomputer executes instructions, it is based on If the frequency of the crystal oscillator is high, the operating speed of the single-chip microcomputer will be faster, which is very important for the control system.

(2) Reset circuit. Reset refers to returning to the initial state. Reset is a prerequisite for the normal operation of the microcontroller system. The RESET pin is a dedicated reset pin for the 52 microcontroller. Connect this pin to the high level and let it last for two machine cycles, the internal of the microcontroller enters the reset state and remains in the reset state until the level on the RESET pin becomes low. Generally speaking, you can use power-on reset or manual reset as the reset method of the single-chip microcomputer. Power-on reset refers to the reset when the single-sided machine is just started, which is more efficient. After the reset is completed, the program starts from the first address unit.

(3) Principle of Hall sensor. The signal capture of this design uses a Hall sensor. In its working process, it needs to use a Hall device fixed in the inductance coil, and use this element for signal detection. In the detection process, when a metal object enters, the magnetic field intensity fluctuates significantly due to electromagnetic induction. In this way, the Hall device converts this fluctuating signal into a voltage signal, and then the single-chip microcomputer judges the signal and gives the result. Due to the periodicity of the magnetic field, the corresponding voltage signal also exhibits a certain periodicity. This requires peak detection to detect the peak value, and then send the corresponding information to the microcontroller after conversion processing. In this way, the presence of metal can be determined by the change in voltage value. According to the knowledge of electromagnetics, when the sensor coil is energized with a sinusoidal alternating current I1, a certain intensity of sinusoidal alternating magnetic field H1 will be generated near the coil under electromagnetic induction, which will then induce an eddy current I2 in the metal conductor, which will cause An alternating magnetic field H2 appears. The directions of the two magnetic fields are inconsistent, and cause the equivalent impedance of the sensor coil to appear the same change.

(4) The design of AT24C02. This system uses AT24C02 to store the set price and fees to ensure that it can be restored even after power failure. As a CMOS low-power E2PROM AT24C02 launched by Atmel (USA), its storage space is 256×8 bits. The basic features are mainly small size, hard to lose data, strong anti-interference ability, and writing within 10ms Speed, 10,000 times of erasing and writing times, 2.5-5.5V wide operating voltage, etc. This kind of serial device does not occupy too many I/O lines and resources. It mainly uses the I2C bus to read and write data. It can also provide support for online programming, and can fetch and store data in real time and conveniently. And the on-chip address register is designed in AT24C02. As long as one data byte is read or written, the on-chip address register will increase by 1 to read and write the next memory cell. All words are processed in a single operation mode. Section to read. From the perspective of total write time saving, up to 8 bytes of data can be written into it in one operation.

(5) Liquid crystal display circuit. The display module used in this device is a 1602 liquid crystal display commonly available on the market, which is used to display costs and time. The 1602 LCD is moderately priced and has abundant codes and can be directly transplanted into the design of this system. The 1602 LCD can be used to display some common characters, simple texts such as Arabic numerals, but it cannot display Chinese at present. The 1602 liquid crystal display is mainly composed of dot matrix, and there is a difference between backlight and no backlight, but generally it will not affect the displayed content. The 1602 liquid crystal display has an obvious advantage, that is, the stability is very good when displaying data , Which is of great significance for users to recognize the information on the display.

Pins 1 and 2 of the LCD are power supply pins, 15 and 16 are a normally high pin and a normally low pin, which are connected to the positive and negative power supply respectively. Pin 3 is the background auto-adjustment pin introduced earlier, by changing the resistance R1 And the ratio of R2 to change the background brightness to adapt to different display environments. The RS, R/E and EN pins are used to read and write operations with the microcontroller. DB0-DB7 are data transfer IO ports, which are the bridges for the microcontroller to control DDRAM. Under appropriate read and write timing, the microcontroller passes DB0. -DB7 LCD module's CGRAM and DDRAM read and write operations. In this system, the circuit connection of the 1602 liquid crystal display is very simple, and the data interface of the liquid crystal display can be directly connected to the input and output interface of the single-chip microcomputer. The RS pin is the data command pin, which mainly controls whether the data of the LCD is read or written. RW is the buffer port of the data bit. This port is used to control the content of the displayed data and the command line characters displayed. DB0 to DB8 are The data transmission port can be directly connected to the IO pin of the microcontroller.


2. Software design of taxi meter

The software design idea of the system: Initialize processing when the work starts. The contents of initialization mainly include: sensor initialization, reset of the microcontroller. Then the software realizes the scanning of the button circuit of the single-chip computer to determine the set price and fare value. According to the diameter of the wheel set by the system, by calculating the circumference of a circle, the distance measurement is measured by Hall sensor induction. You can adjust the starting price, mileage charge, and waiting charge by pressing the button. Simulate the start of charging of the taxi by pressing the button, wait, and end the charging. The mileage and waiting time are displayed on the 1602 LCD, and the total cost of the day and night is displayed when the billing ends. The system uses single-chip C language programming and KEIL4 programming platform.

to sum up

In the end, we designed and implemented a taxi billing system. At this stage, what it can achieve is: (1) display the distance traveled by the taxi; (2) display the taxi speed; (3) display the real-time billing price of the taxi ; (4) Display the waiting time of passengers. These four points are only the realization of the initial stage. We hope to add more and more complete functions in the future to improve the stability and intelligence of the system.