Introduction

Romeo BLE Quad is an arduino compatible robot controller based on STM32 ARM chip. It inherits all features from the Bluno M3, including wireless programming support, wireless communication between iOS/Android apps and remote control. Beyond this it also includes a 4-way DC motor driver and encoder interfaces. You can implement a robot with PID closed-loop feedback control directly with our TT Geared Motor. As well as this the Romeo BLE Quad offers powerful performance thanks to the STM32 ARM 32-bit microcontroller with more storage space and more interface resources. DFRobot has developed bespoke firmware to make it compatible with Arduino IDE and accessible to beginners to robotics.

warning_yellow.png Note: The operating voltage of Romeo BLE Quad is 3.3V, please read the Board Overview carefully before usage!

Features

Specification

NOTE: Romeo BLE Quad serial port starts from Serial1, it is in charge of USB & Bluetooth communication. You need to change Serial to ‘’‘Serial1’‘’ in the sketch if you want to use serial monitor.

Board Overview

Board Overview

Motor GPIO 1 GPIO 2 Encoder A Encoder B
M1 8 23 12 11
M2 7 9 2 3
M3 24 14 5 26
M4 4 25 35 36
Note: Romeo BLE Quad integrates 2x HR8833 motor driver, the driving method is a little different to the common L298 motor controller, you can check the detail here: Dual 1.5A Motor Driver - HR8833 SKU: DRI0040
Recommend fast decay mode. (Encapsulated in the library)

Forward: GPIO 1 = Low (Direction); GPIO 2 = PWM (Speed) Reverse: GPIO 2 = Low (Direction): GPIO 1 = PWM (Speed) |

warning_yellow.png Special Attention: The operating voltage of Romeo BLE Quad is 3.3V, only some of pins support 5V input, please read the following instruction carefully before usage! Or it will destroy the micro chip.
3.3V only: D20, D27, D28
5VCompatible:D0, D1, D29, D30, D31, D32, D33
Analog Input Pins, A0A4, have 5V bleeder circuit, "05V" will be mapped to "0~1023" analog value.

Tutorial

We need to install Romeo BLE Quad development environment before usage. Since this is a secondary development edition based on Bluno M3, and all pins function are same to Bluno M3, we can refer to Bluno M3 wiki for the environment installation. Bluno M3 V2.2 Software Development Environment\Install Software Development Environment

PID Speed Control

In this tutorial, we'll use TT Geared Motor with Encoder. There are some important parameters:

E.g. When the motor encoder pole number is 16, the encoder increments will be 16 * 2 = 32 in one circle. If you get 200 pulse change in a sampling period, it means the real speed of motor is 200÷0.1(s)÷32 = 62.5 r/s = 62.5*60 r/min =3750 r/min; and its output speed is 3750/120=31.25r/min

MotorCPP.png

Requirements

Connection Diagram

Connection Diagram

Sample Code

Click to download arduino library: Motor.h arduino library and PID_V1.h Arduino library. [https://www.arduino.cc/en/Guide/Libraries#.UxU8mdzF9H0| How to install Libraries in Arduino IDE]

/*!
* @file RemeoBLEQuadDrive.ino
* @brief RemeoBLEQuadDrive.ino PID control system of DC motor
*
*  RemeoBLEQuadDrive.ino Use PID control 4 way DC motor direction and speed
*
* @author linfeng(490289303@qq.com)
* @version  V1.0
* @date  2016-4-14
*/

#include "PID_v1.h"
#include "Motor.h"

Motor motor[4];
int motorSpeed[4] = {-200,200,400,-400};/*Set 4 speed motor*/
/* Speed=motorSpeed/(32*(setSampleTime/1000))(r/s) */
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*/
const double motorPidParam[3]={1.2,0.8,0.05};/*Encoder V1.0,160rd/min ;19500/min; 32:1,Kr=3.5*/
void setup( void )
{
  Serial1.begin(115200);
     for(int i=0;i<4;i++){
        motor[i].setPid(motorPidParam[0],motorPidParam[1],motorPidParam[2]);/*Tuning PID parameters*/
        motor[i].setPin(motorDirPin[i][0],motorDirPin[i][1]);/*Configure IO ports*/
        motor[i].setSampleTime(100);/*Sets the sampling period*/
                motor[i].setChannel(i);/*Sets the motor channel */
        motor[i].ready();/*Motor enable*/
                motor[i].setSpeed(motorSpeed[i]);/*Set motor speed*/
    }
}

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
 ******************************************************************************/

Expected Results

Motor speed runs with expected speed.

FAQ

For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More

DFshopping_car1.png Get Romeo BLE Quad Robot Controller SKU:DFR0398 from DFRobot Store or DFRobot Distributor.