Is it possible to read the signals from "simple resistor networks", as on this web site, using only the GPIO on a Raspberry 3? There are six cases with the resistance values 54 Ω, 147 Ω, 301 Ω, 562 Ω, 1037 Ω and 5057 Ω.

I imagine getting a reading a few times per second would be enough.

Addition: it is a steering wheel control stalk. It can be moved in two directions (back and forth) and has a button, so five different actions.

More addition: preferably not the "step response" technique, or any other software-based solution. I'd like to just make quick calls a few times per second to get the current value of the resistor network. I have a programming background, not electronics.

  • 1
    Hello. I want to remind all participating parties in the (now removed) comments of the be nice policy here. Please take a deep breath and try to work together towards a constructive solution. Thanks.
    – Ghanima
    Dec 2, 2017 at 0:27
  • 1
    @Tomas since you only have 6 log-incrementing values you only need 3 bits (3 bits = 8 values) for your ADC. You can use comparators (OP Amps) to construct, what is known as a Flash ADC. These are simple devices, but scale poorly. However f or a 3 bit implementation only a handful of comparators are necessary. That being said, With the state of hardware today, an 8 bit ADC or even an entire microcontroller is much cheaper and more reliable.
    – crasic
    Dec 2, 2017 at 2:24
  • Thanks. Yes, I had the feeling there would be options like that. Ok, 8 bit ADC seems easiest.
    – Tomas By
    Dec 2, 2017 at 23:10

2 Answers 2


There are more than a few approaches to reading resistance. Because you know the specific values, it puts you a bit ahead of the game.

Take a look at O'Reilly Raspberry Pi cookbook chapter 8

The site is using a variable resistor, aka potentiometer. The primary difference for your purpose is that the values will jump from one to another, rather than being "smoothly" advanced. You'll note in the body of the document that this particular circuit is constructed in such a way as to provide stepped readings from the pot. I suspect that will not matter in your case, as you have stepped inputs from your circuit.

stepped resistance circuit

There is what appears to be an identical method presented by Adafruit in multiple pages. The foundation behind this method is to read the values without the need for additional external devices such as an analog to digital converter.

  • Yes, thanks, I did know about this solution. I should have mentioned that. It is explained in several different places I think, in intro books and manuals. I'm leaving it open for now, as I'd like to know if there is a more hardware-y, less software-y solution (short of ADC).
    – Tomas By
    Dec 1, 2017 at 21:17
  • 1
    I would expect that the next step up in the more hardware direction would be an ADC and there isn't likely something in the middle of the two. An arduino can read resistance directly on the analog pins, and you could possibly get the Pi to talk to the Arduino, but that's turning it into an ADC with more possibility of failure due to increased complexity.
    – fred_dot_u
    Dec 1, 2017 at 22:20
  • Or I could use Arduino instead I guess, but ADC seems more likely, then.
    – Tomas By
    Dec 1, 2017 at 22:25
  • 1
    Since OP only needs 3 bit resolution, this will probably work. The biggest problem with this approach is the heinous amount of CPU time doing Software measurement. That could be done instantly with a cheap 8 bit ADC. As a software guy @TomasBy you should understand that this will make your life hell dealing with timing details when you can just use a jelly bean ADC and save your sanity.
    – crasic
    Dec 2, 2017 at 2:23
  • Yes, I think I said that somewhere. I do not want to spend CPU time on this.
    – Tomas By
    Dec 2, 2017 at 23:06

The GPIO on the Pi is essentially Digital, not analog. You can use capacitive timing circuits as shown in the answer from @fred_dot_u above, but this will require some code. Here's another example of the same type of timing circuit.

If you are looking for an answer that does not require either coding (to calculate timing) or a proper ADC, then you may just be out of luck. There's no silver bullet for this unfortunately.

Going with a non-Pi solution such as Arduino, or (better) ESP8266 or ESP32, may solve your ADC issues since they natively support analog inputs. But, not knowing any of your other constraints, I cannot say if they will be a better bet for you than just grabbing a simple ADC HAT for the PI, or wiring up an MCP3008 directly.

Good luck in your quest!

  • Thanks. I'm sure either what type of constraints those would be. It is just resistors as far as I can see. I think a minimal ADC is the solution.
    – Tomas By
    Dec 1, 2017 at 23:50
  • Eh, not sure. Is what I meant.
    – Tomas By
    Dec 2, 2017 at 0:22
  • By "constraints" I was talking about all the other stuff that makes up your overall solution. Operating system, code-base and language considerations, libraries etc. When people work on a Pi they tend to develop their solutions a bit (or a lot) differently than on a microcontroller-based system. That's all. I'm glad my info helped! Take care!
    – MrChips
    Dec 2, 2017 at 2:29

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