I have a STM32F4 Discovery board and I want to activate a LED connected to an external power supply.
I could connect the LED to the 5V supply of the STM32F4 DISCOVERY but I'm testing this to use it with a load that will consume a lot of current, so I need that external power supply. In addition I'm planning to use a N-Channel MOSFET instead of the NPN transistor, but for the moment I'm just testing a main idea.
In order to correctly control the LED toggling I've had to connect the STM32F4 GND to the LED power supply GND using a simple cable (purple cable in the picture below).
simulate this circuit – Schematic created using CircuitLab
If not, the LED is always turned on with a lower light intensisty (transistor not fully switched). I understand this is because there is a voltage offset between both grounds.
Is this procedure correct? If not, how should I proceed?