[Data sharing] Design of anti-drinking driving alcohol detection and alarm system based on single-chip microcomputer, and simulation design of speech timing protues based on digital circuit

 Device Design of Alcohol Detection and Alarm System Based on SCM

1. Description

The alcohol concentration is detected by the MQ3 sensor, and the signal is processed by ADCO832 and then processed by the single-chip microcomputer. When the detected concentration exceeds the "drunk driving" alarm value, the red light is on. When the detected concentration exceeds the "drunk driving" alarm value, The red light is on and the buzzer starts at the same time. The alarm value can be set by pressing the button, and the currently detected concentration value can be saved by pressing the button, and then the saved value can be queried.

2. Button description (from left to right)

KEY1: setting key; switch setting menu (drunk driving, drunk driving).

KEY2: plus key; set parameters +. 2,

KEY3: minus key; setting parameter -. 3.

KEY4: Save key, save the current detected concentration. 4.

KEY5: Query key, to query the previously saved concentration value, which can be browsed through KEY2/KEY3.

Protues simulation design based on digital circuit speech timing

1. Design purpose

  1. Master the principle of digital timing display.
  2. Master the comprehensive design methods of basic logic gate circuits, decoders, flip-flops, counters, and 555 pulse generating circuits commonly used digital circuits.
  3. Familiar with the method of digital circuit simulation design using simulation software Protues.

2. Design points

  1. Speech time can be set (including 6 minutes within 6 minutes);
  2. There is an alarm prompt when the speech time arrives;
  3. Use the digital tube to display the time spent in the speech;
  4. Use LED lights to simulate and display the seconds (one light is on every 10 seconds);
  5. The time can be cleared and used repeatedly.

3. Program Design and Demonstration

In order to realize the counting alarm function in this design, firstly, the pulse switch can be used to generate the counting pulse; secondly, the 74LS192 counter and the 74LS138 decoder can be used to realize the counting and digital display; finally, the buzzer can be used to realize the alarm, in order to keep the LED light on continuously 10 seconds, it can be realized by 555 timer; in general, the circuit consists of two parts, one is the counting and decoding part, and the other is the alarm part.

Option 1 : Use COMS digital chips, use dedicated clock chips, use decimal counters, and use universal boards to weld circuits, build circuits in modules, and use dedicated power supplies for power supply. Advantages: accurate timing, sensitive response, simple thinking, stable performance, high success rate, and easy debugging. Disadvantages: Weak driving ability, complex wiring, and insufficient use of digital knowledge.

Solution 2 : Use TTL digital chip, use 74LS192 multi-ary counter, use 555 timer to build a clock module, use USB power supply, and use PCB board. Advantages: The circuit has strong driving ability, no need to consider the problem of floating input pins, fully utilizes the knowledge of analog and digital electronics, beautiful appearance, and convenient power supply. Disadvantages: The overall layout is more troublesome, troubleshooting is more troublesome, and the clock performance is average.

After comparing the advantages and disadvantages of the two schemes, the second scheme was selected, and the hierarchical design was carried out from top to bottom. Firstly, the structure of each module was defined and specified, and then the interior of the module was designed in detail. Through simulation, schematic design, PCB production, and step-by-step debugging, the shortcomings of the second solution are solved. The effect of making it is good, and the knowledge of digital electricity learned can be fully utilized. It can embody the true connotation of digital and electrical courses. The timing alarm we designed is strictly in accordance with the design requirements, and has the functions of telling the time on the hour and displaying; Some digital chips, these are our group, different from other groups

1596 Device Design of Alcohol Detection and Alarm System Based on SCM

1590 simulation design based on digital circuit speech timing protues

The article is reposted from Dianshiwu, the complete information Baidu network disk download address: Baidu network disk  www.aiesst.cn/share.html


What is the minimum system of 51 single-chip microcomputer

The smallest single-chip microcomputer system, or called the smallest application system, refers to a system that can work with a single-chip microcomputer composed of the fewest components.

For 51 series microcontrollers, the minimum system should generally include: microcontroller, crystal oscillator circuit, reset circuit.

The minimum system circuit diagram of a 51 single-chip microcomputer is given below.

illustrate

Reset circuit: It is composed of capacitors connected in series with resistors. From the figure and combined with the nature of "capacitor voltage cannot change abruptly", it can be known that when the system is powered on, the RST pin will appear at a high level, and the duration of this high level is determined by The RC value of the circuit is determined. A typical 51 single-chip microcomputer will reset when the high level of the RST pin lasts for more than two machine cycles. Therefore, a proper combination of RC values ​​​​can ensure a reliable reset. Generally, textbooks recommend that C be 10u, R is 8.2K. Of course, there are other methods. The principle is to make the RC combination produce a high level of no less than 2 machine cycles on the RST pin. As for how to calculate the specific quantity, you can refer to relevant books on circuit analysis.

Crystal oscillator circuit: the typical crystal oscillator is 11.0592MHz (because 9600 baud rate and 19200 baud rate can be obtained accurately, used in occasions with serial port communication) / 12MHz (produce accurate uS-level time interval, convenient for timing operation)

Single-chip microcomputer: a piece of AT89S51/52 or other 51 series compatible single-chip microcomputer

Special attention: For pin 31 (EA/Vpp), when it is connected to a high level, the microcontroller starts executing from 0000H of the internal ROM after reset; when connected to a low level, it starts to execute directly from 0000H of the external ROM after reset. This point is Beginners are easy to ignore.

Reset circuit:

1. The purpose of the reset circuit

The single-chip microcomputer reset circuit is like the restart part of the computer. When the computer crashes during use, press the restart button to start the program from the beginning. The same is true for single-chip microcomputer. When the single-chip microcomputer system is running and the program runs away due to environmental interference, press the reset button and the internal program will automatically start from the beginning.

The microcontroller reset circuit is shown in the figure below:

Second, the working principle of the reset circuit

It is introduced in the book that to reset the 51 single-chip microcomputer, it only needs to connect a high level to the 9th pin for 2US to realize it. How is this process realized?

In the single-chip microcomputer system, the system resets once when the system is powered on, and the system resets again when the button is pressed. If it is released and then pressed, the system will also reset. Therefore, its reset can be controlled in the running system by opening and closing the key.

Why is it reset when booting

In the circuit diagram, the size of the capacitor is 10uF, and the size of the resistor is 10k. Therefore, according to the formula, it can be calculated that the capacitor is charged to 0.7 times the power supply voltage (the power supply of the microcontroller is 5V, so charging to 0.7 times is 3.5V), and the time required is 10K*10UF=0.1S.

That is to say, within 0.1S after the computer is started, the voltage across the capacitor increases between 0 and 3.5V. At this time, the voltage across the 10K resistor decreases from 5 to 1.5V (the sum of the voltages across the series circuit is the total voltage). So within 0.1S, the voltage received by the RST pin is 5V~1.5V. In the 51 single-chip microcomputer that works normally at 5V, the voltage signal less than 1.5V is a low-level signal, and the voltage signal greater than 1.5V is a high-level signal. Therefore, within 0.1S of starting up, the single-chip system automatically resets (the time for the high-level signal received by the RST pin is about 0.1S).

Why does it reset when the button is pressed

0.1S after the MCU starts, the voltage across the capacitor C continues to charge to 5V. At this time, the voltage across the 10K resistor is close to 0V, and the RST is at a low level, so the system works normally. When the button is pressed, the switch is turned on. At this time, a loop is formed at both ends of the capacitor, and the capacitor is short-circuited. Therefore, during the process of pressing the button, the capacitor starts to discharge the previously charged power. As time goes by, the voltage of the capacitor is released from 5V to 1.5V or even less within 0.1S. According to the voltage of the series circuit is the sum of all places, the voltage across the 10K resistor is 3.5V or even greater at this time, so the RST pin receives a high level again. The microcontroller system automatically resets.

Summarize:

1. The principle of the reset circuit is that the RST pin of the microcontroller receives a level signal above 2US, as long as the charging and discharging time of the capacitor is greater than 2US, the reset can be realized, so the capacitance value in the circuit can be changed.

2. Press the button to reset the system, which is caused by the capacitor being in a short-circuit circuit, releasing all the electric energy and increasing the voltage across the resistor.

Introduction to the minimum system circuit of 51 single-chip microcomputer

1. The size of the polar capacitor C1 of the minimum system reset circuit of the 51 single-chip microcomputer directly affects the reset time of the single-chip microcomputer. Generally, 10~30uF is used. The larger the minimum system capacitance of the 51 single-chip microcomputer, the shorter the reset time required.

2. The minimum system crystal oscillator Y1 of 51 single-chip microcomputer can also use 6MHz or 11.0592MHz, and a higher frequency crystal oscillator can be used under normal working conditions. The oscillation frequency of the minimum system crystal oscillator of 51 single-chip microcomputer directly affects the processing speed of the single-chip microcomputer. The higher the frequency, the faster the processing speed .

3.51 The minimum system start-up capacitors C2 and C3 of the single-chip microcomputer generally use 15~33pF, and the closer the capacitor is to the crystal oscillator, the better, and the closer the crystal oscillator is to the single-chip microcomputer, the better 4. P0 port is an open-drain output, and a pull-up resistor is required as an output port , The resistance is generally 10k.

When set to timer mode, adding 1 to the counter counts the internal machine cycle (1 machine cycle is equal to 12 oscillation cycles, that is, the counting frequency is 1/12 of the crystal oscillator frequency). The count value N multiplied by the machine cycle Tcy is the timing time t.

When set to counter mode, the external event count pulse is input to the counter by T0 or T1 pin. The T0 and T1 pin levels are sampled during S5P2 of each machine cycle. When a high level input is sampled in a certain cycle, and a low level is sampled in the next cycle, the counter is added by 1, and the updated count value is loaded into the counter during S3P1 of the next machine cycle. Since it takes 2 machine cycles to detect a falling edge from 1 to 0, it is required that the sampled level be maintained for at least one machine cycle. When the crystal oscillator frequency is 12MHz, the highest counting frequency does not exceed 1/2MHz, that is, the period of the counting pulse is greater than 2 ms.

Guess you like

Origin blog.csdn.net/jingdianjiuchan/article/details/130839808