containsmachine

Touch table lamp design based on stm32f103c8t6-main control board

 
Overview

This project is a project I chose during the final exam of the basic class of Lichuang’s summer training camp. It can also be regarded as my first project from the bottom up from circuit design to programming. There are definitely a lot of shortcomings in terms of design. On the one hand, it is released so that all electronic enthusiasts can see it and give some suggestions. On the other hand, it is also a summary of my work this week.

Device selection

The main control chip I chose is stm32f103c8t6. I chose this simply because I am more familiar with stm32, it is easier to use, and the price is not high. In fact, it should be cheaper to use STC chips, but I have never used it and I am too lazy to learn. . , and then the touch chip is RH6016CB. This later proves that the touch is very sensitive. It needs to be noted that you must carefully read the touch panel pcb wiring requirements in the datasheet. The point to note is that many lights use WS2812B. This is Mo Gong Recommended, because there are always problems when transplanting drivers written by others, so I wrote a driver myself and used spi. In addition, because I was relatively naive, I didn’t read the datasheet carefully and ran into a lot of pitfalls. For example, the encoding time of 01code is wrong. In addition, there are some commonly used electronic components. You can see the schematic diagram.

Schematic diagram

When I was drawing the first version of the schematic diagram, I actually connected the input and output of ws2812b backwards. After I bought it and checked it for a long time, I realized that I was in tears. Later I drew a new one and simply changed the light panel into a circle.

touchpad

image.png

Light board

image.png Because ws2812b uses 5v power supply, and the main control uses 3.3v power supply. Therefore, the intermediate communication requires a conversion circuit. For other circuits, please refer to the datasheet.

driver

The program is actually relatively simple, but because I haven't programmed stm32 for a long time, it still took a few days. I also encountered various strange bugs in the process, and later found out that it was my own negligence. The most important aspect is the driver writing of ws2812b. At first I wanted to use SysTick to drive the delay directly, but later I found that it took up too many system resources and seemed impossible to implement. Using spi directly, the spi 9M transmission rate uses two bytes to represent one bit. Then just use four exti interrupts to press the button. The touch chip will turn to high level when touched, so it is very convenient to use. In addition, I remember a very painful lesson. The default priority level of SysTick is the lowest, so if you want to use SysTick to delay other interrupts. Be sure to adjust SysTick's interrupt priority level.

Notice

Attention, I forgot to draw the reset circuit on the main control board, so now there are only two ways to re-run the picture after power failure: 1. Re-download 2. Manually reset by yourself (use a wire to connect the reset pin to ground) (Crying) There is only the main control board in this project link, and there is a program for the lights in the attachment here https://lceda.cn/editor#id=27e17fd0c07e4d90998ec2b942c5174f|6fa1e21537bc41fb8fcd97d4095d8215

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-05-21 09:30:32

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号