# connecting devices with two different power supplies

I wanted to know if this configuration is fine with two different grounds. the microcontroller is powered up with 3.3V and the transistor is powered by 5V. Both grounds are separate.

My question is whether it is safe to connect the microcontroller pin to the transistor to switch On/Off the motor?

Everything in your circuit needs a common reference. That's the circuit's ground. You can compare the separate grounds and the trigger to the following: take two batteries, and connect the + of the first one via the 10 kΩ resistor to the - of the other one. There won't flow any current through the resistor since, as Alfred says, there's no closed loop.
So for driving Q1 you need a current path starting at the +3.3 V through the microcontroller, R5 and Q1 to ground, and that should close the loop, so connect that ground to the - of the 3.3 V. It doesn't matter that this is also the ground for another supply voltage; if you have two separated circuits you can always choose one point on each of them to connect them, and that's usually their grounds.