1. you need a logic level mosfet;
2. gate resistors too big.
3. solar panel shorted by the battery.
...
this is soething a 555 + two ptc/ntc sensors could do
thanks for your reply,
I thought the FQP30N06L was a logic level mosfet?
what size resistors do you recommend?
The FQP30N06L turns on at max 2.5V V
gs but it's not fully enhanced until around 10V V
gs. A logic-level FET would be fully enhanced (or fully depleted) at 5V V
gs or less.
However, this part should work fine at 5V V
gs, it achieves an R(ds)
on of about 45 mOhms, which is comparable to a logic level FET anyways.
The 2.4k gate resistor limits the gate current to about 2mA, which saves your micro output drivers, but it's not enough current to switch the FET on very fast... According to the datasheet, that FET needs about 20nC of total gate charge to turn on at 5V V
gs. 1C is 1A in 1s .. thus 20nC is 20nA in 1s ... but you have 2mA available through the 2.4k gate resistor, so that would be 20nC/2mA = 10uS .. and taking 10uS to switch on is way, way too slow for PWM at the typical PWM frequencies above audio... like 25khz or 50khz..
The ATTINY85 can source max 40mA from each pin, up to a maximum of 200mA from all pins... 20nC/40mA = 500nS to fully charge the gate at V
gs = 5V. To get 40mA of gate charging current, you need the gate resistor between 120 - 150 ohms. Now, you can probably go lower than this, to say 100 ohms, and this will switch harder and faster, and the ATTINY will still see an average of less than 40mA at the pin, so long as you are less than 100% duty cycle on the PWM. I didn't do the math for anything less than 120 ohms to figure out the max safe PWM duty cycle to keep the average current sourced out of the pin less than 40mA.
So I'd make R2 be from 120 to 150 ohms.
Just remember , it's the gate charging time that determines the switching time, and the switching time limits your PWM capabilities. If you want 10% minimum voltage, and your PWM frequency is 25kHz, then your PWM cycle time is 40uS. 10% is 4uS on time. So you want to be fully on for 4uS, and thus want to reach that full-on level in less than 4uS, an order of magnitude less, so that would be 400ns. In this case, 500ns is ok at the bottom end.
So, at a PWM frequency of 25kHz, you will want to size your gate resistor to achieve the charging current you need to reach a 400-500ns switching speed. If you use a faster PWM frequency, then you will need to switch faster still. Your post didn't mention what PWM frequency you will be using.
Sorry for the lengthy post.. I could have just said use a 150 ohm resistor and be done, but then you wouldn't know why to use it, nor how to change it if you wanted to. "Teach a person to fish" and all that...