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;
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?
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.
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.