Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Can I control high voltage (here 5V) to power a led lamp and a fan(both operating at 5v) from Raspberry Pi GPIO only using a transistor . Or should I isolate both the circuits using a relay or octo-coupler
yes, you CAN just use a npn transistor:
see more info here
but if you want to use A pnp transistor:
I think a voltage divider with a pnp transistor might work:
simulate this circuit – Schematic created using CircuitLab
you probably just want to go with the npn circuit, though.
Required, but never shown