(SKU:DFR0225)Romeo V2-All in one Controller (R3)

来自DFRobot Product Wiki
跳转至: 导航搜索

目录

产品简介

DFRduino RoMeo V2 (R3)

RoMeo V2[R3]是多合一Arduino兼容微控制器,是DFRobot为机器人应用专门设计的。RoMeo控制器得益于Arduino开源平台,其受成千上万行开源代码的支持,而且借助于Arduino shield,它可以被很容易地扩展。集成2路DC电机驱动器和XBee插板可以让你立刻开始你的项目,而不需要额外的电机驱动器或无线上网模块。
注意:RoMeo v2的模拟端口引脚映射与旧版是不同的,使用Arduino IDE时请选择Arduino Leonardo board

技术规格

  • 电源:USB供电或外接6~23V直流供电
  • 输出电源:5V(2A)/3.3V
  • 直流电机驱动输出电流:2A
  • 微处理器:ATmega32u4
  • 引导程序:Adruino Leonardo
  • 兼容Arduino R3引脚映射
  • 模拟输入:A0-A5, A6-A11 (在数字引脚4, 6, 8, 9, 10和12)
  • PWM:3, 5, 6, 9, 10, 11, 13。提供8位PWM输出
  • 5个用于测试的按钮
  • 自动感知/转换外部电源输入
  • 串口
    • TTL电平
    • USB
  • 支持公母引脚接头
  • 内建Xbee插板
  • 集成APC220 RF模块和DF-蓝牙模块插板
  • 三个I2C/TWI接口引脚组合(二个90度引脚接头)
  • 最大2A电流输出的两路直流电机驱动
  • 尺寸:89x84x14mm

相比 Romeo v1.1的改进

  • 宽工作输入电压
  • 直接支持Xbee和Xbee兼容代理wifi、蓝牙以及射频模块
  • 通过开关按钮控制外部电机电源给系统供电
  • 扩展了3个数字口(D14 D15 D16)
  • S1-S5开关转换跳帽
  • 微型USB取代A-B USB连接
  • 模拟传感器扩展端口:橙色为信号,红色为电源Vcc,黑色为GND


引脚说明

Fig1: Romeo V2 Pin Out

电源设计方案

该电机控制器电源方案是为机器人应用特别设计的。
舵机电源端子

  • 它集成了一个外部舵机电源输入端子。电压输入范围大约是5~23V,我们推荐你使用5V。这样舵机供电扩展将不会破坏数字传感器连接到3p数字传感器的接口,然而,为了使用高于5V的输入电压驱动6~12V的舵机,扩展5V传感器到所有的数字传感器接口不再可行。
  • 舵机电源端口不能提供系统工作电压

系统和舵机电源切换开关的设置

  • 开:给舵机驱动与系统提供稳定的电源。输入范围大约是5~23V,这适用于大多数机器人平台。
  • 关:将系统供电与舵机电源隔绝。因此,需要从微型USB接口给系统供电。在5V Vcc 与GND引脚之间直接使用5V电源,或在VIN与GND引脚之间使用5~23V电源。


示例代码,使用按钮S1-S5

/* start code */
char msgs[5][15] = {
	"Right Key OK ", 
	"Up Key OK    ", 
	"Down Key OK  ", 
	"Left Key OK  ", 
	"Select Key OK" };
char start_msg[15] = {"Start loop "};                    
int adc_key_val[5] = { 30, 150, 360, 535, 760 };
int NUM_KEYS = 5;
int adc_key_in;
int key=-1;
int oldkey=-1;
void setup() { 
	pinMode(13, OUTPUT);  //we'll use the debug LED to output a heartbeat
	Serial.begin(9600);

	/* Print that we made it here */
	Serial.println(start_msg); 
}

void loop() 
{
	adc_key_in = analogRead(0);    // read the value from the sensor  
	digitalWrite(13, HIGH);
	/* get the key */
	key = get_key(adc_key_in);    // convert into key press
	if (key != oldkey) {   // if keypress is detected
		delay(50);      // wait for debounce time
		adc_key_in = analogRead(0);    // read the value from the sensor  
		key = get_key(adc_key_in);    // convert into key press
		if (key != oldkey) {         
			oldkey = key;
			if (key >=0){
				Serial.println(adc_key_in, DEC);
				Serial.println(msgs[key]);
			}
		}
	}
	digitalWrite(13, LOW);
}
// Convert ADC value to key number
int get_key(unsigned int input) {   
	int k;
	for (k = 0; k < NUM_KEYS; k++)
		if (input < adc_key_val[k]) 
			return k;  
	if (k >= NUM_KEYS)
		k = -1;     // No valid key pressed
	return k;
}

/* end code */

引脚配置

"PWM模式"
引脚 功能
数字口4 电机1方向控制
数字口5 电机1速度控制(PWM)
数字口6 电机2速度控制(PWM)
数字口7 电机2方向控制


"PLL模式"
引脚 功能
数字口4 电机1使能
数字口5 电机1速度(方向)控制
数字口6 电机2速度(方向)控制
数字口7 电机2使能

PWM控制模式

Fig4: PWM Motor Control Pin Allocation

The PWM DC motor control is implemented by manipulating two digital IO pins and two PWM pins. As illustrated in the diagram above (Figure 5), Pin 4,7 (7,8 for old Romeo version) are motor direction control pins, Pin 5,6 (6,9 for old Romeo version) are motor speed control pins.

Sample Code:


//Standard PWM DC control
int E1 = 5;     //M1 Speed Control
int E2 = 6;     //M2 Speed Control
int M1 = 4;    //M1 Direction Control
int M2 = 7;    //M1 Direction Control

///For previous Romeo, please use these pins.
//int E1 = 6;     //M1 Speed Control
//int E2 = 9;     //M2 Speed Control
//int M1 = 7;    //M1 Direction Control
//int M2 = 8;    //M1 Direction Control


void stop(void)                    //Stop
{
	digitalWrite(E1,LOW);   
	digitalWrite(E2,LOW);      
}   
void advance(char a,char b)          //Move forward
{
	analogWrite (E1,a);      //PWM Speed Control
	digitalWrite(M1,HIGH);    
	analogWrite (E2,b);    
	digitalWrite(M2,HIGH);
}  
void back_off (char a,char b)          //Move backward
{
	analogWrite (E1,a);
	digitalWrite(M1,LOW);   
	analogWrite (E2,b);    
	digitalWrite(M2,LOW);
}
void turn_L (char a,char b)             //Turn Left
{
	analogWrite (E1,a);
	digitalWrite(M1,LOW);    
	analogWrite (E2,b);    
	digitalWrite(M2,HIGH);
}
void turn_R (char a,char b)             //Turn Right
{
	analogWrite (E1,a);
	digitalWrite(M1,HIGH);    
	analogWrite (E2,b);    
	digitalWrite(M2,LOW);
}
void setup(void) 
{ 
	int i;
	for(i=4;i<=7;i++)
		pinMode(i, OUTPUT);  
	Serial.begin(19200);      //Set Baud Rate
	Serial.println("Run keyboard control");
} 
void loop(void) 
{
	if(Serial.available()){
		char val = Serial.read();
		if(val != -1)
		{
			switch(val)
			{
			case 'w'://Move Forward
				advance (255,255);   //move forward in max speed
				break;
			case 's'://Move Backward
				back_off (255,255);   //move back in max speed
				break;
			case 'a'://Turn Left
				turn_L (100,100);
				break;       
			case 'd'://Turn Right
				turn_R (100,100);
				break;
			case 'z':
				Serial.println("Hello");
				break;
			case 'x':
				stop();
				break;
			}
		}
		else stop();  
	}
}

PLL控制模式

The Romeo also supports PLL(Phase locked loop) control mode.

Fig5: PLL Motor Control Pin Allocation Configuration

Sample Code:

//Standard DLL Speed control

	int E1 = 4;     //M1 Speed Control
int E2 = 7;     //M2 Speed Control
int M1 = 5;    //M1 Direction Control
int M2 = 6;    //M1 Direction Control

///For previous Romeo, please use these pins.
//int E1 = 6;     //M1 Speed Control
//int E2 = 9;     //M2 Speed Control
//int M1 = 7;    //M1 Direction Control
//int M2 = 8;    //M1 Direction Control

//When m1p/m2p is 127, it stops the motor
//when m1p/m2p is 255, it gives the maximum speed for one direction
//When m1p/m2p is 0, it gives the maximum speed for reverse direction

void DriveMotorP(byte m1p, byte m2p)//Drive Motor Power Mode
{

	digitalWrite(E1, HIGH);
	analogWrite(M1, (m1p)); 

	digitalWrite(E2, HIGH);
	analogWrite(M2, (m2p)); 

}

void setup(void) 
{ 
	int i;
	for(i=6;i<=9;i++)
		pinMode(i, OUTPUT);  
	Serial.begin(19200);      //Set Baud Rate
} 
void loop(void) 
{ 
	if(Serial.available()){
		char val = Serial.read();
		if(val!=-1)
		{
			switch(val)
			{
			case 'w'://Move Forward
				DriveMotorP(0xff,0xff); // Max speed
				break;
			case 'x'://Move Backward
				DriveMotorP(0x00,0x00);
				; // Max speed
				break;
			case 's'://Stop
				DriveMotorP(0x7f,0x7f);
				break;       

			}
		}
	}
}



图解




Nextredirectltr.pngGo Shopping Romeo V2-All in one Controller(SKU:DFR0225)

个人工具
名字空间

变换
操作
导航
工具箱