Académique Documents
Professionnel Documents
Culture Documents
Summary
This is an Android example on how to connect a ioio mint, the motor driver TB6612FNG, and two
motors.
Shortcut
The important stuff can all be found at: https://github.com/ergobot/ioioMotorDriver
Fritzing file - "ioioMotorControl.fzz"
Fritzing export - "ioioMotorControl_export.png"
Working example
Description
The ioio is a board to help our android devices interact with sensors, motors, etc. By using a ioio, Android device, two
motors, a motor driver, and a battery, we extend and change the function of our Android device.
Bonus - Bluetooth
The ioio can communicate with the Android device through usb or bluetooth, no extra calls required. In the past, I've taken
apart google's bluetooth example for android so that I could use bluetooth with an Arduino (bluesmirf gold). I made it work
but.... it wasn't very fun.
This example shows how to wire together all of the components needed and write a little to get the components to work.
Before we begin
Battery (for the motors) - In this case, I used a 2S Lipo 7.4V battery. A 9V battery would work fine as well.
Two motors - These are toy motors. I know these motors will work because both motors will run on the same 9v battery.
techvalleyprojects.blogspot.kr/2013/04/android-ioio-motor-control-tb6612fng.html 1/5
10/5/13 Android IOIO - motor control TB6612FNG
ioio mint pin #44 to motor driver pin BIN2
ioio mint pin #45 to motor driver pin PWMB
3. Grounds/Power
Connect the ioio mint pin gnd to the battery negative and to the motor driver pin GND (the GND between VCC and AO1)
ioio mint pin 3.3V to the motor driver pin VCC
motor driver pin VM to the battery positive
[http://1.bp.blogspot.com/-
VdZEwA_m4YU/UWNWus4YqJI/AAAAAAAAAUM/DgQorKO4rQ8/s1600/ioioMotorControl_export.png]
Fritzing Diagram
Get it to work
Machines of all types need instruction(s).
If this is your first ioio project, go to the sparkfun ioio intro page:
https://www.sparkfun.com/tutorials/280 [https://www.sparkf un.com/tutorials/280]
Writing the code for this wasn't too bad. I learned from several sites/references:
Making Android Accessories with IOIO by Simon Monk - there are awesome examples and clear instructions
http://www.jaychakravarty.com/?p=146 [http://www.jay chakrav arty .com/?p=146] - This site has great information on how to do the
same we're doing here.
I'm not going to go over the code in great detail. I looked at the two sources above and wrote the Motor.java and
MotorDriver.java for simplicity. These two classes were implemented in MainActivity.java.
@Override
motorDriver.SetupStandBy(STBY_PIN);
Where AIN1_PIN, AIN2_PIN, PWMA_PIN.... etc are just the pin numbers (int type) you are using on the ioio for the motor
driver
motorDriver.MotorA().FullPower();
motorDriver.MotorB().FullPower();
techvalleyprojects.blogspot.kr/2013/04/android-ioio-motor-control-tb6612fng.html 3/5
10/5/13 Android IOIO - motor control TB6612FNG
motorDriver.MotorA().Clockwise();
motorDriver.MotorB().Clockwise();
motorDriver.RefreshAll();
Example code:
https://github.com/ergobot/ioioMotorDriver [https://github.com/ergobot/ioioMotorDriv er]
Specifically - (bad package naming, will fix
later) https://github.com/ergobot/ioioMotorDriver/tree/master/src/edu/simpson/cmsc/algos/morbov2
[https://github.com/ergobot/ioioMotorDriv er/tree/master/src/edu/simpson/cmsc/algos/morbov 2]
Enjoy!!!
References (anything I used to write this)
0 Add a comment
techvalleyprojects.blogspot.kr/2013/04/android-ioio-motor-control-tb6612fng.html 4/5
10/5/13 Android IOIO - motor control TB6612FNG
Publish Preview
techvalleyprojects.blogspot.kr/2013/04/android-ioio-motor-control-tb6612fng.html 5/5