I’m using this circuit for my project, which I referred from https://www.sparkfun.com/news/1396.
I don’t really understand how current works in GPIO pins, so the question is: instead of connecting them to pin 4, 6, 7, can I connect them to pin 4, 6, 12? as I need control over the brightness of LED and it seems I can only do that through the PCM_CLK pin.
(1) How does current passes through the GPIO pins?
(2) Which GPIO pins should I connect to control an NPN transistor used to control the brightness of infrared LED lamp for Rpi camera photography?
I would suggest to quickly skim through the newbie tutorials to get a very rough idea of GPIO, PWM, and transistor switches: Refs 1 to 3 are particularly related to your IR LED circuit.
(1) Rpi GPIO baiscs
(2) Transistor operation basics
(3) PWM basics
You problem is mainly on:
(a) How much current is need to drive the 13 IR LEDs.
(b) Which GPIO pins to do PWM to control brightness of the LEDs.
I can use ordinary and IR LED to show the basic calculations.
/ to continue, …
End of answer
Yes you probably could. I’ve not heard of anyone controlling the brightness of infra red IRs before, but that might just be my ignorance.
However PWM signals can be generated on all the GPIO. The only advantage of using GPIO 18 (pin 12) is that like GPIOs 12, 13, and 19 it can be connected to the Pi’s hardware PWM peripheral.
See https://pinout.xyz/ for a diagram showing the mapping of GPIO to pins on the extension header.
As I say PWM can be generated on all GPIO.
My pigpio library has this feature. To generate PWM on GPIO 4 (pin 7) do
sudo pigpiod pigs p 4 64 # 1/4 dutycycle pigs p 4 128 # 1/2 dutycycle pigs p 4 192 # 3/4 dutycycle pigs p 4 255 # full on