ESC 30A control with USB Host shield

HI, I’m having a problem with my project. I want to control a Hobbyking Brushless motor, with a USB Host Shield.

This is my current code

Example sketch for the PS3 Bluetooth library - developed by Kristian Lauszus
For more information visit my blog: or
send me an e-mail:

#include <PS3BT.h>
#include <Servo.h>
#include <usbhub.h>
// Satisfy IDE, which only needs to see the include statment in the ino.
#ifdef dobogusinclude
#include <spi4teensy3.h>

Servo myservo; // create servo object to control a servo

USB Usb;
//USBHub Hub1(&Usb); // Some dongles have a hub inside

BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so
/* You can create the instance of the class in two ways */
PS3BT PS3(&Btd); // This will just create the instance
//PS3BT PS3(&Btd, 0x00, 0x15, 0x83, 0x3D, 0x0A, 0x57); // This will also store the bluetooth address - this can be obtained from the dongle when running the sketch

boolean printTemperature;
boolean printAngle;

void setup() {
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
if (Usb.Init() == -1) {
Serial.print(F("\r\nOSC did not start"));
while (1); //halt
Serial.print(F("\r\nPS3 Bluetooth Library Started"));
myservo.attach(5); // attaches the servo on pin 9 to the servo object
void loop() {

if (PS3.PS3Connected || PS3.PS3NavigationConnected) {
if (PS3.getAnalogHat(LeftHatX) > 137 || PS3.getAnalogHat(LeftHatX) < 117 || PS3.getAnalogHat(LeftHatY) > 137 || PS3.getAnalogHat(LeftHatY) < 117 || PS3.getAnalogHat(RightHatX) > 137 || PS3.getAnalogHat(RightHatX) < 117 || PS3.getAnalogHat(RightHatY) > 137 || PS3.getAnalogHat(RightHatY) < 117) {
Serial.print(F("\r\nLeftHatX: “));
Serial.print(F(”\tLeftHatY: “));
if (PS3.PS3Connected) { // The Navigation controller only have one joystick
Serial.print(F(”\tRightHatX: “));
Serial.print(F(”\tRightHatY: "));

myservo.write(map(PS3.getAnalogHat(RightHatY), 0, 255, 0, 100));

My motor isn’t reacting at all! Can somebody help me and tell my what i am doing wrong?

Caryl Stuffertz

Show your connections to the ESC including power and battery. Show EXACTLY how you connected the battery & ESC to arduino. What arduino are you using? Why are you uhsing a PS3 library?.

(ARDUINO UNO) I’m using a ps3 library because i am making a rc vehicle controlled by a ps3 controller. I have connected a 2200mAh-35c-7,4v lipo to the esc using xt60.

First of all you have not shown any of your Bluetooth hardware in your diagram. Secondlly: I don't see anything in the code telling the arduino to control the ESC. If want to run around in circles, keep doing what your doing. If you want to find the problem, eliminate everything Bluetooth or PS3 related and simply command the ESC using Servo Library commands from arduino. Post the new test code using the "#" CODE TAGS button. Make sure the only commands you use are Servo commands. If you want you can connect a pot to A0 and map it to the servo. to make easy to test the ESC.

// Controlling a servo position using a potentiometer (variable resistor) 
// by Michal Rinott <> 

#include <Servo.h> 
Servo myservo;  // create servo object to control a servo 
int potpin = 0;  // analog pin used to connect the potentiometer
int val;    // variable to read the value from the analog pin 
void setup() 
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
void loop() 
  val = analogRead(potpin);            // reads the value of the potentiometer (value between 0 and 1023) 
  val = map(val, 0, 1023, 0, 179);     // scale it to use it with thb e servo (value between 0 and 180) 
  myservo.write(val);                  // sets the servo position according to the scaled value 
  delay(15);                           // waits for the servo to get there 

still not working

Is the ESC beeping at all ? Do you see any leds on (the ESC)

It is bleeping, but i have to deconnected the Accu and then connect the Accu to make the motor running. It is now running for about 2 seconds, after the 2 seconds the motor will stop again!

If you are not using an ESC designed for 2S lipo batteries it will not work because the battery voltage is too low. Post a link for the ESC you are using.


What is “Accu” ? (arduino ?)
What is the battery voltage ? (when conntected)

Do you have experience using lipo batteries ? Do you know what the fully charged voltage should be for a 2S and the fully discharged voltage for a 2S (the voltage at which the battery can no longer be used in it’s current state without damaging it, in other words , the
battery MIN voltage)

Did you program the ESC ?
Do you know the cutoff voltage for the ESC ?
If an ESC works for 2 seconds or 2 minutes and then shuts down, it either because the battery voltage is too low for the way the ESC was programmed or the ESC is a 3S ESC connected to a 2S battery.

My motor isn't reacting at all! Can somebody help me and tell my what i am doing wrong?

What is the arming sequence for your particular ESC?