Shomary
Posts: 22
Joined: Wed Apr 15, 2020 1:31 pm

PWM (gpio 18 ) not outputing 3.3V

Wed Apr 15, 2020 1:43 pm

hey ,
I build a booster converter and I do the switch operation using a transistor and set a frequency of 50K, why at high frequencies the RASPBERRY does not give voltage from 0 to 3.3V on the GPIO output, I only get 1.4-1.8V

pcmanbob
Posts: 9298
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: PWM (gpio 18 ) not outputing 3.3V

Wed Apr 15, 2020 3:43 pm

Hi.

Because you are attempting to measure the voltage of a PWM signal using a digital multi meter, which cant react quick enough to the changing PWM signal.

You need to use an oscilloscope to see see the voltages from a PWM signal.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Heater
Posts: 15838
Joined: Tue Jul 17, 2012 3:02 pm

Re: PWM (gpio 18 ) not outputing 3.3V

Wed Apr 15, 2020 4:00 pm

I have no idea how your circuit looks but can a Pi GPIO output drive the gate capacitance of a MOSFET in a switcher circuit?

Be warned that last time I tried building a switcher boost circuit, just by way of a fun experiment, I managed to blow the MOSFET and the voltage back through the gate killed by digital logic driving it. That was no big deal but I'm glad it was not a Pi I was using to generate the PWM. I was trying to generate 150 volts mind.
Memory in C++ is a leaky abstraction .

Shomary
Posts: 22
Joined: Wed Apr 15, 2020 1:31 pm

Re: PWM (gpio 18 ) not outputing 3.3V

Thu Apr 16, 2020 12:42 pm

I ordered a MOSFET with low THRESHOLD VOLTAGE, but for now I'm trying to work with a simple circuit with BJT as a switch, and I don't know why I don't get VCE = VCC (Off)or VCC close to zero (ON), I get VCE 3.38V and 2.7V ,This is my schematic:
Image

Heater
Posts: 15838
Joined: Tue Jul 17, 2012 3:02 pm

Re: PWM (gpio 18 ) not outputing 3.3V

Thu Apr 16, 2020 12:56 pm

Cannot see your schematic.
Memory in C++ is a leaky abstraction .




Heater
Posts: 15838
Joined: Tue Jul 17, 2012 3:02 pm

Re: PWM (gpio 18 ) not outputing 3.3V

Thu Apr 16, 2020 2:32 pm

Hmm...

I'm a bit rusty at this but you have 3.3 - 0.7 = 2.6 volts across that 7.2K resistor when the GPIO is high. The 0.7 being the base emitter drop.

Ohms law (I = V/R) tells me that results in a current into the base of 2.6 / 7200 = 0.3ma.

If the transistor had a gain of 10 that results in 3ma through the collector/emitter. So the voltage drop across the 220 ohm resistor is V=I*R = 0.003 * 220 = 0.6 volts.

Giving a voltage on the collector of 6 - 0.6 = 5.4v

If you have a higher gain transistor that will get lower of course.

I would expect to 6 volts when the GPIO is low though.
Memory in C++ is a leaky abstraction .

Shomary
Posts: 22
Joined: Wed Apr 15, 2020 1:31 pm

Re: PWM (gpio 18 ) not outputing 3.3V

Thu Apr 16, 2020 3:16 pm

if i put a bigger Resistor in the base it well get a better resultes?

hippy
Posts: 7459
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: PWM (gpio 18 ) not outputing 3.3V

Thu Apr 16, 2020 3:47 pm

Shomary wrote:
Thu Apr 16, 2020 3:16 pm
if i put a bigger Resistor in the base it well get a better resultes?
No. Transistors are current amplifiers, so increasing the resistance will reduce the current. Decreasing the resistance should give better results.

I'm no expert in analogue electronics but most circuits driving transistors from 3.3V I found through Google use a 1K to 2K resistor so perhaps try that.

But I'm also of a view that you are seeing less than you'd expect simply because it's PWM and a multi-meter will show less than peak voltage, unless at 100% duty.

drgeoff
Posts: 10676
Joined: Wed Jan 25, 2012 6:39 pm

Re: PWM (gpio 18 ) not outputing 3.3V

Thu Apr 16, 2020 3:54 pm

Have you really got a 7.2K resistor in the circuit? That is not in any of the E series preferred values.

Shomary
Posts: 22
Joined: Wed Apr 15, 2020 1:31 pm

Re: PWM (gpio 18 ) not outputing 3.3V

Thu Apr 16, 2020 4:17 pm

I am using a PN222a TRANSISTOR and I did the calculations according to Hfe =75

pcmanbob
Posts: 9298
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: PWM (gpio 18 ) not outputing 3.3V

Thu Apr 16, 2020 5:36 pm

Shomary wrote:
Thu Apr 16, 2020 4:17 pm
I am using a PN222a TRANSISTOR and I did the calculations according to Hfe =75
For that transistor you can safely use a 1K resister as the base current limiter, the transistor will be fully on then.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Shomary
Posts: 22
Joined: Wed Apr 15, 2020 1:31 pm

Re: PWM (gpio 18 ) not outputing 3.3V

Fri Apr 17, 2020 9:26 am

No I dont see the right voltage on Vce , may my transistor is not good?

pcmanbob
Posts: 9298
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: PWM (gpio 18 ) not outputing 3.3V

Fri Apr 17, 2020 9:49 am

If you are driving the transistor at frequency of 50K to see the output correctly you need to use an oscilloscope, you will not get a correct voltage reading trying to measure the voltage with a digital meter.

With a pwm signal ratio of 50% you would see approximately 50% of the output voltage if you use a digital voltmeter to measure the voltage.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

User avatar
Burngate
Posts: 6290
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: PWM (gpio 18 ) not outputing 3.3V

Fri Apr 17, 2020 11:06 am

apKvh3s2.png
apKvh3s2.png (11.63 KiB) Viewed 344 times
Would it be worth while going back a step?
Instead of using PWM at 50kHz try switching the transistor at finger-speed, once a second or so, and see what your meter tells you for each of on and off.

Return to “General discussion”