So, I was doing a project with PWM (Pulse-width modulation) but something unsual happens, my raspberry pi turns off. I am using a RPi model 2B, and my circuit looks as follows


simulate this circuit – Schematic created using CircuitLab

Here is my script...

import RPi.GPIO as IO          #calling header file which helps us use GPIO’s of PI

import time                            #calling time to provide delays in program

IO.setwarnings(False)           #do not show any warnings

IO.setmode (IO.BCM)         #we are programming the GPIO by BCM pin numbers. 
(PIN35 as ‘GPIO19’)

IO.setup(19,IO.OUT)           # initialize GPIO19 as an output.

p = IO.PWM(19,100)          #GPIO19 as PWM output, with 100Hz frequency
p.start(0)                              #generate PWM signal with 0% duty cycle

while 1:                               #execute loop forever

    for x in range (50):                          #execute loop for 50 times, x being incremented from 0 to 49.
        p.ChangeDutyCycle(x)               #change duty cycle for varying the brightness of LED.
        time.sleep(0.1)                           #sleep for 100m second

    for x in range (50):                         #execute loop for 50 times, x being incremented from 0 to 49.
         p.ChangeDutyCycle(50-x)        #change duty cycle for changing the brightness of LED.
         time.sleep(0.1)                          #sleep for 100m second

And my male-female pins are connected to pin 19, GND, and 3v3 (when in BCM mode). You can see the illustration at the site that I got this tutorial off of.

But the unusual thing is that my Pi would turn off and not turn back on until I disconnected the jumper cable to GND, and then the PI would turn back on!

I couldn't find anything like this anywhere on the internet, but can someone please explain why this is happening? Thanks


Here are some images of my pi

enter image description here

  • The photo is on the website that I included as a link.
    – jdw136
    Jul 14, 2018 at 22:21
  • Sorry, I have add the image.
    – jdw136
    Jul 14, 2018 at 23:03
  • There is no Rasperry Pi on the schematic.
    – NomadMaker
    Jul 15, 2018 at 20:08

3 Answers 3


It's really easy to confuse oneself when wiring circuits. Standard conventions can really help prevent miswiring. Red wires are normally used to designate steady positive voltages for power distribution. You have a red wire hooked to extension pin header 39, which is ground. Black wires are typically used for ground (if you don't have black, a dark color is preferable). Lighter colors are typically used for signals. You have a yellow wired hooked up to extension header pin 1, which is 3.3V. You can of course use whatever color you want, but it can easily confuse others trying to understand your wires. It will also confuse you if you keep changing wire colors for each circuit.

Breadboards also have colors. The long red stripe is typically used for positive power. You have ground hooked into the red bus. The blue breadboard bus is typically used for ground. You have yellow hooked into the blue bus. This is confusing for the same reason.

Your photo isn't clear enough to show the LED polarity as indicated by the flat side. The flat side should go to ground.

Additionally, your photo shows a Pi without a case. Cases protect against static electricity.

Finally your breadboard circuit doesn't match the circuit diagram.

Double check your wiring with a multimeter and you will quickly find the problem.

  • I came to say same but you have already said, You would also like to add that keep Pi on paper increases a chance for static and OP needs to keep Pi on some insulator.
    – MaNyYaCk
    Jul 16, 2018 at 6:40

Check the current on your pins, if flowing current is more than max. handle capacity, it will cause errors and shutdowns your raspi. Also check the cpu temperature with external thermometer, after 85C it may be cause shutdown


Power in pi is a daemon indeed (and is regulated by a single IC on the hw side) and has settings for stages/phases of boot. Your circuit might load dynamic impedance and pi is not a production stage product that is also far from being robust on GPIOs. Try to embrace this concept and I wish you luck in your pursuit.

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.