0

I have a Raspberry Pi 4B, 4GB version. When I try to run the following code it gives 0.3V output. I mean it works, on-0.3V, off-0V. But I need 3.3V output. I measured it with a voltmeter, as the interested device was not working getting only 0.3V from Pi.

import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(21,GPIO.OUT)
print ("LED on")
GPIO.output(21,True)
time.sleep(10)
print ("LED off")
GPIO.output(21,False)
7
  • 1
    disconnect the interested device and measure again
    – jsotola
    Commented Aug 4, 2023 at 14:42
  • What is the interested device?
    – CoderMike
    Commented Aug 4, 2023 at 15:45
  • I am just using a tiny dc pump!
    – Aaron Crt
    Commented Aug 4, 2023 at 16:34
  • 2
    your trying to power ANY pump directly from the GPIO? Not going to work.. What is the current required for this pump? GPIO pins can only supply 16mA if I rememeber correctly.
    – Chad G
    Commented Aug 4, 2023 at 16:50
  • 1
    You could damage your Pi by connecting a dc pump directly!
    – CoderMike
    Commented Aug 4, 2023 at 16:55

2 Answers 2

0

As others have pointed out in Comments (in response to your comment - which should be edited into your Question) the GPIO can only source a maximum of 16 mA and may be damaged.

You need a transistor or similar to control higher currents. There are hundreds of Answers on this site with recommended circuits (depending on the specifications of the pump).

0

GPIO have extremely limited current output; when overloaded, the voltage drops to near zero. This is a clear indication that you have "screwed up".

Use a transistor (or amplifier) to drive your "tiny dc pump" as shown in the schematic below:

schematic

simulate this circuit – Schematic created using CircuitLab

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.