We're no longer updating This wiki!!

Overview

Control Servo Motor by Android ADK app.

What you need

* ADK Board

* ADK IO Kit

  • Servo Motor

Knowledge Base

Servo Motor

A servo motor is an entirely different story. The servo motor is actually an assembly of four things: a normal DC motor, a gear reduction unit, a position-sensing device (usually a potentiometer—a volume control knob), and a control circuit.

The function of the servo is to receive a control signal that represents a desired output position of the servo shaft, and apply power to its DC motor until its shaft turns to that position. It uses the position-sensing device to determine the rotational position of the shaft, so it knows which way the motor must turn to move the shaft to the commanded position. The shaft typically does not rotate freely round and round like a DC motor, but rather can only turn 200 degrees or so back and forth.

The servo has a 3 wire connection: power, ground, and control. The power source must be constantly applied; the servo has its own drive electronics that draw current from the power lead to drive the motor.

Circuit

Schematic

Video

Software

* ADK svn check out http://dev.odroid.com/svn/accessory/trunk/ODROIDAccessoryPWMDemo br

* Bluetooth svn check out http://dev.odroid.com/svn/accessory/trunk/ODROIDBluetoothPWMDemo br

//MotorContol
//send command message
//msg.what -> command character;
//msg.arg1 -> port number; (1 ~ 5)
//msg.arg2 -> value (1000 ~ 2000)
Message ledUpdate = Message.obtain(uiHandler, what, mPort, value);

// ADK 
    case SEND_LETTER_PWM_DUTY:
                if(accessoryManager.isConnected() == false) {
                    return;
                }
    
                commandPacket[0] = SEND_LETTER_PWM_DUTY;
                commandPacket[1] = 0;
                commandPacket[2] = (byte) msg.arg1;
                value = (short) msg.arg2;
                commandPacket[3] = (byte) (value >> 8); 
                commandPacket[4] = (byte) value;
    
                accessoryManager.write(commandPacket);
                break;

// Bluetooth
      case SEND_LETTER_PWM_DUTY:
                if (mCmdSendService.getState() != BluetoothMotorControlService.STATE_CONNECTED) {
                    Toast.makeText(getBaseContext(), R.string.not_connected, Toast.LENGTH_SHORT)
                    .show();
                    return;
                }

                commandPacket[0] = SEND_LETTER_PWM_DUTY;
                commandPacket[1] = 0;
                commandPacket[2] = (byte) msg.arg1;
                value = (short) msg.arg2;
                commandPacket[3] = (byte) (value >> 8);
                commandPacket[4] = (byte) value;

                mCmdSendService.write(commandPacket);
                break;

send 5 byte buffers by bluetooth or usb

en/servomotorcontrol.txt · Last modified: 2014/07/01 17:17 by ruppi
CC Attribution-Share Alike 3.0 Unported
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0