UXTlXGrdJx

[Tuya Smart] Desktop smart gadgets

 
Overview

Write in front:

    I am very honored to participate in the second training camp of Tuya Smart and Lichuang EDA. However, it is a pity that due to personal reasons, I did not have much time to complete this project (it is even more regrettable that RTT did not complete it due to lack of time), so this This work was submitted very late...I just came after more than 300 big bosses had submitted the project. This time the work is a desktop ornament, inspired by the famous open source project Awtrix. I am also trying to save money as much as possible, so I decided that an 8*24 dot matrix is ​​enough. The circuit has been basically drawn.

This project is mainly divided into two parts:

  1. Basic functions: Of course, it can display time, date, alarm clock, local temperature and humidity, and automatic brightness adjustment . In addition, I also added a memory battery so that even if the clock goes offline after a power outage, it can still display the time correctly .
  2. Extended functions: display local weather, add gyroscope for gravity sensing, add FFT spectrum mode, the signal source is a microphone or audio input, a touch button that can cover the entire circle for operations such as turning off the alarm clock, and then add some beautiful displays. Animation (depending on the completion of the project, I will perfect it to what I want even after the training camp is over).

 

1. WS2812 8*24 dot matrix display principle

    In fact, it is very simple to arrange the light string that was originally strung into a dot matrix, as shown in Figure 1; then you can use instructions to light up the corresponding LEDs to display any numbers, letters, and patterns (because the dot matrix There are few lines, so only simple graphics or text can be displayed), as shown in Figure 2:

SIsgXJc3GJSzI06tM9ETPB4rVAN6cHcVsiwtSphK.png fudCRpDO3M08VZS2Ya6e80nCqlX8oLCMIzvLsFrw.png

 

2. Schematic analysis

    As for the lamp beads, I chose WS2812E. The overall circuit part is still very simple. I will explain it by dividing it into four parts according to the schematic layout:

2.1 Power supply part, temperature and humidity sensor, light collection part, buzzer part

As for the power supply, because WS2812 has a 5V voltage, I use 5V power supply, and then use an ordinary LDO A MS1117 for the microcontroller and Tuya module. The temperature and humidity sensor uses a SHT30 digital temperature and humidity sensor, IIC communication, and a pull-up resistor. I used a photoresistor to collect light, and then collected it with the microcontroller ADC after dividing the voltage. The buzzer selected a chip of 85dB and was driven by an S8050 NPN transistor. This LED is mainly used for debugging when writing programs.
XpECMZveJds3XkNnyBXzhzcwP64INQ1yyBL1TYyD.png

 

2.2 Tuya module, STM32, user buttons

The Tuya module I chose is WB3S , because it has the same package as the ES12 series, so I also adapted it. In this era of 32mm skyrocketing, you can also use ESP for dot matrix driving. For MCU, I still chose STM32F103C8T6 (cannot afford the series). Although I cannot afford it, I decided to remove some of the previous boards and use them... Environmentally friendly This is a simple button. There are 2 buttons set, and the functions can be added through the program.
uY6ZolakU4VwBDJ61AXDL3qjaICmSUsQNJsoLjPK.png

 

2.3 Microcontroller peripheral circuit

The first part is the button battery part, which is used to provide RTC power to the microcontroller. There is nothing much to talk about later, it is all a common process, and the boot can select the program running mode through a resistor.
lpMOGv9Nb1Gp9BDsQYXyADoUIKWFfiM6fMTn2FFk.png

 

2.4 Extend some circuits

The gyroscope uses MPU6050 , IIC communication The audio amplification uses an inverse amplifier with an adjustable gain of 0-50 to amplify the signal. The signal source can be switched between the microphone and the audio input through SW1. This touch button uses an AM01B single-channel touch chip
Xtjx2Nm09lAkP7PYmmjZB5IDmmdt0BRlc4PIXwzp.png

 

It can be found that in the schematic diagram, there are two chips (SHT30 and MPU6050) that communicate through IIC, so we need to find the address of each chip in the data sheet , as follows:

Page 9 of the SHT30 data sheet lists a table. When the ADDR pin is low, the address is 0x44 (default); when it is high, the address is 0x45. I am grounding here, so when writing the program, the slave address is 0x44. . On page 15 of the MPU6050 data sheet, when the AD0 pin is low, the address is 0x68, and when it is high, the address is 0x69. In my schematic, it is grounded, so when writing the program, the address is 0x68.
njvKjNSeo0CN45HIKdmqi85zweHPFaoom0sEeTtC.png zi5ig737dVxE0gqFprsDmlv0GbXpAb5BT1521Kmr.png

3. PCB design

x7O2fkFNwsimq9IqOXXc6Ymzmq7hQ7NuAyhhY9zq.png OaCY8D9ls7uznC4reyxpcFg5jhIshhvEH5ZCuFY7.png
PCB bottom layer PCB top layer
2wRYdYgrveMwuK26kzPSC974yksFw7hsk3Ir8ca5.png W8pk16fXIwcucyvSfLM6ukNejrDbKExSipG66D3e.png
3D front 3D back

 

 

4. Physical construction

    Below is a board that was soldered years ago. WS2812 was attached using 183° solder paste and a heating table.

Add tin paste to solder pad On the heating table Finished product

 

5. Tuya Intelligence

   The Tuya module uses WB3S to directly obtain the network time. The reference protocol is as follows:

MCU sends MCU receives
md7ctpYL5Rhz2JHL4ssNHoGXdQxmvkQX0ohBPl9b.png 1ODpr2PU2Kt93EKYebQlEUFN80lbwWjjPeHUovnC.png XjDuJ71rW17bsHUYBn14TKzG9WDVGRiFyVqFVsKx.png

Problems encountered during the process:

  1. The biggest problem I found during this project is that I know too few things. I can only use STM32 and have never played with other microcontrollers, so I had no choice but to choose 32 for this project. Although everyone said it was about the same, but In fact, it will definitely take some time to get started. I will try more microcontrollers in the future.
  2. The antenna part of the Tuya module is not hollowed out, and even wires are routed, but fortunately it is separated by 2 layers. The impact must be there, but it should not be a big problem... Just change to a router with a strong signal at home. I will wait . Testing (no problem found yet)...
  3. Because I don't have time to read the manual... I still don't know the difference between WS2812 and WS2812B and WS2812C and WS2812E and WS2812F... but the difference should not be big.
  4. The computer's battery may be a bit big, and I haven't thought about what terminal interface to use, so I'll make do by opening two windows. 

 

Attachment description:

The program is written based on the STM32CubuMX HAL library

The welded board display was a video recorded years ago before the Tuya module arrived, so the Tuya module has not been soldered yet.

The effect shown in the video is: time + temperature + humidity display and touch button control display mode is disco mode

There are not many functions yet. Due to my own problems, the project has been delayed for too long. In the days to come, I will complete the debugging of its functions.

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-05-21 14:19:29

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号