> For the complete documentation index, see [llms.txt](https://libooogo.gitbook.io/esplane/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://libooogo.gitbook.io/esplane/developer-guide/12esp32+-kong-xin-bei-you-shua-dian-ji.md).

# 10 Brushed Motor Driver

## 一、 pwm控制原理

![控制电路](https://img-blog.csdnimg.cn/20191031200744442.png)

* PWM就是Pulse Width Modulation,脉冲宽度调制.
* 一般输出后面加上一个(一阶或两阶)`RC低通滤波电路`,去除纹波,将PWM信号转换成等效的直流信号.&#x20;
* 假设一个电源电压为 +5V,使用占空比 50%控制通断,那么它输出的信号就可以看成是一个+2.5V的直流信号.
* `我们使用PWM控制电机转速,正是使用PWM控制电压实现`
* 分辨率越高,波形就越精细
* 频率高可以减少频闪

![低通滤波电路对输出的影响](https://img-blog.csdnimg.cn/20191031194603829.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzIwNTE1NDYx,size_16,color_FFFFFF,t_70)

以上图片来源:[电路/定理PWM波变直流电压](http://bbs.21ic.com/icview-1665776-1-1.html) 其他参考资料:[怎样才能将占空比变化转换成相应的电压信号](http://bbs.eeworld.com.cn/thread-414879-1-1.html)

## 二、MOS芯片参数

[SI2302DS data-sheet](https://assets.nexperia.com/documents/data-sheet/SI2302DS.pdf)

![pin](https://img-blog.csdnimg.cn/20191031201415863.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzIwNTE1NDYx,size_16,color_FFFFFF,t_70)

![动态特性](https://img-blog.csdnimg.cn/20191031201440130.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzIwNTE1NDYx,size_16,color_FFFFFF,t_70)

![动态特性曲线](https://img-blog.csdnimg.cn/20191031201520397.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzIwNTE1NDYx,size_16,color_FFFFFF,t_70)

## 三、空心杯电机参数

| 参数项  | 参数值                           |
| ---- | ----------------------------- |
| 直径   | 7mm                           |
| 电机长度 | 16mm                          |
| 输出轴  | 0.8mm                         |
| 重量   | 5g                            |
| 额定电压 | 3.4v                          |
| 启动电压 | 0.5v                          |
| 额定电流 | 800mA                         |
| 转速   | 3V:35000-37000  5V: 50000 RPM |

## 四、esp32 pwm控制实验

实验发现使用ledc(esp32 release/3.3)模块,如果设置频率过高,会出现频率和占空比异常.以下所有图片设置的占空比均为 300 KHz,8bit分辨率,会出现频率的波动,被控制的电机肉眼比较难看出区别,这一点需要注意.要么调低频率,要么调低分辨率.数据手册上有计算公式,有空算一下作出补充

```
计算公式:
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://libooogo.gitbook.io/esplane/developer-guide/12esp32+-kong-xin-bei-you-shua-dian-ji.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
