You are on page 1of 12

18/03/13

DFRduino Romeo-All in one Controller (SKU:DFR0004) - Robot Wiki

Personal tools

Log in

Home Store Community Wiki Forum

Views

Page Discussion View source History

DFRduino Romeo-All in one Controller (SKU:DFR0004)


From Robot Wiki
This wiki is for Romeo V1, please see the following link for Romeo V1.1:DFRduino Romeo-All in one Controller V1.1(SKU:DFR0004) A. Please read this manual carefully before applying power on the device. B. Do not use this device for military or medical purpose as they are not designed to.

Contents
1 Introduction 2 Specification 3 DFRduino RoMeo Pinout 4 Before you start 4.1 Applying Power 4.2 Software 5 Romeo Configuration 5.1 Servo Power Select Jumper 5.2 Motor Control Pin Jumper 5.3 Wireless Select Jumper 6 Tutorial 6.1 Button Press 6.2 Example use of Button 1-5 7 Dual DC Motor Speed Control 7.1 Hardware Setting 7.2 Pin Allocation 7.3 PWM Control Mode 7.4 PLL Control Mode 8 Schematics

18/03/13

DFRduino Romeo-All in one Controller (SKU:DFR0004) - Robot Wiki

Introduction
RoMeo is an All-in-One microcontroller especially designed for robotics application. Benefit from Arduino open source platform, it is supported by thousands of open source codes, and can be easily expanded with most Arduino Shields. The integrated 2 way DC motor driver and wireless socket gives a much easier way to start your robotic project.

Specification
Atmega 168/328 14 Channels Digital I/O 6 PWM Channels (Pin11,Pin10,Pin9,Pin6,Pin5,Pin3) 8 Channels 10-bit Analog I/O USB interface Auto sensing/switching power input ICSP header for direct program download Serial Interface TTL Level Support AREF Support Male and Female Pin Header Integrated sockets for APC220 RF Module and DF-Bluetooth Module Five I2C Interface Pin Sets Two way Motor Drive with 2A maximum current 7 key inputs DC SupplyUSB Powered or External 7V~12V DC DC Output5V /3.3V DC and External Power Output Dimension90x80mm

DFRduino RoMeo

DFRduino RoMeo Pinout

Figure 1 Romeo Pin Out

The picture above shows all of the I/O lines and Connectors on the Romeo, which includes: One Regulated Motor Power Input Terminal (6v to12v)

18/03/13

DFRduino Romeo-All in one Controller (SKU:DFR0004) - Robot Wiki

One Unregulated Servo Power Input Terminal (you supply regulated 4v to 7.2v) One Servo input power selection jumper One Serial Interface Module Header for APC220/Bluetooth Module Two DC Motor Terminals Handles motor current draw up to 2A, each terminal One I2C/TWI Port SDA, SCL, 5V, GND One Analog Port with 8 analog inputs one input is tied internally to the supply voltage One General Purpose I/O Port with 13 I/O lines 4,5,6,7 can be used to control motors One Reset Button Jumper bank to Enable/Disable Motor Control

Before you start


Applying Power This is one of the most important steps in getting the Romeo up and communicating with your host controller. You MUST make sure that you apply power to the Power Terminal using the correct polarity. Reverse Polarity will damage the Romeo. We are not responsible for such damage, nor do we warranty against such damage. Make sure you take time to apply power correctly. Otherwise, it could get costly for you! Power from USB: Simply plug USB cable, and the Romeo is able to work. Please notice that the USB can only supply 500 mA current. It should be able to meet the most requirements for LED lit application. However it is not enough to power DC motors or servo. Power from Motor Power Input: Simply connect the ground wire from your supply to the screw terminal labeled GND, and then connect the positive wire from your supply to the screw terminal labeled VIN". NOTE: Maximum supply voltage cannot exceed 14V DC. Software RoMeo can be programmed by Arduino IDE 0014 and above version. It can be downloaded at http://arduino.cc/en/Main/Software, Please select Arduino Duemilanove w/ATMega328 as the hardware.

Romeo Configuration
Servo Power Select Jumper As most servo draw more current than the USB power source can supply. A separate servo power terminal is provided to power the servo individually which can be Enable/Disable by the Servo Power Select Jumper. When the Servo Power Select Jumper is applied, the servo is powered by internal 5V. When the Servo Power Select Jumper is not applied, the servo is powered by external power source. The Romeo V1.0 uses an automatic switcher for the power source selection. When the external power source has been applied, the servo will be automatically powered by the external power instead of USB power. Motor Control Pin Jumper Applying the Motor Control Pin Jumpers will allocate Pin 5,6,7,8 for motor control. Removing the jumpers will release the above Pins. Wireless Select Jumper Applying the Wireless Select Jumper will allow the Romeo communicate via its wireless module such as APC220 and DF-Bluetooth module. If no wireless module is plugged, this jumper does not make any difference. Removing the jumper will disable wireless module and allows the sketch to be uploaded.

Tutorial
Button Press RoMeo has 7 build in buttons S1-S7 (Figure 2). S1-S5 use analog input 7, S6,S7 use digital input 2 and 3.

18/03/13

DFRduino Romeo-All in one Controller (SKU:DFR0004) - Robot Wiki

"Button Pin Map" Pin Digital Pin 2 Digital Pin 3 Analog Pin 7 Function Button S6 Button S7 Button S1-S5

Figure 2 Romeo Buttons

Example use of Button 1-5


? 1 2 3 4 h a rm s g s [ 5 ] [ 1 5 ]={ 5 c " R i g h tK e yO K" , 6 " U pK e yO K " , 7 " D o w nK e yO K " , 8 " L e f tK e yO K " , 9 " S e l e c tK e yO K "} ; 10c h a rs t a r t _ m s g [ 1 5 ]={ S t a r tl o o p" } ; 11 " i n t a d c _ k e y _ v a l [ 5 ]= { 12 3 0 , 1 5 0 , 3 6 0 , 5 3 5 , 7 6 0} ; 13 i n t N U M _ K E Y S = 5 ; 14 n ta d c _ k e y _ i n ; 15i i n t k e y = 1 ; 16 n to l d k e y = 1 ; 17i v o i d s e t u p ( ) { 18 p i n M o d e ( 1 3 ,O U T P U T ) ; / / w e ' l lu s et h ed e b u gL E Dt oo u t p u tah e a r t b e a t 19 S e r i a l . b e g i n ( 9 6 0 0 ) ; 20 21 / *P r i n tt h a tw em a d ei th e r e* / e r i a l . p r i n t l n ( s t a r t _ m s g ) ; 22 S 23} 24 o i dl o o p ( ) 25v { 26 a d c _ k e y _ i n=a n a l o g R e a d ( 7 ) ; / /r e a dt h ev a l u ef r o mt h es e n s o r 27 d i g i t a l W r i t e ( 1 3 ,H I G H ) ; *g e tt h ek e y* / 28 / e y=g e t _ k e y ( a d c _ k e y _ i n ) ; / /c o n v e r ti n t ok e yp r e s s 29 k i f ( k e y ! = o l d k e y ) { / / i f k e y p r e s s i s d e t e c t e d 30 d e l a y ( 5 0 ) ; / /w a i tf o rd e b o u n c et i m e 31 a d c _ k e y _ i n=a n a l o g R e a d ( 7 ) ; / /r e a dt h ev a l u ef r o mt h es e n s o r 32 k e y=g e t _ k e y ( a d c _ k e y _ i n ) ; / /c o n v e r ti n t ok e yp r e s s 33 i f( k e y! =o l d k e y ){ o l d k e y=k e y ; 34 i f( k e y> = 0 ) { 35 S e r i a l . p r i n t l n ( a d c _ k e y _ i n ,D E C ) ; 36 S e r i a l . p r i n t l n ( m s g s [ k e y ] ) ; 37 } 38 } 39 } i g i t a l W r i t e ( 1 3 ,L O W ) ; 40 d
}

18/03/13

DFRduino Romeo-All in one Controller (SKU:DFR0004) - Robot Wiki

/C o n v e r tA D Cv a l u et ok e yn u m b e r 41/ n tg e t _ k e y ( u n s i g n e di n ti n p u t ) 42i 43{ i n tk ; 44 f o r( k=0 ;k<N U M _ K E Y S ;k + + ) 45 { 46 i f( i n p u t<a d c _ k e y _ v a l [ k ] ) 47 { 48 r e t u r nk ; 49 } 50 } f( k> =N U M _ K E Y S ) 51 i k=1 ; / /N ov a l i dk e yp r e s s e d 52 r e t u r nk ; 53 } 54 55 56 57

To enable S6 and S7, please apply the jumpers indicated in the red circle. S6 uses Digital Pin2, S7 uses Digital Pin3. Once these enable jumpers have been applied, Pin 2 and 3 will be occupied (Figure 3).

Figure 3 Button Enable Jumpers

Sample code ? 1 2 3 i n tl e d P i n=1 3 ; 4 i n tk e y _ s 6=2 ; 5 i n tv a l = 0 ; 6 v o i ds e t u p ( ) 7 { 8 p i n M o d e ( l e d P i n ,O U T P U T ) ; / /S e tP i n 1 3t oo u t p u tm o d e p i n M o d e ( k e y _ s 6 ,I N P U T ) ; / /S e tP i n 1 2t oo u t p u tm o d e 9 10} o i dl o o p ( ) 11v { 12 i f ( d i g i t a l R e a d ( k e y _ s 6 ) = = 0 ) / / 13 { w h i l e ( ! d i g i t a l R e a d ( k e y _ s 6 ) ) ; 14 v a l + + ; 15 16 } 17 i f ( v a l = = 1 )

18/03/13

DFRduino Romeo-All in one Controller (SKU:DFR0004) - Robot Wiki

18 19 { i g i t a l W r i t e ( l e d P i n ,H I G H ) ; / / 20d } 21 i f ( v a l = = 2 ) 22 { v a l = 0 ; 23 d i g i t a l W r i t e ( l e d P i n ,L O W ) ; 24 } 25} 26 27

/ /

? 1 2 / S a m p l e2 : 3 / 4 / / C o d ef u n c t i o n :P r e s sb u t t o nS 6 ,t u r no nL E D ,P r e s sb u t t o nS 7 ,t u r no f fL E D . 5 6 S a m p l ec o d e 7 i n tl e d P i n=1 3 ; / / 8 i n tk e y _ s 6=2 ; / / 9 i n tk e y _ s 7=3 ; / / 10v o i ds e t u p ( ) 11{ i n M o d e ( l e d P i n ,O U T P U T ) ; / / 12 p p i n M o d e ( k e y _ s 6 ,I N P U T ) ; / / 13 p i n M o d e ( k e y _ s 7 ,I N P U T ) ; / / 14} 15v o i dl o o p ( ) 16{ i f ( d i g i t a l R e a d ( k e y _ s 6 ) = = 0 ) / / 17 { 18 d i g i t a l W r i t e ( l e d P i n ,H I G H ) ; / / 19 } 20 i f ( d i g i t a l R e a d ( k e y _ s 7 ) = = 0 ) / / { 21 d i g i t a l W r i t e ( l e d P i n ,L O W ) ; / / 22 } 23} 24 25

Dual DC Motor Speed Control


Hardware Setting
Connect four motor wires to Motor Terminal. And apply power through motor power terminal (Figure 4).

18/03/13

DFRduino Romeo-All in one Controller (SKU:DFR0004) - Robot Wiki

Figure 4 Romeo Motor Connection Diagram

Pin Allocation
"PWM Mode" Pin Digital 4 Digital 5 Digital 6 Digital 7 Function Motor 1 Direction control Motor 1 PWM control Motor 2 PWM control Motor 2 Direction control

"PLL Mode" Pin Digital 4 Digital 5 Digital 6 Digital 7 Function Motor 1 Enable control Motor 1 Direction control Motor 2 Direction control Motor 2 Enable control

PWM Control Mode

18/03/13

DFRduino Romeo-All in one Controller (SKU:DFR0004) - Robot Wiki

Figure 5 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. For previous Romeo board, the pins used to control the motor is Pin 7,8 (Direction), Pin 6,9 (Speed). You can find the information at the right side of the Motor Control Pin Jumpers. Sample Code ? 1 2 3 4 5 6 7 / / S t a n d a r dP W MD Cc o n t r o l 8 i n tE 1=5 ; / / M 1S p e e dC o n t r o l 9 i n tE 2=6 ; / / M 2S p e e dC o n t r o l 10i n tM 1=4 ; / / M 1D i r e c t i o nC o n t r o l 11i n tM 2=7 ; / / M 1D i r e c t i o nC o n t r o l 12 / / F o rp r e v i o u sR o m e o ,p l e a s eu s et h e s ep i n s . 13/ / / i n t E 1 = 6 ; / / M 1 S p e e d C o n t r o l 14 / / i n tE 2=9 ; / / M 2S p e e dC o n t r o l 15/ / i n tM 1=7 ; / / M 1D i r e c t i o nC o n t r o l 16/ / i n tM 2=8 ; / / M 1D i r e c t i o nC o n t r o l 17 18 19v o i ds t o p ( v o i d ) / / S t o p 20{ i g i t a l W r i t e ( E 1 , L O W ) ; 21 d d i g i t a l W r i t e ( E 2 , L O W ) ; 22} 23v o i da d v a n c e ( c h a ra , c h a rb ) / / M o v ef o r w a r d 24{ n a l o g W r i t e( E 1 , a ) ; / / P W MS p e e dC o n t r o l 25 a d i g i t a l W r i t e ( M 1 , H I G H ) ; 26 a n a l o g W r i t e( E 2 , b ) ; 27 d i g i t a l W r i t e ( M 2 , H I G H ) ; 28} 29v o i db a c k _ o f f( c h a ra , c h a rb ) / / M o v eb a c k w a r d 30{ n a l o g W r i t e( E 1 , a ) ; 31 a d i g i t a l W r i t e ( M 1 , L O W ) ; 32 a n a l o g W r i t e( E 2 , b ) ;

18/03/13

DFRduino Romeo-All in one Controller (SKU:DFR0004) - Robot Wiki

i g i t a l W r i t e ( M 2 , L O W ) ; 33 d 34} o i dt u r n _ L( c h a ra , c h a rb ) / / T u r nL e f t 35v { 36 a n a l o g W r i t e( E 1 , a ) ; 37 d i g i t a l W r i t e ( M 1 , L O W ) ; n a l o g W r i t e( E 2 , b ) ; 38 a i g i t a l W r i t e ( M 2 , H I G H ) ; 39 d } 40v o i dt u r n _ R( c h a ra , c h a rb ) / / T u r nR i g h t 41{ 42 a n a l o g W r i t e( E 1 , a ) ; i g i t a l W r i t e ( M 1 , H I G H ) ; 43 d a n a l o g W r i t e( E 2 , b ) ; 44 d i g i t a l W r i t e ( M 2 , L O W ) ; 45} 46v o i ds e t u p ( v o i d ) 47{ 48 i n ti ; o r ( i = 4 ; i < = 7 ; i + + ) 49 f p i n M o d e ( i ,O U T P U T ) ; 50 S e r i a l . b e g i n ( 1 9 2 0 0 ) ; / / S e tB a u dR a t e 51 S e r i a l . p r i n t l n ( " R u nk e y b o a r dc o n t r o l " ) ; 52} 53v o i dl o o p ( v o i d ) 54{ f ( S e r i a l . a v a i l a b l e ( ) ) { 55 i c h a rv a l=S e r i a l . r e a d ( ) ; 56 i f ( v a l! =1 ) 57 { 58 s w i t c h ( v a l ) { 59 c a s e' w ' : / / M o v eF o r w a r d 60 a d v a n c e( 2 5 5 , 2 5 5 ) ; / / m o v ef o r w a r di nm a xs p e e d 61 b r e a k ; 62 c a s e' s ' : / / M o v eB a c k w a r d 63 b a c k _ o f f( 2 5 5 , 2 5 5 ) ; / / m o v eb a c ki nm a xs p e e d 64 b r e a k ; 65 c a s e' a ' : / / T u r nL e f t t u r n _ L( 1 0 0 , 1 0 0 ) ; 66 b r e a k ; 67 c a s e' d ' : / / T u r nR i g h t 68 t u r n _ R( 1 0 0 , 1 0 0 ) ; 69 b r e a k ; 70 c a s e' z ' : 71 S e r i a l . p r i n t l n ( " H e l l o " ) ; b r e a k ; 72 c a s e' x ' : 73 s t o p ( ) ; 74 b r e a k ; 75 } 76 } 77 e l s es t o p ( ) ; 78 } 79} 80 81 82 83 84 85

PLL Control Mode


The Romeo also support PLLPhase locked loop control mode.

18/03/13

DFRduino Romeo-All in one Controller (SKU:DFR0004) - Robot Wiki

Sample Code ? 1 2 3 4 / S t a n d a r dD L LS p e e dc o n t r o l 5 / 6 i n tE 1=4 ; / / M 1S p e e dC o n t r o l 7 i n tE 2=7 ; / / M 2S p e e dC o n t r o l 8 i n tM 1=5 ; / / M 1D i r e c t i o nC o n t r o l 9 i n tM 2=6 ; / / M 1D i r e c t i o nC o n t r o l 10 11 / / / F o rp r e v i o u sR o m e o ,p l e a s eu s et h e s ep i n s . 12/ / i n tE 1=6 ; / / M 1S p e e dC o n t r o l 13/ / i n tE 2=9 ; / / M 2S p e e dC o n t r o l / i n tM 1=7 ; / / M 1D i r e c t i o nC o n t r o l 14/ / i n tM 2=8 ; / / M 1D i r e c t i o nC o n t r o l 15/ 16 / / W h e nm 1 p / m 2 pi s1 2 7 ,i ts t o p st h em o t o r 17/ / w h e nm 1 p / m 2 pi s2 5 5 ,i tg i v e st h em a x i m u ms p e e df o ro n ed i r e c t i o n 18/ / W h e nm 1 p / m 2 pi s0 ,i tg i v e st h em a x i m u ms p e e df o rr e v e r s ed i r e c t i o n 19 20v o i dD r i v e M o t o r P ( b y t em 1 p ,b y t em 2 p ) / / D r i v eM o t o rP o w e rM o d e 21{ 22 i g i t a l W r i t e ( E 1 ,H I G H ) ; 23 d a n a l o g W r i t e ( M 1 ,( m 1 p ) ) ; 24 25 d i g i t a l W r i t e ( E 2 ,H I G H ) ; 26 a n a l o g W r i t e ( M 2 ,( m 2 p ) ) ; 27 28} 29 o i ds e t u p ( v o i d ) 30v 31{
i n ti ;

18/03/13

DFRduino Romeo-All in one Controller (SKU:DFR0004) - Robot Wiki

o r ( i = 6 ; i < = 9 ; i + + ) 32 f p i n M o d e ( i ,O U T P U T ) ; 33 S e r i a l . b e g i n ( 1 9 2 0 0 ) ; / / S e tB a u dR a t e 34} 35v o i dl o o p ( v o i d ) 36{ f ( S e r i a l . a v a i l a b l e ( ) ) { 37 i c h a r v a l = S e r i a l . r e a d ( ) ; 38 i f ( v a l ! = 1 ) 39 { 40 s w i t c h ( v a l ) 41 { 42 c a s e' w ' : / / M o v eF o r w a r d D r i v e M o t o r P ( 0 x f f , 0 x f f ) ;/ /M a xs p e e d 43 b r e a k ; 44 c a s e' x ' : / / M o v eB a c k w a r d 45 D r i v e M o t o r P ( 0 x 0 0 , 0 x 0 0 ) ; 46 ;/ /M a xs p e e d 47 b r e a k ; 48 c a s e' s ' : / / S t o p D r i v e M o t o r P ( 0 x 7 f , 0 x 7 f ) ; 49 b r e a k ; 50 51 } 52 } 53 } 54} 55 56 57 58

Schematics
Romeo Schematic V0.9 (http://www.dfrobot.com/wiki/images/a/a0/RoMeo_Schematic.png) Romeo Schematic V1.0 (http://www.dfrobot.com/image/data/DFR0004/RoMeo_Schematic_V1.pdf)

Go Shopping Romeo-All in one Controller (Arduino Compatible Atmega 328) (SKU:DFR0004) (http://www.dfrobot.com/index.php? route=product/product&keyword=DFR0004&category_id=0&description=1&model=1&product_id=56) Retrieved from "http://www.dfrobot.com/wiki/index.php/DFRduino_Romeo-All_in_one_Controller_(SKU:DFR0004)" Categories: Product Manual | DFR Series | Motor Controllers | MicroControllers

Sign up for DFRobot"s newsletter We"ll never spam or give this address away

Information Customer Service My Account Newsletter DFRobot Distributors

18/03/13

DFRduino Romeo-All in one Controller (SKU:DFR0004) - Robot Wiki

Brands Warranty Contact Us Gift Vouchers Privacy Policy Returns Affiliates Shipping Site Map Specials Payment

You might also like