# Arduino 电机编码器六线如何接线

> 原文链接：https://robotics.hellobike.com/pitfalls/2018-10-30-robotics-se-10653
> 频道：pitfalls | 更新日期：2018-10-30 | 标签：auto, stackexchange, arduino, motor, encoding, wiring
> 核心摘要：六线电机的红黑接电机驱动，编码器四线接地、供电和正交解码输入。

# Arduino 电机编码器六线如何接线

::: v-pre
> 本文由 AI 根据公开内容整理，可能有误，请以原文为准：[Need super-basic help with motor encoder](https://robotics.stackexchange.com/questions/10653/need-super-basic-help-with-motor-encoder)（Robotics Stack Exchange #10653）

**状态**：已解决

## 问题

提问者使用带编码器的六线齿轮电机和 Arduino Uno 电机驱动盾，电机能转但不知道编码器四根线如何连接，且橙线接到多处会触发故障。

## 环境

Arduino Uno；Pololu Dual VNH5019 Motor Driver Shield；ServoCity 23 RPM HD Premium Planetary Gear Motor w/ Encoder。

## 解决办法

1. 黑线 `Motor -`、红线 `Motor +` 接驱动盾 `M1A`、`M1B`，用于电机供电和换向。
2. 绿线 `Ground` 接公共地；棕线 `Channel B`、黄线 `Channel A` 接正交解码器输入。
3. 橙线 `Sensor Voltage +` 接编码器传感器电源 `V+`，例如逻辑 `+5V` 或 `+12V`，不要随意接到其他信号脚。
4. 若要跟踪轴位置，软件解码可能跟不上，建议用硬件正交解码器/计数器；若只测速度，Uno 可用 `PD5`/`T1` 计数一路编码器信号。

原问题作者：sparse；采纳答案作者：James Waldby - jwpat7。原内容依 CC BY-SA 4.0 授权，本页摘要同样依 CC BY-SA 4.0 授权。
:::

## 原始参考来源 (Sources)

- [Robotics Stack Exchange #10653：Need super-basic help with motor encoder](https://robotics.stackexchange.com/questions/10653/need-super-basic-help-with-motor-encoder)