You are on page 1of 35

Intel Do-It-Yourself Challenge

Maestro Pololu USB card

Cdric Andreolli
Intel Software


Configuring the Android ro(ect
USB Communications
Manage the Pololu card
Create an A


)he Maestro Pololu is a USB Ser*o Controller
with the following secifications+

It,s chea -. #$/

It,s *er0 small 123#cm4

5e can use it with Android

)his course will e3lain how to create and
Android alication for controlling this card.

Configuring the Android

Configuring the Android Pro(ect
5e will use Android Intents to launch the
You won,t 6e a6le to start the a if 0ou don,t
lug the Pololu to the hone.
)his ro(ect uses the Micro Maestro 7 channels
card 6ut 0ou will 6e a6le to adat the code to
another card.

Configuring the Android Pro(ect
Create a new Android Application
Create a 6asic Android alication. Choose a
Blank Activity.
In this course8 our alication is named
Our plan is to create an application that will be launched by
Android when the Pololu is plugged.

Configuring the Android Pro(ect
Open the Manifest
Automatic launch can 6e achie*e with Intents
9irst8 change the intent-filter to
You can directl0 add a meta-data mar:u to lin:
a USB de*ice filter

Configuring the Android Pro(ect
Create the file device_filter
Create a folder xml in res and add a 3ml file

Configuring the Android Pro(ect
Retrieve your card information
Plug the Maestro card to 0our comuter and
oen a terminal
)0e the following command
You can outut the command in a file and loo:
for ;Maestro<

Configuring the Android Pro(ect
Retrieve your card information
=esult of lsus6 -*
)hen fill the file device_filter.xml
You will ha*e to use decimal *alues instead of

Configuring the Android Pro(ect
Install your application
Plug 0our hone to 0our comuter and install the
)he alications should not 6e launched
Plug the Pololu card to the hone with a USB
host ca6le8 Android should as: 0ou
;>en PololuUSBController....<

USB Communications

USB Communications
Control transfert
)o send commands to the card8 we will use the
Android Control)ransfert method
5e will use the samles to configure the method

requestType is set to USB?)YP@?A@BD>=

request is the oeration code

index reresents the channel

buffer can 6e set to null8 length to $

USB Communications
Operation codes
Cere are the different oeration codes a*aila6le+

=@DU@S)?S@)?S@=A>?AA=IABE@ - $3'28

=@DU@S)?S@)?)A=F@) - $3'G
S@)?)A=F@) allows to change the osition of
the ser*o
S@)?S@=A>?AA=IABE@ allows to modif0 ser*o
arameters 1such as seed and acceleration4

USB Communications
Encapsulate !" communications
Eet,s create a new Ha*a interface
And a new class that imlements this interface

USB Communications
Encapsulate !" communications
Imlements the interface with the
control)ransfert method

USB Communications
Encapsulate !" communications
Set osition uses the command $3'G8 num
corresonds to the ser*o num6er
)he *alue of position is in Iuarter of
microseconds8 so we multil0 the position 60 2

USB Communications
Encapsulate !" communications
Seed can 6e set 60 using the command $3'2
5e (ust need to ro*ide the speed *alue

USB Communications
Encapsulate !" communications
Acceleration can 6e set 60 using the command
$3'2 1S@)?S@=A>?AA=IABE@4
5e must use the 2
arameter to set the ser*o
num6er and to define the t0e of *aria6le
)o set the acceleration8 the most significant 60te
of the channel must 6e $3'

Manage the Pololu card

Manage the Pololu card
Create a new class
Create a class to manage the ololu card

Manage the Pololu card
#ill the constructor
)he constructor is ri*ate and is called from a
static method 1createCard4

Manage the Pololu card
$rovide controls on the servos
)he card must 6e a6le to send information to the
ser*o motors

Manage the Pololu card
$rovide a builder
)he card is 6uilt *ia a static method

Create an a

Create an a
Create your xml view

Create an a
Add behavior
In 0our acti*it08 in the onCreate method
You write similar code for acceleration
and seed

Create an a
Add behavior

Create an a
Other improvements %
You can use the sensors to automaticall0
acti*ate the ser*o motors
You can use the FPS data to modif0 ser*o
motor,s 6eha*iors
Intel organi!e a contest on ara-glider
autonomous drones using those technologies


Control your card with your Intel phone
An Intel hone is a comuter8 0ou can rogram it
to control the Maestro card
)a:e ad*antage of the owerful CPU8 sensors8
FPS8 etc that the Intel hone can ro*ide
If you have ideas that use Intel hardware and
$ololu cards& feel free to let us 'now

Eicense Creati*e Commons - B0 &.$
(ou are free)
to !hare J to co08 distri6ute and transmit the wor:
to Remix J to adat the wor:
to ma:e commercial use of the wor:
nder the followin* conditions)
Attribution J You must attri6ute the wor: in the manner secified 60 the author or licensor 16ut not in
an0 wa0 that suggests that the0 endorse 0ou or 0our use of the wor:4.
+ith the understandin* that)
+aiver J An0 of the a6o*e conditions can 6e wai*ed if 0ou get ermission from the co0right holder.
$ublic ,omain J 5here the wor: or an0 of its elements is in the u6lic domain under alica6le law8
that status is in no wa0 affected 60 the license.
Other Ri*hts J In no wa0 are an0 of the following rights affected 60 the license+
Your fair dealing or fair use rights8 or other alica6le co0right e3cetions and limitationsK
)he author,s moral rightsK
=ights other ersons ma0 ha*e either in the wor: itself or in how the wor: is used8 such as u6licit0 or ri*ac0 rights.
-otice J 9or an0 reuse or distri6ution8 0ou must ma:e clear to others the license terms of this wor:.
)he 6est wa0 to do this is with a lin: to this we6 age.