YS13-3 fluorescent tube clock design

A few days ago, when my girlfriend asked her what she wanted for her birthday, she mentioned that she wanted the self-made clock of the glow tube, and then checked the Internet and found that the driving voltage of the glow tube was quite high and the tube was expensive. So I folded it up and replaced the glow tube with YS13-3 fluorescent tube to make the clock. Not much nonsense, let me introduce my design process.

Design ideas and component selection

The main control chip I used here is stm32f103C8T6. There are several reasons. First, the development is faster. Those who have used stm32cubemx know that the development efficiency is faster than the traditional standard library. Secondly, it is cheap and easy to weld. Then there is the question of how to light the fluorescent tube. It took a lot of effort to find information. Finally, let's simply pick up. YS13-3 requires three different voltages, 1.2V, 24V and GND. In general, pin 1 is grounded, pin 9 is connected to 1.2V, and pin 6 is connected to 24V. These three are unchanged. For the remaining pins, which is connected to 24V, the corresponding tube will light up. How to find pin 1? The way is to look at the tube, the lower left corner of the inside is connected to pin 1, and from the bottom, pin 1 clockwise to find 2, 3, 4... and so on.
The pin corresponds to the bright positionThen there is the driving chip. Here I chose 74HC595 and ULN2003 to drive the digital tube. In addition, in order to have a suitable voltage, I used AMS1117 to step down to 3.3V and 1.2V, and then use the integrated XL6009 boost module to boost to 24V. Then an external wireless serial communication module is connected to communicate with the PC.

Schematic design

YS-13 drive circuit
Insert picture description hereInsert picture description here

Main control circuit
Insert picture description here

Buck-boost circuit and
Insert picture description hereother circuits
Insert picture description here

programming

74HC595 send function

void HC595_sendsata(uint8_t data) // (8bit)
{
    
    
  uint8_t i;
	HAL_GPIO_WritePin(GPIOC, GPIO_PIN_15, GPIO_PIN_RESET);   // SHCP=0
    for(i=0;i<=7;i++)
	{
    
    
	  if(data&0x01)
		{
    
    
			HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_SET);//DS=1
		}
		else
		{
    
    
            HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_RESET); //  DS=0
		}
		 HAL_GPIO_WritePin(GPIOC, GPIO_PIN_15,GPIO_PIN_SET);//SHCP=1
	     HAL_GPIO_WritePin(GPIOC, GPIO_PIN_15,GPIO_PIN_RESET);//SHCP=0
	    data=data>>1;
	} 
	 
}

YS13-3 display function

uint8_t time[4]={
    
    0,5,2,0};//存放每个辉光管要显示的数字
uint8_t mabiao[10]={
    
    0xa0,0xbe,0x44,0x0c,0x1a,0x09,0x01,0x3c,0x00,0x08}; //码表

void YS13_display() // YS13显示4个数字
{
    
    
	 uint8_t i;
	 for(i=0;i<4;i++)
	 {
    
    
      HC595_sendsata(mabiao[time[3-i]]);	
     }

     HAL_GPIO_WritePin(GPIOC, GPIO_PIN_14, GPIO_PIN_SET);     //  STCP=1
	 HAL_GPIO_WritePin(GPIOC, GPIO_PIN_14, GPIO_PIN_RESET);   //  STCP=0
	}
}

The main communication method of 74HC595 is when the SHCP rising edge, the data of the DS port is read and the shift is latched, but the external level of Q0-Q7 is actually still unchanged at this time, and only when the STCP is high. The value of the internal shift register is output to the outside at one time. For example, when the SHCP rising edge is 8 times in succession, DS is all 1, but you still output Q0-Q7 in the original state at this time. Only when STCP is set to 1, Q0-Q7 will output 1.

Show results

Insert picture description here
Finally, the program and PCB files in the appendix, hope to help some friends
Link: https://pan.baidu.com/s/1YUuVa5GkLel64a2aL8fPOw
Extraction code: wczd

Guess you like

Origin blog.csdn.net/lxzdsg/article/details/111714395