Romeo BLE Quad-drive

产品名称(300px)
目录

1 简介
2 产品参数
3 引脚说明
4 使用教程

4.1 准备
4.2 接线图
4.3 样例代码
4.4 结果

5 协议说明
6 疑难解答
7 更多

简介
Romeo BLE Quad-drive是基于ARM处理器兼容Arduino接口的开源平台。一款集成了蓝牙4.0通信模块和ST公司的32位 STM32F103RET6微处理器。可以通过蓝牙无线控制Romeo BLE Quad-drive,从而控制Romeo BLE Quad-drive上的直流电机。Romeo BLE Quad-drive最多可支持4路直流电机,采用PID调速,采用正交编码器可测每个电机运行速度,同时也可测得每个电机运行圈数。

产品参数
微控制器:STM32 F103RET6
工作电压:5-10V
直流电机:4路
控制方式:PID控制
数字IO: 10
模拟输入:5
尺寸: 67mm*37mm

引脚说明
顶层引脚图

底层引脚图

使用教程
本教程主要介绍如何使用PID调速。

准备

硬件
Romeo BLE Quad-drive x1
微型直流带编码器L型减速电机 x4
杜邦线 若干

软件
Arduino IDE 版本 需支持Bluno M3版本 下载Ardunio IDE 让ARDUINO1.6.5及其以上版本支持Bluno M3教程

接线图

连线图

注:本图只以M4为例子,其他M1、M2、M3的连接方式和M4是相同的

样例代码

点击下载库文件例程和Motor.h库文件和PID_V1.h库文件

/*!

  • @file Motor.cpp
  • @brief Motor.cpp Interrupted function deployment, encoder motor configurations and corresponding PWM soft function
  • Motor.cpp Corresponds to a set of orthogonal codes for each motor and PWM.
  •           Implements timer 5 implementation of PWM, timer every 3.9 μs (1/256 MS) into an interruption.
    
  • @author linfeng(490289303@qq.com)
  • @version V1.0
  • @date 2016-3-2
    */
    #include "PID_v1.h"
    #include "Motor.h"

Motor motor[4];
int motorSpeed[4] = {100,200,200,100};/Set 4 speed motor/
const int motorDirPin[4][2] = { //Forward, Backward
/Motor-driven IO ports/
{8,23},
{7,9},
{24,14},
{4,25}
};

//const double motorPidParam[3]={0.6,1,0.03};/DC MOTOR,Yellow??180degree/
const double motorPidParam[3]={1.5,1,0.05};/DC MOTOR,Yellow??90 degree/

void setup( void )
{
Serial1.begin(115200);
Serial1.println("setup begin:");
for(int i=0;i<4;i++){
motor[i].setPid(motorPidParam[

void loop( void )
{
for(int i = 0; i < 4; i++){
motor[i].calibrate();/motor PID calibrate/
}

}
/****************************************************************************** Copyright (C) <2016> <linfeng>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Contact: 490289303@qq.com
******************************************************************************/

结果

电机按照设置的速度和方向运行。

协议说明

疑难解答

问:

答:

更多问题及有趣的应用,可以 访问论坛 进行查阅或发帖!

更多

Shopping car.png [Link ]

标签: Arduino传感器