Introduction: This design uses STC15F2K60S2 as the main control chip ( STC15W1K24S and other STC15 series microcontrollers with the same pins are also available ). It reads the time of DS1302 and the temperature collected by DS18B20, and then displays it through the dot matrix screen, and uses the mercury switch (scroll switch) as Gravity sensing sensor, the clock can be displayed normally when placed forward or backward. The CH340G is used to design the automatic download circuit, making program burning more convenient. The clock's pre-installed program can display time, calendar, ambient temperature, and supports alarm clocks. Countdown function. The clock adopts modular programming, which makes it more playable, and DIYers can add functions by themselves. There are several interesting source codes in the attachment: 1. DIY display (you can change the displayed text and images by yourself, the images are modeled using mold-taking software, making programming easier), 2. Mini-games (there are four mini-game codes), 3 routine codes (light up clock LED , button & buzzer & gravity sensor, clock module, temperature module)
Production steps: roughly divided into schematic design, PCB proofing, component selection, board welding, program design, and software and hardware debugging.
1. Schematic design:
1. Conceive the design plan before designing:
2.Circuit design flow chart:
3. Draw the schematic diagram of each module in Lichuang EDA according to the flow chart. After the schematic diagram is completed, proceed to PCB layout and wiring. My skills are limited, so if there are any irregularities in PCB wiring, please forgive me and make corrections. (Personal opinion: It is more convenient to use Lichuang EDA to draw than Altium Designer. It is simple to operate, has rich packages and can be used directly. It is also easier for beginners to get started)
2. PCB proofing:
It is recommended to do proofing at Jialichuang because there are proofing coupons. There is also a 5 yuan free shipping sample activity. I usually make samples at Jialichuang, the price is favorable and the quality is reliable. The proofing board is as shown below
3. Purchase of components:
It comes down to personal choice here. You can buy it from a certain store or Lichuang Mall based on the BOM. Lichuang Mall is more expensive but has complete components and guaranteed quality. 90% of them can be purchased there. The prices of certain products are relatively affordable, but it is difficult to purchase them all in one store and you may buy fakes. Especially today, when chip prices have skyrocketed and are in short supply, there are many fakes and refurbished products, so please keep your eyes peeled when purchasing.
4. Board welding:
Pay attention to distinguish the directions of CH340G, DS1302, and main control STC15F2K60S2. There are not many other requirements. The welding technology depends on the individual! (Program download tutorial is in Six Software and Hardware Debugging)
To check whether the lattice is welded successfully, you can download the routine code " Routine 1- Lighting up the clock LEDlight_led.hex " to display the program in full screen as a verification. After downloading the full-screen display program, if you find that something on the dot matrix cannot be displayed , you can troubleshoot based on the schematic diagram. The dot matrix display is composed of two dot matrixes. The individual dot matrix pins are as shown in the figure below.
Welding physical picture
Download the routine code " Routine 1- Light up the clock LEDlight_led.hex " and the full-screen display effect is as shown below
5. Programming:
I use the keil development environment, and the installation package and installation steps can be found on Baidu. Attached is a routine written in C language (for reference only). You can refer to the official manual and routine during the writing process. I won’t explain too much about the program. No matter how much explanation is given, it’s better to read the routines yourself and write and debug it yourself. Besides, I am also a novice.
6. Software and hardware debugging:
1. Driver installation
Download the CH340G driver installation package in the attachment and install it according to the installation steps.
Install driver for win8 or above system
① Make sure the computer is connected to the Internet
② After the USB port is inserted into the development board, the computer will automatically recognize the device and automatically connect to the network to install the driver device successfully.
③If the computer does not automatically install the driver, open the device manager, find the new device that pops up after inserting the development board ( if the driver is not installed, there is a yellow exclamation mark or question mark in "Other Devices" ) , right-click the device and select "Update driver software" - "Automatically search for updated driver software "
If the above method still fails to install normally, make the following settings
1. Press Winkey+R on the keyboard and enter " services.msc " in the pop-up "Run" dialog box . You can also find "Services" under the "Computer Management" window;
2. Find the two service items " Device Install Service " and " Device Setup Manager " in the service list and confirm whether these two services are turned on. If they are not turned on, you can click "Start" the service on the left.
2. Program download
1. Download the " download program " in the attachment and run the icon software
After opening the program, set it as shown below
2. Select the same microcontroller model as the one welded to the board, then open the program to be downloaded (the pre-installed program in the picture below), click to download the program and then press the download button of the clock board and wait for the program to be downloaded.
7. DIY display and mini-games:
1. Installation and use of impression-taking software
8. Clock settings:
1. Time setting
Lightly press the setting button on the clock board, then press the plus or minus button to modulate the dot matrix display "TIME" (as shown below), then press the setting button (the hour position jumps) and press the plus and minus button to set, and then press the setting button (minutes) Position jump) Press the plus and minus keys to set the minutes, and then press the setting key to set the seconds.
2.Calendar settings
Lightly press the setting button on the clock board, then press the plus or minus button to modulate the dot matrix display "DATE" (as shown below), then press the setting button (the year position jumps) and press the plus and minus button to set the year, and then press the setting button (month position). Position jump) press the plus and minus keys to set the month, press the setting key (day position jumps) press the plus and minus keys to set the day .
3. Alarm clock settings
Lightly press the setting button on the clock board, then press the plus or minus button to modulate the dot matrix display "ALARM" (as shown below), then press the plus or minus button after pressing the setting button to set the switch "ON/OFF", and then display "ON" Press the setting key (the hour position jumps) and press the plus and minus keys to set the hour of the alarm clock . Press the setting key (the minute position jumps) and press the plus and minus keys to set the minutes of the alarm clock .
Summary: Due to time constraints and limited funds, the acrylic panels have not been assembled for the time being. You can assemble them yourself if necessary. There are still many shortcomings in the project, but there are no problems in daily use. The open source experts in the square can modify it themselves or make valuable suggestions. Of course, you can also contact me if you encounter problems during the production process .
Disclaimer: The project is for DIY entertainment. Please do not use it for commercial purposes. I am not responsible for any consequences arising from commercial use.
All reference designs on this site are sourced from major semiconductor manufacturers or collected online for learning and research. The copyright belongs to the semiconductor manufacturer or the original author. If you believe that the reference design of this site infringes upon your relevant rights and interests, please send us a rights notice. As a neutral platform service provider, we will take measures to delete the relevant content in accordance with relevant laws after receiving the relevant notice from the rights holder. Please send relevant notifications to email: bbs_service@eeworld.com.cn.
It is your responsibility to test the circuit yourself and determine its suitability for you. EEWorld will not be liable for direct, indirect, special, incidental, consequential or punitive damages arising from any cause or anything connected to any reference design used.
Supported by EEWorld Datasheet