How Activate a barcode scanner with a bc548 and a nodemcu?

I'm trying to use a bc548 as switch to turn on a barcode scanner.

The scanner is powered with 3.3v and consumes 50 mAh. I'm using a NodeMCu to trigger the bc548. Pin4 has 3V3.

What should be the value of the resitor on the transistor base?

Is there a better way to do this?

I tried to use a solid state relay but for some reason it has a resistance of 2k ohm when it is activated and then the scanner does not work.

Thanks.

Never underestimate the utility of a relay.

1k at the base should do it. It will keep your base current at about 2.5mA or less but it will reduce voltage to scanner by about 0.2V. I wonder if your solid state relay needs a higher voltage to turn on fully. Other options include relay or a good logic level mosfet designed for 3.3v.

wolframore:
1k at the base should do it. It will keep your base current at about 2.5mA or less but it will reduce voltage to scanner by about 0.2V. I wonder if your solid state relay needs a higher voltage to turn on fully. Other options include relay or a good logic level mosfet designed for 3.3v.

Hello, you are right with the voltage drop does not work because I am already at the limit of 3.3 volts.
I'm trying to use the relay again.
Using the relay as a switch, should I interrupt vcc or gnd?
Thanks.

Since relays don't mind whether you switch VCC or Gnd, I prefer switching VCC.