How to Control 5V with 3.3V pin of ESP

somya's picture

Offline

Joined: Sep 18, 2018

Replies: 4
How to Control 5V with 3.3V pin of ESP
October 27, 2018 - 12:51pm

Hi,

My experience is limited only to Arduino UNO so far. Now, I have started working with ESP32 board which has 3.3V GPIO pins. How can I control a 5V relay using a 3.3V pin.

I know I have to use a transistor, I tried the BC547 but this thing does not trigger for 3.3V it trigger only for 5V. I tried changing the base resistor value which did not help.

What should I do now?

Thanks 

Violet's picture

Offline

Joined: Aug 16, 2018

Replies: 23
Use Logic Level Converter or other driver IC
October 27, 2018 - 12:57pm

Hi sowmya, I had the same problem when I started with ESP32, as you found at the BC547 will not trigger for 3.3V since it have a base emitter voltage rating of  6V. The 3.3V is just not enough.

So what you can do is, you can use driver IC like L293D or ULN2003 these IC will trigger even for 3.31v since they have a darlington pair inside them. If you are working with some communication protocol you can also use other logic converter ICs which can switch fast.

somya's picture

Offline

Joined: Sep 18, 2018

Replies: 4
Need a simple solution
October 27, 2018 - 1:00pm

Hi,

Thanks for the quick response violet, but I have already looked into the option of ULN2003. In my whole project I am going to trigger only one GPIO pin I do not want to complicate the circuit with IC's since I am more of a software guy. 

Is there any other simple way I can get away with this? I also have a 5V pin Vin pin on the ESP32 can I use this and do soemthing ? 

Jayant's picture

Offline

Joined: May 19, 2015

Replies: 187
Use BC548 instead of BC547 for 3.3V switching
October 27, 2018 - 1:05pm

Hi, for a quick solution you can just replace the BC547 transistor with the BC548 Transistor. If you peek into its datasheet you can notice that the Base Emitter voltage of BC548 is only 5V compared the 6V of BC547 so even a 3.3V signal could trigger the transistor.

I have already tried in one my Raspberry Pi project, where I needed to control a 5V Relay with a 3.3V GPIO pin of PI. The link to project is given below

https://circuitdigest.com/microcontroller-projects/raspberry-pi-smart-ph...

Hope this helps 

somya's picture

Offline

Joined: Sep 18, 2018

Replies: 4
Thanks
October 27, 2018 - 1:07pm

Thanks Jayant, I remember spotting a BC548 transistor in my old development board. Gonna try salvaging it and try using it here. 

Will let you know the results

 

Violet's picture

Offline

Joined: Aug 16, 2018

Replies: 23
BC548 Transistor will not switch completely with 3.3V
October 27, 2018 - 1:10pm

Using 3.3V to trigger a BC548 is not a good idea. As you, yourself pointed out the Base Emitter voltage for BC548 is 5V and not 3.3V. 

Maybe the transistor get triggered at 3.3V but the breakdown will not be complete and the Voltage drop across the Collector Emitter will be high resulting it heat and loss 

somya's picture

Offline

Joined: Sep 18, 2018

Replies: 4
BC548 works with 3.3V at base pin for trigger
October 27, 2018 - 1:12pm

Hi guys,

As I told I tried it out with BC548 and it works perfectly fine. 

Although Thanks for pointing out the drawback of this method violet. But I am not going to run for a long time and hence I am just trying to get away with this for now.

 

Thanks again you ppl are awesome