0

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?

  • 1
    analog what? ... input or output? – jsotola Nov 23 '19 at 8:22
  • Unlike Arduino, Rpi does not have any ADC (Analog to Digital) pins. You need to use external ADC chips/modules, eg MCP3008. – tlfong01 Nov 23 '19 at 8:40
  • 1
    The simple answer is "zero" without additional hardware. – Dougie Nov 23 '19 at 14:47
  • The simplest answer is "Zero". – tlfong01 Nov 24 '19 at 0:10
6

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 Nov 23 '19 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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