analog pin discussion notes

Active today
Viewed 27 times

I’ve read there https://www.raspberrypi.org/documentation/usage/gpio/ that we have 4 pins which can be used as analog, but other people say that we use only 2, so what’s the correct answer?

 New contributor
  • 1
    analog what? … input or output? – jsotola 20 hours ago
  • Unlike Arduino, Rpi does not have any ADC (Analog to Digital) pins. You need to use external ADC chips/modules, eg MCP3008. – tlfong01 19 hours ago   
  • 1
    The simple answer is “zero” without additional hardware. – Dougie 13 hours ago
  • The simplest answer is “Zero”. – tlfong01 4 hours ago   


The Raspberry Pi has NO analogue GPIO. All the GPIO are digital only.

Perhaps you are being confused by some Arduino terminology. If a digital GPIO is used to generate PWM they often incorrectly refer to that GPIO as an analogue output.

If that’s the case you are probably referring to the Pi’s hardware PWM (output) capability. The Pi’s with the 40 pin header (and the compute modules) can provide hardware PWM on GPIO 12, 13, 18, 19. However there are only two PWM channels so GPIO 12/18 will have identical outputs as will GPIO 13/19.

  • 1
    Note that PWM output is strictly speaking not an analog output, it’s just a quickly switching digital output that may for some applications look like an analog output (i.e. when controlling the brightness of an LED). – PMF 15 hours ago
  • In other words, PWM output is a fake analog output, cheating the stupid human eyes, well also the stupid brain. Let me try to explain using my broken English: (1) After evolving for about a couple of billion years, our stupid brain eye processing is still hopeless inferior, compare to other intelligent beings in the samsung galaxy. To be more specific, the stupid human eyes cannot detect anything changing more frequent than about 30 scenes in a second. Yes, that is the theory of “moving pictures”, or movies. Now let us come back to the fake PWM output pin. / to continue, … – tlfong01 3 hours ago    
  • If the fake pin switches a LED on and off, say five times a second, our stupid human eyes are still not so stupid enoough, ie, smart enough, to count, using our also stupid, so called “brain” to count: oh yes, led on, led off, led on, led off, … But if the fake pin switches faster, say 40 times a seconds, then the stupid brain eye “system” cannot follow, and cheating them selves that the led is NOT blinking, but only “dimming”, ie, becomes dimmer, ie, not digitally on and off, but analogly becomes dimmer and brighter, … / to continue, … – tlfong01 2 hours ago   
  • That is how the clever Holliwood/Fox/Sony/ … guys have been cheating us stupid humans for a couple of hundred years, since they invented the moving picture thing, … Well, of course the stupid humans enjoy being cheated forever after, by YouTube, FB, IG etc, … (End of my English writing lesson. Thanks for reading.) – tlfong01 2 hours ago   Delete

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: