Light sensor with MOSFET turns on/off inverted

Customer:

I received the light sensor and MOSFET and built the circuit. However, the system works inverted - the lamp turns on in ambient light and turns off in the dark. I think I may have selected the wrong MOSFET type. I used the MOSFET as shown in the diagram.

Original message (Croatian)

Dobar dan! Evo da javim da su mi dostavljeni senzor svjetla i mosfet. Spojio sam strujni krug međutim sistem radi obratno, u prisustvu okolnog svjetla lampa je upaljena, a u mraku se lampa gasi. Pretpostavljam da nisam dobro shvatio koji mosfet odabrati. Koristio sam mosfet kao na slici

Attachment omitted in migration: Screenshot_20240320-183424.png

Attachment omitted in migration: Screenshot_20240320-183415.png

Originally submitted via the contact form on soldered.com on 20 March 2024. Migrated to the forum for community visibility.

Soldered Support:

It looks like you need to replace the PMOS with an NMOS, which is a similar type of MOSFET but with inverted logic for turning on and off. The issue appears to be MOSFET selection for how the sensor output drives the gate. Can you try using NMOS instead?

Original message (Croatian)

izgleda da onda PMOS treba zamijeniti za NMOS, što je sličan tip MOSFETa, ukratko, logika za paljenje i gašenje mu je obrnuta. Mislim da sam onda u koncipiranju tog strujnog kruga pogriješio s odabirom MOSFETa s obzirom na izlaz sa senzora. Možeš li probati NMOS?