LED rotating clock production (with source code)

Publisher:LianaiLatest update time:2012-03-21 Source: 电子发烧友Keywords:LED Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
LED Rotating Clock Production:

The key to this project is how to solve the problem of how to power the high-speed rotating circuit board and how to adjust the time. I used the principle of motor brushes to drill a hole in the rotating shaft, and led the power from the back to the front circuit board through a plug, and this rotating plug was in contact with two copper sheets fixed on the backboard. The problem of adjusting the time is somewhat difficult. One is to connect the circuit board to the PC before rotating, and the computer transmits the timing data. Although this is feasible, it is not convenient. Another method is to use remote control, but this solution has great difficulties in debugging.

In terms of display method, I use two balanced rows of LEDs. In addition to being able to maintain better balance when rotating, it can also utilize the alternating display method on both sides, which is twice as fast as a single row.

This device is not only a clock, it can also dynamically display Chinese characters and patterns, it all depends on how it is used.

The specific production process is as follows:

1. Production of rotating electrical machines

Considering the production cost and convenience, the DC brushless motor used in the large floppy drive of old computers was selected and only partial modifications were made.

This antique floppy drive

Brushless DC motor on floppy drive

Disassembled motor

Carefully disassemble the DC motor and cut a hole in the aluminum shaft with the disc so that it can just fit a plug.

The rotating shaft is processed like this

After assembly

Install the shaft onto the DC motor in reverse order of disassembly.

After the motor is assembled

A brush made of two copper sheets

Side view after the brush is installed. The more protruding components on the circuit board are soldered on the reverse side.

How to connect the power supply to the motor.

From the symbols marked on the circuit board, "+" represents the positive power supply and "G" represents the negative power supply.

The "C" and "M" terminals are connected to the positive and negative ends of the power supply to make the motor run.

Make a hole in an old record according to the position of the motor seat, and the light baffle used for positioning should be determined according to the position of the photosensitive component on the circuit board.

2. Production of circuit boards

This product is controlled by 51 single-chip microcomputer, and the specific electrical schematic diagram is as follows:

The circuit board was designed and manufactured using Protel 99.

Finally get the finished work.

The remote control used is a Panasonic car-mounted one, and only six of its keys are used.

When booting

Timing status

Runtime source code:

#include

sbit gate11=P3^0;

sbit gate12=P3^1;

#define unit unsigned int

#define uchar unsigned char

uchar data BUFFER[]={0,0,0,0,1,1,7};

uchar data M[]={31,28,31,30,31,30,31,31,30,31,30,31};

uchar code NUM1[] =

{

0x80,0x7F,0xC0,0xFF,0x40,0x90,0x40,0x8C, // -0-

0x40,0x82,0xC0,0xFF,0x80,0x7F,0x00,0x00,

0x00,0x00,0x00,0x81,0x80,0x81,0xC0,0xFF, // -1-

0xC0,0xFF,0x00,0x80,0x00,0x80,0x00,0x00,

0x80,0xE0,0xC0,0xF0,0x40,0x98,0x40,0x8C, // -2-

0x40,0x86,0xC0,0xC3,0x80,0xC1,0x00,0x00,

0x80,0x40,0xC0,0xC0,0x40,0x84,0x40,0x84, // -3-

0x40,0x84,0xC0,0xFF,0x80,0x7B,0x00,0x00,

0x00,0x0C,0x00,0x0E,0x00,0x0B,0x80,0x89, // -4-

0xC0,0xFF,0xC0,0xFF,0x00,0x88,0x00,0x00,

0xC0,0x47,0xC0,0xC7,0x40,0x84,0x40,0x84, // -5-

0x40,0x8C,0x40,0xFC,0x40,0x78,0x00,0x00,

0x00,0x7F,0x80,0xFF,0xC0,0x84,0x40,0x84, // -6-

0x40,0x84,0x00,0xFC,0x00,0x78,0x00,0x00,

0xC0,0x00,0xC0,0x00,0x40,0xF0,0x40,0xF8, // -7-

0x40,0x0C,0xC0,0x07,0xC0,0x03,0x00,0x00,

0x80,0x7B,0xC0,0xFF,0x40,0x84,0x40,0x84, // -8-

0x40,0x84,0xC0,0xFF,0x80,0x7B,0x00,0x00,

0x80,0x03,0xC0,0x87,0x40,0x84,0x40,0x84, // -9-

0x40,0xC4,0xC0,0x7F,0x80,0x3F,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63, // -:-

0x00,0x63,0x00,0x00,0x00,0x00,0x00,0x00,

};

uchar code NUM2[]=

{

0x00,0x00,0x7f,0x80,0xff,0xc0,0x82,0x40, // -0-

0x8c,0x40,0x90,0x40,0xff,0xc0,0x7f,0x80,

0x00,0x00,0x00,0x00,0x20,0x40,0x60,0x40, // -1-

0xff,0xc0,0xff,0xc0,0x00,0x40,0x00,0x40,

0x00,0x00,0x41,0xc0,0xc3,0xc0,0x86,0x40, // -2-

0x8c,0x40,0x98,0x40,0xf0,0xc0,0x60,0xc0,

0x00,0x00,0x40,0x80,0xc0,0xc0,0x88,0x40, // -3-

0x88,0x40,0x88,0x40,0xff,0xc0,0x77,0x80,

0x00,0x00,0x0c,0x00,0x1c,0x00,0x34,0x00, // -4-

0x64,0x40,0xff,0xc0,0xff,0xc0,0x04,0x40,

0x00,0x00,0xf8,0x80,0xf8,0xc0,0x88,0x40, // -5-

0x88,0x40,0x8c,0x40,0x8f,0xc0,0x87,0x80,

0x00,0x00,0x3f,0x80,0x7f,0xc0,0xc8,0x40, // -6-

0x88,0x40,0x88,0x40,0x0f,0xc0,0x07,0x80,

0x00,0x00,0xc0,0x00,0xc0,0x00,0x83,0xc0, // -7-

0x87,0xc0,0x8c,0x00,0xf8,0x00,0xf0,0x00,

0x00,0x00,0x77,0x80,0xff,0xc0,0x88,0x40, // -8-

0x88,0x40,0x88,0x40,0xff,0xc0,0x77,0x80,

0x00,0x00,0x70,0x00,0xf8,0x40,0x88,0x40, // -9-

0x88,0x40,0x88,0xc0,0xff,0x80,0x7f,0x00,

0x00,0x00,0x00,0xc0,0x01,0x80,0x03,0x00, // -/-

0x06,0x00,0x0c,0x00,0x18,0x00,0x30,0x00,

};

unit disp1,disp2,key1,key2;

unit ii,jj;

unit i,sw,xz;

void Delay(unit ms){

ms=ms*3;

while(--ms);

}

void num_led(int kk, int tt)

{

int jj;

for(jj=0;jj<8;jj++){

gate11=key1; gate12=key2;

P2=~NUM1[kk+jj*2];P1=~NUM1[kk+1+jj*2];

Delay(20);

P1=0xff;P2=0xff;

gate11=key2; gate12=key1;

P2=~NUM2[tt+15-jj*2];P1=~NUM2[tt+14-jj*2];

Delay(20);

P1=0xff;P2=0xff;

}

}

void display_clock(void)

{

key1=!key1;key2=!key2;

disp1=BUFFER[3]/10;disp2=BUFFER[4]-(BUFFER[4]/10)*10;

ii=disp1*16;jj=disp2*16;

num_led(ii,jj);

P2=0xff;P1=0xff;Delay(60);

disp1=BUFFER[3]-disp1*10;disp2=BUFFER[4]/10;

ii=disp1*16;jj=disp2*16;

num_led(ii,jj);

P2=0xff;P1=0xff;Delay(60);

ii=160;jj=160;

num_led(ii,jj);

P2=0xff;P1=0xff;Delay(60);

disp1=BUFFER[2]/10;disp2=BUFFER[5]-(BUFFER[5]/10)*10;

ii=disp1*16;jj=disp2*16;

num_led(ii,jj);

P2=0xff;P1=0xff;Delay(60);

disp1=BUFFER[2]-disp1*10;disp2=BUFFER[5]/10;

ii=disp1*16;jj=disp2*16;

num_led(ii,jj);

P2=0xff;P1=0xff;Delay(60);

ii=160;jj=160;

num_led(ii,jj);

P2=0xff;P1=0xff;Delay(60);

disp1=BUFFER[1]/10;disp2=BUFFER[6]-(BUFFER[6]/10)*10;

ii=disp1*16;jj=disp2*16;

num_led(ii,jj);

P2=0xff;P1=0xff;Delay(60);

disp1=BUFFER[1]-disp1*10;disp2=BUFFER[6]/10;

ii=disp1*16;jj=disp2*16;

num_led(ii,jj);

P2=0xff;P1=0xff;Delay(60);

}

void timer0(void) interrupt 1 using 1

{

TMOD=0x11;

TH0=-(5000/256);

TL0=-(5000%256);

TR0=1;

BUFFER[0]=BUFFER[0]+1;

if (BUFFER[6]%4==0) M[1]=M[1]+1;

if (BUFFER[0]>201+xz){

BUFFER[0]=0;

BUFFER[1]=BUFFER[1]+1;

if (BUFFER[1]==60){

BUFFER[1]=0;

BUFFER[2]=BUFFER[2]+1;

if (BUFFER[2]==60){

BUFFER[2]=0;

BUFFER[3]=BUFFER[3]+1;

if (BUFFER[3]==24){

BUFFER[3]=0;

BUFFER[4]=BUFFER[4]+1;

if (BUFFER[4]>M[BUFFER[5]-1]){

BUFFER[4]=1;

BUFFER[5]=BUFFER[5]+1;

if (BUFFER[5]>12){

BUFFER[5]=1;

BUFFER[6]=BUFFER[6]+1;

if(BUFFER[6]>99) {

BUFFER[6]=0;

M[1]=M[1]-1;

}

}

}

}

}

}

}

}

void intersvr0(void) interrupt 0

{

sw=1;

}

void main(void)

{

xz=8;

key1=1;key2=0;

EA=1;

IT0=1;EX0=1;

IT1=1;ET0=1;

TMOD=0x11;

TH0=-5000/256; TL0=-5000%256;

TR0=1;

for(;;){

Delay(10);

if(sw==1) {display_clock();sw=0;}

}

}

Keywords:LED Reference address:LED rotating clock production (with source code)

Previous article:Introduction to the principle of rotating LED screen
Next article:The latest LED dimming technology solutions

Recommended ReadingLatest update time:2024-11-16 16:46

AL3158 triple 1x (2x) charge pump white LED driver
This article introduces the main features, functional block diagram and typical application circuit of AL3158. AL3158 is a high-efficiency 1x/2x charge pump white LED driver from Diodes Incorporated. The DC/DC converter uses a dual-mode load switch 1x or 2x. The VIN voltage range is from 2.7V to 5.5V. The maximum po
[Power Management]
AL3158 triple 1x (2x) charge pump white LED driver
Principle and typical application of LED driver
Among various types of light sources, high-brightness LEDs (light-emitting diodes) are currently growing well and are beginning to replace other types of light sources such as incandescent lamps, halogen lamps, fluorescent lamps, HID xenon lamps, etc. In recent years, high-brightness LEDs (HBLEDs) have begun to be u
[Power Management]
Principle and typical application of LED driver
Mini LED manufacturers are about to increase production, and domestic substitution of power semiconductors has accelerated
The iMac and iPad pro released by Apple this time both use the self-developed M1 chip. So far, the hardware foundation of Apple's five major products all use ARM architecture. The unification of hardware architecture makes the cross-device interaction of products smoother and more natural, and Apple's closed-loop ecol
[Mobile phone portable]
Analysis of Chinese LED Cooling Technology Patents
High-brightness light-emitting diodes (LEDs) have the characteristics of low power consumption, long life, fast response speed, small size, no pollution, and easy integration. They are a new generation of light sources that have caused a lighting revolution and upgraded the traditional lighting industry. Especially
[Power Management]
Analysis of Chinese LED Cooling Technology Patents
Mini LED trend is becoming clearer and will start large-scale commercialization
According to Jiwei.com, after Samsung and Apple successively released Mini LED related terminal application products, on July 29, Huawei also launched the Mini LED smart screen, and a situation of three strong forces was officially formed. It is reported that Huawei Smart Screen V75 Super adopts the self-developed Hon
[Mobile phone portable]
Design of Flicker-free LED Lamp Driver
Traditional halogen cup lamps use electronic transformers and AC input, so the LED lamps currently on the market can directly replace traditional halogen cup lamps by installing rectifier circuits inside. Although traditional electronic transformers are cheap, their quality varies. Since electronic transforme
[Power Management]
Design of Flicker-free LED Lamp Driver
Analysis of differences in LED bulb design ideas among Asian companies
As prices drop, LED bulbs are becoming more and more popular. Recently, not only Japanese manufacturers, but also Korean, Chinese mainland, Taiwanese and European manufacturers have begun to focus on the commercialization of LED bulbs. For this reason, we disassembled and analyzed 9 LED bulbs sold in East
[Power Management]
Analysis of differences in LED bulb design ideas among Asian companies
UCC28019A LED lighting application load dynamic performance optimization solution
1. Introduction Average current control in CCM operation is the most typical control scheme, which is widely used in high-power APFC converters, such as UC3854-based converters. Compared with peak current control, it has many advantages, such as no external compensation slope, higher noise suppression of the check cu
[Power Management]
UCC28019A LED lighting application load dynamic performance optimization solution
Latest Power Management Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

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号