
[ SCM ] Simple digital tube electronic clock
PRO[ SCM ] Simple digital tube electronic clock
License
:GPL 3.0
Description
1 Project Introduction
Based on the simple digital tube electronic clock designed by STC89C52RC single-chip microcomputer, 6 1-digit digital tubes form a display circuit, and the DP band dot of the digital tube is used to realize the intermediate interval display of the clockThe time, minute and second of the clock are calibrated and set by pressing the button to realize the 24-hour dynamic display of the clock.
2 General design
As shown in Figure 2-1, the block diagram of the digital tube electronic clock system uses STC89C52RC for the main control microcontroller, 5V for power input, TYPE-C interface, and 1x4Pin is reserved for program downloadThe 2.54mm pitch pad interface, the button uses a 6*6*6mm SMD package, the digital tube displays the time, the overall design is simple and efficient, and there are no cumbersome and complex driving components.
Fig.2-1 Block diagram of the electronic clock system of the digital tube
3 Hardware Design
The digital tube electronic clock based on the STC89C52RC single-chip microcomputer design is mainly composed of a power supply circuit, a single-chip microcomputer minimum system circuit, a program download circuit, a key control circuit and a digital tube display circuit.
3.1 Power Circuit
The power supply part is mainly the Type-C female connector as the power input port, SW1 is the toggle switch, and C1/C2 is used as the power filter capacitor. Turn on TYPE-C and flip the SW1 switch to power the entire board.
Fig. 3-1 Power input circuit
3.2 The minimum system circuit of the single-chip microcomputer
The main control microcomputer uses STC89C52RC (LQFP-44 package), which is cheap, high-speed and reliable, low power consumption, and strong anti-interference. The instruction code is fully compatible with the traditional 8051 microcontroller, the working voltage is 3.3~5.5V, and the working frequency range is 0~40MHz, which is equivalent to 0~80MHz of ordinary 8051. The actual operating frequency can reach 48MHz, the Flash program memory space size is 8K bytes, and the on-chip integrated 512-byte RAM data memory, The operating temperature range is -40~85°C.
The P0 port (30 to 37 pins) of the STC89C52 is special, when the P0 port is used as the input/output port, P0 is an 8-bit quasi-bidirectional port that is in open-drain mode after power-on reset. There is no pull-up resistor inside the P0 port, so when used as an I/O port, an external pull-up resistor of 4.7K~10K must be connected. When the P0 port is used as an address/data multiplexing bus, there is no need for an external pull-up resistor when the low 8-bit address line [A0~A7] and the data line [D0~D7].
Fig.3-2 STC89C52RC minimum system circuit
3.3 Program download circuit
The program is downloaded using the USB-TTL tool, and the 1x4pin 2.54mm pitch pad interface is reserved, which is simple and cumbersome.
Fig.3-3 Program download circuit
3.4 Digital tube display circuit
6 digital tubes form a display circuit, directly connected with a group of I/O ports of single-chip microcomputer, the triode plays the role of driving position selection, and the dot of the dp tube segment of the digital tube is used to realize the intermediate interval display of the clock, and the time of 24 is realizedHour dynamic display.
Fig.3-4 Digital tube display circuit
3.5 Button circuit
The button realizes the time calibration function, through the programming of the program, the effect of adding one calibration to the hour, minute and second is realized, and the effect of other control functions can be programmed by yourself, using 3 SMD 6*6*6mm touch switch buttons.
Fig.3-5 Key circuit
4 Schematic design
4.1 New projects
Open JLC EDA, create a new project and name it [MCU] Simple Digital Tube Electronic Clock, and name the schematic file: SCH_ Simple Digital Tube Electronic Clock. Draw a circuit schematic diagram based on the following circuits.
Fig.4-1 SCH_ simple digital tube electronic clock
4.2 Device Selection
In the component selection of this project, all components can be directly in Jialichuang EDAin the component library. If you are not familiar with the components, you can also search by copying the commodity number in the material (each component has a unique commodity number in the Lichuang Mall), if the material is out of stock, you can also choose other replaceable materials, through the analysis of the above circuit, I believe that you have an understanding of the role of each component in the circuit, then the replacement of individual materials will not affect the working performance of the circuit, after understanding the working characteristics of the circuit, the circuit selection has become simple.
Fig.4-2 Schematic diagram of a component search
Fig.4-3 Searching by product number
4.3 Bill of Materials
BOM_ simple digital tube electronic clock |
||||||
NO. |
name |
parameter |
tags |
quantity |
encapsulation |
Item number |
1 |
resistance |
10K |
R1~R7 |
7 |
R0805 |
C17414 |
220 |
R8~R15 |
8 |
C114519 |
|||
1K |
R16~R21 |
6 |
C17513 |
|||
2 |
capacitance |
10uF |
C1,C3 |
2 |
C0805 |
C386019 |
100nF |
C2,C4 |
2 |
C38141 |
|||
30pF |
C5,C6 |
2 |
C43094 |
|||
3 |
Transistor |
S8550 |
Q1~Q6 |
6 |
SOT-23-3 |
C444725 |
4 |
key |
K4-6x6_SMD |
KEY1~KEY3,RST |
4 |
KEY-SMD_4P-L6.0-W6.0 |
C191626 |
5 |
switch |
MST22D18G2 |
SW1 |
1 |
SW-SMD_MST22D18G2 |
C2906280 |
6 |
Crystal oscillator |
12MHz |
X1 |
1 |
OSC-SMD_4P-L5.0-W3.2-BL |
C251597 |
7 |
Digital tubes |
0.56 inch Gongyang |
SEG1~SEG6 |
6 |
LED-SEG-TH_10P-L12.6-W19.0-P2.54-S15.24-BL |
C8092 |
8 |
Microcontroller |
STC89C52RC |
U1 |
1 |
LQFP-44 |
C8707 |
9 |
USB connector |
TYPE-C |
USB1 |
1 |
USB-C-SMD_TYPE-C-31-M-29 |
C2689969 |
10 |
Copper pillars |
M3 |
TP1~TP4 |
4 |
M3X10-6 |
C551322 |
5 PCB design
After completing the schematic design, after checking that the circuit is connected to the network correctly, click on the top menu bar Design → Convert Schematic to PCB (Alt+I) and save the PCB file to the project file named: PCB_ Simple digital tube electronic clock.
5.1 Border Design
Before drawing the PCB, it is necessary to determine the shape and border size of the PCB according to personal wishes and the space occupied by the number of components, if there is no special shell requirements, it is generally designed into rectangular, circular and square. When designing this project, adhering to the principle of appropriate size and beautiful appearance, we click Place → board frame → rectangle under the top tool menu bar, with rounded corners of 100mm in length, 32mm in width and 2mm in width. The actual size of the board frame will be adjusted with the layout of the wiring, if too small can be appropriately enlarged, too large can also reduce the border, style style can be free to play, but try to control within 10cm*10cm, so that you can go to JLC free proof
Fig.5-1 Border design
5.2 PCB Layout
After drawing the outline of the board and frame, the second step of PCB design is to classify and layout the components, which refers to the classification of each component according to the functional module of the circuit schematic diagram, and there are many keys and external interfaces in the diagramThe project has been saved to the same project folder as the schematic file, then select a circuit block in the schematic, such as a key circuit, and click "Design" → "Cross Select" in the top menu bar (the shortcut keys areShift+X), the components corresponding to the PCB page can be selected and placed according to the schematic layout, and each circuit module is sorted and placed in the border box placed in front of it using this method.
Pay attention to the neat placement during the layout, according to the guidance of the flying line, according to the flow direction of the schematic signal and the connection relationship of the device, you can place the schematic device very neatly, and pay attention to the interface position in the process of layout. Here are a few suggestions for reference in the layout of the project:
(1) The digital tube is placed next to each other on the top layer, and other devices are placed on the bottom layer;
(2) The single-chip microcomputer is centered on the back of the bottom layer;
(3) The crystal oscillator is placed close to the single-chip microcomputer to reduce interference;
(4) TYPE-C is placed in the middle of the right side of the board;
(5) Switches, buttons and programming interfaces are placed on the edge of the upper board;
(6) The digital tube drive circuit is arranged below;
(7) M3 copper pillar holes are respectively placed at the four corners of the board edge for fixing supports;
Fig.5-2-1 PCB layout reference diagram - top layer
Fig.5-2-2 PCB layout reference diagram - bottom layer
5.3 PCB Routing
The size of the board here is small, and the double-layer wiring is more difficult, so the four-layer wiring is used. To draw four or more layers of copper foil, you can click the tool → the layer manager (shortcut key is Ctrl+L) to switch settings, click the copper foil layer drop-down to select 4, the inner layer 1 type is set to signal layer, and the inner layer 2 (GND) is set to the inner electrical layer, and when the GND layer is complete, the color of each layer can also be changed here.
Fig.5-3 Layer Manager
Among them, the top layer of the trace is the red line by default, the bottom layer is the blue line, the inner layer 1 is brown, the inner layer 2 (GND) is green, you can also set other colors according to personal preference, the trace is to connect the wire according to the flying wire in the circuit board, Just connect the same network.
First, select the layer you want to route in the Layers panel on the right (the shortcut for layer switching is: Top Layer: T; Ground Floor: B; Inner layer 1:1; Inner layer 2:2), and then click Single Route in the Routing toolbar to connect (shortcut key is W). The seemingly simple Lianliankan requires us to patiently adjust, and the placement layout of components will also affect the difficulty of wiring, so it is necessary to further adjust the layout and further optimize it in the process of wiring. The PCB layout introduced above is equivalent to paving the way for the wiring, and the wiring will be naturally smooth after the layout is completed. Here are a few suggestions for reference in the routing of this project:
(1) The power line is set to 25mil, and the signal line is set to 10mil width;
(2) The wiring is mainly based on the bottom layer wiring, and those that cannot be passed can be switched to the inner layer 1 for connection;
(3) In the process of wiring, the straight line is preferred, and the place that needs to be turned is mainly arc bend or obtuse angle;
(4) Finally, add teardrops, add silk screen marking of the key function and interface function;
Figure 5-4-1 Reference diagram of PCB traces - top layer
Figure 5-4-2 PCB trace reference diagram - inner layer 1
Figure 5-4-3 Bottom layer of PCB traces
Figure 5-4-3 Bottom layer of PCB traces
After the PCB traces are drawn, the copper is poured, and the GND network can be connected . Silk screen characters follow the principle of top-down and left-to-right. Add silk screen labeling instructions to the toggle switch, programming interface and buttons, and add the project name and LOGO annotation in the blank area of the board.
Fig.5-5-1 Copper pouring and silk screen printing reference diagram - top layer
Fig.5-5-2 Copper pour and silk screen printing reference diagram - inner layer 1
Fig.5-5-3 Copper pouring and silk screen printing reference diagram - inner layer 2
Fig.5-5-4 Copper pour and silk screen printing reference diagram - bottom layer
6 Circuit debugging
6.1 Hardware Debugging
(1) Device soldering
First, solder the TYPE-C interface first; second, STC89C52RC (pay attention to the direction when soldering the chip, the dot is marked by 1 pin, if there are multiple dots on the chip, it is usually the smallest dot); third, transistors, resistors and capacitors; Fourth, crystal oscillators, switches and buttons; Fifth, digital tube (note that one positive and one negative are placed according to the screen mark of the device).
Fig.6-1-1 Top layer of PCB assembly
Fig.6-1-2 PCB assembly diagram - bottom layer
Fig.6-2-1 Blank PCB - top surface
Fig.6-2-2 Bottom surface of the empty PCB board
Pay attention to the soldering iron tip with electric safety hands during the soldering process to avoid burns. When soldering, the components are aligned to check whether the model is correct. When soldering chip components are clamped with tweezers, wait for the solder to solidify before removing the tweezers, otherwise it is easy to cause false soldering. During the soldering process, pay attention to whether the solder wire is soldered or missed, so as to avoid affecting the performance of the circuit and causing the circuit to not work normally.
Fig.6-3-1 Physical view of PCBA - top surface
Fig.6-3-2 Physical PCBA diagram - bottom surface
Fig.6-4-1 Top 3D rendering
Fig.6-4-2 3D rendering - bottom surface
(2) Hardware debugging
If the welder is rough, after welding a component, you can visually check whether it is a short circuit, or you can use a multimeter to check. After the welding is completed, you need to use a multimeter to check whether the power supply is short-circuited with the ground, whether there is a short circuit and open circuit during the welding process, and the power-on test can be carried out only after the inspection is correct.
6.2 Software Debugging
(1) Programming environment
The keil C51 can be used in microcontrollers such as AT89 series, STC89 series and STC15 series for programming and developmentFor development, the keil C51 software supports hundreds of chips, and the official download address is https://www.keil.com/download/product/
(2) Firmware burning
Use Hongjing's STC-ISP to download the programming and burning software, and use the USB-TTL tool to download the program to the single-chip microcomputer, the official download address: http://www.stcmcudata.com/
(3) Program introduction
Configure the relevant parameters in STC-ISP, select the chip model STC89C52RC, click the timer calculator tool, enter the corresponding system frequency, select the timer mode, etc., and then click Generate C code to copy to keiluse;
The reason why the AUXR error is reported in the program compilation and debugging is that the AUXR register is not declared in the header file reg52.h of the STC89C52RC, and you need to check the definition in the data sheet to turn on, that is, sfr AUXR = 0x8E;
Fig.6-5 Timer configuration operation
Fig. 6-6 Working diagram of a simple digital tube electronic clock
Designed by 立创EDA课程案例推荐 (from OSHWHub)
Link:https://oshwhub.com/course-examples/dan-pian-ji-jian-yi-shu-ma-guan-dian-zi-shi-zhong
Design Drawing


Comment