Please refer to the diagram I have attached, the following circuit uses IRF9520 P-Type Mosfet and IRF520 N-Type Mosfet.
I have designed a switching LED, i.e. when we push a button two LEDs in first branch light up when we again press the push-button LEDs in second branch light up and first branch turn off and so on, when we hold the push-button for more than 2 seconds both the branches turn ON and when we again press the push button the first branch lights up with second branch in OFF state. What I haven't shown in the circuit diagram is a push-button that toggles switching between two branches where each branch consist of two LEDs in series. The circuit's pwm is controlled via potentiometer(not shown in the circuit diagram).
I am using two 3V LEDs in series with maximum current rating of 180mAmps in both the branches.
I have decided the Resistance such that max current drawn be 180mAmps in each branch.
Following was my calculation :
at 100% duty cycle 6V in total drops across the two LEDs so rest of the voltage should drop across the series resistor. Max current rating for these LED is 180mAmp so 12-6 = 6; 6/180mAmp = ~34ohms. So I placed 34ohms resistor in series with two LEDs in each branch.
Now when I connect the whole circuit up few problems arise :
1> The LEDs in the branch that has P-Type MOSFET lights brighter than the LEDs in other branch initially at any PWM but at max duty cycle (100%) both shines equally but I'd want both to light up with equal brightness. why could this be happening? I measured voltages across LEDs in both the branches at same PWM by activating both branches one by one at same PWM and the LEDs in first branch with P-Mosfet one had higher voltage drop than the second branch and hence was lighting brighter than the other branch.
2> Secondly what I expected was, say at 100% duty cycle, there would be 6V drop on LEDS and rest of the voltage drop should be on the resistor in series with the LEDs and a little voltage drop between drain and source but when I use multimeter to check the voltage drops at components in a branch, voltage drops at LEDs according to PWM supplied but the rest of the voltage should drop on the resistor in series with the LEDs but instead of that a very tiny voltage drops at that resistor and the remaining voltage drops between drain and source. For example if 4 volts drop across LEDs, a few volts(less than 1) drops at the series resistor and the remaining 7.x volts would drop between source and drain. I don't understand why is this happening! At ON state Vds should be less depending on the On-state resistance which from data sheet I found out it to be less than 1 ohm. And this is happening at both the branches with both P-MOSFET and N-MOSFET.
I am assuming it's the problem with my understanding of transistors maybe. Any help would be greatly appreciated.