匿名
未登录
登录
丢石头百科
搜索
查看“Motor Driver HAT”的源代码
来自丢石头百科
名字空间
页面
讨论
更多
更多
页面选项
查看
查看源代码
历史
←
Motor Driver HAT
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
<div class="tabber"> {{Product |images=[[File:Motor-Driver-HAT-intro.jpg|360px |alt=Motor Driver HAT|link=http://{{SERVERNAME}}/shop/Motor-Driver-HAT.htm | Motor Driver HAT]] |categories= {{Category|树莓派}} {{Category|电机}} |brand=Waveshare |features=电机驱动 |interfaces= {{Category|RPi接口}} {{Category|I2C接口}} }} <div class="tabbertab" title="说明"> '''提供树莓派与Jetson nano控制程序 =硬件说明= ==特点== *基于树莓派接口设计,适用于Raspberry Pi Zero/Zero W/Zero WH/2B/3B/3B+ *I2C接口控制,通过改变5个地址跳线可以同时接多达32个模块 *板载PCA9685芯片,可输出12位硬件PWM控制电机转速 *板载TB6612FNG双H桥电机驱动芯片,工作高效,不易发热 *板载5V稳压芯片,输出可达3A电流,可通过VIN端子接入电池供电 *预留I2C控制接口,方便接入其他主控板 ==实物== [[file:motor_Driver_hat_1.png|800px]]<br /> {|border=1; style="width:400px;" align="center" |-style="background:#0000ff; color:white;" align="center" |标号||描述 |-align="center" |5V||5V电源 |-align="center" |3V3||3.3V电源 |-align="center" |GND||电源地 |-align="center" |SDA||I2C数据线 |-align="center" |SCL||I2C时钟线 |-align="center" |VIN||电机驱动电压(6-12V) |-align="center" |A1||电机A正极 |-align="center" |A2||电机A负极 |-align="center" |B1||电机B正极 |-align="center" |B2||电机B负极 |-align="center" |B4||双极步进电机M2绕组B输出2端 |} ==资源介绍== ===电源=== [[file:motor_Driver_hat_power.png|900px]]<br /> 输入端采用MP1584稳压芯片,该芯片支持4.5V到28V的宽电压输入,输出电流达3A。虽然芯片支持最高28V的输入,但是由于给电机的工作电压也由VIN_USER供给,实际上输入电压最好保持在6-12V.<br /> MP1584稳压芯片输出5V,这个5V用于给树莓派供电,然后5V再通过RT9193-33转成3.3V电平,该电平给PWM、电机驱动这两部分提供逻辑电压<br /> ===PWM=== 由于树莓派硬件PWM只有一个引脚GPIO.1,而且,虽然wiringPi库与python都有软件PWM,但是会占用部分CPU资源,因此本模块采用PCA9685芯片,该芯片使用I2C控制,可输出16路12位分辨率的PWM,可控制输出频率40HZ-1000HZ。<br /> 操作简单,只需要给芯片控制对应寄存器的值,即可一直输出PWM信号。<br /> [[file:motor_Driver_hat_PCA9685.png|900px]]<br /> 根据上面的原理图,我们可以看出LED0-LED5为控制电机驱动芯片管脚。<br /> A0-A4是控制PCA9685的从设备地址;<br /> 查看[http://{{SERVERNAME}}/w/upload/6/68/PCA96_datasheet.pdf 数据手册page6 – page8]可知:<br /> [[file:motor_Driver_hat_i2caddr.png|900px]]<br /> I2C从设备地址有7位,加上1位读写位,最高位固定为1,A5-A0可以通过硬件引脚配置。<br /> 在此模块中,默认A5接至地,可通过焊接或移除A0-A4电阻,来控制设备地址,焊接电阻为位1,不焊接为位0,I2C设备地址设置范围为:0x40到0x5F<br /> [[file:motor_Driver_hat_i2caddr2.png|900px]]<br /> ===电机驱动=== [[file:motor_Driver_hat_TB6612FNG.png|900px]]<br /> TB6612FNG是一款双H桥电机驱动芯片,工作高效,不易发热。<br /> VIN_USER为输入电压,理论上该电压越大电机的转速也越快,建议输入控制在6-12V。<br /> 其中PWMA与PWMB为控制两个电机的转速,AIN1与AIN2、BIN1与BIN2分别控制两个电机的旋转方向。<br /> A1与A2、B1与B2分别接两个电机的正负极。<br /> =树莓派= {{RPI_open_i2c}} ==安装库== {{RPI_C_lib}} *python <pre> sudo apt-get updata sudo apt-get install python-pip sudo pip install RPi.GPIO sudo apt-get install python-smbus </pre> ==下载示例程序,并解压到指定目录== <pre> sudo apt-get install p7zip wget http://wiki.diustou.com/w/upload/9/9a/Motor_Driver_HAT_Code.7z 7zr x Motor_Driver_HAT_Code.7z -r -o./Motor_Driver_HAT_Code sudo chmod 777 -R Motor_Driver_HAT_Code cd Motor_Driver_HAT_Code/Raspberry\ Pi/ </pre> ==运行测试例程== *BCM2835 <pre> cd bcm2835/ make clean make sudo ./motor </pre> *wiringPi <pre> cd wiringpi/ make clean make sudo ./motor </pre> *python <pre> cd python/ sudo python main.py </pre> =Jetson Nano= ==安装库== {{JetsonNano python lib}} ==下载示例程序,并解压到指定目录== <pre> wget http://wiki.diustou.com/w/upload/9/9a/Motor_Driver_HAT_Code.7z 7zr x Motor_Driver_HAT_Code.7z -r -o./Motor_Driver_HAT_Code sudo chmod 777 -R Motor_Driver_HAT_Code cd Motor_Driver_HAT_Code/Jetson\ Nano/ </pre> ==运行测试例程== *python2 <pre> cd python2/ sudo python main.py </pre> *python3 <pre> cd python3/ sudo python3 main.py </pre> </div> <div class="tabbertab" title="资料"> ===文档=== *[http://{{SERVERNAME}}/w/upload/a/ab/Motor_Driver_HAT_Schematic.pdf 原理图] ===程序=== *[http://{{SERVERNAME}}/w/upload/9/9a/Motor_Driver_HAT_Code.7z 示例程序] ===数据手册=== *[http://{{SERVERNAME}}/w/upload/6/68/PCA96_datasheet.pdf PCA9685] *[http://{{SERVERNAME}}/w/upload/d/d3/MP1584.pdf MP1584] *[http://{{SERVERNAME}}/w/upload/f/f6/RT9193.pdf RT9193] *[http://{{SERVERNAME}}/w/upload/3/36/TB6612FNG_datasheet_zh_cn.pdf TB6612FNG-CN] *[http://{{SERVERNAME}}/w/upload/6/62/TB6612FNG_datasheet_en.pdf TB6612FNG-EN] 转到:[[#软件]],[[#程序]],[[#文档]] <!--{{Join_us}}--> </div> == FAQ == <div class="tabbertab" title="FAQ"><br /></div> <div class="tabbertab" title="售后"><br />{{Service08}}</div>
该页面使用的模板:
模板:Category
(
查看源代码
)
模板:JetsonNano python lib
(
查看源代码
)
模板:Product
(
查看源代码
)
模板:RPI C lib
(
查看源代码
)
模板:RPI open i2c
(
查看源代码
)
模板:Service00
(
查看源代码
)
模板:Service08
(
查看源代码
)
模板:Tag
(
查看源代码
)
模板:Tipbox
(
查看源代码
)
返回至
Motor Driver HAT
。
导航
导航
首页
最近更改
随机页面
MediaWiki帮助
首页
首页
树莓派
主机
配件包
外壳
键鼠
电源
扩展板
显示屏
墨水屏
摄像模块
通信模块
继电器
电机驱动板
游戏机
产品分类
树莓派
Arduino
micro:bit
STM32
Espressif
WiFi模块
蓝牙模块
无线模块
LoRa模块
4G模块
GSM
GPRS
以太网
导航模块
北斗卫星
GPS
LCD
墨水屏
OLED
摄像头
USB模块
串口模块
RS232
RS485
CAN
传感器
温度模块
湿度模块
气压模块
继电器
电机模块
指纹模块
电平转换
音频模块
编程器
Wiki工具
Wiki工具
特殊页面
页面工具
页面工具
用户页面工具
更多
链入页面
相关更改
页面信息
页面日志