NDP6020P P-Channel to switch power on/off for an orange pi

Hi. I want to use NDP6020P to switch power for an orange pi with attiny85.

First time I choose an LED for the load and for R1 I put 1k resistor. But when I connect the power for the first time to all system the led is on for a half a second or so, after that all is ok. (I also tried to remove R1, but same results).

If I replace R1 with 10k this is not happening.

Can I use this schematic with 10K for R1? It is all ok like that?

Sorry for my english.

tiny_mosfet.ino (637 Bytes)

I believe you should move R1 over to the right of the R2 connection, so that both R1 and R2 are connected to PB2. Otherwise, PB2 can't take the gate all the way to ground.

I would guess that the initial On state is caused by the state of PB2 when power is first applied to the system. You might try adding a one second delay at the very beginning of setup().

And make R1 220R.

Show us an image of the actual wiring.

0x807F807F (8 bytes ??? ) seems not correct, check this value.