ADC Vref

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
ttmetro
Posts: 104
Joined: Mon Jul 31, 2017 12:44 am

ADC Vref

Post by ttmetro » Mon Dec 11, 2017 9:33 pm

Can I set the ADC to use the 3.3V supply (or a voltage supplied on a pin) for Vref on the pyboard in Micropython?

Many thanks,
Bernhard
Bernhard Boser

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: ADC Vref

Post by pythoncoder » Tue Dec 12, 2017 7:23 am

My understanding is that the ADC uses the 3.3V supply for the reference.

The 64 pin package version of the MCU used on the Pyboard doesn't bring Vref+ or Vref- out to pins.

According to the hardware datasheet (P133), "1. V REF+ and V REF– inputs are both available on UFBGA176. V REF+ is also available on LQFP100, LQFP144, and LQFP176. When V REF+ and V REF– are not available, they are internally connected to V DDA and V SSA ."

So it's defined in hardware and cannot be changed. However you can use the ADC to read the reference voltage and thus determine the voltage of the Vdd supply. This enables you to correct for ADC read errors caused by lack of accuracy in the 3.3V supply. The docs describe how to do this.
Peter Hinch
Index to my micropython libraries.

ttmetro
Posts: 104
Joined: Mon Jul 31, 2017 12:44 am

Re: ADC Vref

Post by ttmetro » Tue Dec 12, 2017 9:26 pm

I see, the internal reference is only and input, it is never applied to the ADC Vref, which is 3.3V. Exactly what I need for ratiometric readout.

2nd Question: Apparently adc.read_timed is blocking? Are interrupts still served?

Thanks!
Bernhard
Bernhard Boser

User avatar
Wolfgang
Posts: 8
Joined: Wed Dec 06, 2017 9:12 pm
Location: Munich
Contact:

Re: ADC Vref

Post by Wolfgang » Wed Dec 13, 2017 3:33 pm

You can make a cut or extract L1 and connect VDDA to a High Precision Vref 3.3V, powering with V+ (5V). IDDA is only 0.5mA, max 0.85mA. Then, ADC, DAC and Vref are working with high precision 3300mV +-0.1% which in common is needed for useful measurements instead of estimates with accuracy ..+-4%!

Reading Vref and corrections with it is a funny idea for the next Nobel Prize in Physical Science (...)

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: ADC Vref

Post by pythoncoder » Thu Dec 14, 2017 10:45 am

adc.read_timed is blocking. As far as I can see the code doesn't disable interrupts.
Peter Hinch
Index to my micropython libraries.

Post Reply