servo by wired Xbox Controller

Hi there,

I have messured a peak voltage of 5V if I use a very easy sketch using PWM. Without xboxcontroller.

For the Controller I`ve downloaded Revision 2.0 of USB_Host_Shield_20 from Github.com .
So, there is the issue.
When i run the init(), there is only a paek volatge of 2.5V ! In the attachment you can find code fragments..
For our Servo, Hitec HS-645MG, we need the higher peak.

The question now is, how we solve this and how we get the 5V peak, because without init(), the controller wont start.

Any ideas?

Thank You,

best regards from Germany

sketch_controller.ino (3.35 KB)

So, when we strip out all the commented lines (you really need to learn to use "#if 0 . . #endif"), we're left with

#include <XBOXUSB.h>
#include <math.h>

USB Usb;
XBOXUSB Xbox(&Usb);

void setup()
{
	pinMode(9, OUTPUT);

}

void loop()
{
  analogWrite(9, 127);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
}

And, in fact only

void setup()
{
}

void loop()
{
  analogWrite(9, 127);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
}

makes any sense.

Now, what is the question?

We want to control our Servo by the Xbox Controller, the Controller is initialized by the following Code:

	if (Usb.Init() == -1) {
		while (1); //halt
	}

When we comment the Code we have 5 V Output at Pin 9.
If we uncomment the 3 lines, we only get 2.5 V.

The Controller itself is running fine, we already control a step Motor with a Joystick.

We use the follwing USB Shield:

If we uncomment the 3 lines, we only get 2.5 V.

You measured this how - With a scope?
(Any answer other than "yes" is not acceptable)

Why are you using analogWrite for a servo?

Of cource we measure the Signal with oscilloscope. The 3.3V or the 5 are Peak to Peak and not the mean.

We use analogWrite, because the Servo is working with PWM.

Or why should we not use analogWrite?

We use analogWrite, because the Servo is working with PWM.

At what frequency and duty cycle?

Frequency: 490 Hz
Duty Cycle: between 0 and 255 is the analog Write Function, our Servo works between 70 and 170.

In the attachement is a picture of the oscilloscope. We use Pin 9 for Servo 1 (Yellow line), it only reaches 2.5 V.
The Blue Line on Pin 11 has the correct 5 V.

er.jpg

It's a fairly unusual servo that runs at 490Hz - are you sure about that?

Pulse Width: 900-2100 µs

Hmmm.

(A scope screen dump would be better than a blurred photo)