aerobotics

【Course Design】Programmable Creative Clock

 
Overview

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

  • Run the " lattice LCD mold taking.EXE " in the attachment
  • After opening the software, set the software (if you have set it before, you can skip this step), click Parameter Settings in the left column - > Other options, and select modulo mode, byte reverse order, retention, and the number of digits of A51 data. These points are set as shown in the figure. 

 

  •   Click Basic Operations in the left column - > Create a new image, and fill in the length and width of the created image as needed (width 22 , height 8 , settings that can be displayed on the full screen)

  • After pressing OK, click Simulate Animation in the left column - > Zoom in on the grid. After placing it to the maximum, you can create an image in the white area (black means the lights are actually on, white means no lights)

  • After creating the image, click Module Mode - > C51 Format in the left column. In the dot matrix generation area, code data will be automatically generated and the required code will be copied.

  • Open the relevant routine in the attachment, copy the required code to replace the relevant code in the routine, recompile and download, and the DIY content will be displayed.

 

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.

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-23 08:49:14

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号