- Home >> News >> Blog articles >> Internet of things
Scheme Design of Taxi Meter
Taxi billing system, its function is divided into two aspects, the taxi meter is designed with at24c02 memory chip, LCD1602 liquid crystal display and so on. The starting price is within 3 kilometers, and how much is 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. The price is not calculated within 3 minutes, and the price per minute is more 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 can be displayed by LCD1602.
1. Hardware circuit design of taxi meter
(1) Crystal oscillator circuit. There are strict timing requirements when the single-chip microcomputer is working. It first fetches an instruction, then decodes it in the decoder, then performs micro-operations, and then repeats such a process. The instructions are executed one by one, all of which need to be matched with the beat, and the crystal oscillator circuit is the circuit that generates the beat. Generally speaking, a crystal oscillator circuit is integrated inside a single-chip microcomputer, also called a crystal oscillator. The crystal oscillator circuit is indispensable for a single-chip microcomputer. It provides the beat of the single-chip microcomputer during normal operation and generates a clock signal. When the single-chip microcomputer executes instructions, it is based on The beat is carried out, the frequency of the crystal oscillator we choose is high, and the running 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 the prerequisite for the normal operation of the single-chip microcomputer system. The RESET pin is a dedicated reset pin for 52 single-chip microcomputers. Connect this pin to a high level and let it last for two machine cycles, the inside of the microcontroller enters a reset state, and remains in a reset state until the level above the RESET pin becomes low. Generally speaking, power-on reset or manual reset can be used as the reset method of the single-chip microcomputer. Power-on reset means that the single-sided machine is reset when it is just started, which is more efficient. After the reset is completed, the program starts to execute from the first address unit.
(3) Hall sensor principle. The capture of the signal in this design uses a Hall sensor. During its working process, it needs to use the Hall device fixed in the inductance coil, and use this element for signal detection. During the detection process, when a metal object enters, the magnetic field strength fluctuates obviously due to electromagnetic induction, so the Hall device converts the fluctuating signal into a voltage signal, and then judges the signal through the single-chip microcomputer and gives the result. Due to the periodicity of the magnetic field, the corresponding voltage signal also exhibits certain periodicity. This requires peak detection to detect its peak value, and then the corresponding information is sent to the single chip microcomputer after conversion processing. In this way, the presence of metal can be determined through the change of voltage value. According to the knowledge of electromagnetism, when the sensor coil is supplied with a sinusoidal alternating current I1, under the action of electromagnetic induction, a sinusoidal alternating magnetic field H1 of a certain intensity will be generated near the coil, which will then induce an induced 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 same change in the equivalent impedance of the sensor coil.
(4) Design of AT24C02. This system uses AT24C02 to store the set price and fee to ensure that it can be restored even when the power is off. As a CMOS type low-power E2PROM AT24C02 launched by Atmel Corporation (USA), its storage space is 256×8 bits. Speed, more than 10,000 times of erasing and writing, wide operating voltage of 2.5-5.5V, etc. This kind of serial device does not occupy too many I/O lines and resources. It mainly reads and writes data through the I2C bus. It can also provide support for online programming, and can store 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 in, the on-chip address register will increase by 1 by itself, so as to read and write the next storage unit, all of which use a single operation mode to process all words section to read. From the perspective of total write time saving, a maximum of 8 bytes of data can be written into it in one operation.
(5) Liquid crystal display circuit. The display module adopted by this device is a common 1602 liquid crystal display on the market, which is used to display the cost and time. The price of 1602 liquid crystal display is moderate and the code is rich, and can be directly transplanted into the design of this system. The 1602 liquid crystal display can be used to display some common characters, Arabic numerals and other simple text, but it cannot display Chinese yet. The interior of the 1602 LCD is mainly composed of a dot matrix. There is a difference between backlight and no backlight, but generally it will not affect the displayed content. The 1602 LCD has an obvious advantage, that is, the stability is very good when displaying data. , which is significant for the user to recognize the information on the display.
Pins 1 and 2 of the LCD are power supply pins, 15 and 16 are a normal high pin and a normal low pin, which are respectively connected to the positive and negative power supply, and pin 3 is the background automatic adjustment pin introduced earlier, by changing the resistor R1 and R2 ratio to change the background brightness to adapt to different display environments. RS, R/E, and EN pins are used to realize read and write operations with the microcontroller. DB0-DB7 is the data transmission IO port, which is the bridge for the microcontroller to control the DDRAM. Under the appropriate read and write timing, the microcontroller passes DB0 - CGRAM and DDRAM read and write operations of the DB7 LCD module. 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 interfaces of the single-chip microcomputer. The RS pin is a data command pin, which mainly controls whether the LCD data 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 displayed command line characters. DB0 to DB8 are The data transmission port can be directly connected with the IO pin of the microcontroller.
2. Taxi meter software design
The software design idea of the system: Initialize the processing when the work starts. The content of initialization mainly includes: sensor initialization, reset of the one-chip computer. Then the software scans the button circuit of the single-chip microcomputer 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. Start billing, wait, and end billing by simulating the taxi by pressing the button. 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 adopts single-chip microcomputer C language programming and uses KEIL4 programming platform.
Summarize
In the end, we designed and implemented a taxi billing system. What it can achieve at this stage is: (1) display the distance traveled by the taxi; (2) display the speed of the taxi; (3) display the real-time billing price of the taxi ; (4) Display the waiting time of passengers. These four points are only an initial stage of realization, and we hope to add more and more perfect functions in the future to improve the stability and intelligence of the system.
The above are the details of the design of the taxi meter based on the microcontroller introduced by Shenzhen Zuchuang Microelectronics Co., Ltd. We have rich experience in customized development of smart electronic products, can evaluate the development cycle and IC price as soon as possible, and can also calculate the PCBA quotation. We are the agent of Sonix MCU and Yingguang MCU agent, selling and developing MCU and voice IC solutions of Sonix and Yingguang. We act as an agent and develop ICs and solutions for Jieli, Ankai, Allwinner, Realtek, etc., and also develop BLE Bluetooth ICs, dual-mode Bluetooth modules, wifi modules, and IoT modules. We have hardware design and software development capabilities. Covering circuit design, PCB design, single-chip microcomputer development, software custom development, APP custom development, WeChat official account development, voice recognition technology, Bluetooth development, wifi technology, etc. It can also undertake the research and development of smart electronic products, the design of household appliances, the development of beauty equipment, the development of Internet of Things applications, the design of smart home solutions, the development of TWS earphones, the development of Bluetooth earphone speakers, the development of children's toys, and the research and development of electronic education products.
Proposal recommendation
- TOP