How to Control 5V with 3.3V pin of ESP

Submitted by somya on

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 

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.

  Joined August 16, 2018      42
Thursday at 11:31 AM

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 ? 

  Joined September 18, 2018      4
Tuesday at 05:38 PM

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-p…

Hope this helps 

  Joined May 19, 2015      213
Tuesday at 03:45 PM

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

 

  Joined September 18, 2018      4
Tuesday at 05:38 PM

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 

  Joined August 16, 2018      42
Thursday at 11:31 AM

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 

 

  Joined September 18, 2018      4
Tuesday at 05:38 PM