laitimes

Schematic diagram of single-chip microcomputer small system based on WiFi trolley control board

author:Embedded Xiaomei teacher

A small system refers to a system that can work with a single-chip microcomputer composed of few components. Generally, when designing a small system, it is divided into these four necessary circuits, which are 1. Power supply circuit; 2. Single-chip reset circuit; 3. Clock oscillation circuit; 4. The download interface circuit of the program. This time, based on the small system schematic diagram of the WiFi trolley 51 core control board developed by us, let's talk about the small system of the 51 single-chip microcomputer.

Schematic diagram of single-chip microcomputer small system based on WiFi trolley control board

The single-chip microcomputer used in the WiFi trolley 51 core control board is a STC15W4K32S4 series single-chip microcomputer, and this series of single-chip microcomputer is a wide-voltage single-chip microcomputer. Refers to the wide working voltage, its working voltage can be 2.5V-5.5V, in order to facilitate your use, we chose the same single-chip microcomputer IAP15W4K61S4 as the multi-core experimental box, with 4K SRAM and 61KB of Flish program storage space, with 8 PWMs, including 6 15-bit PWM and 2 CCPs, 4 serial communication interfaces, 5 internal timers and 8 10-bit ADC channels. This single-chip microcomputer can directly simulate and debug the program online, which is convenient for development and learning.

Power supply circuit For a complete electronic product, the first problem faced is the power supply of the system, so the power supply is the basis for the smooth operation of the entire system. In the design of the microcomputer next to each power pin will put a filter capacitor to ensure that the voltage input to the microcomputer power pin is stable, if the clock frequency of the microcomputer is high, it is recommended that the capacitor here set to 0.01uF; If the clock frequency of the microcontroller is low, it is recommended to set it to 0.1uF.

The function of the reset circuit is to reset the single-chip microcomputer, so that the single-chip microcomputer returns to the starting state and the program is executed from the beginning, just like the computer crashes during use, press the restart button The internal program of the computer runs from the beginning. The same is true for single-chip microcomputers, when single-chip microcomputers are also affected by environmental factors and other factors in the process of operation. From the data sheet of the microcomputer, it is known that the working principle of the reset circuit is to input a reset signal of more than two machine cycles to the reset pin of the microcomputer when it needs to be reset. There are two types of reset signals, one is a high reset and the other is a low reset. As shown in the figure below, these two reset circuits are low-level reset circuits on the left and high-level reset on the right. The specific choice of the kind of microcomputer needs to see the kind of reset circuit used, the principle is the same, but the reset signal is different, and the 51 single-chip microcomputer is commonly used to low-level reset signal.

Schematic diagram of single-chip microcomputer small system based on WiFi trolley control board

It can be seen from the figure that these two reset circuits are composed of capacitors and resistors in series, the difference is that we consider that the level signal connected to the reset pin of the microcomputer is different when the capacitor is short-circuited in DC. In the high-level reset circuit, the reset pin is connected to a low-level signal, and the low-level reset circuit pin is connected to a high level. After the reset circuit is energized, because the capacitor to be charged, the voltage at the RST end is not abrupt, such as in the high-level reset circuit, the system will appear a period of high level as soon as the RST pin is powered on, and the duration of this high level is determined by the RC value of the reset circuit, so the selection of a suitable combination of RC value can ensure that the single-chip microcomputer can be reliably reset. Usually choose 0.1uF capacitor and 10K ohm resistance value, in the case of the working voltage is 5V, the capacitor full charge time is about 1ms, this 1ms charging time is much greater than the two machine cycles of the single-chip microcomputer. In these two reset circuits also include an automatic reset circuit and a manual reset circuit, the reset circuit will complete a reset when the system is powered on, in addition to the manual reset can be achieved by the button on the reset circuit, the principle of manual reset is to press the button after the capacitor is short-circuited directly to the RST pin to achieve reset.

Clock oscillation circuit: The front power circuit is easier to understand, but what is the clock circuit? What does it do? In fact, the role of the clock oscillation circuit in the single-chip microcomputer is like the human heart, which is constantly beating every moment, so the clock circuit is to provide driving force for the normal work of the internal parts of the single-chip microcomputer. The clock oscillation circuit on the WiFi trolley is shown in the figure below.

Schematic diagram of single-chip microcomputer small system based on WiFi trolley control board

Often our oscillation circuit uses a quartz crystal oscillator as the clock source of the microcomputer, and if there is a clock signal, it can also be directly input to the TXAL1 pin. If passive crystal oscillators are used, a quartz crystal oscillator is connected to the XTAL1 and XTAL2 pins of the single-chip microcomputer, which will produce a specific frequency oscillation when it is powered on, and then a frequency-stable clock signal can be output through the circuit to drive the single-chip microcomputer to work.

The clock circuit also uses two capacitors, C1 and C2. These two capacitors and the internal circuit together form an oscillation of a certain frequency, and the capacitor acts as a fixed frequency. Generally, when designing, pay attention to the trace between the crystal oscillator, the external capacitor and the single-chip microcomputer should be as short as possible, if the line is too long, it will become very sensitive to interference, and it will also increase the parasitic capacitance to the oscillator.

The single-chip microcomputer used on the WiFi trolley control board actually comes with an RC oscillator as a clock source, but it can also use an external crystal oscillator. Generally, RC oscillators are prone to temperature drift, which affects clock accuracy, so we still use an external quartz crystal oscillator as a clock oscillation circuit here.

Another part is the interface of the single-chip microcomputer download program, which is decided according to the use of different models of single-chip microcomputer and different download methods. The single-chip microcomputer used in the WiFi trolley 51 core control board can use the serial port for download and simulation, so it is necessary to set aside a serial port as the interface of the download program, and the download port that leads to the download port is an ordinary serial port in addition to downloading the program, which can be used for serial communication like an ordinary serial port.

With these four circuits single-chip microcomputer can work stably, we connect our RGBLED lights, ultrasonic ranging, motor drive circuits, buttons and other peripheral devices on the WiFi trolley, and we can use the single-chip microcomputer to control and communicate!

Embedded IoT needs to learn a lot of things, don't learn the wrong route and content, resulting in the salary or not!

Share with you a data pack, almost 150 gigabytes. The learning content, faces, and projects are relatively new and complete!

Scan the code to enter the group to receive information

Schematic diagram of single-chip microcomputer small system based on WiFi trolley control board