User avatar
OutoftheBOTS
Posts: 711
Joined: Tue Aug 01, 2017 10:06 am

turn on LED with transistor

Thu Sep 07, 2017 1:55 am

Ok I have made a little circuit to turn on and off a LED with the RPi using a PN100 transistor as it was the one that I could get down the road near my house easily.

I have a 100ohm resistor to limit the current to the LED and a 4.7k ohm resistor on the base of the transistor to limit then current from the RPi GPIO pin

Now to my surprise when the GPIO pin connected the base is set to high the LED turns off and when the GPIO pin is set to low the LED turns on. I was expecting it to work the other way around

see my picImage
Attachments
20170907_113945.jpg
20170907_113945.jpg (84.15 KiB) Viewed 615 times

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

Re: turn on LED with transistor

Thu Sep 07, 2017 2:44 am

Presumably you have wired it up incorrectly. Assuming all your components work as advertised.
Memory in C++ is a leaky abstraction .

Return to “General discussion”