LOW Voltage on PWM

Hi, I got these situation, I conect my arduino to an optoacoplator, by using PWM, I'll show you the code I'm using, but the strange thing is when I measure the voltage between pwm pin and gnd it is 1,64V when the pwm is at 100%, shouldnt it be at 5V?

#define MOTOR 11
#define RECARGA 3
int POT;
int VELOCIDAD;

void setup ()
{
Serial.begin (9600);
pinMode (MOTOR, OUTPUT);

}

void loop ()

{
POT = analogRead (A5);
VELOCIDAD = map(POT,0,1024,0,255);
Serial.println (VELOCIDAD, DEC);
analogWrite(MOTOR, VELOCIDAD);

}

What do you read when you take the optocoupler out of the circuit?

Do you have a current limit resistor on the optocoupler?
Most are just an LED inside and can likely sink 50mA.

Absolute max of 50mA, while Arduino likely to burn out after 40mA.
Operation characterized for 20mA. Up to user to correctly limit current based on source voltage being used.

For example,with Vf of 1.2V:
(5V-1.2V)/.02A = 190 ohm resistor needed.

No I don't have any, I just conect de arduino to de USB PC, and then de 11 pin to the opctoacoplator, and the out pin of it to GND... is it wrong?, why am I reciving these voltage?

If I takes out the acopaltor I recive 5V...

You NEED a current-limiting resistor.

But, is it going to help with the voltage? and what size of resistor?

Did you read reply #2?

Yes but I'm not catching what is Vf? and why it happend and there says how to use it...

Vf is the forward voltage drop of the LED in the optocoupler, found in the device's data sheet.

You need a resistor wired up like this:
Arduino pin --- resistor --- Anode of optocoupler.

If the LED in the optocoupler has Vf of 1.6V, then the resistor needs to be:
(5V - 1.6)/20mA = 170 ohms
to limit the current to 20mA to prevent damaging the arduino pin or the LED.

Thank you very much! really!

I understand perfect all what you had say, but, the Vf in every datasheet for any kind of thing, is allways the forward voltage drop?

Vf generally just refers to diodes and LEDs.

And what would be forward current If? and reverse Voltage?

If is the 20mA being discussed, the current from the Arduino pin thru the resistor and LED.
Reverse Voltage is how much voltage can be applied to the Cathode with the Anode at a lower voltage before the diode/LED will conduct current backwards.