User avatar
Gavinmc42
Posts: 5882
Joined: Wed Aug 28, 2013 3:31 am

Re: How would you add more ADCs to the Raspberry Pi Pico?

Mon Jun 21, 2021 3:19 am

Noise is useful is it is random.
Just average a bunch of samples?

Could Sigma Delta be done using the PIO and any digital IO?
Was done on Parallax Propeller chip.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
aallan
Raspberry Pi Trading Employee & Forum Moderator
Raspberry Pi Trading Employee & Forum Moderator
Posts: 197
Joined: Mon Feb 09, 2015 11:30 am
Location: Exeter, UK
Contact: Website Twitter

Re: How would you add more ADCs to the Raspberry Pi Pico?

Wed Jun 23, 2021 9:53 am

We’ve completed characterisation of the RP2040 ADC after an issue was raised in the otherADC-related forum thread, and updated the RP2040 Datasheet. Please see the latest documentation release (tagged as V1.6) which was published today for further details, specifically sections 4.9.3 and 4.9.4. A chip errata (RP2040-E11) has been added to flag the issue for newcomers to the hardware.
Technical Documentation Manager
Raspberry Pi (Trading) Limited
About me, http://alasdairallan.com

lurk101
Posts: 695
Joined: Mon Jan 27, 2020 2:35 pm
Location: Cumming, GA (US)

Re: How would you add more ADCs to the Raspberry Pi Pico?

Wed Jun 23, 2021 2:03 pm

aallan wrote:
Wed Jun 23, 2021 9:53 am
We’ve completed characterisation of the RP2040 ADC after an issue was raised in the otherADC-related forum thread, and updated the RP2040 Datasheet. Please see the latest documentation release (tagged as V1.6) which was published today for further details, specifically sections 4.9.3 and 4.9.4. A chip errata (RP2040-E11) has been added to flag the issue for newcomers to the hardware.
Yes, but what does all that mean???

My layman's interpretation would be that at 4 points in the analog range, the digital representation is off by a value of one (LSB error).
How to make your arguments stronger? Longer is not the answer.

bgolab
Posts: 321
Joined: Sat Jan 30, 2021 12:59 pm
Location: Krakow, PL

Re: How would you add more ADCs to the Raspberry Pi Pico?

Wed Jun 23, 2021 2:08 pm

I would assume 8 bit resolution i.e. I would shift the ADC readings by 4 bits right (adc_reading>>4)

Am I wrong?

hippy
Posts: 10317
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: How would you add more ADCs to the Raspberry Pi Pico?

Wed Jun 23, 2021 4:59 pm

lurk101 wrote:
Wed Jun 23, 2021 2:03 pm
aallan wrote:
Wed Jun 23, 2021 9:53 am
We’ve completed characterisation of the RP2040 ADC after an issue was raised in the otherADC-related forum thread, and updated the RP2040 Datasheet. Please see the latest documentation release (tagged as V1.6) which was published today for further details, specifically sections 4.9.3 and 4.9.4. A chip errata (RP2040-E11) has been added to flag the issue for newcomers to the hardware.
Yes, but what does all that mean???
Indeed.
lurk101 wrote:
Wed Jun 23, 2021 2:03 pm
My layman's interpretation would be that at 4 points in the analog range, the digital representation is off by a value of one (LSB error).
My interpretation, from Figure 117, is there is an error of up to +7 to -7 in the readings as one changes an input voltage from 0V to VREF so, rather than cleanly progressing from returning values between 0 and 4095, it can jump up and down, and by a significant amount at those four points; so it's not guaranteed that the returned value will always be rising when input voltage is increasing, won't always be falling when decreasing.

It won't always be rising or falling because of noise, and that's the case for any ADC, but in this case the jumps are significantly higher than 1 LSB,

And, if that is the case, the only way to avoid that, to return to an always rising or always falling situation, is to reduce the returned value resolution to 8-bit.

But maybe that's not a correct interpretation ?
Last edited by hippy on Wed Jun 23, 2021 5:07 pm, edited 1 time in total.

bgolab
Posts: 321
Joined: Sat Jan 30, 2021 12:59 pm
Location: Krakow, PL

Re: How would you add more ADCs to the Raspberry Pi Pico?

Wed Jun 23, 2021 5:02 pm

Exactly what I understood!

dthacher
Posts: 44
Joined: Sun Jun 06, 2021 12:07 am

Re: How would you add more ADCs to the Raspberry Pi Pico?

Wed Jun 23, 2021 10:29 pm

handsomegenius wrote:
Tue Jun 15, 2021 10:46 am
Hey folks,

So the Raspberry Pi Pico has three ADCs. That's 3 more than my other Raspberry Pi boards, so pretty cool.

What if you wanted to read 10 or 14 pots though? Obviously that requires more hardware, but what?

PIC microcontrollers seem to offer lots of ADCs for the $$$, but there's the whole hassle of programming them, which is mysterious to me.

Or is there some clever way to multiplex many pots to few ADCs?

I realise there's probably a billion ways to go about this.. so really just fishing for people's personal preferences.. feel welcome to be as opinionated as you like :)
You can multiplex them like LEDs. I am assuming these are resistor pots which are basically voltage dividers. Put all the center connections together. Connect this to ADC pin. Connect a single pull down resistor to ground. Connect one end of each of the pots to GPIO, shift register, decoder chip, etc. Must leave the other side of the pots unconnected to anything.

I do not know if the sample rate will be high enough with this or not. Only a single ADC will be active. Make sure the pull down resistor will prevent too much current through the IO pin. Only a single pin should ever be held high. This is really crude and cheap. However it may work.

Edit: I am not sure this works. It may work if you can tristate the IO pins. (Depending on what your doing.) Multiple ADCs as mentioned by others will likely work. Analog multiplexer may also work

User avatar
davidcoton
Posts: 6367
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: How would you add more ADCs to the Raspberry Pi Pico?

Wed Jun 23, 2021 10:50 pm

dthacher wrote:
Wed Jun 23, 2021 10:29 pm
You can multiplex them like LEDs. I am assuming these are resistor pots which are basically voltage dividers. Put all the center connections together. Connect this to ADC pin. Connect a single pull down resistor to ground. Connect one end of each of the pots to GPIO, shift register, decoder chip, etc. Must leave the other side of the pots unconnected to anything.
The OP has ordered an analogue multiplexor, so this is moot, BUT:

For the scheme to work, the output of the multiplex device must be unipolar -- that is, pull up or open. Pull down on the unused potentiometers will wreck the reading of the active potentiometers.
It is much easier to implement the other way up.
  • Put all the centre connections together. Connect this to ADC pin. Connect a single pull up resistor to the ADC supply, probably 3V3.
  • Connect one end of each of the pots to an open collector NPN transistor (no pull-up).
  • Drive each transistor base via an appropriate resistor from GPIO, shift register, decoder chip, etc.
  • Connect all the transistor emitters to ground.
  • Must leave the other (top) end of the pots unconnected.
Arrange to switch on one transistor at a time, then read the corresponding voltage from the potentiometer.
Location: 345th cell on the right of the 210th row of L2 cache

dthacher
Posts: 44
Joined: Sun Jun 06, 2021 12:07 am

Re: How would you add more ADCs to the Raspberry Pi Pico?

Thu Jun 24, 2021 2:11 am

davidcoton wrote:
Wed Jun 23, 2021 10:50 pm
Pull down on the unused potentiometers will wreck the reading of the active potentiometers.
I do not understand this. I later realized that I needed an open drain, which I am hoping a tristate possibly could provide. The accuracy may not be very good. However the point was trying to be cheap/small. I was considering using transistors however I decided to drop them.

I do not see the difference in pull down with open collector vs pull up with open drain. Both create voltage divider. Please explain if a difference exists.
dthacher wrote: Edit: I am not sure this works. It may work if you can tristate the IO pins. (Depending on what your doing.) Multiple ADCs as mentioned by others will likely work. Analog multiplexer may also work
This in response to this. Which would need open drain transistor to work.
dthacher wrote: Connect one end of each of the pots to GPIO, shift register, decoder chip, etc.

User avatar
davidcoton
Posts: 6367
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: How would you add more ADCs to the Raspberry Pi Pico?

Thu Jun 24, 2021 8:37 am

dthacher wrote:
Thu Jun 24, 2021 2:11 am
I do not understand this. I later realized that I needed an open drain, which I am hoping a tristate possibly could provide.
Yes, that is the point. But it is much easier to implement your scheme with conventional n-FET or NPN transistors pulling the active pot low, while the +ve connection is through a common pull-up on the ADC input. The pote voltage supply can now be from any ADC reference voltage, which will increase accuracy. It also means that the selection s/w will be active high, which is often easier to understand.

As long as the standing current through each pot is less than 3mA, and the supply voltage is not over 3V3, you could use an active low GPIO directly as the switch, but deselection requires switching the GPIO to input mode (no pull) rather than output high. This is probably the ultimate low component count implementation.
Location: 345th cell on the right of the 210th row of L2 cache

PiGraham
Posts: 4788
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: How would you add more ADCs to the Raspberry Pi Pico?

Thu Jun 24, 2021 8:42 am

It is interesting this has come up again.
See previous discussion
viewtopic.php?f=144&t=305636&hilit=adc+pico

dthacher
Posts: 44
Joined: Sun Jun 06, 2021 12:07 am

Re: How would you add more ADCs to the Raspberry Pi Pico?

Thu Jun 24, 2021 6:02 pm

PiGraham wrote:
Thu Jun 24, 2021 8:42 am
It is interesting this has come up again.
See previous discussion
viewtopic.php?f=144&t=305636&hilit=adc+pico
Yes this is basically that, however I am only using 1D array. Implied 2D array is problematic. Couple levels of decoders may work in a couple different approaches to save pins with 2D.

Software and ADC rail can account for offsets caused by diodes, BJT, FETs, etc. I could force max voltage with series resistor or use offset to ensure I never exceed ADC rail. I will admit this is a little annoying.

User avatar
fulburncams
Posts: 74
Joined: Wed Nov 30, 2011 8:29 pm

Re: How would you add more ADCs to the Raspberry Pi Pico?

Sun Jun 27, 2021 9:51 am

NXP PCF8591 , easy to solder DIP , cheap, 8 bits , i2c ( up to 8 using address pins ) , 4*A2D + 1*D2A.

Return to “General”