Difference between revisions of "NanoHat Motor"

From FriendlyELEC WiKi
Jump to: navigation, search
(Resources)
 
(11 intermediate revisions by 3 users not shown)
Line 5: Line 5:
 
* The NanoHat Motor is a motor module with I2C. It uses NXP’s PCA9685 and Toshiba’s TB6612FNG.
 
* The NanoHat Motor is a motor module with I2C. It uses NXP’s PCA9685 and Toshiba’s TB6612FNG.
 
* A single module can drive four 5V PWM steering motors and four 12V DC motors or four 5V PWM steering motors and two 12V four-wire step motors. You can drive more motors by stacking multiple modules with different I2C addresses together.
 
* A single module can drive four 5V PWM steering motors and four 12V DC motors or four 5V PWM steering motors and two 12V four-wire step motors. You can drive more motors by stacking multiple modules with different I2C addresses together.
*模块使用了TI公司的TPS54331电源转换芯片,能为NanoPi NEO/Air提供稳定、可靠的供电。
+
* It uses TI's TPS54331 device to provide stable power source.
*板上还有一片32K的EEPROM芯片AT24C32D,你可以用它来存储一些有用的信息。
+
* An onboard 32K EEPROM AT24C32D can save user data,
*NanoHat Motor和NanoPi NEO的外形尺寸和接口完全相同,可直接堆叠在NanoPi NEO上使用。
+
* The NanoHat Motor has the same form factor as the NanoPi NEO and can be stacked on a NanoPi NEO.
  
 
+
==Hardware Spec==
==特性==
+
*Input Voltage: 12V
*输入电压:12V
+
*Capable of driving four 5V PWM steering motors
*可驱动四个5V PWM舵机
+
*Capable of driving four 12V DC motors
*可驱动四个12V直流电机
+
*Capable of driving two 12V four-wire step motors
*可驱动两个12V四线步进电机
+
*Onboard 32K EEPROM
*板载32K的EEPROM
+
*Stackable and Configurable I2C address
*I2C地址可自由配置,多个模块堆叠使用
+
  
 
[[File:NanoHat Motor_PCB.png | frameless|400px|NanoHat Motor-PCB]]
 
[[File:NanoHat Motor_PCB.png | frameless|400px|NanoHat Motor-PCB]]
  
===接口布局===
+
===Diagram, Layout and Dimension===
[[File:NanoHat Motor-layout.jpg |thumb|600px|NanoHat Motor接口布局]]
+
[[File:NanoHat Motor-layout.jpg |thumb|600px|NanoHat Motor Layout]]
 
[[File:NanoHat Motor-02.jpg|thumb|frameless|600px|NanoHat Motor]]
 
[[File:NanoHat Motor-02.jpg|thumb|frameless|600px|NanoHat Motor]]
  
* '''24Pin引脚功能定义'''
+
* '''24-Pin Pin Description'''
 
::{| class="wikitable"
 
::{| class="wikitable"
 
|-
 
|-
Line 54: Line 53:
 
|}
 
|}
  
12Pin排针未使用,引脚功能定义在此不列举,请在NanoPi NEO/Air/NEO2维基页面查阅。<br>
+
None of the pins except 5V and GND in the 12-Pin connector is connected.<br>
 
[http://wiki.friendlyarm.com/wiki/index.php/NanoPi_NEO/zh NanoPi NEO]  
 
[http://wiki.friendlyarm.com/wiki/index.php/NanoPi_NEO/zh NanoPi NEO]  
 
[http://wiki.friendlyarm.com/wiki/index.php/NanoPi_NEO_Air/zh NanoPi NEO Air]
 
[http://wiki.friendlyarm.com/wiki/index.php/NanoPi_NEO_Air/zh NanoPi NEO Air]
 
<br>
 
<br>
  
* '''2Pin电源端子定义'''
+
* '''2-Pin Connector Pin Description'''
 
::{| class="wikitable"
 
::{| class="wikitable"
 
|-
 
|-
 
|Pin# || Name || Description   
 
|Pin# || Name || Description   
 
|-
 
|-
|1    || 12V || 12V电源输入      
+
|1    || 12V || 12V Input      
 
|-
 
|-
|2    || GND  ||  
+
|2    || GND  || Ground  
 
|}
 
|}
  
* '''4Pin PWM 舵机端子定义'''
+
* '''4Pin PWM Steering Motor Connector Pin Description'''
 
::{| class="wikitable"
 
::{| class="wikitable"
 
|-
 
|-
 
|Pin# || Name || Description   
 
|Pin# || Name || Description   
 
|-
 
|-
|1    || PWM* || PWM*输出      
+
|1    || PWM* || PWM * Output      
 
|-
 
|-
|2    || NC  ||  
+
|2    || NC  || Not Connected  
 
|-
 
|-
|3    || 5V || 5V电源输出      
+
|3    || 5V || 5V Output      
 
|-
 
|-
|4    || GND  ||  
+
|4    || GND  || Ground  
 
|}
 
|}
 +
[http://wiki.friendlyarm.com/wiki/images/f/f5/2.0mm_dip_4pin.jpg 2.0mm 4Pin PWM Steering Motor Connector Pin File in PDF]
  
* '''电机端子定义'''
+
* '''Motor Connector Pin Description'''
 
::{| class="wikitable"
 
::{| class="wikitable"
 
|-
 
|-
 
|Name || Description   
 
|Name || Description   
 
|-
 
|-
|M1    || 直流电机1输出 或 步进电机1(1,2线)输出      
+
|M1    || DC Motor #1 output/Step Motor #1 (Wire 1 & 2) output      
 
|-
 
|-
|M2    || 直流电机2输出 或 步进电机1(3,4线)输出    
+
|M2    || DC Motor #2 output/Step Motor #1 (Wire 3 & 4) output    
 
|-
 
|-
|M3    ||直流电机3输出  或 步进电机2(1,2线)输出
+
|M3    || DC Motor #3 output/Step Motor #2 (Wire 1 & 2) output
 
|-
 
|-
|M4    ||直流电机4输出  或 步进电机2(3,4线)输出
+
|M4    || DC Motor #4 output/Step Motor #2 (Wire 3 & 4) output
 
|}
 
|}
  
==硬件连接==
+
==Hardware Setup==
===连接NanoPi NEO===
+
===Connect NanoHat Motor to NanoPi NEO===
NanoHat Motor模块和NanoPi NEO尺寸和接口完全相同,可直接堆叠在NanoPi NEO上使用。
+
The NanoHat Motor has the same form factor as the NanoPi NEO and can be stacked on a NanoPi NEO
参考下图连接模块:<br>
+
Here are some hardware setups:<br>
 
[[File:NanoHat Motor_nanopi_NEO.jpg|frameless|600px|NanoHat Motor_nanopi_NEO]]
 
[[File:NanoHat Motor_nanopi_NEO.jpg|frameless|600px|NanoHat Motor_nanopi_NEO]]
 
[[File:NanoHat Motor_nanopi_NEO_Air.jpg|frameless|600px|NanoHat Motor_nanopi_NEO_Air]]
 
[[File:NanoHat Motor_nanopi_NEO_Air.jpg|frameless|600px|NanoHat Motor_nanopi_NEO_Air]]
 
[[File:NanoHat Motor_nanopi_NEO2.jpg|frameless|600px|NanoHat Motor_nanopi_NEO2]]<br>
 
[[File:NanoHat Motor_nanopi_NEO2.jpg|frameless|600px|NanoHat Motor_nanopi_NEO2]]<br>
可通过配置电阻更改模块的I2C从地址,从而堆叠使用多个模块以驱动更多的电机,参考下图连接模块:<br>
+
The I2C address on the module can be reset by adjusting the onboard resistor. You can stack multiple motor modules together with different I2C addresses. Here is a hardware setup:<br>
 
[[File:NanoHat Motor_nanopi_NEO_Hat.jpg|frameless|600px|NanoHat Motor_nanopi_NEO_Hat]]
 
[[File:NanoHat Motor_nanopi_NEO_Hat.jpg|frameless|600px|NanoHat Motor_nanopi_NEO_Hat]]
  
==运行测试程序==
+
==Run Test Program==
  
NanoHat Motor的测试程序包含在 NanoHAT-Motor-Python-Library 软件仓库里。
+
The NanoHat Motor's test program is included in the NanoHAT-Motor-Python-Library.
  
NanoHAT-Motor-Python-Library是一个Python类库,为舵机、直流电机和步进电机提供了非常便利的编程接口,提供单个和多个电机的高精度控制。
+
The NanoHAT-Motor-Python-Library is a Python library which provides various APIs for motor control.
  
当前支持的开发板:<br />
+
Applicable Boards:<br />
 
NanoPi NEO<br />
 
NanoPi NEO<br />
 
NanoPi Fire<br />
 
NanoPi Fire<br />
 +
NanoPi NEO2<br />
 +
NanoPi NEO Plus2<br />
  
其他开发板只能带有 I2C 接口,通过适当配置也能支持。
+
As for other FriendlyElec's nano boards as long as they have an I2C interface you can make them work with this module by making some wiring.
  
===安装NanoHAT-Motor-Python-Library===
+
===Install NanoHAT-Motor-Python-Library===
通过ssh,或者串口终端进入开发板的命令行,执行以下命令安装:
+
To make a NEO work with the motor module you need to install this library on NEO. You can install the library by logging into your NEO via ssh and type the following commands:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
sudo apt-get install python-dev python-smbus git
 
sudo apt-get install python-dev python-smbus git
Line 126: Line 128:
 
git clone https://github.com/friendlyarm/NanoHAT-Motor-Python-Library
 
git clone https://github.com/friendlyarm/NanoHAT-Motor-Python-Library
 
cd NanoHAT-Motor-Python-Library
 
cd NanoHAT-Motor-Python-Library
python setup.py install
+
sudo python setup.py install
 
</syntaxhighlight>
 
</syntaxhighlight>
  
===NanoHAT-Motor-Python-Library的基本使用===
+
===Use of NanoHAT-Motor-Python-Library===
====操作直流电机====
+
====Control DC Motor====
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
cd ~/NanoHAT-Motor-Python-Library/examples
 
cd ~/NanoHAT-Motor-Python-Library/examples
 
python DCTest.py <motor port>
 
python DCTest.py <motor port>
 
</syntaxhighlight>
 
</syntaxhighlight>
其中,<motor port>为电机连接的端口。
+
"<motor port>" is a motor's port
  
====操作步进马达====
+
====Control Step Motor====
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
cd ~/NanoHAT-Motor-Python-Library/examples
 
cd ~/NanoHAT-Motor-Python-Library/examples
 
python StepperTest.py <motor port>
 
python StepperTest.py <motor port>
 
</syntaxhighlight>
 
</syntaxhighlight>
其中,<motor port>为马达连接的端口。
+
"<motor port>" is a step motor's port
  
====操作舵机====
+
====Control Steering Motor====
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
cd ~/NanoHAT-Motor-Python-Library/examples
 
cd ~/NanoHAT-Motor-Python-Library/examples
 
python ServoTest.py <pwm port>
 
python ServoTest.py <pwm port>
 
</syntaxhighlight>
 
</syntaxhighlight>
其中,<pwm port>为舵机连接的端口。
+
"<pwm port>" is a steering motor's port
  
==相关资料==
+
==Resources==
 
*[Schematic]([http://wiki.friendlyarm.com/wiki/images/2/2d/SCHEMATIC1_NanoHat_Motor_v1.0_1703.pdf Schematic - NanoHat Motor.pdf])
 
*[Schematic]([http://wiki.friendlyarm.com/wiki/images/2/2d/SCHEMATIC1_NanoHat_Motor_v1.0_1703.pdf Schematic - NanoHat Motor.pdf])
 
*[Datasheet]([http://www.nxp.com/documents/data_sheet/PCA9685.pdf PCA9685 datasheet])
 
*[Datasheet]([http://www.nxp.com/documents/data_sheet/PCA9685.pdf PCA9685 datasheet])
 
*[Datasheet]([http://wiki.friendlyarm.com/wiki/images/6/62/TB6612FNG_datasheet_en.pdf TB6612FNG datasheet])
 
*[Datasheet]([http://wiki.friendlyarm.com/wiki/images/6/62/TB6612FNG_datasheet_en.pdf TB6612FNG datasheet])
 +
*[Dimension]([http://wiki.friendlyarm.com/wiki/images/f/f5/2.0mm_dip_4pin.jpg 2.0mm 4Pin PWM Steering Motor Connector Pin File in PDF])
 +
 +
==Update Log==
 +
===April-20-2017===
 +
* Released English Version

Latest revision as of 01:59, 5 July 2018

查看中文

1 Introduction

NanoHat Motor
  • The NanoHat Motor is a motor module with I2C. It uses NXP’s PCA9685 and Toshiba’s TB6612FNG.
  • A single module can drive four 5V PWM steering motors and four 12V DC motors or four 5V PWM steering motors and two 12V four-wire step motors. You can drive more motors by stacking multiple modules with different I2C addresses together.
  • It uses TI's TPS54331 device to provide stable power source.
  • An onboard 32K EEPROM AT24C32D can save user data,
  • The NanoHat Motor has the same form factor as the NanoPi NEO and can be stacked on a NanoPi NEO.

2 Hardware Spec

  • Input Voltage: 12V
  • Capable of driving four 5V PWM steering motors
  • Capable of driving four 12V DC motors
  • Capable of driving two 12V four-wire step motors
  • Onboard 32K EEPROM
  • Stackable and Configurable I2C address

NanoHat Motor-PCB

2.1 Diagram, Layout and Dimension

NanoHat Motor Layout
NanoHat Motor
  • 24-Pin Pin Description
Pin# Name Pin# Name
1 SYS_3.3V 2 VDD_5V OUT
3 I2C_SDA 4 VDD_5V OUT
5 I2C_SCL 6 GND
7 NC 8 NC
9 GND 10 NC
11 NC 12 NC
13 NC 14 GND
15 NC 16 NC
17 SYS_3.3V 18 NC
19 NC 20 GND
21 NC 22 NC
23 NC 24 NC

None of the pins except 5V and GND in the 12-Pin connector is connected.
NanoPi NEO NanoPi NEO Air

  • 2-Pin Connector Pin Description
Pin# Name Description
1 12V 12V Input
2 GND Ground
  • 4Pin PWM Steering Motor Connector Pin Description
Pin# Name Description
1 PWM* PWM * Output
2 NC Not Connected
3 5V 5V Output
4 GND Ground

2.0mm 4Pin PWM Steering Motor Connector Pin File in PDF

  • Motor Connector Pin Description
Name Description
M1 DC Motor #1 output/Step Motor #1 (Wire 1 & 2) output
M2 DC Motor #2 output/Step Motor #1 (Wire 3 & 4) output
M3 DC Motor #3 output/Step Motor #2 (Wire 1 & 2) output
M4 DC Motor #4 output/Step Motor #2 (Wire 3 & 4) output

3 Hardware Setup

3.1 Connect NanoHat Motor to NanoPi NEO

The NanoHat Motor has the same form factor as the NanoPi NEO and can be stacked on a NanoPi NEO Here are some hardware setups:
NanoHat Motor_nanopi_NEO NanoHat Motor_nanopi_NEO_Air NanoHat Motor_nanopi_NEO2
The I2C address on the module can be reset by adjusting the onboard resistor. You can stack multiple motor modules together with different I2C addresses. Here is a hardware setup:
NanoHat Motor_nanopi_NEO_Hat

4 Run Test Program

The NanoHat Motor's test program is included in the NanoHAT-Motor-Python-Library.

The NanoHAT-Motor-Python-Library is a Python library which provides various APIs for motor control.

Applicable Boards:
NanoPi NEO
NanoPi Fire
NanoPi NEO2
NanoPi NEO Plus2

As for other FriendlyElec's nano boards as long as they have an I2C interface you can make them work with this module by making some wiring.

4.1 Install NanoHAT-Motor-Python-Library

To make a NEO work with the motor module you need to install this library on NEO. You can install the library by logging into your NEO via ssh and type the following commands:

sudo apt-get install python-dev python-smbus git
cd ~
git clone https://github.com/friendlyarm/NanoHAT-Motor-Python-Library
cd NanoHAT-Motor-Python-Library
sudo python setup.py install

4.2 Use of NanoHAT-Motor-Python-Library

4.2.1 Control DC Motor

cd ~/NanoHAT-Motor-Python-Library/examples
python DCTest.py <motor port>

"<motor port>" is a motor's port

4.2.2 Control Step Motor

cd ~/NanoHAT-Motor-Python-Library/examples
python StepperTest.py <motor port>

"<motor port>" is a step motor's port

4.2.3 Control Steering Motor

cd ~/NanoHAT-Motor-Python-Library/examples
python ServoTest.py <pwm port>

"<pwm port>" is a steering motor's port

5 Resources

6 Update Log

6.1 April-20-2017

  • Released English Version